Yesterday, I upgraded my PHP from 4 to 5 (5.2.10). I updated my login code and it was working like a dream. Today I came in and apart from my PC rebooting overnight (update I think), the same code doesn't work! :mad:
I have now stripped my code down to just test sessions and it's not working.
Here is my test code:
File: test1.php
<?
session_start();
echo "<h1>Your session ID is ".session_id()."</h1>";
$_SESSION["myuserlevel"] = "1";
$_SESSION["myusername"] = "Imagesub";
$_SESSION["mypassword"] = "Notworking";
echo "Username: ".$_SESSION["myusername"]."<br>";
echo "Password: ".$_SESSION["mypassword"]."<br>";
echo "Permissions: ".$_SESSION["myuserlevel"]."<br>";
header("location:test2.php");
?>
File: test2.php
<?
session_start();
echo "<h1>Your session ID is ".session_id()."</h1>";
echo "Username: ".$_SESSION["myusername"]."<br>";
echo "Password: ".$_SESSION["mypassword"]."<br>";
echo "Permissions: ".$_SESSION["myuserlevel"]."<br>";
?>
I can see that it creates two sessions:
Session 1 contains: myuserlevel|s:1:"1";myusername|s:8:"Imagesub";mypassword|s:10:"Notworking";
Session 2 contains: Nothing
It's obviously not picking up the same session name, but the URL is identical, so it's not that.
My php.ini is this (session bit only):
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 1440 1440
session.cookie_path C:\PHP\sessions C:\PHP\sessions
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path C:\PHP\sessions C:\PHP\sessions
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0
It's doing my head in 😕 Any help would be much appreciated.
Cheers