heyya..
i need a help from u guys..
i'm doin a 'staff leave' application here..
getting stuck when i wanted to change the status of the temporary staff who has been assigned to replace an on-leave staff. I'm using 2 tables here which as below;
login - loginID, UserID, UserName, Password, TmpId, TmpPwd, StatusTemp,CatLevel
staff_leave - loginID, FromDate, ToDate, Total, AssignedID
I already set the StatusTemp = 1 if the temporary staff is on duty and StatusTemp = 0, if the temporary password is expired. If A is assigned to replace his officemate starting 27/7/08 till 28/7/06, he has to use an assigned temporary username and password. i need to make sure that, when the A has finished his duty; so, on 29/7/06 he can no longer use the temporary password and need to use his original password. Means, i have to change the statusTemp to 0.
i have done some coding here, but it seems like work well...
i need some help here...
i paste my coding here...
check_login.php
<?php
include '../connection.php';
include 'info.inc.php';
$username = $_POST["username"];
$password = $_POST["password"];
$stmt = "SELECT * FROM login WHERE UserName ='$username' AND Password = '$password'";
$res = mysql_query($stmt);
$query = mysql_num_rows($res);
if($query == 1)
{
$stmt = "SELECT ToDate FROM login lo, staff_leaves sl WHERE lo.loginID = sl.loginID";
$res = mysql_query($stmt)or die(mysql_error());
$query= mysql_num_rows($res);
strtotime("YYYY-MM-DD");
$today = strtotime("Y-M-D");
$ToDate = mktime(0,0,0, date("M"), date("D"), date("Y"));
if($today >= $ToDate)
{
clearStatus($db);
echo "You are no longer a club member!";
}else{
echo "Welcome to the club!";
}
}else{
echo "You Are Intruder..!!!";
}
?>
here is my info.inc.php file
<?php
//temporary login
function clearStatus($db)
{
strtotime("YYYY-MM-DD");
$today = strtotime("y-m-d");
$ToDate = mktime(0,0,0, date("m"), date("d"), date("y"));
$status = 0;
$query_clear = "UPDATE login SET StatusTemp = '$status' WHERE $ToDate >= $today";
$res = mysql_query($query_clear);
}
?>
the only output i get is just...
Welcome to the club..
seems like it doesn't execute the function i've created in info.inc.php
help me please...
thankss....