Forum Moderators: coopster
Parse error: syntax error, unexpected T_STRING in /Applications/MAMP/htdocs/main/loginfunc.php on line 39
Line 39 is where I am trying to update the lastlogin field in the db.
What am I doing wrong?
Here is my php code:
<?php
session_start();
//include our db data to make the connection
include ('db.php');
//get form data
$username = $_POST["form_username"];
$password = md5($_POST["form_password"]);
//pull all the data from users table
$content = mysql_query("SELECT * FROM users WHERE username = '$username'");
while($row = mysql_fetch_array($content)) {
$db_id = $row['id'];
$db_password = $row['password'];
$db_username = $row['username'];
$db_function = $row['ismod'];
}
/*
echo 'form username: '.$_POST["form_username"].'<br />';
echo 'form password: '.$password.'<br />';
echo 'db username: '.$db_username.'<br />';
echo 'db password: '.$db_password;
*/
if ($password !== $db_password) {
header("Location: index.php?page=login&error=fail");
} else {
$_SESSION['logged_in'] = 1;
$_SESSION['username'] = $db_username;
$_SESSION['function'] = $db_function;
header("Location: index.php?page=home");
//update the lastlogin field in the db
$date = date("F j, Y, g:i a");
mysql_query("UPDATE users SET lastlogin='$date' WHERE id=$db_id") or die mysql_error());
}
?>