if statement - PHP function not reaching the innermost nested if block -


so i've done bit of testing conditions, , reason can't function reach innermost set of if/else.

i'm hoping can show me did?

function verifystridersidentity($post_name, $modpass) {     //is post name strider?     //this part works     if (strtolower($post_name) == 'strider') {         //is mod pass set?         //this part works         if (!empty($modpass)) {             //modpass has kind of value               $staff_name = md5_decrypt($modpass, ku_randomseed);//is strider though?             //this seems block having trouble getting into?             //i can not value of either of these next 2 return statements.             if ($staff_name == $post_name) {                 return 'this works, it\'s me!'; //this strider             }             else {                 return 'this '.$staff_name.' attempting strider. has been logged.';             }         }         else {             return 'anonymous test';         }     }        else {         return $post_name;     }  } 

i hoping inline comments explain enough what's going on, if not please ask me more info.

when called function originating class, used code:

$post_name = verifystridersidentity($post_name,$modpass); 

the problem there $modpass doesn't exist, sending in blank.

therefore, correcting call should have been this:

    $modpass = '';     if (isset($_post['modpassword'])) {         $modpass = $_post['modpassword'];     }     $post_name = verifystridersidentity($post_name,$modpass); 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -