<?php
function pageinfo() {
// This function returns an array '$pageinfo' containing four values :
// $pageinfo[0] is the requested page uri relative to webroot, i.e. what comes before the '?'
// $pageinfo[1] is the requested page query-string, i.e. what comes after the '?'
// $pageinfo[2] is the concatenated string including servername,
// i.e. www.servername.dom/dir/subdir/pagename?p1=$v1&p2=$v2'
// $pageinfo[3] is the request method, i.e. 'GET' or 'POST'
# Get global vars
global $SERVER_NAME, $REQUEST_METHOD, $HTTP_POST_VARS, $SCRIPT_NAME,
$QUERY_STRING
$pageinfo[0] = $SCRIPT_NAME ;
if ($REQUEST_METHOD == 'GET')
{ $pageinfo[1] = $QUERY_STRING ; }
else
{
$counter = 0 ;
$count_vars = count($HTTP_POST_VARS) ;
while (list($name,$value) = each($HTTP_POST_VARS))
{
$pageinfo[1] .= "$name=$value" ;
$counter++ ;
if ( $counter < $count_vars ) { $pageinfo[1] .= "&" ; }
}
}
if ($query != '')
{ $q = "?" ; }
$pageinfo[2] = $SERVER_NAME.$SCRIPT_NAME.$q.$QUERY_STRING ;
$pageinfo[3] = $REQUEST_METHOD ;
return $pageinfo ;
}
$pageinfo = pageinfo();
?>
Simple script to passing persistent and growing array between recalls of one page (manipulate little stack). Categories : Arrays , Global Variables , PHP , HTML and PHP , Variables Variable serialization and unserialization. Loading and saving variable structures
to and from file. Categories : Arrays , Filesystem , Variables , Strings , PHP clearing variables in php3 Categories : Variables , Arrays , PHP PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside. Categories : PHP , Arrays , Variables Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP , Directories , Variables , Arrays A class to put get and post variables in hidden form
elements. Works on scalars, normal arrays, associative
arrays. Categories : Algorithms , Variables , Arrays , PHP , PHP Classes How to pass an array to a function, or how to define a
function wich recieves an array. Categories : Variables , PHP , Arrays Make your PHP 4.1 (or higher) script compatible with PHP 4.0 (still used by some prviders) Categories : PHP , PHP Options and Info , Variables translate.php - Assocciative array example, passing a reference to a function. Categories : PHP , Arrays , Languages , Variables A database abstraction layer for the PHP Oracle 8 module (available from PHP 3.0.5). It supports persistent connections, fetching rows into arrays, prepare/execute (variable binding) and has a new and improved error interface. Categories : Databases , Oracle , PHP , Arrays , Variables PHP Script to find url links in a page Categories : PHP , URLs , Regexps , Arrays getting the name of the current script and query string Categories : PHP , Global Variables , Variables , URLs Newbie Notes #5 - To double quote, or single quote, that is the question Categories : PHP , Beginner Guides , Variables PHP5 URL Object Categories : PHP , PHP Classes , URLs , Strings Select with current month Categories : PHP , HTML and PHP , Date Time , Arrays
Jeko Ianev wrote : 428
this is beter ;-D
if ($REQUEST_METHOD == `GET`)
{ $pageinfo[1] = $QUERY_STRING ; }
else
{
$counter = 0 ;
$count_vars = count($HTTP_POST_VARS) ;
while (list($name,$value) = each
($HTTP_POST_VARS))
{
if (is_array($value))
{
$counter2 = 0 ;
$count_vars2 = count($HTTP_POST_VARS
[$value]) ;
while (list($name2,$value2) = each
($HTTP_POST_VARS[$name]))
{
$pageinfo[1] .= $name."[".$name2."]=".$value2 ;
$counter2++ ;
if ( $counter2 < $count_vars2 ) { $pageinfo
[1] .= "&" ; }
}
}
else
{ $pageinfo[1] .= "$name=$value" ; }
$counter++ ;
if ( $counter < $count_vars ) { $pageinfo[1] .= "&" ; }
}
}