Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From what I can tell you should escape all fields in here:</p> <pre><code>$registerquery = mysql_query("INSERT INTO users (Username, password, EmailAddress,Activation,registered) VALUES('".$username."', '".$password."', '".$email."','".$activation."','".$date."')"); </code></pre> <p>You have:</p> <pre><code>$username = mysql_real_escape_string(trim($_POST['username'])); $email = mysql_real_escape_string(trim($_POST['email'])); </code></pre> <p>You should have the same for $password, $activation and $date... Not sure if you do</p> <p>Anyway I use normally use this:</p> <pre><code>function getPost($s) { if (array_key_exists($s, $_POST)) return mysql_real_escape_string(htmlspecialchars($_POST[$s])); else return false; } function getGet($s) { if (array_key_exists($s, $_GET)) return mysql_real_escape_string(htmlspecialchars($_GET[$s])); else return false; } </code></pre> <p>But it's to protect against XSS also... I though you should be safe with mysql_real_escape_string().</p> <p>Anyway you can also use Prepared statements and forget all about this!! <a href="http://php.net/manual/en/pdo.prepared-statements.php" rel="nofollow">http://php.net/manual/en/pdo.prepared-statements.php</a></p> <p><strong>EDIT</strong> Well, no valid username there, right? So what about this:</p> <pre><code>try{ $getMail = $dbh-&gt;prepare("SELECT EmailAddress FROM users WHERE username = :username"); $getMail-&gt;bindParam(':username', $username); $getMail-&gt;execute(); $rowMail = $getMail-&gt;fetch(); $email = $rowMail['emailaddress']; } catch( PDOException $Exception ) { echo 'Authentication Failed'; } </code></pre> <p>Can't test it right now, but it should be something around this lines...</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.
 

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