Results 1 to 3 of 3

Thread: Who can help me with a script ???

  1. #1
    Join Date
    Apr 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Who can help me with a script ???

    I have a webpage... in the index is a submission button that leaves to the "true index" page. I want a script that after a visitor press the submission button, always when he will enter on my site, he will be redirected on the "true index" page. i think it's with cookies this script that i need.
    Someone can help me ? i wait an anser. Thank's

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    You could accomplish this using javascript and cookies, but it will only work if the user has a Javascript enabled browser (or if they did not turn it off). Not sure of the exact code in Javascript, but pretty sure someone will.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Or with PHP. That's more reliable, in that PHP, if you have it available, will work no matter what the user has enabled (as long as cookies are enabled, but there is no other way, other than using a server side database storing each person as a user or IP).

    Use this form:
    Code:
    <form action="next.php" method="post">
    <input type="submit" name="submit" value="agree">
    </form>
    Put this code on the top of the page that points to (form action="this.php")
    PHP Code:
    <?php
    if ($_POST['submit']=='agree') {
      
    setcookie('agree',1);
      }
    ?>
    And for the index page, use this code (at the top) to check if they have agreed:
    PHP Code:
    <?php
    if ($_COOKIE['agree']==1) {
      
    header('Location: http://my.com/full/path/realindex.htm');
      }
    You may also want an else statement in one or the other, to redirect if that fails, but I'm not sure how you want to handle that.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •