co.ador Posted March 22, 2011 Share Posted March 22, 2011 Warning: Cannot modify header information - headers already sent by (output started at /home3/nyhungry/public_html/storeprueba/storescripts/connect_to_mysql.php:2) in /home3/nyhungry/public_html/storeprueba/storeadmin/admin_login.php on line 29 What can I do to fix the error where a second header is called, needed but intervening admin_login.php <?php session_start(); if (isset($_SESSION["manager"])) { header("location:index.php"); exit(); } ?> <?php if (isset($_POST["username"]) && isset($_POST["password"])) { $manager = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["username"]); // filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["password"]); // filter everything but numbers and letters include "../storescripts/connect_to_mysql.php"; $sql = mysql_query( "SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1"); $existCount = mysql_num_rows($sql); if ($existCount == 1) { while($row = mysql_fetch_array($sql)) { $id = $row["id"]; } $_SESSION["id"] = $id; $_SESSION["manager"] = $manager; $_SESSION["password"] = $password; header("location:index.php"); exit(); } else { echo 'That information is incorrect, try again <a href="index.php">Click Here</a>'; exit(); } } ?> is the second header here like below in the code clashing? because in the connect_to_mysql.php there is no headers <?php $_SESSION["id"] = $id; $_SESSION["manager"] = $manager; $_SESSION["password"] = $password; header("location:index.php"); exit(); <? Link to comment https://forums.phpfreaks.com/topic/231439-need-help-with-a-warning-modify-header/ Share on other sites More sharing options...
trq Posted March 22, 2011 Share Posted March 22, 2011 See http://www.phpfreaks.com/forums/index.php?topic=37442.0 Link to comment https://forums.phpfreaks.com/topic/231439-need-help-with-a-warning-modify-header/#findComment-1191061 Share on other sites More sharing options...
Recommended Posts