Jump to content

Recommended Posts

Greeeeeetings!

 

I recently upgraded my site to php5 and noticed a script I have is no longer functioning properly. It's called Snowmail and I cannot find any website for it now with any updated info.

 

The purpose is for a user to input their name and number into a .SWF form and 3 actions happen:

~ The data is put into my database

~ an email is sent to me with the inputted data

~ the .SWF displays a message with the person's name indicating the data was received.

 

Well since the php5 switch, the database still gets the data but the email to me is blank as is the person's name on the callback. "Thanks,  ! Your submission has been sent!!!"

 

I was hoping someone could let me know how to make this php5-ready.

 

Since the connection to the DB works, I'm not including that code.

Asterisks are being used to replace the actual content I have in there.

 

<?php

include('connect.php');

$ToEmail = "***@****";

##$ToName = "***";
$ToSubject = "***";

$EmailBody = "PHONE NUMBER COLLECTED: $phone\n\nSENDER'S NAME: $name\n";

$EmailFooter = "\n----------------------------------\nThis message was sent through ***.com from $REMOTE_ADDR\n";
$EmailPresetText = "\nA submission has come through. \nPlease contact this person using the information provided below.\n";

$Message = $EmailPresetText.$EmailBody.$EmailFooter;

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$name." <".$email.">");

Print "_root.Mail.status=Thanks, ".$name."! Your submission has been sent!!!";

?>
<?php
$name = $_POST['name'];
$phone = $_POST['phone'];

$connection = new connection;
$query = "INSERT INTO phones (name,phone) VALUES ('$name','$phone')";
$connection->queryString($query);

?>

The problem is not php4 vs php5, It is because part of the code relies on an old out dated (turned off by default 7 years ago and removed completely in php6) feature that your web host must have mistakenly kept turned on in the php4 configuration.

 

The part of your code that does work is correctly using the $_POST variables. The part of your code that does not work is expecting program variables to be magically populated from the $_POST variables.

 

All of the following form variables must have lines of code to set them from the corresponding $_POST variables - $phone, $name, and $email.

 

You already have two of these in your database code. Just move those two lines to the beginning of the code and add one for the $email variable.

 

Also, $REMOTE_ADDR must be changed to {$_SERVER['REMOTE_ADDR']} including the leading and trailing braces {} because it is being used inside of a string.

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.