Page 1 of 1

rse error: syntax error, unexpected T_STRING

Posted: Thu Dec 28, 2006 10:36 am
by wildwobby
I can't find the error!

Parse error: syntax error, unexpected T_STRING in /home/rwphoto/public_html/loginclass.php on line 59

Help!

Code: Select all

<?php
session_start();
ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);
Class Mysql {
	var $link;
	var $database;
 
	function Mysql($db,$dbuser,$dbpass) {
		$this->link = mysql_connect('localhost', $dbuser, $dbpass) or die(mysql_error());
		$this->database = mysql_select_db($db);
		if (!$this->database) {
			die('COULD NOT CONNECT: ' . mysql_error());
		}
	}
}
 
class Auth {
	var $quesr;
	var $qpass;
	var $query;
	var $rows;
	var $result;
	var $location;
 
	function login($user,$pass) {
		$this->quser = $user;
		$this->qpass = $pass;
		$this->query = sprintf("SELECT * FROM users WHERE username='%s' AND password='%s'", 
 
mysql_real_escape_string($this->quser), mysql_real_escape_string($this->qpass));
		$this->result = mysql_query($this->query);
		$this->rows = mysql_numrows($this->result);
		if (!$this->result) {
			die('QUERY FAILED: ' . mysql_error());
		}
		if ($this->rows != 1) {
			$_SESSION['errmsg'] = "No match found";
// Set location to login script because failed login.
			session_write_close();
			header('Location: http://rwphoto.thepeopleshost.com/login.php');
			exit;
		} else {
			$_SESSION['auth'] = 1;
			$_SESSION['authx'] = (time() + 900);
// Set Fowarded location if login passes
			session_write_close();
			header('Location: http://rwphoto.thepeopleshost.com/members.php');
			exit;
		}
	}
 
	function checkLogin() {
		if ($_SESSION['auth'] != 1) {
			$_SESSION['errmsg'] = 'Authentication required to view the requested page';
			session_write_close();
			header('Location: http://www.rwphoto.thepeopleshost.com/login.php');
			exit;
		}  // line 59
		if (1 == 2) {
			$_SESSION['errmsg'] = 'You're login has timed-out, please login again.';
			session_write_close();
			header('Location: http://www.rwphoto.thepeopleshost.com/login.php');
			exit;
		}
		$_SESSION['authx'] = (time() + 900);
	}
 
	function logout() {
		session_destroy();
	}
}
?>

Posted: Thu Dec 28, 2006 10:51 am
by Jaxolotl
I find only this @ line 61

Code: Select all

$_SESSION['errmsg'] = 'You're login has timed-out, please login again.';
you should escape the "you're" single quote

option 1

Code: Select all

$_SESSION['errmsg'] = 'You\'re login has timed-out, please login again.';
option 2

Code: Select all

$_SESSION['errmsg'] = "You're login has timed-out, please login again.";

Posted: Thu Dec 28, 2006 11:27 am
by wildwobby
solved, thanks.

Im stupid.

Posted: Thu Dec 28, 2006 12:48 pm
by daedalus__
rofl, it's ok.

Do you use an editor with syntax highlighting?

Posted: Thu Dec 28, 2006 12:53 pm
by wildwobby
Usually.

But im on the road now (passenger) using the verizon card for internet acess from the car and I am just using notepad because I don't really want to download anything on the laptop.