SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    the boss is here gery's Avatar
    Join Date
    Aug 2005
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need a script, urgently!

    Hello!

    For example I have 5 links:

    Link1
    Link2
    Link3
    Link4
    Link5

    I need a script that rotates the links! When the visitor visits the site the "Link1" is in the first line, but when he clicks on Refresh (in IE) the "Link5" will be inthe first line!

    Is this possible?

    I need it urgently. Thanks

  2. #2
    _ silver trophy ses5909's Avatar
    Join Date
    Jul 2003
    Location
    NoVa
    Posts
    5,466
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by gery
    Hello!

    For example I have 5 links:

    Link1
    Link2
    Link3
    Link4
    Link5

    I need a script that rotates the links! When the visitor visits the site the "Link1" is in the first line, but when he clicks on Refresh (in IE) the "Link5" will be inthe first line!

    Is this possible? I need it urgently. Thanks
    are your liinks stored in a database or flatfile? What language are you using?
    Sara

  3. #3
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    I know PHP you can simply through those five links into an array and then have that array randomized.

  4. #4
    the boss is here gery's Avatar
    Join Date
    Aug 2005
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes It's in PHP, but I'm not really good in it!

  5. #5
    _ silver trophy ses5909's Avatar
    Join Date
    Jul 2003
    Location
    NoVa
    Posts
    5,466
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    PHP Code:

    $links 
    = array('link1''link2''link3''link4');
    shuffle($links);
    foreach (
    $links as $link
    {
       echo 
    "$link ";

    Sara

  6. #6
    the boss is here gery's Avatar
    Join Date
    Aug 2005
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow. Big big thanks! Respect man!

  7. #7
    the boss is here gery's Avatar
    Join Date
    Aug 2005
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, an another question:

    Can be the links in a .txt file?

  8. #8
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Sure, you just need to read the file into an array and then use the code above.


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
  •