Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-02-2007, 09:17 PM   PM User | #1
Peuplarchie
Regular Coder

 
Join Date: Feb 2006
Posts: 262
Thanks: 23
Thanked 1 Time in 1 Post
Peuplarchie is an unknown quantity at this point
Post Redirect depending on year and month ??

Good day to all,
I need someone to help me find a way to do a check date on server and depending of year go to the page of this month of this year.

I know it problably not the way it just that Iwanted to give an example :


PHP Code:
$200701 header("Location: http://www.example.com/2007/01.html");
$
200702 header("Location: http://www.example.com/2007/02.html");
$
200703 header("Location: http://www.example.com/2007/03.html");
$
200704 header("Location: http://www.example.com/2007/04.html");
$
200705 header("Location: http://www.example.com/2007/05.html");
$
200706 header("Location: http://www.example.com/2007/06.html");
$
200707 header("Location: http://www.example.com/2007/07.html");
$
200708 header("Location: http://www.example.com/2007/08.html");
$
200709 header("Location: http://www.example.com/2007/09.html");
$
200710 header("Location: http://www.example.com/2007/10.html");
$
200711 header("Location: http://www.example.com/2007/11.html");
$
200712 header("Location: http://www.example.com/2007/12.html");

$
200801 header("Location: http://www.example.com/2008/01.html");
$
200802 header("Location: http://www.example.com/2008/02.html");
$
200803 header("Location: http://www.example.com/2008/03.html");
$
200804 header("Location: http://www.example.com/2008/04.html");
$
200805 header("Location: http://www.example.com/2008/05.html");
$
200806 header("Location: http://www.example.com/2008/06.html");
$
200807 header("Location: http://www.example.com/2008/07.html");
$
200808 header("Location: http://www.example.com/2008/08.html");
$
200809 header("Location: http://www.example.com/2008/09.html");
$
200810 header("Location: http://www.example.com/2008/10.html");
$
200811 header("Location: http://www.example.com/2008/11.html");
$
200812 header("Location: http://www.example.com/2008/12.html");

$year date("Y");
 if ( 
$year == "2008" ) {

$month date("m");
else if (
$month == "01" ) {
$result = $200801;
}

else if (
$month == "02" ) {
$result = $200802;
}

else if (
$month == "03" ) {
$result = $200803;
}

else if (
$month == "04" ) {
$result = $200804;
}

else if (
$month == "05" ) {
$result = $200805;
}

else if (
$month == "06" ) {
$result = $200806;
}

else if (
$month == "07" ) {
$result = $200807;
}

else if (
$month == "08" ) {
$result = $200808;
}

else if (
$month == "09" ) {
$result = $200809;
}

else if (
$month == "10" ) {
$result = $200810;
}

else if (
$month == "11" ) {
$result = $200811;
}

else if (
$month == "12" ) {
$result = $200812;
}






Peuplarchie is offline   Reply With Quote
Old 07-02-2007, 09:31 PM   PM User | #2
devinemke
Regular Coder

 
devinemke's Avatar
 
Join Date: Dec 2004
Location: NYC
Posts: 443
Thanks: 0
Thanked 12 Times in 11 Posts
devinemke is an unknown quantity at this point
PHP Code:
header('location: http://www.example.com/' date('Y') . '/' date('m') . '.html'); 
devinemke is offline   Reply With Quote
Old 07-03-2007, 12:56 AM   PM User | #3
Peuplarchie
Regular Coder

 
Join Date: Feb 2006
Posts: 262
Thanks: 23
Thanked 1 Time in 1 Post
Peuplarchie is an unknown quantity at this point
PHP Code:
header('Location: http://www.example.com/'.date('Y').'/'.date('m').'.html');
exit; 
is the answer
Peuplarchie is offline   Reply With Quote
Old 07-03-2007, 12:58 AM   PM User | #4
Peuplarchie
Regular Coder

 
Join Date: Feb 2006
Posts: 262
Thanks: 23
Thanked 1 Time in 1 Post
Peuplarchie is an unknown quantity at this point
ho Thanks aslo :

devinemke and temps.user123
Peuplarchie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:04 PM.


Advertisement
Log in to turn off these ads.