Jump to content

syntax error, unexpected T_VARIABLE


captaintyson

Recommended Posts

I keep getting this error "Parse error: syntax error, unexpected T_VARIABLE in /home/pacifij1/public_html/sunflightva/applications/finishapp.php on line 16" after submitting my form, I have asked my friend but he has no clue either. Here is my code

 

<?php 

//Post from previus form
$callsign = $_POST['callsign'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$pwd = $_POST['pwd'];
$dob = $_POST['dob'];
$city = $_POST['city'];
$state = $_POST['state'];
$country = $_POST['country'];

//Generate Key
$key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20"
$keycode = shuffle("$key");

//Connect to database and check
mysql_select_db($database,$yrbo);
$query_key = "SELECT * FROM `roster` WHERE `key` = '$keycode'";
$key = mysql_query($query_key, $yrbo) or die(mysql_error());
$row_key = mysql_fetch_assoc($key);

//Count recieved rows
$totalRows_key = mysql_num_rows($key);

//If rows are found, re-generate
if($totalRows_key > 0)
{

//Re-generate key
$keycode = str_shuff("1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20");

//Otherwise, if no recieved rows
}else{


}



$hostname = "localhost";   
$database = ""; 
$username = ""; 
$password = ""; 
$vrbo = mysql_connect($hostname, $username, $password) or die(mysql_error()); 

//Checks to see if the callsign is taken
mysql_select_db($database, $vrbo);
$query_pilot = "SELECT * FROM roster where callsign = '$callsign'";
$pilot = mysql_query($query_pilot, $vrbo) or die(mysql_error());
$row_pilot = mysql_fetch_assoc($pilot);
$totalRows_pilot = mysql_num_rows($pilot);


if ($totalRows_pilot > '0') {

echo '<script>alert("Callsign Already in use, please select a new one.");</script>';
echo '<script>history.back(1);</script>';
exit;

}
//Checks to see if the email is taken
mysql_select_db($database, $vrbo);
$query_email = "SELECT * FROM roster where email = '$email'";
$email = mysql_query($query_email, $vrbo) or die(mysql_error());
$row_email = mysql_fetch_assoc($email);
$totalRows_email = mysql_num_rows($email);


if ($totalRows_email > '0') {

echo '<script>alert("Email Already in use, please select a new one.");</script>';
echo '<script>history.back(1);</script>';
exit;

}
//Makes sure email is valid and works
if((!strstr($email , "@")) || (!strstr($email , ".")))

{

echo '<script>alert("You entered an invalid email address");</script>';

echo '<script>history.back(1);</script>';

exit;

}
//Adds them!
mysql_select_db($database, $vrbo);
$query_in = "INSERT INTO roster (first_name, last_name, email, pwd, dob, city, state, country, keycode) VALUES ('$first_name', '$last_name', '$email', '$pwd', '$dob', '$city', '$state', '$country', '$keycode')";
$in = mysql_query($query_in, $vrbo) or die(mysql_error());
//Emails US!**US**
$to = "[email protected]";

$subject ="A new pilot has signed up";

$message = "


A new pilot ($first_name $last_name($callsign)) has signed up.  


Thanks
AquaJet Automated Message

";

mail($to, $subject, $message);
//Emails THE PILOT!**PILOT**
$to_pilot = $email;

$subject_pilot ="Verification Link";

$message_pilot = "
Hello $first_name,

Please click the following link to verify your account and start flying!

http://blocked.com/application/verify.php?key=$keycode


Thanks
AquaJet Automated Message

";

mail($to_pilot, $subject_pilot, $message_pilot);



?>

 

Thanks for any help!

Link to comment
https://forums.phpfreaks.com/topic/118997-syntax-error-unexpected-t_variable/
Share on other sites

you forgot a semicolon

 

//Generate Key

$key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20"

 

should be

 

//Generate Key

$key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20";

 

too lazy to put it in code tags

you forgot a semicolon

 

//Generate Key

$key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20"

 

should be

 

//Generate Key

$key = "1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,20";

 

too lazy to put it in code tags

 

Oh thanks! But now i get this Fatal error: Call to undefined function: str_shuff() in /home/pacifij1/public_html/sunflightva/applications/finishapp.php on line 15

See where it says str_shuff() on line 15? I have a feeling that the function on that line is undefined.

 

 

Just a hunch...

 

 

really, just think about it a few minutes or do some googling before you ask us ;) We love to help... just help us help you.

 

But how do i define the str_shuff?

 

do you even know what it's supposed to do? Or did you just make it up? Or perhaps you read it from somewhere? Anytime it says variable not defined, it means that it's not a variable in PHP's library of functions and therefore something made up, which you need a definition( by doing "function FUNCTIONNAME() { // stuff } ") in order for it to even do anything.

What is str_shuff supposed to do? unfortunately we can't advise you on how to fix it until we know that much... looking at the code it seems as if it serves no purpose, but if there's more code I'd suspect it should be shuffle()

 

Try replacing str_shuff with shuffle. Where did you get this piece of code?

 

Edit: Nevermind, you said you got it fixed.

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.