WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Make old style (PHP3) scripts using GET, POST, COOKIE and File uploads (POST) compatible with PHP 4.2.0
Categories : PHP, HTML and PHP, Global Variables, Cookies, Variables Click here to Update Your Picture
Ulrich Kapp
Date : May 23rd 2002
Grade : 2 of 5 (graded 4 times)
Viewed : 10206
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Ulrich Kapp
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Due to security reasons, the 'register_globals' setting is off by default since PHP 4.2.0.

So, if you used the old PHP3 style for accessing the HTTP_GET, HTTP_POST, HTTP_COOKIE and HTTP_POST_FILES values
directly as globals, you will find that it won't work anymore. The GET, POST and COOKIE variables aren't direct
accessable anymore. Also the $userfile, $userfile_name e.t.c. variables are no longer available.

One solution would be to set 'register_globals' to 'on' in the php.ini file (which is not recommended).

Or you import the values from the new superglobals (since PHP 4.1.0) into the local variable scope.

Just place the following script snippet everywhere you need access to the HTTP_GET, HTTP_POST, HTTP_COOKIE and
HTTP_POST_FILES values, and your old PHP3-style applications will work again.




--- code starts here ---
unset ($userfile);
@extract($_GET);
@extract($_POST);
@extract($_COOKIE);
@extract($_FILES);

if ($tmp_array = $userfile) {
        unset ($userfile);
        $old_type = array();
        foreach ($tmp_array as $key => $value) {
                if ($key == "tmp_name") {
                        $old_type["userfile"] = $value;
                } else {
                        $old_type["userfile_".$key] = $value;
                }
        }
        extract($old_type);
}
--- code ends here ---



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
How to make sure a that $foo is from a cookie and not from the URI.
Categories : PHP, Variables, Global Variables, Cookies
A quick way set data from a form to a function or other places where you can lose scope.
Categories : PHP, HTML and PHP, Variables
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
Smart Counter - This little script is a plain and simple hit counter that uses cookies to determine whether or not the visitor has already been counted.
Categories : Cookies, HTML and PHP, PHP
Initialize global variables for every field in a table. This version requires that phplib is installed on your server.
Categories : Global Variables, MySQL, PHP, Variables
Complete, simple working example of login screen and check on a unique page using php functions, cookies and mysql database.
Categories : PHP, Cookies, MySQL, HTML and PHP, Authentication
Function that allows a Javascript cookie to be set after HTML has been outputted to the page.
Categories : PHP, Java Script, Cookies, HTML and PHP
Global Dump Highlighted
Categories : PHP, Variables, Global Variables
PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
getting the name of the current script and query string
Categories : PHP, Global Variables, Variables, URLs
Multiple Select box, Select multiple Items from Menu.List box
Categories : PHP, HTML and PHP, Beginner Guides
mySQL/PHP/search with multientry form and table output with colored rows
Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases
If you want to create select buttons featuring current date this example will show you how...
Categories : Date Time, HTML and PHP, PHP
Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML -
Categories : PHP, Directories, FTP, Filesystem, HTML and PHP