I am having a bit of trouble as our ISP have moved us onto a new server, but an older version of PHP (vers 4.0.6).
I previously used $_SESSION['userid'] to set the session variable, but have now changed that to $HTTP_SESSION_VARS['userid'], but the session is not being transferred between pages.
I have following code:
login.php
<?php
session_start();
require_once ("../../../mysql_connect_personal.php");
$query = "SELECT * FROM user_details WHERE user_id = '$user'";
$result = mysql_query($query)or die ("MySQL: " . mysql_error());
$item = mysql_fetch_array($result);
if ($item['user_id']==$user) {
if ($item['user_password']==$pass) {
$HTTP_SESSION_VARS['user_id']=$item['user_id'];
?>
<script type="text/javascript">
location.replace('check_user.php');
</script>
<?php
} else {
?>
<script type="text/javascript">
location.replace('../../UnauthorisedUser.htm');
</script>
<?php
}
} else {
?>
<script type="text/javascript">
location.replace('../../UnauthorisedUser.htm');
</script>
<?php
}
?>
This works fine and the $HTTP_SESSION_VARS['user_id'] is set - the code is redirected to check_user.php when the correct username and password are entered.
check_user.php
// Open the Session
session_start();
// if the user_id session variable is not null, send the user to the Tradezone and add the user to the login stats, otherwise send the user to the stated page
if (isset($HTTP_SESSION_VARS['user_id'])) {
?>
<script type="text/javascript">
location.replace('Tradezone/Home.php');
</script>
<?php
include("login_add_to_stats.php");
exit();
} else {
?>
<script type="text/javascript">
location.replace('/UnauthorisedUser.htm');
</script>
<?php
exit();
}
Could really do with some help here, as customers cannot login at the moment. Thanks guys!!
I previously used $_SESSION['userid'] to set the session variable, but have now changed that to $HTTP_SESSION_VARS['userid'], but the session is not being transferred between pages.
I have following code:
login.php
<?php
session_start();
require_once ("../../../mysql_connect_personal.php");
$query = "SELECT * FROM user_details WHERE user_id = '$user'";
$result = mysql_query($query)or die ("MySQL: " . mysql_error());
$item = mysql_fetch_array($result);
if ($item['user_id']==$user) {
if ($item['user_password']==$pass) {
$HTTP_SESSION_VARS['user_id']=$item['user_id'];
?>
<script type="text/javascript">
location.replace('check_user.php');
</script>
<?php
} else {
?>
<script type="text/javascript">
location.replace('../../UnauthorisedUser.htm');
</script>
<?php
}
} else {
?>
<script type="text/javascript">
location.replace('../../UnauthorisedUser.htm');
</script>
<?php
}
?>
This works fine and the $HTTP_SESSION_VARS['user_id'] is set - the code is redirected to check_user.php when the correct username and password are entered.
check_user.php
// Open the Session
session_start();
// if the user_id session variable is not null, send the user to the Tradezone and add the user to the login stats, otherwise send the user to the stated page
if (isset($HTTP_SESSION_VARS['user_id'])) {
?>
<script type="text/javascript">
location.replace('Tradezone/Home.php');
</script>
<?php
include("login_add_to_stats.php");
exit();
} else {
?>
<script type="text/javascript">
location.replace('/UnauthorisedUser.htm');
</script>
<?php
exit();
}
Could really do with some help here, as customers cannot login at the moment. Thanks guys!!