Hey, I'm getting the error:
Parse error: syntax error, unexpected T_VARIABLE in /Users/Oscar/AwesomeSongz/userCake/profile.php on line 7
with this code
Parse error: syntax error, unexpected T_VARIABLE in /Users/Oscar/AwesomeSongz/userCake/profile.php on line 7
with this code
Code:
<?php
require_once("models/config.php");
function signinTimeStamp()
{
$sql = "SELECT LastSignIn FROM ".$db_table_prefix."Users WHERE User_ID = '"$user"'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
return ($row['LastSignIn']);
}
function signupTimeStamp()
{
$sql = "SELECT SignUpDate FROM ".$db_table_prefix."Users WHERE User_ID = '"$user"'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
return ($row['SignUpDate']);
}
function groupID()
{
$sql = "SELECT ".$db_table_prefix."Users.Group_ID, ".$db_table_prefix."Groups.* FROM ".$db_table_prefix."Users INNER JOIN ".$db_table_prefix."Groups ON ".$db_table_prefix."Users.Group_ID = ".$db_table_prefix."Groups.Group_ID WHERE User_ID = '". $user ."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
return($row);
}
$user = $_GET["user"];
//Prevent the user visiting the logged in page if he/she is not logged in
if(!isUserLoggedIn()) { header("Location: login.php"); die; }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome <?php echo $loggedInUser->display_username; ?></title>
<link href="cakestyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="logo"></div>
<!--
This is an simple profile page. You can easily get access to
user properties via $loggedInUser variable which is globally accessible.
-->
<div id="regbox">
<?php if(usernameExists($_GET["user"])) {?>
<div style="text-align:center; padding-top:15px;">
Welcome to <strong><?php echo $user ?>'s</strong> profile.</p>
<p><?php echo $user ?> is a <strong><?php $group = $loggedInUser->groupID(); echo $group['Group_Name']; ?></strong></p>
<p><?php echo $user ?> joined on <?php echo date("l \\t\h\e jS Y",$loggedInUser->signupTimeStamp()); ?> </p>
<p><?php echo $user ?> last logged in on <?php echo date("l \\t\h\e jS Y",$loggedInUser->signinTimeStamp()); ?> </p>
</div>
<?php
} else {
echo "This is not a valid username, <strong> " .$loggedInUser->display_username. " </strong></p>";
}
?>
</div>
</div>
</body>
</html>
<?php include("models/clean_up.php"); ?>
Comment