Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

Getting parse error by using PHP 5 help book?

  • Please log in to reply




  • Member
  • PipPip
  • 40 posts
Okay so im using a PHP help book to create a register and login script.

Register script is fine, it drops users into a MySQL database, however to the login script gives me the following error:

Parse error: syntax error, unexpected T_VARIABLE in /hermes/bosweb25a/b109/ipg.removalspacecom/removal space.com/loginscript.php on line 15

I know that there is an error but which one? i basically copied the script word-for-word, letter-for-letter. so how come im getting this one?

Heres the actual script:

<?php $username = $_POST['username'];
$password = $_POST['password'];
$self = $_SERVER['PHP_SELF'];
$referer = $_SERVER['HTTP_REFERER'];
#if either form field is empty return to the log-in page
if( ( !$username ) or (!$paswword ) )
{ header( "Location:$referer" ); exit(); }
#connect to MySQL
$conn = @mysql_connect ( "removalspacecom.ipagemysql.com", "removal", "123" )
or die("Could not connect" );
#select the specified database
$rs = @mysql_select_db( "removal1", $conn )
or die( "Could not select database" )
#create sql query
$sql="select * from users where user_name=\"$username\"
and password = password( \"$password\" )";
#execute query
$rs = myslq_query( $sql, $conn )
or die( "Could not execute query" );
#get number of rows that match username and password
$num = mysql_numrows( $rs );
#if there is a match the log-in is authenticated
if( $num != 0 )
{ $msg = "Welcome $username - your log-in was sucessfull!"; }
else #or return to the log-in page
{ header( "location:$referer" ); exit(); }
<html> <head><title>Log-in Authenticated</title></head>
<body> <?php echo( $msg ); ?> </body> </html>


Thank you!!
  • 0


Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP