sudip_dg77 Posted January 26, 2008 Share Posted January 26, 2008 Hello, I am trying to set up a loging script but I keep on getting this error: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/kuuja/public_html/test/verify.php:2) in /home/kuuja/public_html/test/verify.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/kuuja/public_html/test/verify.php:2) in /home/kuuja/public_html/test/verify.php on line 3 Password does not match The code I wrote is here: <?php session_start();<BR> ?> ----MY HTML CODE HERE---------------- <?php $user_id = $_POST['user_id']; $password = $_POST['password']; $myDatabase = "kuuja_business"; $con = mysql_connect("localhost:3306","kuuja_admin","admin1"); if (!$con) { die('Could not connect to Database: ' . mysql_error()); } @mysql_select_db($myDatabase, $con) or die("Unable to select database"); $result_user = mysql_query("SELECT user_id FROM user WHERE user_id = '$user_id'"); $row1 = mysql_fetch_array($result_user); $user = $row1['user_id']; $result_password = mysql_query("SELECT password FROM user WHERE password = '$password'"); $row2 = mysql_fetch_array($result_password); $pass = $row2['password']; $result_fname = mysql_query("SELECT fname FROM user WHERE user_id = '$user_id'"); $row3 = mysql_fetch_array($result_fname); $name = $row3['fname']; if ($user) { if ($pass) { echo "Hello $name\n\n"; echo "Welcome to the members area, you can use the options on your left to navigate through the pages\n\n"; echo "Do also remember to include yourself in our rotation software by the option available under the Settings link on the left"; } else { echo "Password does not match"; session_destroy(); } } else { echo "User Id does not match"; session_destroy(); } mysql_close($con); ?> Can you please help? Link to comment https://forums.phpfreaks.com/topic/87975-problems-with-setting-up-sessions/ Share on other sites More sharing options...
revraz Posted January 26, 2008 Share Posted January 26, 2008 What is the BR for? Also, if you use a editor like Dreamweaver, it puts plain text before the <?php Link to comment https://forums.phpfreaks.com/topic/87975-problems-with-setting-up-sessions/#findComment-450111 Share on other sites More sharing options...
sudip_dg77 Posted January 26, 2008 Author Share Posted January 26, 2008 No it doesn't work I opened the file in notepad and removed all the lines, spaces etc. before session_start(), still it didn't help. Still I get the error.. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/kuuja/public_html/test/verify.php:2) in /home/kuuja/public_html/test/verify.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/kuuja/public_html/test/verify.php:2) in /home/kuuja/public_html/test/verify.php on line 3 Is there any other way to handle a login script other than this way?? Link to comment https://forums.phpfreaks.com/topic/87975-problems-with-setting-up-sessions/#findComment-450123 Share on other sites More sharing options...
revraz Posted January 27, 2008 Share Posted January 27, 2008 That is saying there is still something before your session_start(); Link to comment https://forums.phpfreaks.com/topic/87975-problems-with-setting-up-sessions/#findComment-450141 Share on other sites More sharing options...
sudip_dg77 Posted January 27, 2008 Author Share Posted January 27, 2008 Yes it is working now....thanks a lot!! I guess there was something before the session_start() which I couldn't see, i deleted the first two lines and re-wrote it, that solved the problem. Link to comment https://forums.phpfreaks.com/topic/87975-problems-with-setting-up-sessions/#findComment-450161 Share on other sites More sharing options...
revraz Posted January 27, 2008 Share Posted January 27, 2008 Great. Mark as solved please. Link to comment https://forums.phpfreaks.com/topic/87975-problems-with-setting-up-sessions/#findComment-450163 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.