SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello.

    I'm new at this thing call MySQL.

    I'm trying to have different index.htm pages. Something like the Ad Rotator to banners. But I don't want to change only the content from the page I want a new one.

    So I have four index pages with different design and I want a random. You visited once and at the next time you won't see the same.

    First I think of cookies. Now I'm thinking of table with the four URLS. Each one with an ID. And then use a Random method.

    Any comments?

    Thank you.

    Magi::::::::::

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Helsingborg, Sweden
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure what you mean by cookies. How would you use cookied for this?

    Using a table with urls sounds better to me. Go for that.
    "Some people play hard to get - I play hard to want."

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cookies... well I was thinking that using them I could know if the user visited the site and if it's true I'll redirect to another page.
    But I'll tried with the random method.

    Thank you.

  4. #4
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?
    srand ((double) microtime() * 1000000);

    $i = rand(1,4);

    $file = "index".$i.".php";

    include($file);

    ?>

    that should do the trick... if THAT is your index.php file and you have 4 main indexes, named index1.php index2.php index3.php index4.php

    added more:

    ok, the above code is for COMPLETELY random choosing of pages... you dont want them to see the same page again ? .. you could use cookies, to set the "pages they've seen" , then create a file list (array) , and then run random on the size of the file list, or something of that sort.. more complicated though
    <Edited by Vinay on 02-03-2001 at 03:14 PM>
    cogito, ergo sum


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
  •