SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: page timing

  1. #1
    SitePoint Member
    Join Date
    May 2006
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    page timing

    It intended to use php to diplay an image on a web site for three days after it has been uploaded to a webserver.

    The was what I did I set an initial date in the format date('dmYHis');

    PHP Code:
    $initialdate "02102006141401";
    $threedays "03000000000000"//for day three
    $present_time date('dmYHis');
    if(
    $present_time >= ($initialdate $threedays)) {
    $welcomeImg "";
    }
    else {
    $welcomeImg "/images/welcome.gif";  //image displayed within three days

    This worked only if it falls within the month the file was uploaded but if it happens to be in the next month or the other year it never works as planned.
    So I will like someone to help me out on this script of a diffrent method of doing it.

  2. #2
    SitePoint Zealot Fiska's Avatar
    Join Date
    Jul 2004
    Location
    Dardania - Ancient Illyria
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You would have to use cron jobs on nix or win. services on IIS in order to do that
    let's make things easier

  3. #3
    SitePoint Member
    Join Date
    May 2006
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How will I have to do that in win and nix
    also, cant the job be done with php?

  4. #4
    SitePoint Zealot Fiska's Avatar
    Join Date
    Jul 2004
    Location
    Dardania - Ancient Illyria
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you have to schedule a task as far as I can understand your problem and that is not possible via php, you can't schedule with php, basically you to make your server do that for you.
    let's make things easier

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should use time() and mktime() instead of date when doing the comparison you want.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •