Jump to content

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


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: rsvp@---.com' . "\r\n" .
    'Reply-To: support@---.com' . "\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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.