A few weeks back I switched from the apache win32 to iis. I have noticed a couple differences and am wondering how i can fix them.
First of all for some reason if the user's privacy is not set on low then the sessions will not pass between pages. I'm not sure why this is, when using apache I had no problems with keeping it on medium. Secondly is cookies heres and example of muh code:
// This is checks to see if the cookie exists and then authenticates
// with the information
include('connection.php');
$action == $_GET['action'];
include('session.php'); // contains the session start and checking
include('functions.php');
if ($login <> 1) { // If login is false
if (isset($tloginUser)) { // if username cookie exists
if (isset($tloginPass)) { // if password cookie exists
$login = auth($tloginUser,$tloginPass, "ON"); // check info
}
}
}
if ($action == 'logout') {
// Unset session vars and cookies and end session
unset($_SESSION['uname']);
unset($_SESSION['passwd']);
setcookie ("tloginPass");
setcookie ("tloginUser");
session_destroy();
// This is the auth function (contained in the function.php
function auth($username,$password,$remember)
{
$query = "select * from members where uname='$username'";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) <> '1')
{
setcookie ("tloginUser");
setcookie ("tloginPass");
return 0;
}
else
{
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$uname = $row['uname'];
$passwd = $row['passwd'];
}
// see if passwords match
if ($passwd == $password)
{
// set session vars
$_SESSION['uname'] = $username;
$_SESSION['passwd'] = $password;
if ($remember == "ON") { //set cookies
setcookie ("tloginUser", "$username", time() + 360000);
setcookie ("tloginPass", "$password", time() + 360000);
}
return 1; // return login true
}
else
{
setcookie ("tloginUser");
setcookie ("tloginPass");
return 0;
}
}
}