Page 1 of 1
STRANGE PROBLEM
Posted: Thu Jun 09, 2005 10:24 am
by Parody
For some strange reason I get an error on the last line of my code, even though it is empty, it is just a blank line
This is the error :
Code: Select all
Parse error: parse error in c:\program files\eas1yphp1-8\www\registertmp123.php on line 217
And the last 10 lines of the code are:
Code: Select all
<td>
<td colspan="e;2"e; align="e;right"e; class="e;style5"e;><div align="e;center"e;>
<input type="e;submit"e; name="e;submit"e; value="e;Sign Up"e;>
</div></td> </td>
</tr>
</table>
</div>
<p class="e;style5"e;>
</p>
</body>
</html>
It ends on HTML.
Strange

Posted: Thu Jun 09, 2005 10:27 am
by hawleyjr
You are missing one of the following characters (;'"{}()) in your PHP code above the HTML you posted.
Posted: Thu Jun 09, 2005 10:44 am
by Parody
Thanks, how do I find out where?
Bit of a stupid question, but is there a quicker way?
Posted: Thu Jun 09, 2005 10:57 am
by anjanesh
Post Lines 216, 217 & 218 of code c:\program files\eas1yphp1-8\www\registertmp123.php
Posted: Thu Jun 09, 2005 11:10 am
by Parody
That is the point, the line at the end is just this:
The last 3 lines are:
Posted: Thu Jun 09, 2005 11:12 am
by anjanesh
Parody - a parse can take place for php related code - not HTML.
Post the PHP code of those lines - not the HTML generated output.
Posted: Thu Jun 09, 2005 11:13 am
by Burrito
well start searchign for the missing end of a line...usually it's a missing "}" on a loop or an if or something like that with the error you described.
might help if you posted all of your code...
Posted: Thu Jun 09, 2005 1:15 pm
by Parody
Ok, here is the code:
Code: Select all
<?php
require('db_connect.php'); // database connect script.
?>
<html>
<head>
<title>Register an Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-image: url(/top2.jpg);
}
.style3 {color: #FFFFFF; font-weight: bold; }
a:link {
color: #FFFFFF;
}
a:visited {
color: #FFFFFF;
}
.style4 {
color: #FFFFFF;
font-family: Arial, Helvetica, sans-serif;
}
.style5 {font-family: Arial, Helvetica, sans-serif}
.style6 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #FFFFFF;
}
-->
</style></head>
<body>
<?php
$rand = rand(10248765,99543547);
$chrctr = $_POST['chrctr'];
if(isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they supposed to, passwords matched, username
isn't already taken, etc. */
if(!$_POST['uname'] | !$_POST['email'] | $_POST['character']) {
die('You didn\'t complete the register form correctly.');
// check if username exists in database.
if(!get_magic_quotes_gpc()) {
$_POST['uname'] = addslashes($_POST['uname']);
$name_check = $db_object->query("SELECT username FROM users WHERE username = '".$_POST['uname']."'");
if(DB::isError($name_check)) {
die($name_check->getMessage());
$name_checkk = $name_check->numRows();
if($name_checkk != 0) {
die('Sorry, the username: <strong>'.$_POST['uname'].'</strong> is already taken, please pick another one.');
// check e-mail format
if(!preg_match("/.*\@.*\..*/", $_POST['email']) | preg_match("/(\<|\>)/", $_POST['email'])) {
die('Sorry the e-mail address you submitted was of invalid format.');
// no HTML tags in username, website, location, password
if(preg_match("/(\<|\>)/", $_POST['uname']) | preg_match("/(\<|\>)/", $_POST['passwd']) | preg_match("/(\<|\>)/")) {
die('Invalid input, no HTML tags are allowed.');
$_POST['passwd'] = md5($_POST['passwd']);
if(!get_magic_quotes_gpc()) {
$_POST['passwd'] = addslashes($_POST['passwd']);
$_POST['email'] = addslashes($_POST['email']);
mysql_connect("localhost", "(myusername)", "(mypassword)") or die(mysql_error());
mysql_select_db("users") or die(mysql_error());
$regdate = date('m d, Y');
$qry = "INSERT INTO users (username, password, regdate, email) VALUES ('".$_POST['uname']."', '".$rand."', '".$regdate."', '".$_POST['email']."')";
echo $qry;
mysql_query($qry) or die(mysql_error());
#$result = mysql_query($query) or die (mysql_error());
mysql_query("INSERT INTO stats('".$_POST['uname']."','$chrctr', '100', '2000', '001', '01', 000, '01', '01', '01', '1', '0', '00000000', '00000000', '00000000', '00000000')");
echo mysql_errno() . ": " . mysql_error() . "<br><br>";
mysql_close();
?>
<?php
$to = $_POST['email'];
$subject = "(subject)";
$body = "Your password is: ".$rand;
if (mail($to, $subject, $body))
?>
<h1 class="style4"><strong>Registered</strong></h1>
<p class="style3 style5">Thank you, you successfully registered, you may now <a href="/login.php" title="Login" target="_self">log in</a>.</p>
<span class="style4">
<?php
}
else { // if form hasn't been submitted
?>
</span>
<h1 class="style4">Register</h1>
<form action="<?=$HTTP_SERVER_VARS['file:///K|/HOMIES/PHP_SELF']?>" method="post">
<table border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999">
<tr><td class="style5"><span class="style3">Username*:</span></td>
<td class="style5"><input type="text" name="uname" maxlength="40"></td></tr>
<tr><td class="style5"><span class="style3">E-Mail*:</span></td>
<td class="style5"><input type="text" name="email" maxlength="100"></td></tr>
<tr></tr>
</table>
</form>
<p align="center" class="style5">
<?php
}
?>
</p>
<p align="center" class="style6">PICK A HOMIE</p>
<div align="center">
<table width="600" border="1">
<tr>
<td width="100"><img src="/characters/1.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/2.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/3.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/4.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/5.jpg" width="100" height="150"></td>
<td width="108"><div align="center"><img src="/characters/6.jpg" width="100" height="150"></div></td>
</tr>
<tr>
<td><div align="center">
<input type="radio" name="character" value="1">
<br>
</div></td>
<td><div align="center">
<input type="radio" name="character" value="2">
</div></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="3">
</div>
</form></td><td>
<form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="4">
</div>
</form></td>
<td>
<form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="5">
</div>
</form></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="3">
</div>
</form></td>
</tr>
</table>
<p> </p>
<table width="600" border="1">
<tr>
<td width="100"><img src="/characters/7.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/8.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/9.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/10.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/11.jpg" width="100" height="150"></td>
<td width="108"><div align="center"><img src="/characters/12.jpg" width="100" height="150"></div></td>
<td width="108"><img src="/characters/13.jpg" width="100" height="150"></td>
</tr>
<tr>
<td><div align="center">
<input type="radio" name="character" value="7">
<br>
</div></td>
<td><div align="center">
<input type="radio" name="character" value="8">
</div></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="9">
</div>
</form></td>
<td>
<form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="10">
</div>
</form></td>
<td>
<form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="11">
</div>
</form></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="12">
</div>
</form></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="13">
</div>
</form></td>
</tr>
</table>
<p> </p>
</div>
<div align="center">
<table width="200" border="1">
<tr>
<td>
<td colspan="2" align="right" class="style5"><div align="center">
<input type="submit" name="submit" value="Sign Up">
</div></td> </td>
</tr>
</table>
</div>
<p class="style5">
</p>
</body>
</html>
Posted: Thu Jun 09, 2005 1:21 pm
by Burrito
you're missing a TON of "}"
each one of those ifs that has a "{" needs to be "closed" with "}".
you can use ifs without "{" if whatever you want to execute that falls within the condition is only one line
ex:
Code: Select all
if($bob)
$stuff = "stuff";
$willy = "willy";
// if bob is true, only stuff will get set whereas....
if($bob){
$stuff = "stuff";
$willy = "willy";
} // notice the closing bracket here...you need to add a bunch of those
// if bob is true both stuff and willie will get set.
Posted: Thu Jun 09, 2005 1:26 pm
by anjanesh
Your closing block at Line 93 seems to be closing for the Line if(!get_magic_quotes_gpc()) { at Line 44 - Missed a } somwhere.
Posted: Thu Jun 09, 2005 1:32 pm
by Burrito
I count a lot more missing than that.
lines:
40
44
48
53
58
62
67
all have { that don't terminate...
there are a few } intertwined with the html below, but I'll leave it up to him to sort through that.
Posted: Thu Jun 09, 2005 1:41 pm
by anjanesh
Parody - If you have you indentations aligned vertically at tabbed intervals for every inner block you would be able to sort it out very easily.
Most people use this style - which till date I have not understood why - esp true c/c++ guys.
but I prefer it this way :
Code: Select all
if (condition)
{
?>
<table>
</table>
<?
}
else
{
?>
<table>
.
.
<table>
<?
echo 'something';
?>
</table>
.
.
</table>
<?
}
Posted: Thu Jun 09, 2005 4:31 pm
by Parody
Can someone tell me which lines have problems please
If someone can be really kind and tell me the corrections for each line, it would be most apprecciated
I can't learn from my mistakes if I don't know what to change

Posted: Fri Jun 10, 2005 10:54 am
by Parody
Please
