PDA

View Full Version : Debugging this PHP script...



Riverworld
June 19th, 2003, 21:58
Hey all...

I'm just trying to figure out what I've done wrong here... this script is meant to send the already saved information via email:



<?

// Change you@your.com to the email address you want to receive these at.
$admin = ("email-address@riverworld.net");

// Change YourSite.Com to your site's name. Can be Your Site or YourSite.com or whatever.
$sitename = ("Hermione.com.ru");

// These are your form's fields.
$FName = $_POST['FName'];
$LName = $_POST['LName'];
$username = $_POST['username'];
$subdomain = $_POST['subdomain'];
$password = $_POST['password'];
$mysql = $_POST['mysql'];
$email = $_POST['email'];
$alternate_contact = $_POST['alternate_contact'];
$Email = $_POST['Email'];
$Message = $_POST['Message'];

$submissiondate = date("D dS M, Y h:i a");

$ipaddress = GetHostByName($REMOTE_ADDR);

$filename= "reqcounter.txt" ; // Numbers the submissions of the form
$fd = fopen ($filename , "r") or die ("Can't open $filename") ;
$fstring = fread ($fd , filesize ($filename)) ;
fclose($fd) ;

$fd = fopen ($filename , "w") or die ("Can't open $filename") ;
$fcounted = $fstring + 1 ;
$fout = fwrite ($fd , $fcounted ) ;
fclose($fd) ;

// This is your formatted message.

$msg = "----- Website Submission -----\n\n";
$msg .= "Date/Time Submitted: $submissiondate - EST\n";
$msg .= "Submission ID: $fcounted\n\n";
$msg .= "IP address: $ipaddress\n;
$msg .= "Name: $FName $LName\n\n";
$msg .= "Address wanted: $username $subdomain\n\n";
$msg .= "Password: $password\n;
$msg .= "mySql: $mysql\n";
$msg .= "Email Address: $email\n\n";
$msg .= "Alternate contact: $alternate_contact\n;
$msg .= "Reason for wanting hosting:\n\n";
$msg .= "$Message\n\n";

$to = "$admin";
$subject = "$sitename Hosting Request No. $fcounted\n";
$mailheaders = "From: $FName $LName <$Email>\n";
$mailheaders .= "Reply-To: $FName $LName <$Email>\n";

mail($to, $subject, $msg, $mailheaders);

?>

Cagez
June 19th, 2003, 22:41
// Change you@your.com to the email address you want to receive these at.
$admin = ("email-address@riverworld.net");

// Change YourSite.Com to your site's name. Can be Your Site or YourSite.com or whatever.
$sitename = ("Hermione.com.ru");

to

// Change you@your.com to the email address you want to receive these at.
$admin = "email-address@riverworld.net";

// Change YourSite.Com to your site's name. Can be Your Site or YourSite.com or whatever.
$sitename = "Hermione.com.ru";
Mabe? I don't think you put the '( )' around.

And what error are you recieving exactly?

Riverworld
June 19th, 2003, 23:04
oohhh... sorry, thats always helpful

"Parse error: parse error, unexpected T_IF in [see code above] on line 74"

hohoho
June 20th, 2003, 02:24
$msg .= "IP address: $ipaddress\n;
$msg .= "Name: $FName $LName\n\n";
$msg .= "Address wanted: $username $subdomain\n\n";
$msg .= "Password: $password\n;
$msg .= "mySql: $mysql\n";
$msg .= "Email Address: $email\n\n";
$msg .= "Alternate contact: $alternate_contact\n;
there are some closing " missing...

it should look like this:

$msg .= "IP address: $ipaddress\n";
$msg .= "Name: $FName $LName\n\n";
$msg .= "Address wanted: $username $subdomain\n\n";
$msg .= "Password: $password\n";
$msg .= "mySql: $mysql\n";
$msg .= "Email Address: $email\n\n";
$msg .= "Alternate contact: $alternate_contact\n";

The Red Guy
June 20th, 2003, 08:31
It's always the little things that cause errors. :)