View Single Post
  #4 (permalink)  
Old 07-11-2006, 11:35 AM
kgun's Avatar
kgun kgun is offline
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 4,948
kgun RepRank 3kgun RepRank 3
Default

That is inbuilt arrays (mean that they are built automatically as part of the language) and there are lots of them like

$_GET, $_POST, $_SESSION, $_SERVER (that holds information about the server the script is running on).

Let us say an element in the associative array is:
WEBBROWSER (it is an example and not necessarily correct) and stored in the $_SERVER array, you get that information like this:

$webbrowser = $_SERVER['WEBBROWSER']

Another example: Another element is PHP_SELF (the URL of the active page and that is correct).

$thisurl = $_SERVER['PHP_SELF']

I have reccomended "The PHP Anthology: Object Oriented PHP Solutions" a lot of times here at WPW.

The first chapter of volume II is about authentication. You can download the frist chapters of volume I free and some chapters from volume II free. Hopefully it is the first chapter of volume II. There you have an exact example of what you are requiring.

Variable:
$redirect = URL you want to redirect to:

Method:

function redirect($from=true) {
if ( $from ) {
header ( 'Location: '.$this->redirect.'?from='.
$_SERVER['REQUEST_URI'] );
} else {
header ( 'Location: '.$this->redirect );
}
exit();
}
Reply With Quote