a simple script needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • allamerican2003
    Confirmed User
    • Mar 2003
    • 675

    #1

    a simple script needed

    can anyone point me to a script, or help me figure out what Im doing wrong.
    I need a "random gallery" script that will do the following.

    I enter in a url such as:
    http://www.domainname.com/galleries.php?=123456

    now the galleries.php file will access another file called galls.
    There will be 20 galleries in there.
    It will pick a random gallery and add the "123456" code above to a variable in the file.

    the galls file will be setup like
    http://www.domain1.com/linkcode=refer code
    http://www.domain2.com/linkcode=refer code
    http://www.domain3.com/linkcode=refer code
    etc

    so when I enter in
    http://www.domainname.com/galleries.php?=123456
    it will go to the galls file, and replace the "refer code"
    with the 123456 which is at the end of
    http://www.domainname.com/galleries.php?=123456

    so if I change 123456 to 444444 it will change the refer code on the output of the random gallery.

    Im using a php based script, but i'll use cgi if someone can show me the way.
  • 4Pics
    Confirmed User
    • Dec 2001
    • 7952

    #2
    cut n paste from elsewhere.. I'm looking into this as well to see if there is a better way.


    gallery.php contain the next script to select an random link from gallery.txt

    $fileName = "gallery.txt";
    mt_srand( (double) microtime() * 1000000 );
    $a = file($fileName);
    $randNum = mt_rand( 0, sizeof($a)-1 );
    header( "Location: ". $a[$randNum] );
    ?>

    gallery.txt contain for example next 3 links:
    site3.com/linkgallery1.html
    site3.com/linkgallery2.html
    site3.com/linkgallery3.html

    Comment

    Working...