Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2006, 11:51 PM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Stormwalkers
Default Newbie... HTTP_SERVER_VARS issue...

Hi everyone.

I did PHP back at Uni almost 5 years ago.. got 98% overall with my coding assignments.. but have not touched it since... I know the basics I guess of the programming language but I am now pretty much unfamiliar with even the basics...

My problem is now I have decided to get back into it.. and my first problem is trying to modify some PHP code that was created to run on a PHP 4 server (or earlier not really sure). And I am updating it to be compatible with a newer PHP 5 server.

Here is the code in its original form:

Code:
<?php require_once('../Connections/confirm.php'); ?>
<?php

session_start();

$loginFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($accesscheck)) {
  $GLOBALS['PrevUrl'] = $accesscheck;
  session_register('PrevUrl');
}

if (isset($HTTP_POST_VARS['username'])) {
  $loginUsername=$HTTP_POST_VARS['username'];
  $password=$HTTP_POST_VARS['password'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "adminentry.php";
  $MM_redirectLoginFailed = "index.php?badlogin=true";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_name, $name);
  
  $LoginRS__query=sprintf("SELECT name, pass FROM admin WHERE name='%s' AND pass='%s'",
    get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); 
   
  $LoginRS = mysql_query($LoginRS__query, $name) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";

    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset($HTTP_SESSION_VARS['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $HTTP_SESSION_VARS['PrevUrl'];    
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>


I am aware that the HTTP_SERVER_VARS is no longer cool to use.. but how to modify the code to be acceptable is messing with my head.. I replaced HTTP_SERVER_VARS with $GET, and the page did nothing.. no errors.. it displayed okay.. just didnt actually do anything...

Any help would be greatly appreciated.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie here jmac731976 HTML Code Clinic 13 August 29th, 2007 03:54 PM
newbie needs help digitaldesigns HTML Code Clinic 5 January 22nd, 2005 04:08 PM
Need Help - Newbie Nickph Beginning PHP 3 September 26th, 2004 07:58 PM
newbie richardtr Beginning PHP 13 August 7th, 2004 10:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.