Jump to content

How's my script working when I forgot to write part of the code? lol


leefentress

Recommended Posts

I just noticed that I forgot to write all the variables to store POST data in, and yet my script is still processing the data sent from this form. How does it know how to do this when I only wrote the code to store the first three fields?

I just noticed that I forgot to write all the variables to store POST data in, and yet my script is still processing the data sent from this form. How does it know how to do this when I only wrote the code to store the first three fields?

 

I don't know.  Could we see some code?

See I forgot to go back and write the stuff for everything after $email = $_POST["email"]; yet everything works. I've since gone back and went ahead and added the rest of the stuff that's sposta be there. Does php have some kind of thing built in where if you're referencing a variable that hasn't been defined, it looks in the post data to see if there's something with the same name?

 

<?php 
$fName = $_POST["fName"];
$lName = $_POST["lName"];
$email = $_POST["email"];

$curlPost = 
'entry.0.single='  . urlencode($fName) 
. '&entry.1.single=' . urlencode($lName) 
. '&entry.2.single=' . urlencode($email) 
. '&entry.3.single=' . urlencode($party) 
. '&entry.4.single=' . urlencode($email2) 
. '&entry.5.single=' . urlencode($phone) 
. '&entry.6.single=' . urlencode($address) 
. '&entry.7.single=' . urlencode($state) 
. '&entry.8.single=' . urlencode($city) 
. '&entry.9.single=' . urlencode($zip) 
. '&entry.11.single=' . urlencode($comments) 
. '&SUBMIT=Submit';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://spreadsheets.google.com/formResponse?key=...');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($ch);
curl_close($ch);


$to      = $email;
$subject = 'Thank you for registering for the Heart for Israel Conference';
$message = "Dear $fName,\n\nThank you for registering. We have received your information and look forward to seeing you at the conference.\n\nShalom,\nHeart for Israel";
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
$message = wordwrap($message, 70);

mail($to, $subject, $message, $headers);

echo "<p>Thank you for registering! We look forward to seeing you at the conference. An email has been sent to $email confirming your RSVP.</p> 
<p>First Name: $fName </p> 
<p>Last Name: $lName </p>
<p>Email: $email </p>
<p>Phone: $phone </p>
<p>Address: <br /> $address <br /> $city, $state $zip </p>
<p>Party: $party </p>
<p>Comments: $comments </p>
";
?>

What does a phpinfo() statement show for register_globals?

 

If this setting is on (7 years after it was turned off by default in php4.2), you should not rely on it, you should turn it off if possible (due to the security risk), and it has been completely removed in php6.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.