I have asked this question before, but still can't find the solution, can anyone help me? 🙁
I want to use count ++ function when user login. I have already created a row named 'count' in my database.
<?php require_once('Connections/dbcn.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['login'])) {
$loginUsername=$_POST['login'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "level";
$MM_redirectLoginSuccess = "main.php";
$MM_redirectLoginFailed = "accessdenied.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_dbcn, $dbcn);
$LoginRS__query=sprintf("SELECT logid, password, level, count FROM data WHERE logid='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $dbcn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'level');
// After Found User, I run UPDATE function, but no response.
mysql_query("UPDATE data SET count++");
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>