Jump to content

Header Problem


pkmleo

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/10116-header-problem/
Share on other sites

[!--quoteo(post=375741:date=May 21 2006, 06:44 AM:name=Crimpage)--][div class=\'quotetop\']QUOTE(Crimpage @ May 21 2006, 06:44 AM) [snapback]375741[/snapback][/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.

Link to comment
https://forums.phpfreaks.com/topic/10116-header-problem/#findComment-37666
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/10116-header-problem/#findComment-37695
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.