/    Sign up×
Community /Pin to ProfileBookmark

Redirect From Date & Time HELP*

Hello,

I am new to PHP and I really need someone that knows their stuff to help out a newbie ?

I basically want to have a PHP code that accesses a database such as this:

on and after 10 JAN 06 @ 12:30am redirect to – page1.htm

on and after 17 JAN 06 @ 07:30pm redirect to – page2.htm

on and after 23 JAN 06 @ 12:00am redirect to – page3.htm

I also want to be able to change the dates and times for the next year and so on using Php “UPDATE”. So really I am looking for a Php code that will get the time and date from the server and then match it with the time and date in a Database and if the date and time of the server is after the date and time of the Database redirect to page1.htm and so on if the date is after the next date and time redirect to page2.htm.

Can anyone please help me as I cannot find a code anywhere that will do this,

Regards

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@legendxNov 25.2006 — [code=php]
$date1 = "10 JAN 06 @ 12:30am";
$date2 = "17 JAN 06 @ 07:30pm";
$date3 = "23 JAN 06 @ 12:00am";
if (time() >= strtotime($date1))
header("Location: page1.htm");
else if (time() >= strtotime($date2))
header("Location: page2.htm");
else if (time() >= strtotime($date3))
header("Location: page3.htm");
[/code]


All thats left is to write the update part of your request, but strtotime() really solves your problem for you.
Copy linkTweet thisAlerts:
@airforcefcauthorNov 27.2006 — Thanx for your help,

<?php

$date1 = "10 JAN 06 @ 12:30am";

$date2 = "17 JAN 06 @ 07:30pm";

$date3 = "23 JAN 06 @ 12:00am";

if (time() >= strtotime($date1))

header("Location: page1.htm");

else if (time() >= strtotime($date2))

header("Location: page2.htm");

else if (time() >= strtotime($date3))

header("Location: page3.htm");

?>

This works for the first page 1.htm but it does not redirect after the next set date and time? also, how can I get the site to use the server date and time or does it already?

Just a quick other question if possible,

I would like to have a refresh and redirect on each page that you are able to be directed to from the home page so that basically it would be something like this for Page 1.htm:

<

on 17 JAN 06 @ 07:30pm auto refresh page and redirect to "page 2.htm"
>

This way the user either way cannot access page 1.htm after the change of date and time, how many I go about achieving this?

Thanx Heeps
×

Success!

Help @airforcefc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...