This topic is locked
[SOLVED]

 Time for access

3/27/2012 5:09:30 PM
PHPRunner General questions
S
sickacid author

Hi, I'm using the latest version of phprunner, is possible to set a time for site operativity?

For example, a user with specific credentials can access from 7.00 am until 13.00, another from 8 to 14.. etc..

C
cgphp 3/27/2012

You can restrict access times in the "Before login" event or in the "After successful login" event.

Sergey Kornilov admin 3/28/2012

date('G') will give you the current hour in 24 hours format.
Example of BeforeLogin event:

$hour = date('G');

if ($username=='admin' && ($hour<8 || $hour>19) )

{

echo "You work too much";

return false;

}
S
sickacid author 3/29/2012



date('G') will give you the current hour in 24 hours format.
Example of BeforeLogin event:

$hour = date('G');

if ($username=='admin' && ($hour<8 || $hour>19) )

{

echo "You work too much";

return false;

}



With this I'll block a group of users <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65303&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
global $conn;

$hour = date('G');

$strSQLExists = "select * from users where nome='".$username."'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

$gruppo = $data["id_group"];
if ($gruppo=='utenti' && ($hour<9 || $hour>18) )

{

$message = "You work too much ";

return false;

}
return true;