Jump to content

[SOLVED] Upgrading Snowmail form mail script to be php5 compatible


cozbaldwin

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.

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.