Hi!,

I want a simple code for a login system in php where users should be able to login in between 9.00 Am & 5.00 PM. Otherwise it should not allow users to login.

Can anyone please help

thank you

Santosh

Is this time relative to each user or it is the server time?

Is this time relative to each user or it is the server time?

its the server time sir

Santosh

Then you just need to make use of the PHP time functions.
Check out about the date function

$hours=date('G',time()); //Gives you the hours
$minutes=date('i',time()); //Gives you the minutes
$sec=date('s',time()); //Gives you the seconds
/** Now you can test if for example the hours is between 9 and 17 hrs.

Of course there is a lot to the date function. Find out more on it's documentation at php.net

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.