Results 1 to 4 of 4

Thread: sleep() pauses scripts on all pages :(

  1. #1
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default sleep() pauses scripts on all pages :(

    Hi,

    i hope there is an alternative to this problem,

    i''m using a script that redirects depending on the content of a database, so it redirects on page 1 if data 1 exists or page 2 if data 1 doesn't exist.

    so i needed a php script to verify that, the page shows at the moment before redirecting for
    SLEEP(15);

    but i also use this website to admin a few things, and when i access my datas, al my php scripts seem to suffer from that SLEEP function!!

    I thought it woud only affect the current running script from the page that calls the sleep function.

    Is there an alternative? ( i can't call a loop to make a timer, it loads the cpu too high)

    javascript redirection won't offer me a database check..

    so does anybody have a idea?

    thanks a lot in advance.

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    What about performing a redirect using Javascript using PHP?

    Something like the following

    Code:
    if(somecondition == true)
    {
          echo "<script type='text/javascript'>window.location.replace(\"yourrequiredpage.extension\");</script";
    }

  3. #3
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    You could also change
    PHP Code:
    if(somecondition == true
    to
    PHP Code:
    if(somecondition
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  4. #4
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What about performing a redirect using Javascript using PHP?


    well that's what i'm using but i 'm using Sleep() to timer the page change according to this.

    i want to have page wait 15 seconds before redirecting.

    i can't use javascript redirect or i don't know how using php condition.

    Does one you two know?

    thanks already for your answers.

    nb: i don't get the if statment, isn't that what i already use?

    i could post my scripts if needed.

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
  •