I want to make a game, and I'm starting by doing the pages for logging in and registering players and gamecharacters.After a player has registered and has no character created yet, the player will be sent to the page for creating the character. When info on the character has been noted by the players, I need to find the username that was logged in, to see who is creating the character.The only way I can find to do this, is by using cookies.From the tutorial on cookies here, I got these codes:
setcookie("User", $User, time()+3600);
$User is the username that was logging in, and by now the username has been checked against the password and found to be matching.Then at the page where the character is created, I put in these codes, also found on this site:
<?phpif (isset($_COOKIE["user"])) echo "Welcome " . $_COOKIE["user"] . "!<br />";else echo "Welcome guest!<br />";?><?php// Print a cookieecho $_COOKIE["User"];// A way to view all cookiesprint_r($_COOKIE);?>
Now the problem is that even when I've used script to check that the player was actually able to log in, I'm not getting any cookies.All I get is "welcome guest" and some
Array ( [machine-id] => (ip):(some number))
So what am i doing wrong, what is the tutorial not telling me?