Page 1 of 1

Basic User Authentication

Posted: Thu May 07, 2009 4:49 am
by danielwalters6
Hi, I'm trying to implement some basic user authentication:
i'm learning how to implement the BASIC USER AUTHENTICATION.
 
Unfortunately I'm receiving an error:
 
Parse error: syntax error, unexpected T_STRING in /home/fhlinux197/g/gadgetsolutions.co.uk/user/htdocs/main.php on line 6
 
Is anyone else experiencing this issue?

Code: Select all

 
<?php
// like i said, we must never forget to start the session
session_start();
 
// is the one accessing this page logged in or not?
if (!isset($_SESSION['basic_is_logged_in']) 
    || $_SESSION['basic_is_logged_in'] !== true) {
 
    // not logged in, move to login page
    header('Location: login.php');
    exit;
}
 
?>
<html>
<head>
<title>Main User Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
<p>This is the main application page. You are free to play around here since you 
are an autenthicated user :-) </p>
<p>&nbsp;</p>
<p><a href="logout.php">Logout</a> </p>
</body>
</html>
I'm taking the code from the website,
http://www.php-mysql-tutorial.com/wikis ... ation.aspx

I have had previous problems with Unexpected T_String error - With another seemingly OK script. I have tried these on two different webhosts, so I wonder if it's the way in which I'm uploading the files?

Re: Basic User Authentication

Posted: Sat May 09, 2009 1:21 am
by jaoudestudios
The error points to line 6, check no headers are sent before the session start (even white space).