forumnz Posted January 1, 2007 Share Posted January 1, 2007 Parse error: syntax error, unexpected $end in /usr/local/psa/home/vhosts/freshlook.co.nz/httpdocs/thing/create.php on line 99 Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/ Share on other sites More sharing options...
kenrbnsn Posted January 1, 2007 Share Posted January 1, 2007 It usually means that you have forgotten to close a quote or haven't balanced the curly brackets "{ }" in your script.Ken Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151036 Share on other sites More sharing options...
HoTDaWg Posted January 1, 2007 Share Posted January 1, 2007 please, show us the code. also it most likely means u left out a bracket [b]{[/b] or a [b];[/b] Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151037 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 [code]<html><head><style type="text/css"><!--body { font-family: Tahoma, Arial, sans-serif; font-size: 12px; font-weight: bold;}--></style><title>Account Creation System</title></head><body><?php/// install file checkif (!file_exists("install.txt")){ die("Admin - Please run install first");};/// import configrequire("config.php");/// connect to database$con=mysql_connect($mysql_hst,$mysql_us,$mysql_ps);if (!$con) { die('Could not connect: ' . mysql_error() . '<br /><br />Check your config file or contact your server support team.'); }; /// select DBif (!mysql_select_db($mysql_db, $con)){die ("Could not connect to the database you specified. Make sure it exists and is correctly named within config.php");};/// active or create?if ($_GET["activec"] == "true"){$setact = "UPDATE members SET active = '1' WHERE username = '" . str_replace(' ','/space/',mysql_real_escape_string($_GET["usrc"])) . "'";mysql_query($setact, $con);die ('Account active<br /><br /><a href="index.html">Login Now!</a>');};///Thing goes here/// check filledif ($_POST["username"] == "") { die ("You did not enter a username"); if ($_POST["password"] == "") { die ("You did not enter a password");};if ($_POST["password"] != $_POST["password_confirm"]) { die ("Your passwords don't match"); };if ($conf == "yes"){if ($_POST["email"] == "") {die ("Site Admin is requested that you supply a valid email address. Please go back and try again");};if ($_POST["age"] == "") { die ("You did not enter an age");};if ($_POST["phone"] == "") { die ("You did not enter a phone number"); };if ($_POST["area"] == "") { die ("You did not enter an area");};//lowercase$usernamel = strtolower($_POST[username]);$usernamel = str_replace(' ','/space/',$usernamel);/// check whether usrname exists$extresult = mysql_query("SELECT * FROM members");while($row = mysql_fetch_array($extresult)) { if ($row[username] == $usernamel){die ('The username is already inuse. Please go back and try again<br /><br /><a href="create.html">Try Again</a>');}; }; /// encode psswrd$passenc = $_POST[password];$passencon = base64_encode($passenc);/// insert data under conditionsif ($conf == "yes"){$active = "0";} else { $active = "1"; };$store = "INSERT INTO `members` (`id`, `username`, `password`, `active`, `age`, `phone`, `area`) VALUES ('', '" . mysql_real_escape_string($usernamel) . "', '" . $passencon . "', '" . $active . "')";mysql_query($store, $con);/// confirmation$to = $_POST[email];$subject = "Members Account";$headers = "MIME-Version: 1.0\r\n";$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";$headers .= "From: " . $sendmail;$body = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><META content="MSHTML 6.00.2900.2912" name=GENERATOR><STYLE></STYLE></HEAD><BODY bgColor=#ffffff><DIV><FONT face=Tahoma>Thank you for signing up to the members area at ' . $_SERVER['HTTP_HOST'] . ' <BR><BR>Click to activate your account: </FONT><A href="http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?usrc=' . $_POST[username] . '&activec=true"><FONT face=Tahoma>http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '</FONT></A> </DIV></BODY></HTML>'; if ($conf == "yes") { mail($to, $subject, $body, $headers); echo ("Thank you " . str_replace('/space/',' ',$usernamel) . " your account has been created. Please activate it using the email that has been sent to your address"); } else { echo ('Your account has been created and is also active. You may login now.<br /><br /><a href="index.html">Login Now!</a>');?></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151038 Share on other sites More sharing options...
corbin Posted January 1, 2007 Share Posted January 1, 2007 [code=php:0]<html><head><style type="text/css"><!--body { font-family: Tahoma, Arial, sans-serif; font-size: 12px; font-weight: bold;}--></style><title>Account Creation System</title></head><body><?php/// install file checkif (!file_exists("install.txt")){ die("Admin - Please run install first");};/// import configrequire("config.php");/// connect to database$con=mysql_connect($mysql_hst,$mysql_us,$mysql_ps);if (!$con) { die('Could not connect: ' . mysql_error() . '<br /><br />Check your config file or contact your server support team.'); }; /// select DBif (!mysql_select_db($mysql_db, $con)){die ("Could not connect to the database you specified. Make sure it exists and is correctly named within config.php");};/// active or create?if ($_GET["activec"] == "true"){$setact = "UPDATE members SET active = '1' WHERE username = '" . str_replace(' ','/space/',mysql_real_escape_string($_GET["usrc"])) . "'";mysql_query($setact, $con);die ('Account active<br /><br /><a href="index.html">Login Now!</a>');};///Thing goes here/// check filledif ($_POST["username"] == "") { die ("You did not enter a username"); if ($_POST["password"] == "") { die ("You did not enter a password");};if ($_POST["password"] != $_POST["password_confirm"]) { die ("Your passwords don't match"); };if ($conf == "yes"){if ($_POST["email"] == "") {die ("Site Admin is requested that you supply a valid email address. Please go back and try again");}}if ($_POST["age"] == "") { die ("You did not enter an age");};if ($_POST["phone"] == "") { die ("You did not enter a phone number"); };if ($_POST["area"] == "") { die ("You did not enter an area");};//lowercase$usernamel = strtolower($_POST[username]);$usernamel = str_replace(' ','/space/',$usernamel);/// check whether usrname exists$extresult = mysql_query("SELECT * FROM members");while($row = mysql_fetch_array($extresult)) { if ($row[username] == $usernamel){die ('The username is already inuse. Please go back and try again<br /><br /><a href="create.html">Try Again</a>');}; }; /// encode psswrd$passenc = $_POST[password];$passencon = base64_encode($passenc);/// insert data under conditionsif ($conf == "yes"){$active = "0";} else { $active = "1"; };$store = "INSERT INTO `members` (`id`, `username`, `password`, `active`, `age`, `phone`, `area`) VALUES ('', '" . mysql_real_escape_string($usernamel) . "', '" . $passencon . "', '" . $active . "')";mysql_query($store, $con);/// confirmation$to = $_POST[email];$subject = "Members Account";$headers = "MIME-Version: 1.0\r\n";$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";$headers .= "From: " . $sendmail;$body = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><META content="MSHTML 6.00.2900.2912" name=GENERATOR><STYLE></STYLE></HEAD><BODY bgColor=#ffffff><DIV><FONT face=Tahoma>Thank you for signing up to the members area at ' . $_SERVER['HTTP_HOST'] . ' <BR><BR>Click to activate your account: </FONT><A href="http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?usrc=' . $_POST[username] . '&activec=true"><FONT face=Tahoma>http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '</FONT></A> </DIV></BODY></HTML>'; if ($conf == "yes") { mail($to, $subject, $body, $headers); echo ("Thank you " . str_replace('/space/',' ',$usernamel) . " your account has been created. Please activate it using the email that has been sent to your address"); } else { echo ('Your account has been created and is also active. You may login now.<br /><br /><a href="index.html">Login Now!</a>');}}?></body></html>[/code]Should work fine. Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151040 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Now no text shows up. Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151041 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 And nothing is added to my database Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151044 Share on other sites More sharing options...
fert Posted January 1, 2007 Share Posted January 1, 2007 you have an extra semi-colon is this line[code]if (!file_exists("install.txt")){ die("Admin - Please run install first");};[/code] Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151046 Share on other sites More sharing options...
forumnz Posted January 1, 2007 Author Share Posted January 1, 2007 Do you think I should start again? Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151049 Share on other sites More sharing options...
kenrbnsn Posted January 1, 2007 Share Posted January 1, 2007 In this mysql query:[code]<?php$store = "INSERT INTO `members` (`id`, `username`, `password`, `active`, `age`, `phone`, `area`) VALUES ('', '" . mysql_real_escape_string($usernamel) . "', '" . $passencon . "', '" . $active . "')";mysql_query($store, $con);?>[/code]You are specifying 7 fields, but only supplying 4 values. This will cause a mysql error, but since you're not checking, your script just dies.Add an "or die" clause to the mysql_query line:[code]<?php$store = "INSERT INTO `members` (`id`, `username`, `password`, `active`, `age`, `phone`, `area`) VALUES ('', '" . mysql_real_escape_string($usernamel) . "', '" . $passencon . "', '" . $active . "')";mysql_query($store, $con) or die("There is a problem with the query: $store<br>" . mysql_error());?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151053 Share on other sites More sharing options...
forumnz Posted January 2, 2007 Author Share Posted January 2, 2007 Ok ill start again... here is the original code that worked. (bottom)Now what I have done in create.html is add 3 more fields, age, phone number and area. I want this script to be able to insert them on my database also.I have edited my database to suit this and the field names are, age, phone, and area.Please help.[code]<html><head><style type="text/css"><!--body { font-family: Tahoma, Arial, sans-serif; font-size: 12px; font-weight: bold;}--></style><title>Account Creation System</title></head><body><?php/// install file checkif (!file_exists("install.txt")){ die("Admin - Please run install first");};/// import configrequire("config.php");/// connect to database$con=mysql_connect($mysql_hst,$mysql_us,$mysql_ps);if (!$con) { die('Could not connect: ' . mysql_error() . '<br /><br />Check your config file or contact your server support team.'); }; /// select DBif (!mysql_select_db($mysql_db, $con)){die ("Could not connect to the database you specified. Make sure it exists and is correctly named within config.php");};/// active or create?if ($_GET["activec"] == "true"){$setact = "UPDATE members SET active = '1' WHERE username = '" . str_replace(' ','/space/',mysql_real_escape_string($_GET["usrc"])) . "'";mysql_query($setact, $con);die ('Account activated<br /><br /><a href="index.html">Login Now!</a>');};///Thing goes here/// check filledif ($_POST["username"] == "") { die ("You did not enter a username"); };if ($_POST["password"] == "") { die ("You did not enter a password"); };if ($_POST["password"] != $_POST["password_confirm"]) { die ("Your passwords don't match"); };if ($conf == "yes"){if ($_POST["email"] == "") {die ("Site Admin is requested that you supply a valid email address. Please go back and try again");};};//lowercase$usernamel = strtolower($_POST[username]);$usernamel = str_replace(' ','/space/',$usernamel);/// check whether usrname exists$extresult = mysql_query("SELECT * FROM members");while($row = mysql_fetch_array($extresult)) { if ($row[username] == $usernamel){die ('The username is already inuse. Please go back and try again<br /><br /><a href="create.html">Try Again</a>');}; }; /// encode psswrd$passenc = $_POST[password];$passencon = base64_encode($passenc);/// insert data under conditionsif ($conf == "yes"){$active = "0";} else { $active = "1"; };$store = "INSERT INTO `members` (`id`, `username`, `password`, `active`) VALUES ('', '" . mysql_real_escape_string($usernamel) . "', '" . $passencon . "', '" . $active . "')";mysql_query($store, $con);/// confirmation$to = $_POST[email];$subject = "Members Account";$headers = "MIME-Version: 1.0\r\n";$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";$headers .= "From: " . $sendmail;$body = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><META content="MSHTML 6.00.2900.2912" name=GENERATOR><STYLE></STYLE></HEAD><BODY bgColor=#ffffff><DIV><FONT face=Tahoma>Thank you for signing up to the members area at ' . $_SERVER['HTTP_HOST'] . ' <BR><BR>Click to activate your account: </FONT><A href="http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?usrc=' . $_POST[username] . '&activec=true"><FONT face=Tahoma>http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '</FONT></A> </DIV></BODY></HTML>'; if ($conf == "yes") { mail($to, $subject, $body, $headers); echo ("Thank you " . str_replace('/space/',' ',$usernamel) . " your account has been created. Please activate it using the email that has been sent to your address"); } else { echo ('Your account has been created and is also active. You may login now.<br /><br /><a href="index.html">Login Now!</a>');};?></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151068 Share on other sites More sharing options...
Rother2005 Posted January 2, 2007 Share Posted January 2, 2007 in the 1st set of code you postedif ($_POST["username"] == "") { die ("You did not enter a username"); if ($_POST["password"] == "") { die ("You did not enter a password");};the username is missing a }; at the end hope this helps Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151087 Share on other sites More sharing options...
forumnz Posted January 2, 2007 Author Share Posted January 2, 2007 It does thanks...But now i get this error [code]INSERT INTO `members` (`id`, `username`, `password`, `active`, `age`, `phone`, `area`) VALUES ('', 'test100', 'dGVzdA==', '1')Column count doesn't match value count at row 1[/code] Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151092 Share on other sites More sharing options...
trq Posted January 2, 2007 Share Posted January 2, 2007 Your trying to insert 4 values into 7 fields. Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151093 Share on other sites More sharing options...
forumnz Posted January 2, 2007 Author Share Posted January 2, 2007 Which part do I change? Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151094 Share on other sites More sharing options...
trq Posted January 2, 2007 Share Posted January 2, 2007 You either need more values; eg[code]('', 'test100', 'dGVzdA==', '1')[/code]or less fields; eg[code](`id`, `username`, `password`, `active`, `age`, `phone`, `area`)[/code] Link to comment https://forums.phpfreaks.com/topic/32496-solved-what-does-this-error-mean/#findComment-151095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.