By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,435 Members | 2,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,435 IT Pros & Developers. It's quick & easy.

parse error on the last line of code </html>

P: n/a
/// here is the code i'm getting a parse error on the last line of the
code which
/// is </html> any help will be much appreciated.


<?php

session_start ();
require_once('connect.php');

if ($_SESSION['username']){ //test for logged-in
$query = "SELECT status FROM accounts WHERE
username='".$_SESSION['username']."'";
$result = mysql_query ($query) or die("<b>A fatal MySQL error
occured</b>.\n<br>\nError: (" . mysql_errno() . ") " . mysql_error());
$row = mysql_fetch_array ($result,MYSQL_NUM);

if ($row[0] == 0){
$error_message .= "<P>Your account has been frozen. Email the <A
HREF='mailto:ac************@severedrealm.net'>webm aster</A> for more
information.</P>";}

if ($row[0] == 1){
$query2 = "SELECT name, hp, gold, exp FROM characters WHERE
username='".$_SESSION['username']."'";
$result2 = mysql_query ($query2) or die("<b>A fatal MySQL
error occured</b>.\n<br>\nError: (" . mysql_errno() . ") " .
mysql_error());
$character_table .= "<TABLE CELLSPACING='2' CELLPADDING='2'
BORDER='0'><TR><TD>Name</TD><TD>Hit
Points</TD><TD>Gold</TD><TD>Experience</TD><TD>Delete</TD></TR>";
$x=0;
while ($character = mysql_fetch_array ($result2)) {
$x=$x+1;
$character_table .=
"<TR><TD>".$character[1]."</TD><TD>".$character[2]."</TD><TD>".$character[3]."</TD><TD>".$character[4]."</TD>";
$character_table .= "<TD><form action='character.php'
method='post'><input type='hidden' name='character'
value='".$character[1]."'><INPUT TYPE='submit'
NAME='delete_character_submit'
VALUE='delete_character'></FORM></TD></TR>";}
$character_table .= "</TABLE>";
if ($x >= 1){
$error_message .= "<P>You have too many characters. You must
delete ".$x."before you can create another.</P>";
}else{
$character_creation_form .= "<FORM
ACTION='character.php?op=create_character' METHOD='post'>";
$character_creation_form .= "<table cellspacing='2'
cellpadding='2' border='0'><tr>";
$character_creation_form .= "<td>New Character
Name:</td><td><input type='text' name='new_character_name' size='30'
maxlength='30' value=''/></td></tr>";
$character_creation_form .= "<tr><td></td><td><input
type='submit' name='New_Character_Submit' value='Create
Character'></td></tr></table></FORM>";}

if ($row[0] == 2){
$query3 = "SELECT name, hp, gold, exp FROM characters WHERE
username='".$_SESSION['username']."'";
$result3 = mysql_query ($query3) or die("<b>A fatal MySQL
error occured</b>.\n<br>\nError: (" . mysql_errno() . ") " .
mysql_error());
$character_table .= "<TABLE CELLSPACING='2' CELLPADDING='2'
BORDER='0'><TR><TD>Name</TD><TD>Hit
Points</TD><TD>Gold</TD><TD>Experience</TD><TD>Delete</TD></TR>";
$x=0;
while ($character = mysql_fetch_array ($result2)) {
$x=$x+1;
$character_table .=
"<TR><TD>".$character[1]."</TD><TD>".$character[2]."</TD><TD>".$character[3]."</TD><TD>".$character[4]."</TD>";
$character_table .= "<TD><form action='character.php'
method='post'><input type='hidden' name='character'
value='".$character[1]."'><INPUT TYPE='submit'
NAME='delete_character_submit'
VALUE='delete_character'></FORM></TD></TR>";}
$character_table .= "</TABLE>";
if ($x >= 2){
$error_message .= "<P>You have too many characters. You must
delete ".$x."before you can create another.</P>";
}else {
$character_creation_form .= "<FORM
ACTION='character.php?op=create_character' METHOD='post'>";
$character_creation_form .= "<table cellspacing='2'
cellpadding='2' border='0'><tr>";
$character_creation_form .= "<td>New Character
Name:</td><td><input type='text' name='new_character_name' size='30'
maxlength='30' value=''/></td></tr>";
$character_creation_form .= "<tr><td></td><td><input
type='submit' name='New_Character_Submit' value='Create
Character'></td></tr></table></FORM>";}

if ($row[0] == 3){
$query4 = "SELECT name, hp, gold, exp FROM characters WHERE
username='".$_SESSION['username']."' ORDER BY name ASC";
$result4 = mysql_query ($query4) or die("<b>A fatal MySQL
error occured</b>.\n<br>\nError: (" . mysql_errno() . ") " .
mysql_error());
$character_table .= "<TABLE CELLSPACING='2' CELLPADDING='2'
BORDER='0'><TR><TD>Name</TD><TD>Hit
Points</TD><TD>Gold</TD><TD>Experience</TD><TD>Delete</TD></TR>";
$x=0;
while ($character = mysql_fetch_array ($result2)) {
$x=$x+1;
$character_table .=
"<TR><TD>".$character[1]."</TD><TD>".$character[2]."</TD><TD>".$character[3]."</TD><TD>".$character[4]."</TD>";
$character_table .= "<TD><form action='character.php'
method='post'><input type='hidden' name='character'
value='".$character[1]."'><INPUT TYPE='submit'
NAME='delete_character_submit'
VALUE='delete_character'></FORM></TD></TR>";}
$character_table .= "</TABLE>";
if ($x >= 3){
$error_message .= "<P>You have too many characters. You must
delete ".$x."before you can create another.</P>";
}else {
$character_creation_form .= "<FORM
ACTION='character.php?op=create_character' METHOD='post'>";
$character_creation_form .= "<table cellspacing='2'
cellpadding='2' border='0'><tr>";
$character_creation_form .= "<td>New Character
Name:</td><td><input type='text' name='new_character_name' size='30'
maxlength='30' value=''/></td></tr>";
$character_creation_form .= "<tr><td></td><td><input
type='submit' name='New_Character_Submit' value='Create
Character'></td></tr></table></FORM>";}

}else{//display login form
$login .= '<!-- Login Form -->';
$login .= '<form action="index.php?' . SID . '" method="post">';
$login .= '<small>User Name</small><BR><input type="text"
name="username" size="10" maxlength="20" value="';
$login .= '" /><BR>';
$login .= '<small>Password</small><BR><input type="password"
name="password" size="10" maxlength="20" /><BR>';
$login .= '<input type="submit" name="login_submit" value="login"
/>';
$login .= '</form></p>';}

if ($_POST['delete_character_submit']){//test for delete character
button pressed
$query5 = "DELETE FROM characters, accounts WHERE
characters.account_id = accounts.account_id AND
accounts.username='".$_SESSION['username']."' and
characters.name='".$_POST['character']."'";
echo "<PRE>".$query5."</PRE>";
$result5 = mysql_query ($query5) or die("<b>A fatal MySQL error
occured</b>.\n<br>\nError: (" . mysql_errno() . ") " . mysql_error());
echo "<PRE>".$result5."</PRE>";
$row5 = mysql_affected_rows ($dbc);
echo "<PRE>".$row5."</PRE>";
if($row5 = 0){$error_message .= "Something went wrong. Please try
again.";}
elseif($row5 >= 2){$error_message .= "Somehow the entire character
database has been trashed. Thank You for playing Severed Realms.";}}

if ($HTTP_GET_VARS[op]=="create_character"){//test for create
character button pressed
$query6 = "INSERT INTO characters (name, hp, gold, exp) VALUES
('".$_POST['new_character_name']."', 10, 100, 0)";
$result6 = mysql_query ($query6) or die("<b>A fatal MySQL error
occured</b>.\n<br>\nError: (" . mysql_errno() . ") " . mysql_error());
$row6 = mysql_affected_rows ($dbc);
if($row6 = 0){$error_message .= "Something went wrong. Please try
again.";}
elseif($row6 >= 2){$error_message .= "Somehow the entire character
database has been trashed. Thank You for playing Severed Realms.";}}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<head>
<title>New Character</title>
</head>
<body background="images/bkg.gif" bgcolor="#EEE2CC" text="#804000"
link="#004000" vlink="#000040" alink="#808080">
<div align="center"><table width="85%" border="0" cellspacing="5"
cellpadding="5" align="center" style="font-family: sans-serif;">

<!-- Header Row -->
<tr><td colspan="2" align="left" valign="top"><img
src="images/header.jpg" width="550" height="100" alt=""
border="0"></td></tr>

<!-- Menu Column -->
<tr><td width="100" valign="top" background="images/lt_bkg.gif"
style="border: medium solid #804000;">
<?php echo login_logout (); ?>
<A HREF="forgotpassword.php"><small>Forgot Your
Password?<br></small></A><HR>
<a href="index.php">Home</a><BR>
Forum<br>
FAQ's<br>
Policies<br>
Artifacts<br>
Contact Us<br>
Downloads<br>

</td>

<!-- Content Column -->
<td valign="top" background="images/lt_bkg.gif" style="border: medium
solid #804000;">
<?php if ($message){echo stripslashes($message);} ?>
<?php if ($error_message){echo stripslashes($error_message);} ?>
<?php if ($character_table){echo stripslashes($character_table);} ?>
<?php if ($character_creation_form){echo
stripslashes($character_creation_form);} ?>
</td></tr>

<!-- Footer Row -->
<tr><td colspan="2" align="center"
valign="top"background="images/lt_bkg.gif" style="border: medium solid
#804000;">copyright contacts policies other stuff to go here</td></tr>
</table></div>
</BODY></HTML>
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <90**************************@posting.google.com >,
sk*******@yahoo.com (josh dismukes) wrote:
/// here is the code i'm getting a parse error on the last line of the
code which
/// is </html> any help will be much appreciated.


Check your {}'s. I would guess that a closing } is missing somewhere.

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #2

P: n/a

"Jan Pieter Kunst" <de*****@cauce.org> wrote in message
news:de***************************@news1.news.xs4a ll.nl...
In article <90**************************@posting.google.com >,
sk*******@yahoo.com (josh dismukes) wrote:
/// here is the code i'm getting a parse error on the last line of the
code which
/// is </html> any help will be much appreciated.


Check your {}'s. I would guess that a closing } is missing somewhere.

JP


According to my bracket matching editor, there are _three_ missing. Get one,
they're great for this sort of thing.

Garp
Jul 17 '05 #3

P: n/a
"Garp" <ga***@no7.blueyonder.co.uk> wrote in message
news:7d********************@news-text.cableinet.net...

"Jan Pieter Kunst" <de*****@cauce.org> wrote in message
news:de***************************@news1.news.xs4a ll.nl...
In article <90**************************@posting.google.com >,
sk*******@yahoo.com (josh dismukes) wrote:
/// here is the code i'm getting a parse error on the last line of the
code which
/// is </html> any help will be much appreciated.
Check your {}'s. I would guess that a closing } is missing somewhere.

JP


According to my bracket matching editor, there are _three_ missing. Get

one, they're great for this sort of thing.


People with poor curly hygiene depends to be tormented if you ask me.
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.