WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
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 Index
Web Development Resources
Web Development Content
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
Mobile Dev World

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 2 times)
Viewed : 8547
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 
 

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 ---



How to make sure a that $foo is from a cookie and not from the URI.
Categories : PHP, Variables, Global Variables, Cookies
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
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
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
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
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
Global Dump Highlighted
Categories : PHP, Variables, Global Variables
getting the name of the current script and query string
Categories : PHP, Global Variables, Variables, URLs
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
Parse string to find sub-string between two arbitrary strings
Categories : PHP, Strings, HTML and PHP, Arrays
Database resultset navigation
Categories : PHP, HTML and PHP, Databases, MySQL, Navigation
webcam cam view image ispy browser independant
Categories : Graphics, HTML, HTML and PHP, PHP
Customizable encoding and decoding strings with security.
Categories : PHP, Strings, HTML and PHP