I have 2 questions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

I have 2 questions

Post by seeker2921 »

1st question:

I wrote the simple date script below and It wokrs but my server is on the east coast and I need the timezone to be in PST format not EST.. heres the code:

Code: Select all

<?
//Img paths
$monday=("http://www.alien-web-networks.com/htm/images/date/monday.gif");
$tuesday=("http://www.alien-web-networks.com/htm/images/date/tuesday.gif");
$wendnesday=("http://www.alien-web-networks.com/htm/images/date/wednesday.gif");
$thursday=("http://www.alien-web-networks.com/htm/images/date/thursday.gif");
$friday=("http://www.alien-web-networks.com/htm/images/date/friday.gif");
$saturday=("http://www.alien-web-networks.com/htm/images/date/saturday.gif");
$sunday=("http://www.alien-web-networks.com/htm/images/date/sunday.gif");
$zone=("pst");
$img_date=date("w");
$time=date(" h:i a ");
$date=date("F j, Y");
 if($img_date=="0")
 {
 print("<img src="$sunday"> ".$date.$time.$zone);
 }
 if($img_date=="1")
 {
 print("<img src="$monday"> ".$date.$time.$zone);
 }
 if($img_date=="2")
 {
 print("<img src="$tuesday"> ".$date.$time.$zone);
 }
 if($img_date=="3")
 {
 print("<img src="$wednesday"> ".$date.$time.$zone);
 }
 if($img_date=="4")
 {
 print("<img src="$thursday"> ".$date.$time.$zone);
 }
 if($img_date=="5")
 {
 print("<img src="$friday"> ".$date.$time.$zone);
 }
 if($img_date=="6")
 {
 print("<img src="$saturday"> ".$date.$time.$zone);
 }
?>
2nd Question

On my site I want all the other pages to call to the index.php for the links so say I have the page:
..doc_root/htm/info/info.php

and one of the links on that page leads to my order page so when someone clicks the link it will go to the index.php page and then go to the link like that.. so the address would be

http://www.domain.com/index.php?id=order

instead of

http://www.domain.com/htm/order/order.php

I hope I explained what I want well enough.. I am still a beginner and i'm not sure how to do that.. thanx for your help on both of my questions
tylerdurden
Forum Commoner
Posts: 66
Joined: Mon Jul 28, 2003 11:52 am
Location: Austria

Post by tylerdurden »

Question 1:
Maybe there is a function to do this but the first solution that comes to mind is this:

Code: Select all

echo date("w",time() -21600);
where 21600 is: offset in hours * 360, so you have the number of seconds.

Question 2:

You could call an include like this:

Code: Select all

include ($_GET&#1111;'id'].".php");
or redirect via HTTP header:
header("Location: &#123;$_GET&#1111;'id']&#125;.php");
The syntax in the above examples may be wrong, but you get the idea.
Post Reply