PDA

View Full Version : Updating table data


nonner
10-1-05, 09:24 PM
I have a script that stopped working when the globals were changed. (Really don't know what that means but it did stop working after 8/05 changes)

After someone fills out the form, I am supposed to have the information written to a table in my SQL and that information is mailed to me. The information consists of submission data and http links to uploaded files.

Since the global changes I receive emails but the SQL table is not updated and files are not uploading.

The form is an html document and it calls PHP file called process.php.

I am assuming that the problem lies in the last few lines of the process.php file but I do not know how to make it c omply with the changes at PowWeb.

I did install a php.ini file in root of html and un-remark register_globals = on.

This did not fix the problem. I still get no SQL table update and no file upload.

Any help or direction where to look for a solution is appreciated.

The process.php file code follows.

<?php
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$about=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $about);if($name=="" || $username=="" || $height=="" || $hair=="" || $measurement=="" || $weight=="" || $eyecolor=="" || $dressize=="" || $city=="" || $state=="" || $about=="" || $keyword=="" || $name=="" || $email=="" || $upload=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!is_uploaded_file($upload)){
$error.="<li>The file, ".$upload_name.", was not uploaded!";
$errors=1;
}
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$upload_name;
$image_list[14] = $image_part;
copy($upload, "files/".$image_part);
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="name: ".$name."
username: ".$username."
height: ".$height."
hair: ".$hair."
measurement: ".$measurement."
weight: ".$weight."
eyecolor: ".$eyecolor."
dressize: ".$dressize."
city: ".$city."
state: ".$state."
about: ".$about."
keyword: ".$keyword."
name: ".$name."
email: ".$email."
upload: ".$where_form_is."files/".$image_list[14]."
";
mail("my_email@yahoo.com","Submission Applicant",$message,"From: Submission Applicant");
$link = mysql_connect("mysql02.powweb.com","sql_member_name","sql_password");
mysql_select_db("sql_database_name",$link);
$query="insert into sql_table _name(stagename,username,height,hair,measurement,w eight,eyecolor,dressize,city,state,about,keyword,n ame,email,upload) values ('".$name."','".$username."','".$height."','".$hair."','".$measurement."','".$weight."','".$eyecolor."','".$dressize."','".$city."','".$state."','".$about."','".$keyword."','".$name."','".$email."','".$where_form_is."files/".$image_list[14]."')";
mysql_query($query);
header("Refresh: 0;url=thanks.html");
}
?>

steveresch
10-4-05, 10:57 AM
I have the same problem. Unfortunately, dont know how to fix it either. My code just stopped working. I dont get any error messages, but when i submit a new entry to my database, the data isnt entered. Earlier this summer, it used to work perfectly, and I made no changes. Just discovered this problem today.

RTH10260
10-4-05, 12:37 PM
I have a script that stopped working when the globals were changed. (Really don't know what that means but it did stop working after 8/05 changes)[/PHP]I didn't get any feedback on my PM to you. Did you test the modified script I gave to you ?

PS. please don't duplicate a problem discussion, keep it where it was started (I believe it was in the php section fo the forum.).

RTH10260
10-4-05, 12:46 PM
I have the same problem. Unfortunately, dont know how to fix it either. My code just stopped working. I dont get any error messages, but when i submit a new entry to my database, the data isnt entered. Earlier this summer, it used to work perfectly, and I made no changes. Just discovered this problem today.
In this case you must have missed this announcement: http://forum.powweb.com/showthread.php?t=55379

Suggestion: sign up for daily digests to the Announcements and to the Outages forums to keep current.

As how to fix the problem:
You can make a quick fix by placing a private copy of php.ini into your /htdocs directory and changing the register_globals setting to read On, then the script continues to work as-is.
The safer version is to use the default php.ini, but recode the script and replace all variables you receive from the form, and that are now used directly as '$variable' by the safe notation of $_POST['variable'].