Page 1 of 1

Challenge/Response Secure Login Process - Warning: session_s

Posted: Sun Sep 03, 2006 2:39 pm
by gf05856
Dear,

I am trying to get the tutorial "Challenge/Response Secure Login Process" to work on my shared hosting on php5/mysql but get the following error when filling out the login form on the index page with userid: devnetwork & password:

Code: Select all

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/XXXXXXXX/html/login/login.php:1) in /home/content/XXXXXXX/html/login/login.php on line 5

Warning: Cannot modify header information - headers already sent by (output started at /home/content/XXXXXXX/html/login/login.php:1) in /home/content/XXXXXXXX/html/login/login.php on line 103
These are lines 5 & 103

Code: Select all

1 <?php
2/*
3    Start the PHP Session
4*/
5session_start();
6/*
7   Connect to database, and some table (say mytestdatabase)
8    Edit for your own credentials...
9*/
10$conn = mysql_connect('hostname', 'username', 'password') or die('Database is down for maintenance at the moment');
11mysql_select_db('database', $conn) or die ('Can\'t access any tables at the moment : ' . mysql_error());
...
...

99if($_POST['response'] == $expected_response)
100{
101    $_SESSION['authenticated'] = 1;
102    $_SESSION['userid'] = $user['userid'];
103    header('Location: hello.php');
I am using the downloaded code at the bottom of the tutorial.

Thanks!

I see that my host also supports sha512/php5 - where do I change the code to just use the build in php function instead of the SHA256 static class for PHP4 - which maybe also the reason why it's not working under php5 although I have read somewhere here I think that it should work ... anyway I see a record being added to the challenge database every time I "login"

Posted: Sun Sep 03, 2006 2:42 pm
by volka
Is there a blank or BOM before <?php on line 1?
It's send as-it to the client making it impossible to send additional http headers like those for session handling.

Posted: Sun Sep 03, 2006 2:43 pm
by feyd
It would appear you have a space or some other character data before the opening <?php.

viewtopic.php?t=1157

Posted: Sun Sep 03, 2006 2:45 pm
by Chris Corbyn
Dreamweaver anyone? :)

Posted: Sun Sep 03, 2006 2:49 pm
by gf05856
yep, sorry to have wasted your time!

Maybe somebody can adjust the download file's as there seem to be a space before the <php ... in the login.php included in the zip file

Thanks !