Jump to content

[SOLVED] Unexpected T_VARIABLE


Akenatehm

Recommended Posts

Hey Guys,

 

This script is apart of a login script. It shows up this error:

 

Parse error: syntax error, unexpected T_VARIABLE in /home/kaurlcom/public_html/relayadmin/scripts/login.php on line 8

 

Here's the code:

 

<?php
// we must never forget to start the session
session_start();
$errorMessage = '';
if (isset($_POST['username']) && isset($_POST['password'])) {
   include 'connect.php'

   $username = $_POST['username'];
   $password = $_POST['password'];

   // check if the user id and password combination exist in database
   $sql = "SELECT username
           FROM users
           WHERE username = '$username' 
                 AND password = password('$password')";

   $result = mysql_query($sql) 
             or die('Query failed. ' . mysql_error()); 

   if (mysql_num_rows($result) == 1) {
      // the user id and password match, 
      // set the session
      $_SESSION['db_is_logged_in'] = true;

      // after login we move to the main page
      header('Location: home.php');
      exit;
   } else {
      $errorMessage = 'Sorry, wrong Username or Password';
   }

}
?>

 

Help would be greatly appreciated!

Link to comment
https://forums.phpfreaks.com/topic/134804-solved-unexpected-t_variable/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.