For more information, see the restricted time period webpage access code.

Source: Internet
Author: User
For more information, see <g id = "1"> </g>, now I want to use it from to. how can I use code to limit access time?


Reply to discussion (solution)

Obtain the current time. a prompt is displayed for a time period that is not allowed...

In 24-hour format, the start time is.
Isn't that cross-day?
So you have to set it in two sections.
To
To

In 24-hour format, the start time is.
Isn't that cross-day?
So you have to set it in two sections.
To
To
Can you send the code?

You have only
Date ('H: I ') >=$ start time and date ('H: I') <end time
Such a criterion
Add a criterion
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 have only
Date ('H: I ') >=$ start time and date ('H: I') <end time
Such a criterion
Add a criterion
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
Is there a conflict?

You have only
Date ('H: I ') >=$ start time and date ('H: I') <end time
Such a criterion
Add a criterion
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, please give the complete code.


Why?



You have only
Date ('H: I ') >=$ start time and date ('H: I') <end time
Such a criterion
Add a criterion
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
Is there a conflict?


Why?




You have only
Date ('H: I ') >=$ start time and date ('H: I') <end time
Such a criterion
Add a criterion
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
Is there a conflict?
Moderator. could you please send all the code?

Can't you write?
Then paste your original part.
Or I wrote it to you, and you cannot get it.

Can't you write?
Then paste your original part.
Or I wrote it to you, and you cannot get it.

// Prompt for time check $ fromTime = strtotime (date ('Y-m-D', $ this-> time ). $ this-> settings ['cashfromtime']. ': 00'); $ toTime = strtotime (date ('Y-m-D', $ this-> time ). $ this-> settings ['cashtotime']. ': 00'); if ($ this-> time <$ fromTime | $ this-> time> $ toTime) throw new Exception ("Sorry, the withdrawal time has elapsed, please submit 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 capital password '); unset ($ para ['coinpwd']); if ($ this-> user ['coin '] <$ para ['amount']) throw new Exception ('Your account is underfunded ');


This is the code

During the access, you can use php to retrieve the current time and determine whether to continue running if it is within the allowed time; otherwise, you will be redirected to the government!

During the access, you can use php to retrieve the current time and determine whether to continue running if it is within the allowed time; otherwise, you will be redirected to the government!

// Prompt for time check $ fromTime = strtotime (date ('Y-m-D', $ this-> time ). $ this-> settings ['cashfromtime']. ': 00'); $ toTime = strtotime (date ('Y-m-D', $ this-> time ). $ this-> settings ['cashtotime']. ': 00'); if ($ this-> time <$ fromTime | $ this-> time> $ toTime) throw new Exception ("Sorry, the withdrawal time has elapsed, please submit 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 capital password '); unset ($ para ['coinpwd']); if ($ this-> user ['coin '] <$ para ['amount']) throw new Exception ('Your account is underfunded ');

Currently, it is in the 24-hour format. what I need is a cross-day time. for example, from to, the above is my PHP code. how can I change it?

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

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.