Jump to content


Photo

Header Problem


  • Please log in to reply
3 replies to this topic

#1 pkmleo

pkmleo
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 21 May 2006 - 11:31 AM

I am working on a small website using PHP 4x, MySQL 5.0 and Apache 1.2. When I try to login I get some header problems. I am new to PHP and I am learining it. The logincheck.php code is below:

<?php
session_start();
header("Cache-control: private");
require_once($_SERVER['DOCUMENT_ROOT'].'/sports/includes/db_config.php');

$login_name = $_POST['login_name'];
$password = $_POST['password'];
$password = md5($password);
$userIP = isset($REMOTE_HOST) ? $REMOTE_HOST : @gethostbyname($REMOTE_ADDR);
$today = date("Y-m-d h:m:s");
$sql = "SELECT * FROM admin WHERE login_name='$login_name' AND password='$password'";
$query = "UPDATE admin SET last_login = '$today', ip_address = '$userIP' WHERE login_name = '$login_name'";
$result = mysql_query($sql) or die("Unable to execute $sql query: " . mysql_error());
$count = mysql_num_rows($result);
if($count == 1)
{
@mysql_query($query) or die("Unable to execute $query query: " . mysql_error());
$_SESSION['login_name'] = $login_name;
header("Location: ./admin/adminhome.php");
}
else
{
header("Location: relogin.php");
}
?>

I get this error in the browser:

Warning: open(/tmp\sess_612acdf0193058442bb485e14b7d713b, O_RDWR) failed: No such file or directory (2) in c:\apache group\apache\htdocs\sports\logincheck.php on line 2

Warning: Cannot add header information - headers already sent by (output started at c:\apache group\apache\htdocs\sports\logincheck.php:2) in c:\apache group\apache\htdocs\sports\logincheck.php on line 3

Warning: Cannot add header information - headers already sent by (output started at c:\apache group\apache\htdocs\sports\logincheck.php:2) in c:\apache group\apache\htdocs\sports\logincheck.php on line 19

Warning: open(/tmp\sess_612acdf0193058442bb485e14b7d713b, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0



#2 Crimpage

Crimpage
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts
  • LocationBrisbane, Australia

Posted 21 May 2006 - 11:44 AM

It can't write your session file.

Check your PHP.ini file and make sure you have read / write access to the folder. All the other errors are because it has already sent the headers (means it has already output something to the screen).

#3 pkmleo

pkmleo
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 21 May 2006 - 12:04 PM

[!--quoteo(post=375741:date=May 21 2006, 06:44 AM:name=Crimpage)--][div class=\'quotetop\']QUOTE(Crimpage @ May 21 2006, 06:44 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
It can't write your session file.

Check your PHP.ini file and make sure you have read / write access to the folder. All the other errors are because it has already sent the headers (means it has already output something to the screen).
[/quote]


What should I change in php.ini file. I am not sure what to change.

What should I change in php.ini. I am not sure what changes have to be made in the php.ini file.



#4 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 21 May 2006 - 03:21 PM

Read item # 4 in our session troubleshooting guide:
[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=31047&view=findpost&p=157705\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...ndpost&p=157705[/a]

Remember to restart your server after making any changes to the php.ini file so the changes take effect.

If you're new to PHP, please post in the newbie topic area. I'm moving this post there. Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users