Hey,
My site developed on a home setup apache/php/mysql server works fine here. My university web space where the site must be uploaded does not run the scripts correctly. They have and older version of PHP with register_globals set to On... I cannot modify this thru .htaccess as AllowOverrides None has been set for my dir.
How do I rewrite, or what needs to be changed in a script to port code written for register_globals = off to register_globals = on
Thanks
Script Annoyance... register_globals =on Vs off
Moderator: General Moderators
here is the relevant php, there is html in between but so i can paste it in i have ommited it:
feyx | fixed
Code: Select all
<?php
session_start();
$path = ini_get('include_path');
$sep = PATH_SEPARATOR;
$docRoot = $_SERVERї'DOCUMENT_ROOT'];
$dirName = dirname($_SERVERї'PHP_SELF']);
ini_set('include_path', $path . $sep . $docRoot . '/phpIncludes' . $sep . $docRoot . $dirName . '/login');
include_once('common.php');
include_once('db.php');
$uid = isset($_POSTї'uid']) ? $_POSTї'uid'] : $_SESSIONї'uid'];
$pwd = isset($_POSTї'pwd']) ? $_POSTї'pwd'] : $_SESSIONї'pwd'];
if(!isset($uid)) {
?>
<html>
...
a form to collec tthe login details
...
</html>
<?php
exit;
}
$_SESSIONї'uid'] = $uid;
$_SESSIONї'pwd'] = $pwd;
//dbConnect("elearn");
dbConnect("ceemrm1");
$sql = "SELECT * FROM user WHERE
username = '$uid' AND password = PASSWORD('$pwd')";
$result = mysql_query($sql);
if (!$result)
{
error('A database error occurred while checking your '.
'login details.\\nIf this error persists, please '.
'contact webmaster@realisedesign.co.uk.');
}
if (mysql_num_rows($result) == 0) {
unset($_SESSIONї'uid']);
unset($_SESSIONї'pwd']);
include("accessdenied.php");
exit;
}
$username = mysql_result($result,0,'firstname');
$surname = mysql_result($result,0,'surname');
?>feyx | fixed
Code: Select all
tags[/color]This code is a header to every protected page... If this is at home, the user is prompted to login if the session variables are not set, at uni, they are shown the protected cotent, and when they signout and try and return to a protected page, they are again show the protected content without being challenged for a password.
the uni url is http://www.macs.hw.ac.uk/~ceemrm1/project
Hope this helps
the uni url is http://www.macs.hw.ac.uk/~ceemrm1/project
Hope this helps
They have the same variable_order as me, and use 4.3.4 of PHP... $_SERVER works because otherwise I would get an error about including files because the include path would not be set correctly.
Is it possible that $_SESSIONS does not work? In that case, can you direct me to somewhere that will show me hwo to convert $_SESSION to HTTP_SESSION_VARS !?
Thanks
Is it possible that $_SESSIONS does not work? In that case, can you direct me to somewhere that will show me hwo to convert $_SESSION to HTTP_SESSION_VARS !?
Thanks