Jump to content

Problem in this script


zeeshan

Recommended Posts

i dont know whats the problem because iam unable to see whats the problem here

<?phpfunction showheader ($title) {?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><HEAD><TITLE> Pokemon Meteor </TITLE></HEAD><BODY BGCOLOR="#FFFFFF"><CENTER><?php}?>mysql_connect("localhost", "pokemonmeteor_zxq_net_x", "computer");mysql_select_db("pokemonmeteor_zxq_net_x");if ($Password == $confirm_password) {	$user = mysql_query("SELECT * FROM info (Username='$username')");	if (mysql_num_rows($Username) > 0) {	   {  		 echo "User Name Taken !";	   }		?>		<p>We are sorry to inform you that the User Name <B><?php echo $Name ?></B> Is already Taken.</p>		<?php				}   else 		{		$user = mysql_query("INSERT INTO info VALUES ('$Username','$Password','$confirm_password','$Email','$Confirm_email','$Trainer's_title)");		setcookie("pokemonmeteor_zxq_net_x", $user, time() + 3600, "/");		setcookie("computer", $Password, time() +3600, "/");		showheader("Registration Success!");		?>		You have registered.<BR>		Username: <?php echo $Username ?>		<BR>		Password: <?php echo $Password ?>		<?php			}	 }else 	 {	showheader("Registration Error!");	?>	Your Confirm Password Did Not Match	<?php	showfooter();}?>?>

the error message show in the browser was Parse error: syntax error, unexpected '}' in /www/zxq.net/p/o/k/pokemonmeteor/htdocs/insert.php on line 30i dont know where the error was

Link to comment
Share on other sites

You have 5 '{' and 4 '}'. One of the '{' shouldn't be in the code.Do you not see where it is a '{' that shouldn't be there?Maybe it's a bit hard to find, but if you would make your code look nice with tabs or spaces in a good way, you would see the wrong one direct. Right now it's a bit hard to see which code that lies in which if-statement.

Link to comment
Share on other sites

This is the same code, reformatted:

<?phpfunction showheader ($title) {  ?>  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">  <HTML>  <HEAD>  <TITLE> Pokemon Meteor </TITLE>  </HEAD>  <BODY BGCOLOR="#FFFFFF">  <CENTER>  <?php}?>mysql_connect("localhost", "pokemonmeteor_zxq_net_x", "computer");mysql_select_db("pokemonmeteor_zxq_net_x");if ($Password == $confirm_password) {  $user = mysql_query("SELECT * FROM info (Username='$username')");  if (mysql_num_rows($Username) > 0)   {	{	  echo "User Name Taken !";	}	?>	<p>We are sorry to inform you that the User Name <B><?php echo $Name ?></B> Is already Taken.</p>	<?php  }  else  {	$user = mysql_query("INSERT INTO info VALUES('$Username','$Password','$confirm_password','$Email','$Confirm_email','$Trainer's_title)");	setcookie("pokemonmeteor_zxq_net_x", $user, time() + 3600, "/");	setcookie("computer", $Password, time() +3600, "/");	showheader("Registration Success!");	?>	You have registered.<BR>	Username: <?php echo $Username ?>	<BR>	Password: <?php echo $Password ?>	<?php  }}else{  showheader("Registration Error!");  ?>  Your Confirm Password Did Not Match  <?php  showfooter();}?>?>

There are several problems here, again. I'm going to reference things by line number so if you don't have a text editor that shows line numbers then download something like ConTEXT. On line 13 you have a closing PHP tag, and right after that more PHP code. That's one problem, it thinks everything from line 13 to line 28 is HTML output. On lines 22 and 23 you have duplicate open brackets. That's not correct, you should only have one there. On line 20 you save the query result into a variable called $user, then on the next line you're trying to check $Username. On line 27 you're trying to print $Name. Also in the if statement on line 18 you're trying to compare 2 variables that don't exist (none of the variables in this script that you're trying to use look like they exist, you aren't getting anything from $_POST). On line 34 you're trying to use a variable called "$Trainer's_title", you are not allowed to use punctuation inside variable names, and I don't think any of the other variables in that query exist. On line 36 you're trying to set a cookie with the value inside $user, but on line 33 you made $user a MySQL resource, it doesn't hold the username. On line 54 you're trying to call a function called showfooter that doesn't exist, and on the last two lines you have duplicate closing tags.

Link to comment
Share on other sites

No I can't, there is information missing where I don't know what it is supposed to be. I'm not sure where all of the variables are coming from (I would assume from POST), or what their original names are, and I don't know what the showfooter function is supposed to be.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...