Jump to content

session problem


fazzfarrell

Recommended Posts

I have created some sessions, these work on my testing server fine.

As soon as I upload to the proper server they stop.

[code]
<?php require_once('Connections/gmc.php'); ?>
<?php
ini_set("session.save_path", "../SESSIONS");
session_start();
$Menref = $HTTP_POST_VARS['Ref'];
if ($Menref != '')
$_SESSION["Menref"] = $Menref;

$SubRefr = $HTTP_GET_VARS['SubRef'];
if ($SubRefr != '')
$_SESSION["SubRefr"] = $SubRefr;

$TodayDate = date('l dS \of F Y h:i:s A');
$_SESSION['TodayDate'] = $TodayDate;
?>[/code]

So I tested the server with this
[code]
<?php
ini_set("session.save_path", "../SESSIONS");
session_start();

if (isset($_SESSION['test'])){
echo "Session found: test is set to ".$_SESSION['test']."<br />\n";
} else {
$_SESSION['test'] = "some data";
echo "No session data found, so setting the test variable<br />\n";
echo "Click <a href=\"".$_SERVER['PHP_SELF']."\">here</a> to test it out<br />\n";
}
?>[/code]

and it works fine, can any one see where I have gone wrong?
Link to comment
https://forums.phpfreaks.com/topic/35363-session-problem/
Share on other sites

Try running this:

[code]<?php require_once('Connections/gmc.php'); ?>

<?php

ini_set("session.save_path", "../SESSIONS");
session_start();
if (isset($_POST['Ref']) && !empty($_POST['Ref']))
$_SESSION["Menref"] = $_POST['Ref'];

if (isset($_GET['SubRef']) && !empty($_GET['SubRef']))
$_SESSION["SubRefr"] = $_GET['SubRef'];

$TodayDate = date('l dS \of F Y h:i:s A');
$_SESSION['TodayDate'] = $TodayDate;

?>[/code]

Orio
Link to comment
https://forums.phpfreaks.com/topic/35363-session-problem/#findComment-167122
Share on other sites

thanks,

Worked with a tweak!

[code]
<?php

ini_set("session.save_path", "../SESSIONS");
session_start();
// Rob Farrell PageID holds the current ID in a session
if (isset($_GET['ID']) && !empty($_GET['ID']))
$_SESSION["PageID"] = $_GET['ID'];

// Rob Farrell Hold the ref in a session for the three product sets A,B,C
if (isset($_GET['Ref']) && !empty($_GET['Ref']))
$_SESSION["Menref"] = $_GET['Ref'];

// Rob Farrell SubRefr hold the sub ref to a product set
if (isset($_GET['SubRef']) && !empty($_GET['SubRef']))
$_SESSION["SubRefr"] = $_GET['SubRef'];

// Rob Farrell TodayDate holds the current date in a session
$TodayDate = date('l dS \of F Y h:i:s A');
$_SESSION['TodayDate'] = $TodayDate;
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/35363-session-problem/#findComment-167143
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.