Go Back   SitePoint Forums > Forum Index > Program Your Site > PHP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Feb 26, 2004, 01:12   #1
HarryF
SitePoint Wizard
gold trophysilver trophy
 
Join Date: Nov 2000
Location: Switzerland
Posts: 2,906
The ?from= field the the Auth.php class generates is a "nive to have" feature - if someone is surfing your site, then has a break for a while, leaving their browser open, during which time their session times out, when they return they will be required to login again but the from value can help take them back to the page they were viewing.

As Kev points out, the from value is populated from $_SERVER['REQUEST_URI'] may not be available if you're using IIS or the CGI version of PHP. You can check where you have with the following;

PHP Code:

echo php_sapi_name() 

When it comes to the login system, the form in 4.php has the following at the start;

PHP Code:

// If $_GET['form'] comes from the Auth class

if ( isset ( $_GET['from'] ) ) {
    
$target=$_GET['from'];
} else {
    
// Default URL: usually index.php
    
$target='5.php';
}
That could be a little smarter in checking the value of $_GET['form'] - right now if $_GET['form'] is empty, it will still be assigned to the $target variable, which is used to specify where the form should submit it's values to - in other words it will result in the form posting to itself (hence you never get back to the secured page).

The following is a quick fix;

PHP Code:

<?php

// If $_GET['form'] comes from the Auth class
if ( isset ( $_GET['from'] ) && !empty ( $_GET['from'] ) ) {
    
$target=$_GET['from'];
} else {
    
// Default URL: usually index.php
    
$target='5.php';
}
?>
That now checks $_GET['from'] has a value. A more careful check might be to determine whether the file specified in the from field actually exists.
HarryF is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 18:19.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved