how to block the entry of a user to log in on a particular day

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • savyatha
    New Member
    • Mar 2007
    • 9

    how to block the entry of a user to log in on a particular day

    we r doing the project INVENTORY MGMT SYSTEM. it is just like a super bazar producung bills in computer using PHP with database POSTGRESQL.
    ny question is............. ........
    the shop is holiday on every sunday. so, on every sunday, if some one in the store try to login, they should not be allowed to enter. how to acheive this ? is there any concept to complete this task?
    plzzzzzzz help me in this regard. urgent!!!!!!!!! !!!!!!
    thanks in advance
  • michaelb
    Recognized Expert Contributor
    • Nov 2006
    • 534

    #2
    You can have something like this PHP code in the file that handles logins:
    Code:
    if (date('l') ===  'Sunday')
       // deny login; redirect to other page
       // or display some message and quit 
    else 
       // proceed with normal login;
       // verify login/password etc
    In real life you probably won't want to hardcode Sunday here, the following approach seems cleaner to me:

    Code:
    if ( SiteIsUp() )
       // proceed with normal login;
       // verify login/password etc
    else 
       // deny login; redirect to other page
       // or display some message and quit
    SiteIsUp (not the best name, perhaps) is a function where you identify all required criteria.
    In addition to day of the week this function may have to check on other factors -
    when you do a site maintenance, software upgrade, etc you may just set some variable and this function will deny access to the site.

    Comment

    Working...