Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I have written a complete login system in PHP/MySQL, which works fine on my local webserver. When I test this on the remote server where the site is to be hosted, cookies don’t work (disabled on that server?). So I’ve tried passing the session id via the URL. This works, but the session variables (name and surname) are not retrieved. So my questions are:
What is the correct way to pass the session id via a URL?
What is the correct way to access and display the user’s name and password in subsequent pages?
Code from the login pageCode: Select all
$go_ahead = true; // set this to true for now – will perform proper function later
if ($go_ahead) { //register session variables
$_SESSION['session_id'] = session_id();
$_SESSION['name'] = $name;
$_SESSION['surname'] = $surname;Another page is called up with an URL similar to this:
page2.php?session_id=$session_id
Code from page2.php:
Code: Select all
session_start();
$session_id = $_GET['session_id'];Code: Select all
if (isset($session_id)) {
$_SESSION['session_id'] = $session_id;
$name = $_SESSION['name'];
$surname = $_SESSION['surname'];What is the correct way to link the session id (passed through the URL) to the user’s current session, with corresponding session variables?
Please help, thx