Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

$HTTP_SESSION_VARS

Status
Not open for further replies.

lazydays

Technical User
Sep 29, 2003
93
GB
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!!
 
Tell your ISP to upgrade to the latest version of PHP. If they won't do it find a "real" web host that will support you correctly. Version 4.0.6 is VERY old and many bugs and security issues have been fixed since it's release.

Ken
 
yes! tell your ISP in the correct way!
Dont say: man, you suck (even though they might very well do).

Tell them that you like theire services, but that you have to consider the fact that they just degraded theire offer, both in terms of functionality and in terms of security.

It's not very hard for them to upgrade to the newer version of PHP, also they might want to check out which version they have of Apache, if they run Apache that is.

There are some compatability-issues with different versions of apache vs. php, but I think I remember that it's displayed at apaches website

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top