Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4255604
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:14:29+00:00 2026-05-21T05:14:29+00:00

Okay, so I have a chat feature on my website that I’ve mentioned in

  • 0

Okay, so I have a chat feature on my website that I’ve mentioned in other questions. There are some kids at my school who would love to chat during school, but I’d really rather they’d just chat during study hall so I don’t get in trouble for interrupting class time. How can I restrict user movement on my website during specific time periods during the day? Thanks! I don’t know what type of scripting language I might need for this, but I’m assuming PHP since this is a server issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:14:30+00:00Added an answer on May 21, 2026 at 5:14 am
    <?php date("H"); ?>
    

    returns the current hour in a 24 hour format with leading zeroes.

    That means, you can write something like this:

    <?php
    
    if (date("H") == 14)){
       die("You cannot get here right now");
    }
    
    ?>
    

    This will “die” echoing the page, and will return the error instead, exactly during the 14th hour of the day (2:00 pm).

    Give us more code/details to get a deeper answer.

    EDIT: This is an expanded answer to the new question, asking,

    Study hall at my school is 2:30 to 3:15, so how would I do that?

    SOLUTION: Assuming study hall is the time when the students are allowed to use the (section of) the site, you would do something like this:

    <?php
    
    $bottomValue = 60*14+30;
    $upperValue = 60*15+15;
    $currentValue = date("G")*60+date("i");
    
    if (($currentValue >= $bottomValue) && ($currentValue <= $upperValue)){
       // everything is OK = put some code here, or ignore this
    }
    else{
       // well, this is the time they are not allowed to see this, so, let's try:
       die("Sorry, you are not allowed to be here right now.");  
    }
    
    ?>
    

    To explain how this works: your time base is counted into minutes as $bottomValue and $upperValue. Notice how they are defined, it’s 60 minutes multiplied by hour (14) plus minutes (30).

    So, 14:30 is 60*14+30, therefore, 16:20 would be 60*16+20.

    Then the base is compared to the current time and an appropriate code is executed according to the if/else statements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so I have a web view that holds the chat bar div from
Okay i have a custom server control that has some autocomplete settings, i have
Okay I have three tables that all communicate with each other. ForumTopic t ForumMessage
Is it okay to have a full silverlight website? I've seen some website implements
Okay I have seen some very similar questions here but none seem to be
Okay I'll try describe this the best way I can. I have a chat
Okay I have a large CRUD app that uses tabs with Forms embedded in
I have several posts on a website; all these posts are chat conversations of
Okay I have 2 files. One file is data that is updated every 10
Okay I have been working on a website but I keep on having an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.