Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>Please help! SOS</code> Yep, you're in deep sh... But not for what you'd expect... </p> <p>Even if your code was operating well, you are the 5th or 6th who asks roughly the same question, riddled with <a href="http://en.wikipedia.org/wiki/SQL_injection" rel="nofollow">SQL injection</a> in a PHP login form using the deprecated <strong>mysql_</strong> functions...</p> <p>And also, <strong><code>$guery</code></strong> is not the same as <strong><code>$query</code></strong>... Check for the <strong>q</strong> and <strong>g</strong> letters...</p> <p>This line:</p> <pre><code>$guery = mysql_query("SELECT * FROM UserAccount WHERE email_address = '$email_address'"); </code></pre> <p>Should be at least</p> <pre><code>$query = mysql_query("SELECT * FROM UserAccount WHERE email_address = '".mysql_real_escape($email_address)."'"); </code></pre> <p>to both be correct, and avoid injection...</p> <p>But you should <strong>really be using prepared statements through PDO</strong>, like this:</p> <pre><code>try { //open connection, this is different than in the old functions $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass); //***running query //**step1: create statement $stmt = $dbh-&gt;prepare('SELECT * FROM UserAccount WHERE email_address = :email'); //notice parameter prefixed with ':' //**step2: bind values (be sure to also check out the bindParameter() function too!) $stmt-&gt;bindValue(':email', $email_address); //**step3: exexcute statement $stmt-&gt;execute(); //**step4: process results $result = $stmt-&gt;fetch(PDO::FETCH_OBJ); if($result-&gt;PASSWORD==$password) { //logged in, do whatever reuqired } $dbh = null; //don't let it slip out of our hands } catch (PDOException $e) { print "Error!: " . $e-&gt;getMessage() . "&lt;br/&gt;"; die(); } </code></pre> <p>Also, another word of caution: don't store plaintext passwords. Even storing MD5 hashes is out of scope these days, and SHA1 is also declared to be weak...</p>
    singulars
    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.
    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