Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Getting parse error by using PHP 5 help book?


  • Please log in to reply

#1
andy_b_1502

andy_b_1502

    Member

  • 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>

PLEASE HELP ME ON THIS GUYS!!!

Thank you!!
  • 0

Advertisements







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