I have a problem with my win2003 server and PHP. I'm using PHP Version 4.2.2, and I have got the "hello world" program and phpinfo() to work well...
The problem is that when I try to use sessions and header()-functions it all goes wrong. Here is some of my code:
session_start();
session_register('auth');
$_SESSION['user'] = $username;
include('cons/.ht_conn_mix.inc');
$logsql = "SELECT * FROM Administrators WHERE adminUserName='$username'";
$logres = mysql_query($logsql) or die("" . mysql_error());
$isuser = mysql_num_rows($logres);
$user = mysql_fetch_array($logres, MYSQL_ASSOC);
if($sub){
if($username && $pwd){
if($isuser > 0){
if(($user['adminPasswd']) == (md5($pwd))){
$auth = "yes";
header("Location: admin_index.php?user=".$username."");
}else echo "wrong password";
}else echo "Cannot find username i database";
}else echo "You have to fill inn both username and password";
}
The "admin_index.php" - file have this session control:
<?php
session_start();
$_SESSION['user'] = $username;
if (@$auth != "yes"){
header("Location: index.php");
exit();
}
if(isset($_SESSION['user'])){
$user = $_SESSION['user'];
}
?>
It seems like it can't get either the header()-function or the sessions to work....I tried with a simple javasript refresh but that didn't work either.
Is there something wrong with:
1. My code
2. My php.ini-file(se attachment)
3. Something else??
Fast response would be much appreciated!