|
|
|
The following can be an include file (eg set.ini), and be called at the top of every page in case you knowingly* want all the global variables passed on the URL to be defined as global variables and don't know if your target webserver(s) will have the auto global variable parameter turned on when the code is executed.
| <?php
if($_SERVER['REQUEST_METHOD'] == "GET" )
{
reset ($_GET);
while (list ($key, $val) = each ($_GET)) $$key=$val;
}
else
{
reset ($_POST);
while (list ($key, $val) = each ($_POST)) $$key=$val;
}
?> | |
*Attention, it may be unsecure to have this behaviour though. |
|
| Newbie Notes #5 - To double quote, or single quote, that is the question Categories : PHP, Beginner Guides, Variables | | | Basic Authentication with sessions Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions | | | Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | Introduction to Language Files Categories : PHP, Filesystem, Beginner Guides | | | email new items in db Categories : PHP, Email, Databases, MySQL, Beginner Guides | | | clearing variables in php3 Categories : Variables, Arrays, PHP | | | PHP Email image generator - hide your email from bots - using the GD Library Categories : PHP, Graphics, GD image library, Beginner Guides | | | A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors Categories : PHP, Variables, Errors and Logging | | | 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 | | | Newbie Notes #8 - A cron trick Categories : PHP, CURL, Beginner Guides | | | This functions compares the current PHP version with a
desired version. Because of the 3 tiered version system, a
direct compare of a string to phpversion() will not be
accurate. Categories : PHP Configuration, PHP, Variables | | | a PHP Function to Get only the filename (remove the extension) using regular expressions. Categories : PHP, Regexps, Beginner Guides | | | A beginner's session handling class Categories : PHP, PHP Classes, Sessions, Beginner Guides | | | A very simple PHP single password cookie based login without usernames. Categories : PHP, Cookies, Security, Beginner Guides | | | PHP based Contact email form with multiple recipients, text file based, supports departments. Categories : PHP, Email, Beginner Guides, Filesystem | |
|
|
|