Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Warning: Cannot modify header information - headers already sent by [error]"
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1912029/warning-cannot-modify-header-information-headers-already-sent-by-error">“Warning: Cannot modify header information - headers already sent by” error</a> </p> </blockquote> <p>Here's my code:</p> <pre><code>$con = mysql_connect("localhost",$dbuser,$dbpass); mysql_select_db($dbname, $con); function crSalt($max = 15) { $characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $i = 0; $salt = ""; while ($i &lt; $max) { $salt .= $characterList{mt_rand(0, (strlen($characterList) - 1))}; $i++; } return $salt; } if ($_POST['username'] &amp;&amp; $_POST['password']){ $username=mysql_real_escape_string($_POST['username']); $password=mysql_real_escape_string($_POST['password']); $hash = hash("ripemd160", $password); $x = mysql_fetch_array(mysql_query("SELECT * FROM `accounts` WHERE `Username`='$username'")); if ($hash == $x['Password']){ $salt = crSalt(); setcookie("xtx_SALT", $salt, time()+3600*74 , "/"); setcookie("xtx_ID", $x['id'], time()+3600*74 , "/"); setcookie("xtx_CRED", hash("ripemd160", $username), time()+3600*74, "/"); mysql_query("UPDATE `accounts` SET `Salt`='$salt' WHERE `Username`='$username'"); } } ?&gt; &lt;form action="" method="post"&gt; Username: &lt;input type="text" name="username" /&gt;&lt;br/&gt; Password: &lt;input type="password" name="password" /&gt;&lt;br/&gt; &lt;input type="submit" value="Login!" /&gt; &lt;form&gt; </code></pre> <p>I've been struggling with these errors for a while:</p> <blockquote> <p>Warning: Cannot modify header information - headers already sent by (output started at /home/xtrosx10/public_html/Secure/Login/index.php:5) in /home/xtrosx10/public_html/Secure/Login/index.php on line 27</p> <p>Warning: Cannot modify header information - headers already sent by (output started at /home/xtrosx10/public_html/Secure/Login/index.php:5) in /home/xtrosx10/public_html/Secure/Login/index.php on line 28</p> <p>Warning: Cannot modify header information - headers already sent by (output started at /home/xtrosx10/public_html/Secure/Login/index.php:5) in /home/xtrosx10/public_html/Secure/Login/index.php on line 29</p> </blockquote> <p>I don't see why I am actually getting this because there is not one line of code here that suggests a header should be sent.</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.
 

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