Users browsing this thread: 1 Guest(s)
JavaScript -> Auto-updating Image
#6
PHP?
I can give that a quick stab if you like, I think I remember the syntax well enough.
Code:
<?php
    $day = date(d);
    $month = date(j);
    $year = date(Y);
    $dayofweek = date(w);
    if ($day < 10){
       $day = '0' + $day;
    }
    if ($month < 10) {
        $month = '0' + $month;
    }
    $url = "http://thedilbertstore.com/images/periodic_content/dilbert/dt".$year.$month.$day.$dayofweek."hct.jpg";
    echo($url);
?>

[note: I might have got this wrong somewhere, it's totally untested and I haven't done this in over a year now]

This (should) be doing exactly what the other script did, although I had to go with best guesses on what format the date was in and the year is kind of confusing if you wanted to take into account leap years.

The two main considerations are that this is again literally just writing out the URL, you'd want to replace the simple echo tag there with the redirect, just use $url wherever you want it, and the other consideration is that php is server-side, so you need to upload it to a webserver that runs php (I think that code is technically PHP5?)
B A N D C A M P - T W I T T E R - T U M B L R - Y O U T U B E - G 1 5
Call me aggressive, call me obscene,
but you've always called me sir when you've invaded my dreams.
Thanked by: puggsoy


Messages In This Thread
JavaScript -> Auto-updating Image - by puggsoy - 11-06-2013, 03:51 PM
RE: JavaScript -> Auto-updating Image - by PatientZero - 11-07-2013, 09:29 AM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-08-2013, 10:58 AM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-08-2013, 04:28 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-08-2013, 02:38 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-08-2013, 08:48 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-09-2013, 07:18 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-09-2013, 10:32 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-09-2013, 10:56 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-09-2013, 11:16 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-10-2013, 01:38 AM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-10-2013, 10:58 AM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-10-2013, 03:04 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-10-2013, 06:37 PM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-11-2013, 02:03 AM
RE: JavaScript -> Auto-updating Image - by Phaze - 11-11-2013, 07:16 PM

Forum Jump: