PDA

View Full Version : Parse Error ? wtf ?



GregT
July 17th, 2003, 08:03
Upon completing the form and clicking send on my script i get this

Parse error: parse error, unexpected $ in /home/thadmin/public_html/order.php on line 200

The code:



<?php
// Get the users IP
$ip = getenv("REMOTE_ADDR");

// Display the form if this is a new user
if ($action != "sendmail") {
include ("./orderfrm.tpl");
exit;
}

if ($action == "sendmail") {

// Make sure our form was filled out completely and error free.
if( $firstn == "" ){
$firstnerror = 1;
$send = "no";
}
if( $lastn == "" ){
$lastnerror = 1;
$send = "no";
}
if( $country == "" ){
$countryerror = 1;
$send = "no";
}
if( $phone == "" ){
$phoneerror = 1;
$send = "no";
}
if (!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email) || ereg("", $email)) {
$emailerror = "1";
$send = "no";
}
if (!ereg('^[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $domain) || ereg("'", $domain)) {
$domainerror = 1;
$send = "no";
}
if( $usern == "" ){
$usernerror = 1;
$send = "no";
}

if( $password1 == "" || $password2 == ""){
$passworderror = 1;
$send = "no";

if( $package == "" ){
$packageerror = 1;
$send = "no";
}
if ($cfristn == $firstn && $cemail == $email && $clastn == $lastn && $ccountry == $country && $cphone == $phone && $cdomain == $domain && $cusern == $usern && $cpassword == $password1 && $cip == $ip) {
$cookieerror = "1";
$send = "no";
}

// Send user back because he ----ed up and did something stupid
if ($send == "no") {
$error = 1;
include ("orderfrm.tpl");
exit;
}
}

// End Error Checking

// Begin Hosting

// Shared Hosting - Bronze
if($package == "s1" && $payMent=="Monthly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=37";
$pckname = "Bronze";
}
elseif($package == "s1" && $payMent=="Quarterly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=38";
$pckname = "Bronze";
}
elseif($package == "s1" && $payMent =="Annually"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=39";
$pckname = "Bronze";
}

// Shared Hosting - Silver
if($package == "s2" && $payMent=="Monthly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=40";
$pckname = "Silver";
}
elseif($package == "s2" && $payMent=="Quarterly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=41";
$pckname = "Silver";
}
elseif($package == "s2" && $payMent =="Annually"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=42";
$pckname = "Silver";
}

// Shared Hosting - Gold
if($package == "s3" && $payMent=="Monthly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=43";
$pckname = "Gold";
}
elseif($package == "s3" && $payMent=="Quarterly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=44";
$pckname = "Gold";
}
elseif($package == "s3" && $payMent =="Annually"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=46";
$pckname = "Gold";
}
// End Shared Hosting

// Begin Reseller Hosting

// Reseller Packages - Entry
if($package == "r1" && $payMent=="Monthly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=47";
$pckname = "Entry Level Reseller - Monthly";
}
elseif($package == "r1" && $payMent=="Quarterly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=48";
$pckname = "Entry Level Reseller - Quarterly";
}
elseif($package == "r1" && $payMent =="Annually"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=49";
$pckname = "Entry Level Reseller - Annually";
}

// Reseller Packages - Pro
if($package == "r2" && $payMent=="Monthly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=50";
$pckname = "Professional Reseller - Monthly";
}
elseif($package == "r2" && $payMent=="Quarterly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=51";
$pckname = "Professional Reseller - Quarterly";
}
elseif($package == "r2" && $payMent =="Annually"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=52";
$pckname = "Professional Reseller - Annually";
}

// Reseller Packages - Enterprise
if($package == "r3" && $payMent=="Monthly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=53";
$pckname = "Enterprise Reseller - Monthly";
}
elseif($package == "r3" && $payMent=="Quarterly"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=54";
$pckname = "Enterprise Reseller - Quarterly";
}
elseif($package == "r3" && $payMent =="Annually"){
$link = "https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=56503&merchant_order_id=&product_id=55";
$pckname = "Enterprise Reseller - Annually";
}

// End Reseller Hosting
// End Hosting

// Create the message with details about the customer
$msg="
First Name:\t $firstn \n
Last Name:\t $lastn \n
Street:\t\ $street \n
City:\t $city \n
Prov:\t $state \n
Postal Code:\t $zip \n
Country:\t $country \n
Phone Number:\t $phone \n
Email Address:\t $email \n
Domain Name:\t $domain \n
Username:\t $usern \n
Password:\t $password1 \n
Package:\t $pckname \n
Payment Period:\t $payMent \n
Ip Address:\t $ip \n\n\n";

// Set headers for the email
$headers = "From: Total-Host.net Web Solutions<contact@total-host.net>\r\n";
$headers .= "To: admin@total-host.net\r\n";

// Set cookies to spam protect
setcookie(cfirstn, $firstn, time()+86400);
setcookie(clastn, $lastn, time()+86400);
setcookie(cemail, $emailn, time()+86400);
setcookie(ccountry, $country, time()+86400);
setcookie(cphone, $phone, time()+86400);
setcookie(cdomain, $domain, time()+86400);
setcookie(cusern, $usern, time()+86400);
setcookie(cpackage, $package, time()+86400);

// Set subject and recepitant for mail.
$subjectmsg= "New order for: $firstn $lastn";
$emailto == "admin@total-host.net";

// Send the message
mail("$emailto","$subjectmsg","$msg",$headers);

// Tell the user he did good and continue to get some money !
include("orderok.tpl");

?>

Line 200 is ?>. Wtf ? I dont see any $ there ... I went over the code and i didnt see any obvious errors. Plz help. :classic2:

agent007
July 17th, 2003, 09:26
change:


$emailto == "admin@total-host.net";

to


$emailto = "admin@total-host.net";

ECTrimble20
July 17th, 2003, 11:30
a parse error at the end of a PHP script means you have more open brackets or { than close brackets }. The password check is missing a close bracket.....

if( $password1 == "" || $password2 == ""){
$passworderror = 1;
$send = "no";



just add one of these close brackets } and that sould solve it. The ==, shouldn't effect anything.

GregT
July 18th, 2003, 02:06
Thnx, I sometimes add an extra = :o

dawizman
July 18th, 2003, 02:58
Originally posted by agent007
change:


$emailto == "admin@total-host.net";

to


$emailto = "admin@total-host.net";


Wow, you got one, but you missed the line directly above it:


$subjectmsg= "New order for: $firstn $lastn";



TO



$subjectmsg = "New order for: $firstn $lastn";

Cagez
July 18th, 2003, 19:06
That wouldn't cause an error,
dawizman.