CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Limit login to time-of-day

Print topic Send  topic

Author Message
dawber

Posts: 25
Posted: 01/21/2005, 1:39 PM


I have table based login working for my users.
For some users I want to limit login to time-of-day.

So user_a can login any time.
But user_b can login only between 8am and 5pm.

How can I do this?
View profile  Send private message
Martin K.
Posted: 01/22/2005, 4:25 AM

Hello.
You can write your own login function in the common.php

Examle:

//CCLoginUserB
function CCLoginUserB($login, $password)
{
$db = new clsDBConnection1(); // Your Connection Name
$SQL = "SELECT user_ab, user_id, user_level FROM office_user WHERE user_login=" . $db->ToSQL($login, ccsText) . " AND user_password=" . $db->ToSQL($password, ccsText); // your SQL
$db->query($SQL);
$Result = $db->next_record();
if($Result && $db->f("user_ab") == "a")
{
CCSetSession("UserID", $db->f("user_id"));
CCSetSession("UserLogin", $login);
CCSetSession("GroupID", $db->f("user_level"));
return $Result;
$db->close();
}
elseif($Result && $db->f("user_ab") == "b")
{
$login_begin = strtotime(date("Y-m-d")." 08:00:00");
$login_end = strtotime(date("Y-m-d")." 17:00:00");
$login_time = strtotime(date("Y-m-d G:i:s"));
if(($login_time >= $login_begin) && ($login_time <= $login_end)) {
CCSetSession("UserID", $db->f("user_id"));
CCSetSession("UserLogin", $login);
CCSetSession("GroupID", $db->f("user_level"));
return $Result;
$db->close();
}
}
}
//End CCLoginUserB

If SQL Field user_ab == "a" User can login anytime
If SQL Field user_ab == "b" and Time is between 08.00.00-17.00.00
user_b can also login

Sorry about my english
greets martin
dawber

Posts: 25
Posted: 01/23/2005, 4:03 AM

Thanks Martin.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.