Joshv1288 Posted August 6, 2008 Share Posted August 6, 2008 Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/h3swat/public_html/livereg.php on line 13 line 13 at the top $user = $_POST[\'username\']; $pass = $_POST[\'password\']; $pass2 = $_POST[\'password2\']; $name = $_POST[\'name\']; $age = $_POST[\'age\']; $loc = $_POST[\'loc\']; $gender = $_POST[\'gender\']; $email = $_POST[\'email\']; $gt = $_POST[\'GT\']; Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/ Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 Remove all those \. >_> Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609113 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 still gettin the same error Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609119 Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 Post the full code in code tags without those \ around the array key names. Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609121 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 this file is like big so i just post to the end of the varibles the rest just verify the user has wrote in the input fields <?php $url = "http://h3swatlg.exofire.net/profile.php\"; $user = $_POST['username']; $pass = $_POST['password']; $pass2 = $_POST['password2']; $name = $_POST['name']; $age = $_POST['age']; $loc = $_POST['loc']; $gender = $_POST['gender']; $email = $_POST['email']; $gt = $_POST['GT']; Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609125 Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 Remove the \ on the end of $url after the profile.php part. Why do you keep adding backslashes? >_> Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609126 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 ok that fixed all that now i get this Warning: Cannot modify header information - headers already sent by (output started at /home/h3swat/public_html/livereg.php:9) in /home/h3swat/public_html/livereg.php on line 87 if (empty($gender)) { header("Location: error-gender.php"); //the user will be sent to this page Die(); } Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609135 Share on other sites More sharing options...
DeanWhitehouse Posted August 6, 2008 Share Posted August 6, 2008 there cant be any ouput before the header ,no echos , or HTML Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609140 Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 Read the stickied post on headers. >_> There cannot be ANY output whatsoever. Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609141 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 ok i dnt understand that can u tell me in simple terms Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609149 Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 Yeah: Don't output anything. That's about as simple as it gets. No output. Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609150 Share on other sites More sharing options...
DeanWhitehouse Posted August 6, 2008 Share Posted August 6, 2008 can't make it simpler Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609154 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 //PASSWORD VERIFICATION if (($pass)!=($pass2)) { header("Location: register.php"); Die(); } //EMAIL VERIFICATION function CheckMail($email) { if(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$",$email)) { return true; } else { return false; } } if ((empty($email)) || (!CheckMail($email))) { header("Location: register.php"); Die(); } //Age VERIFICATION function CheckAge($age) { if (eregi("[0-9]", $age)) { return true; } else { return false; } } if ((empty($age)) || (!CheckAge($age)) || (strlen($age)!=2)) { header("Location: register.php"); Die(); } //NAME VERIFICATION if (empty($name)) { header("Location: register.php"); Die(); } //GENDER VERIFICATION if (empty($gender)) { header("Location: register.php"); Die(); } //LOCATION VERIFICATION if (empty($loc)) { header("Location: register.php"); Die(); } //GAMERSTAG VERIFICATION if (empty($gt)) { header("Location: register.php"); Die(); } //USER AND PASSWORD LENGTH CHECK $min_lenngth = 6; / if(strlen($user) < $min_lenngth || strlen($pass) < $min_lenngth) { header("Location: register.php"); Die(); } //Connects to Database $connection = mysql_connect("localhost", "h3swat_test", "kwdb39"); @mysql_select_db("h3swat_test") or die( "Unable to select database"); $check = mysql_query("select username from users where username=\"$user\""); $returned = mysql_fetch_array($check); if(!empty($returned)) { header("Location: register.php"); mysql_close($connection); } else { $check = mysql_query("select email from users where email=\"$email\""); $returned = mysql_fetch_array($check); if(!empty($returned)) { header("Location: register.php"); mysql_close($link); // Die(); } else / $pass=md5($pass); / $request = "INSERT INTO users values(NULL,\'$name\',\'$user\',\'$pass\', \'$email\',\'$gt\',\'$age\',\'$gender\',\'$loc\')"; $results = mysql_query($request); if($results) { header("Location: profile.php"); } else { header("Location: register.php"); } mysql_close($link); Die(); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=.$url.">';[/quote] Wat do i do with all this then sry im not really understanding output Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609161 Share on other sites More sharing options...
DeanWhitehouse Posted August 6, 2008 Share Posted August 6, 2008 Is this all your code Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609164 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 yea well the part where the header comes in Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609169 Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 No, we need the FULL code. The entire page. Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609173 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 <?php $url = "http://h3swatlg.exofire.net/profile.php"; $user = $_POST['username']; $pass = $_POST['password']; $pass2 = $_POST['password2']; $name = $_POST['name']; $age = $_POST['age']; $loc = $_POST['loc']; $gender = $_POST['gender']; $email = $_POST['email']; $gt = $_POST['GT']; //PASSWORD VERIFICATION if (($pass)!=($pass2)) { header("Location: register.php"); Die(); } //EMAIL VERIFICATION function CheckMail($email) { if(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$",$email)) { return true; } else { return false; } } if ((empty($email)) || (!CheckMail($email))) { header("Location: register.php"); Die(); } //Age VERIFICATION function CheckAge($age) { if (eregi("[0-9]", $age)) { return true; } else { return false; } } if ((empty($age)) || (!CheckAge($age)) || (strlen($age)!=2)) { header("Location: register.php"); Die(); } //NAME VERIFICATION if (empty($name)) { header("Location: register.php"); Die(); } //GENDER VERIFICATION if (empty($gender)) { header("Location: register.php"); Die(); } //LOCATION VERIFICATION if (empty($loc)) { header("Location: register.php"); Die(); } //GAMERSTAG VERIFICATION if (empty($gt)) { header("Location: register.php"); Die(); } //USER AND PASSWORD LENGTH CHECK $min_lenngth = 6; / if(strlen($user) < $min_lenngth || strlen($pass) < $min_lenngth) { header("Location: register.php"); Die(); } //Connects to Database $connection = mysql_connect("localhost", "h3swat_test", "kwdb39"); @mysql_select_db("h3swat_test") or die( "Unable to select database"); $check = mysql_query("select username from users where username=\"$user\""); $returned = mysql_fetch_array($check); if(!empty($returned)) { header("Location: register.php"); mysql_close($connection); } else { $check = mysql_query("select email from users where email=\"$email\""); $returned = mysql_fetch_array($check); if(!empty($returned)) { header("Location: register.php"); mysql_close($link); // Die(); } else / $pass=md5($pass); / $request = "INSERT INTO users values(NULL,\'$name\',\'$user\',\'$pass\', \'$email\',\'$gt\',\'$age\',\'$gender\',\'$loc\')"; $results = mysql_query($request); if($results) { header("Location: profile.php"); } else { header("Location: register.php"); } mysql_close($link); Die(); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=.$url.">'; ?> here ya go Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609184 Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 Is there any blank space before the opening PHP tag? Also, did you save the file as UTF-8? If so, your editor may have included the BOM (Byte Order Mark). You'd need to remove it. Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609189 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> this is b4 it Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609191 Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 Okay, when I say FULL CODE in caps like that, I usually mean that I want the entire code for the page. You need to move the someone else, after the headers. Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609199 Share on other sites More sharing options...
phpretard Posted August 6, 2008 Share Posted August 6, 2008 I might be able to help what is the name of your submit button? I use that same code all the time. Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609201 Share on other sites More sharing options...
Joshv1288 Posted August 6, 2008 Author Share Posted August 6, 2008 Parse error: syntax error, unexpected $end in /home/h3swat/public_html/livereg.php on line 134 i get this now its the ?> at the end and the name of my submit button is submit Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609203 Share on other sites More sharing options...
phpretard Posted August 6, 2008 Share Posted August 6, 2008 submit your login to the index page and (assuming index.php) at the top of your inex page LINE 1 <? session_start(); if (isset($_POST[l'Submit'])){ include 'your_login_file.php'; } ?> Then the begining of your index page... Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609209 Share on other sites More sharing options...
DeanWhitehouse Posted August 6, 2008 Share Posted August 6, 2008 unexpected end means you are missing a closing bracket } Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609211 Share on other sites More sharing options...
phpretard Posted August 6, 2008 Share Posted August 6, 2008 submit your login to the index page and (assuming index.php) at the top of your inex page LINE 1 <? session_start(); if (isset($_POST[l'submit'])){ include 'your_login_file.php'; } ?> Then the begining of your index page... Quote Link to comment https://forums.phpfreaks.com/topic/118361-parse-error/#findComment-609212 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.