Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li><p><a href="http://php.net/language.operators.logical" rel="nofollow noreferrer"><code>OR</code></a> is the same as <code>||</code> except that <code>OR</code> has a lower <a href="http://php.net/language.operators.precedence" rel="nofollow noreferrer">precedence</a> than <code>||</code>. This can cause logical errors when it’s used with other operators with a higher precedence than <code>OR</code> but a lower precedence than <code>||</code> like the assignment operators:</p> <pre><code>$var = false OR true; // ($var = false) OR true; var_dump($var); // bool(false) $var = false || true; // $var = (false || true); var_dump($var); // bool(true) </code></pre> <p>So I recommend you to rather use <code>||</code> than <code>OR</code>.</p></li> <li><p><a href="http://php.net/die" rel="nofollow noreferrer"><code>die</code></a> does print the passed string and quits the execution of the current script. Personally, I wouldn’t use use <code>die</code> but implement a more decent error handling like storing the error message in a variable and print it in the document like this:</p> <pre><code>$errors = array(); if (!empty($_POST)) { if ($pass!="d41d8cd98f00b204e9800998ecf8427e" || $user!="") { $result=mysql_query($sql); if (mysql_error()) { $errors[] = 'Sorry, this username already exists'; } } else { $errors[] = "Please enter the Password"; } } if (!empty($errors)) { echo 'There were some errors:'; echo '&lt;ul&gt;&lt;li&gt;', implode('&lt;/li&gt;&lt;li&gt;', $errors), '&lt;/li&gt;&lt;/ul&gt;'; } </code></pre></li> <li><p>If you use an empty URL for the <code>action</code> attribute, it refers to the very same URL:</p> <pre><code>&lt;form name="form1" method="post" action=""&gt; </code></pre></li> </ol> <p>Some further tips:</p> <ul> <li>Use <code>$_SERVER['REQUEST_METHOD'] === 'POST'</code> to test the request method instead of testing <code>!empty($_POST)</code>.</li> <li>Avoid <a href="http://php.net/security.globals" rel="nofollow noreferrer">register globals</a>. So use <code>$_POST['pass']</code> instead of <code>$pass</code> if you want to refer to the parameter <em>pass</em> passed by POST.</li> </ul>
 

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