Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You've got some syntax errors/gotchas:</p> <pre><code>$helpfaerie = mysql_fetch_array(mysql_query("SELECT * FROM helpfaerie WHERE page = 'reportbug'")); </code></pre> <p>You assume the query works. This is bad practice. Even if the SQL statement itself is syntactically perfect, it can fail for any number of OTHER reasons. You should ALWAYS check for query success before doing anything with the result of a query. e.g.</p> <pre><code>$result = mysql_query(...); if ($result === FALSE) { die(mysql_error()); } </code></pre> <p>should be the bare minimum you have everywhere while developing/testing.</p> <pre><code>if ($helpfaerie2[helpfaerie] == 1) ^-- ^-- </code></pre> <p>You've neglected to quote the array key here. In this particular code snippet, the unquoted <code>helpfaerie</code> will be parsed as a <code>defined()</code> constant. However, it's probably not been defined, so PHP will "politely" auto-convert it into a string for you and throw a warning.</p> <p>Then immediately afterwards you have</p> <pre><code>{ echo "&lt;div id=\"helpfaerie\" </code></pre> <p>and output a massive blob of multi-line HTML. Yet later on you use a HEREDOC. Why not use one here too? It'd save you having to escape all of the <code>"</code> characters in your echo statement.</p> <pre><code>$page = mysql_real_escape_string($page); $page = stripslashes($page); $page = stripusers($page); </code></pre> <p>This makes not sense whatsoever. You escape $page properly, but then you do stripslashes, which essentially UNDOES the mysql_real_escape_string() call. While not totally accurate, you can consider m_r_e_s() to be an advanced version of <code>addslashes()</code>, so you're basically escaping, then unescaping again, leaving you vulnerable to SQL injection.</p> <p>I don't know what <code>stripusers()</code> does, but regardless, the order of operations should be</p> <pre><code>$page = stripusers($page); $page = mysql_real_escape_string($page); </code></pre> <p>m_r_e_s() should always be the <strong>LAST</strong> operation performed before you use that bit of data in a query string. If you do anything to an escaped string after the escaping has been done, you risk undoing the escaping and/or introducing another way for an injection attack to sneak in.</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.
    1. VO
      singulars
      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