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