Demonic Posted February 4, 2007 Share Posted February 4, 2007 Well im converting all my cookies to sessions for security reasons imo, but when i add session_start() at the head of my config file I get errors: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/nbb/public_html/131/config.php:1) in /home/nbb/public_html/131/config.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/nbb/public_html/131/config.php:1) in /home/nbb/public_html/131/config.php on line 2 <?php session_start(); ?> <?php mysql_connect("localhost","*******","********") or die(mysql_error()); mysql_select_db("********") or die(mysql_error()); /* $cookieid = htmlspecialchars($_COOKIE[uid]); $cookiepass = htmlspecialchars($_COOKIE[upass]); */ if(isset($_SESSION['uid'])){ $session_id = htmlspecialchars($_SESSION['uid']); $session_pass = htmlspecialchars($_SESSION['upass']); $logged = mysql_query("SELECT * FROM `users` WHERE `id` = '$session_id' AND `password` = '$session_pass' "); $logged = mysql_fetch_array($logged); } if(!isset($session_id)){ $logged = array(); $logged['dskin'] = "2"; }; /* if((!$cookieid) || (!$cookiepass)){ $logged = array(); $logged['dskin'] = "2"; $logged['username'] = "Guest"; }else{ $logged = mysql_query("SELECT * FROM users WHERE id='$cookieid' AND password='$cookiepass' "); $logged = mysql_fetch_array($logged); } */ ?> Link to comment https://forums.phpfreaks.com/topic/37001-some-quick-help/ Share on other sites More sharing options...
fert Posted February 4, 2007 Share Posted February 4, 2007 you can't have any spaces or lines before session_start(); Link to comment https://forums.phpfreaks.com/topic/37001-some-quick-help/#findComment-176602 Share on other sites More sharing options...
JasonLewis Posted February 4, 2007 Share Posted February 4, 2007 read the pinned topic at the start of this board for more information on header errors. Link to comment https://forums.phpfreaks.com/topic/37001-some-quick-help/#findComment-176605 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.