rse error: syntax error, unexpected T_STRING

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wildwobby
Forum Commoner
Posts: 66
Joined: Sat Jul 01, 2006 8:35 pm

rse error: syntax error, unexpected T_STRING

Post 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();
	}
}
?>
User avatar
Jaxolotl
Forum Contributor
Posts: 137
Joined: Mon Nov 13, 2006 4:19 am
Location: Argentina and Italy

Post 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.";
wildwobby
Forum Commoner
Posts: 66
Joined: Sat Jul 01, 2006 8:35 pm

Post by wildwobby »

solved, thanks.

Im stupid.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

rofl, it's ok.

Do you use an editor with syntax highlighting?
wildwobby
Forum Commoner
Posts: 66
Joined: Sat Jul 01, 2006 8:35 pm

Post 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.
Post Reply