WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-08-2003, 11:19 PM
WebProWorld Member
 

Join Date: Nov 2003
Location: MD, USA
Posts: 37
willstein RepRank 0
Default EASY PHP HELP NEEDED

Hey you PHP programmer you,

I need to include a PHP script on the bottom of my page that:

if time is 10:00 PM - 8:00 AM, then display banner.htm

if not, then display nothing.


any help?
feel free to ask any questions.
Reply With Quote
  #2 (permalink)  
Old 11-09-2003, 06:38 AM
WebProWorld Pro
 

Join Date: Aug 2003
Location: United Kingdom
Posts: 128
OSFan RepRank 0
Default

Your Webpage

Code:
<?PHP include('time.php') ?>
time.php:

Code:
<?PHP

//Current hour of day, this is in the server time
$CurHour = date('H');

//If it's greater than or equal to 22 i.e. 10 or 11PM
//Or if it's less than or equal 08 i.e. 00,01,...,08AM
//Include the banner.htm otherwise do nothing
if ($CurHour>=22 || $CurHour<8) {
 include('banner.htm');
}

?>
First time the banner is shown is at 22:00 the last is at 07:59.
Reply With Quote
  #3 (permalink)  
Old 11-09-2003, 01:57 PM
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Bristol, UK
Posts: 965
carbonize RepRank 0
Default

Couldn't he just put the following straight into the page?

Code:
<?PHP 

//Current hour of day, this is in the server time 
$CurHour = date('H'); 

//If it's greater than or equal to 22 i.e. 10 or 11PM 
//Or if it's less than or equal 08 i.e. 00,01,...,08AM 
//Include the banner.htm otherwise do nothing 
if ($CurHour>=22 || $CurHour<8) { 
 print 'HTML CODE FOR THE BANNER GOES HERE'; 
} 

?>
remembering of course that he has to change the extension of the page this code is used on to .php so that the server knows to send it to the PHP processor first.
__________________
Carbonize
Reply With Quote
  #4 (permalink)  
Old 11-10-2003, 06:25 AM
WebProWorld Pro
 

Join Date: Aug 2003
Location: United Kingdom
Posts: 128
OSFan RepRank 0
Default

Yes.

All depends on how many pages it's being used in. If it's just the one, do it carbonize's way, if it's in many, just include the file into the files.

Yes, don't forget all the pages must be .php that use it ;-).
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0