cmb Posted November 10, 2011 Share Posted November 10, 2011 on all my secured pages at the the very top the code is <?php require ("u_check_login.php"); ?> and then the u_check_login.php code is <?php require('database.php'); //Include DB connection information $ip = mysql_real_escape_string($_SERVER["REMOTE_ADDR"]); //Get user's IP Address $email = mysql_real_escape_string($_COOKIE['uemail']); //Get username stored in cookie $pp = mysql_real_escape_string($_COOKIE['pp']); if ($pp == 1){ $sessionid = mysql_real_escape_string($_COOKIE['sessionid']); //Get user's session ID $check = mysql_query("SELECT * FROM `users` WHERE `email` = '$email' AND `session_id` = '$sessionid' AND `login_ip` = '$ip' AND `pp` = '1' ") or die(mysql_error()); //Check if all information provided from the user is valid by checking in the DB $answer = mysql_num_rows($check); //Return number of results found. Equal to 0 if not logged in or 1 if logged in. if ($answer == 0 || $sessionid == '') { //Check if login is valid. If not redirect user to login page header('Location: ulogin.php'); exit(); } $row = mysql_fetch_array($check); $email = stripslashes($row['email']); }else{ header('Location: ulogin.php'); } ?> and this error is being displayed on my page that is supposed to not have let me on because i was not logged in Warning: Cannot modify header information - headers already sent by (output started at /home/content/03/8587103/html/pinkpanthers/pinkpanthers.php:1) in /home/content/03/8587103/html/pinkpanthers/u_check_login.php on line 17 Quote Link to comment https://forums.phpfreaks.com/topic/250822-check-to-see-if-the-user-is-logged-in-error/ Share on other sites More sharing options...
trq Posted November 10, 2011 Share Posted November 10, 2011 You must have missed this? http://www.phpfreaks.com/forums/index.php?topic=37442.0 Quote Link to comment https://forums.phpfreaks.com/topic/250822-check-to-see-if-the-user-is-logged-in-error/#findComment-1286909 Share on other sites More sharing options...
cmb Posted November 10, 2011 Author Share Posted November 10, 2011 No i saw it, it didn't help me at all, i already new that you cant have anything output before a header but i don't and that's why I'm confused as to why its not working Quote Link to comment https://forums.phpfreaks.com/topic/250822-check-to-see-if-the-user-is-logged-in-error/#findComment-1286911 Share on other sites More sharing options...
PFMaBiSmAd Posted November 10, 2011 Share Posted November 10, 2011 but i don't But you do - output started at /home/content/03/8587103/html/pinkpanthers/pinkpanthers.php:1 (line 1), otherwise that error would not be occurring. You either have something in your file on line one, before the <?php tag or like that sticky post states, you have BOM (Byte Order Mark) characters as part of the file and they are being output. Quote Link to comment https://forums.phpfreaks.com/topic/250822-check-to-see-if-the-user-is-logged-in-error/#findComment-1286919 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.