Ask a question about restricting the time period to access the page code

Source: Internet
Author: User
Tags time and date
My site is now limited access time is 24-hour system, that is, from the start time from 00:01 to 24:00 to end, now I want from the start of 10:00 to 02:00 end is not used, how can I use code to restrict time access?


Reply to discussion (solution)

Gets the current time, not the allowable time period to give a hint ...

24-hour, start time 10:00 to 02:00 end
Isn't that a cross-day?
So you have to set it in 2 paragraphs.
00:00 to 02:00
10:00 to 24:00

24-hour, start time 10:00 to 02:00 end
Isn't that a cross-day?
So you have to set it in 2 paragraphs.
00:00 to 02:00
10:00 to 24:00
Can you send out the code?

You used to have a similar
Date (' H:i ') >= $ start time and date (' h:i ') < end time
Such a discrimination
Adding a distinction is
Date (' H:i ') >= $ start time 1 and date (' h:i ') < end time 1
Or
Date (' H:i ') >= $ start Time 2 and date (' h:i ') < end time 2

You used to have a similar
Date (' H:i ') >= $ start time and date (' h:i ') < end time
Such a discrimination
Adding a distinction is
Date (' H:i ') >= $ start time 1 and date (' h:i ') < end time 1
Or
Date (' H:i ') >= $ start Time 2 and date (' h:i ') < end time 2
Does this not conflict?

You used to have a similar
Date (' H:i ') >= $ start time and date (' h:i ') < end time
Such a discrimination
Adding a distinction is
Date (' H:i ') >= $ start time 1 and date (' h:i ') < end time 1
Or
Date (' H:i ') >= $ start Time 2 and date (' h:i ') < end time 2
Moderator, trouble to give a complete code.


What's the rush?



You used to have a similar
Date (' H:i ') >= $ start time and date (' h:i ') < end time
Such a discrimination
Adding a distinction is
Date (' H:i ') >= $ start time 1 and date (' h:i ') < end time 1
Or
Date (' H:i ') >= $ start Time 2 and date (' h:i ') < end time 2
Does this not conflict?


What's the rush?




You used to have a similar
Date (' H:i ') >= $ start time and date (' h:i ') < end time
Such a discrimination
Adding a distinction is
Date (' H:i ') >= $ start time 1 and date (' h:i ') < end time 1
Or
Date (' H:i ') >= $ start Time 2 and date (' h:i ') < end time 2
Does this not conflict?
Moderator, could you please send me all the code?

You can't write?
Then put your old part out.
Or I'll write it for you, and you won't get in.

You can't write?
Then put your old part out.
Or I'll write it for you, and you won't get in.

Prompt time check $fromtime=strtotime (date (' y-m-d ', $this->time). $this->settings[' cashfromtime ']. ': 0 0 '); $toTime =strtotime (Date (' y-m-d ', $this->time). $this->settings[' cashtotime ']. ': 0 0 '); if ($this->time < $fromTime | | $this->time > $toTime) throw new Exception ("Sorry, the time has been raised, please submit it at the right time!")
Withdrawal time: ". $this->settings[' Cashfromtime ']." ~ ". $this->settings[' cashtotime '); $this->begintransaction (); try{$this->freshsession (); if ($this->user[' Coinpassword ']!=md5 ($para [' coinpwd ']) throw new Exception (' Incorrect money password '); unset ($para [' coinpwd ']); if ($this->user[' coin ']< $para [' Amount ']) throw new Exception (' Your account is underfunded ');


This is the code

When you visit the time you use PHP to determine the current times, if it is allowed within the time to continue to run, or go home!

When you visit the time you use PHP to determine the current times, if it is allowed within the time to continue to run, or go home!

Prompt time check $fromtime=strtotime (date (' y-m-d ', $this->time). $this->settings[' cashfromtime ']. ': 0 0 '); $toTime =strtotime (Date (' y-m-d ', $this->time). $this->settings[' cashtotime ']. ': 0 0 '); if ($this->time < $fromTime | | $this->time > $toTime) throw new Exception ("Sorry, the time has been raised, please submit it at the right time!")
Withdrawal time: ". $this->settings[' Cashfromtime ']." ~ ". $this->settings[' cashtotime '); $this->begintransaction (); try{$this->freshsession (); if ($this->user[' Coinpassword ']!=md5 ($para [' coinpwd ']) throw new Exception (' Incorrect money password '); unset ($para [' coinpwd ']); if ($this->user[' coin ']< $para [' Amount ']) throw new Exception (' Your account is underfunded ');

is currently 24-hour system, I need is a cross-day time, such as 08 to 02 points, above is my PHP code, how to change?

Strtotime (Date ("y-m-d")),//00:00strtotime (Date ("y-m-d 02:00"),//02:00strtotime (Date ("y-m-d 22:00"));// 22:00strtotime (Date ("y-m-d 24:00"));//24:00
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.