PHP Help "parse error"
| From: | spongel3obfan04 at aol dot com | Date: | Thu, 30 Nov 2006 21:52:22 +0000 |
| Subject: | PHP Help "parse error" | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-33420@lists.php.net to get a copy of this message | ||
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in
/Applications/MAMP/htdocs/jmdst25/store/signin.php on line 36
I have a problem I'm trying to set up this sign in page for a project for school and it
worn't work. I keep getting this parse error. I look at the code and I don't think there
is anything wrong with it since I copied it from the book (PHP and MYSQL for dynamic websites Larry
Ullman). Could you please help me? This is the error I'm getting and the code is at the bottom.
Thanks.
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in
/Applications/MAMP/htdocs/jmdst25/store/signin.php on line 36
<?php
// connecting to the database
$db = mysql_connect("localhost");
if(! $db)
die("Failed to connect");
mysql_select_db("jmdst25", $db);
$page_title = 'Login';
('.includes/header.html');
if(isset($_POST['submitted'])) { //Check if form has been submitted.
require_once ('../mysql_connect.php');
if(!empty($_POST['username'])) {
$e = escape_data($_POST['username']);
} else {
echo '<p><font color="red" size="+1">You forgot to enter yoour
username!</font></p>
$e = FALSE;
}
if(! $errors) {
//Validate the password
if (!empty($_POST['password'])) {
$p = escape_data($_POST['password']);
} else {
$p = FALSE;
echo '<p><font color="red" size="+1">You forgot to enter your
PASSWORD!</font></p>
$e = FALSE;
}
IF ($E && $P) { //IF EVERYTHINGS OK
// running the query
$QUERY = "SELECT username, first_name FROM users WHERE
(username='$e' AND password=SHA('$p')) AND active IS NULL";
$result = mysql_query ($query) or trigger_error("Query: $query\n<br/>
MySQL Error: " . mysql_error());
if (@mysql_num_rows($result) ==1 ) {
//match was made
//register the values $ redicted
$row + mysql_fetch_array
($result, MYSQL_NUM);
mysql_free_result($result);
mysql_close(); //close the database
$_SESSION['firstname'] =
#row[1];
$_SESSION['username'] = $row[0];
//start defining the url
$url = 'http://' . $_SERVER
['HTTP_HOST'] . dirname($_SERVER
['PHP_SELF']);
//check for a trailing slash
if ((substr($url, -1) == '/') OR
(substr($url, -1) == '\\') ) {
$url = substr ($url, 0, -1;
//choop off slash.
}
//add the page
$url .= '/index.php';
ob_end_clean(); // Delete the buffer.
heder("Location: $url");
exit(); //quit the script
} else {
echo '<p><font color="red" size="+1">Either username and
password do not match!</font></p>
}
} else {
echo '<p><font color="red" size="+1">Try again
!</font></p>
}
// close connection to database
mysql_close($db);
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Login</TITLE>
<LINK REL="stylesheet" Type="text/css" HREF="css/1.css">
</HEAD>
<BODY>
<div id="logo">
<A HREF="index.html"><img src="pics/logo.png"
border="0"></A>
</div>
<div id="links">
<center>
<A HREF="products.php">Accessories</a> |
<A HREF="products.php">Art</a> |
<A HREF="products.php">Clothing</a> |
<A HREF="products.php">Crafts</a> |
<A HREF="products.php">Health and Beauty</a> |
<A HREF="products.php">Jewelry</a> |
<A HREF="products.php">Music and Movies</a> |
<A HREF="products.php">Technology</a> |
<A HREF="products.php">Toys</a> |
<A HREF="products.php">Video Games</a>
</center>
<p>
</div>
<div id="signin">
<A HREF="signin.php">Sign In</a> | <A
HREF="create_account.php">Register</a>
</div>
<p>
<div id="content">
<?
if($errors)
echo $errors;
?>
<FORM METHOD="POST" ACTION="signin.php">
<TABLE align="left">
<TR>
<TD>
Username
</TD>
<TD>
<INPUT TYPE="text" SIZE="25" MAXLENGTH="50"
NAME="username">
</TD>
</TR>
<TR>
<TD>
Password
</TD>
<TD>
<INPUT TYPE="password" SIZE="25" MAXLENGTH="50"
NAME="password">
</TD>
</TR>
<TD COLSPAN=2>
<INPUT TYPE="submit" VALUE="Sign In">
<!-- This is a form variable to tell the server what to do when the button is pressed. -->
<INPUT TYPE="hidden" NAME="mode" VALUE="add">
</TD>
</TR>
</TABLE>
</FORM>
</div>
</BODY>
</HTML>
________________________________________________________________________
Check out the new AOL. Most comprehensive set of free safety and security tools, free access to
millions of high-quality videos from across the web, free AOL Mail and more.