I have a client that is running PHP 4.2.3 on a Windows box, with the register_globals variable in the php.ini file set to Off. This is my first experience w/ working with this setting, but with a few loops, I was able to get all my forms to work again:
if(isset($HTTP_SESSION_VARS)) {
while($each_var = each($HTTP_SESSION_VARS)) {
${$each_var["key"]} = $each_var["value"];
}
}
I did the same for the $HTTP_GET_VARS, $HTTP_SERVER_VARS and $HTTP_POST_VARS. Does anyone know of a loop that would fix/define ALL of them, instead of using four while loops as I have now?
However, the bigger problem is that the one form is not uploading an image properly. I have a form as so:
<form action="<?= $PHP_SELF ?>" method="post" enctype="multipart/form-data">
<input type="file" name="new_file" size="40" class="form-tags">
<input type="hidden" name="max_file_size" value="9999999">
<input type="submit" name="save_document" value="Save Document">
</form>
When I submit the form (along with several other fields), it is hitting the following code:
if($new_file != "") {
copy($new_file, "$file_dir/$new_file_name") or die ("Couldn't copy");
$file = $new_file_name;
}
Now for some reason, even though it's getting inside this statement, and it's getting all the other variables just fine, it's spitting out the following errors on the screen:
Notice: Undefined variable: new_file in E:\IISPubmD\mdweb\admin\document_management.php on line 12
Notice: Undefined variable: file in E:\IISPubmD\mdweb\admin\document_management.php on line 18
The while loops where I define the $HTTP_POST_VARS is the first thing on the screen, and as I mentioned, it's getting all the other variables w/o a problem. Any ideas?
Sorry about the LONG message 🙁