Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP weird scope error, empty variable
    primarykey
    data
    text
    <p>Hello i have a weird scope problem</p> <pre><code>require 'connect.php'; $name = $_GET['R']; echo $name; if(isset($_POST['prev_password']) &amp;&amp; isset($_POST['new_password']) &amp;&amp; isset($_POST['rep_password'])) { echo $name; if(!empty($_POST['prev_password']) &amp;&amp; !empty($_POST['new_password']) &amp;&amp; !empty($_POST['rep_password'])) { $user_password = $_POST['prev_password']; $user_new_password = $_POST['new_password']; $user_rep_password = $_POST['rep_password']; if($user_new_password == $user_rep_password) { $mysql_query = sprintf("SELECT username, password FROM users WHERE username='$name'", $name); $query_run = mysql_query($mysql_query, $mysql_link) or die('COULD NOT PERFORM QUERY'); while($row = mysql_fetch_array($query_run)) { $qUser_name = $row['username']; $qUser_pass = $row['password']; } if($qUser_name == $name) { echo 'Match'; if($qUser_pass == $user_password) { $mysql_query = sprintf("UPDATE users SET password='$user_new_password' WHERE username='$name'", $name); $query_run = mysql_query($mysql_query, $mysql_link) or die('COULD NOT PERFORM QUERY'); echo header('Location: main.php?C=1'); }else { header('Location: main.php?C=4'); } } }else { header('Location: main.php?C=3'); } }else { header('Location: main.php?C=2'); } } </code></pre> <p>anyway, the problem is with the first variable $name, when i 'echo' $name its ok, displays the content correctly, but inside the (if sss) ITS EMPTY, idk why, i've tried using global, the GLOBALS array, and its still empty, ... so .. the query its executed with an empty parameter.</p> <p>please help, if someone can see what could be possible wrong.</p> <p>PD: this is a Changepassword.php the $_GET['R'] is getting from the user Main.php site, AND I KNOW, im not Hashing password,, that is not really the problem here </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload