random url rotator? (php)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • XXXPaysiteDesign
    Confirmed User
    • Mar 2002
    • 2201

    #1

    random url rotator? (php)

    Can anybody tell me how I would write a php file so that it will look for a txt file, grab a url from the file and load it when a link is clicked?


    Thanks
    SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.
  • Hot Tropical Babes
    Confirmed User
    • Feb 2001
    • 3014

    #2
    I have one, but its not php
    <BR>
    Trade with Big Tits TGP
    Trade with Titman

    Comment

    • XXXPaysiteDesign
      Confirmed User
      • Mar 2002
      • 2201

      #3
      Originally posted by Hot Tropical Babes
      I have one, but its not php
      is it CGI?
      SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

      Comment

      • woj
        <&(©¿©)&>
        • Jul 2002
        • 47882

        #4
        ICQ me [ 33375924 ], I'll steer you in the right direction... or if you want I can write the whole thing for you...
        Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
        Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
        Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

        Comment

        • Hot Tropical Babes
          Confirmed User
          • Feb 2001
          • 3014

          #5
          Originally posted by XXXPaysiteDesign


          is it CGI?
          yes and real easy to use
          <BR>
          Trade with Big Tits TGP
          Trade with Titman

          Comment

          • XXXPaysiteDesign
            Confirmed User
            • Mar 2002
            • 2201

            #6
            Originally posted by Hot Tropical Babes

            yes and real easy to use
            102707188

            jeff @ wow18.com
            SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

            Comment

            • XXXPaysiteDesign
              Confirmed User
              • Mar 2002
              • 2201

              #7
              thanks tropical!
              SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

              Comment

              • Hot Tropical Babes
                Confirmed User
                • Feb 2001
                • 3014

                #8
                Jeff if ya need help yell!!
                here is the url of the one I use
                http://www.scriptarchive.com/rand_link.html
                <BR>
                Trade with Big Tits TGP
                Trade with Titman

                Comment

                • Hot Tropical Babes
                  Confirmed User
                  • Feb 2001
                  • 3014

                  #9
                  I dont like using php because the mysql data base seems to fail, and I dont have access to that. So i use cgi when i can.
                  <BR>
                  Trade with Big Tits TGP
                  Trade with Titman

                  Comment

                  • XXXPaysiteDesign
                    Confirmed User
                    • Mar 2002
                    • 2201

                    #10
                    thanks tropical!
                    SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

                    Comment

                    • Hot Tropical Babes
                      Confirmed User
                      • Feb 2001
                      • 3014

                      #11
                      Originally posted by XXXPaysiteDesign
                      thanks tropical!
                      Your welcome
                      <BR>
                      Trade with Big Tits TGP
                      Trade with Titman

                      Comment

                      • Rory
                        Confirmed User
                        • Jul 2002
                        • 616

                        #12
                        Originally posted by Hot Tropical Babes
                        I dont like using php because the mysql data base seems to fail, and I dont have access to that. So i use cgi when i can.
                        LOAD"IAMUSINGAC64",8,1
                        SEARCHING FOR IAMUSINGAC64
                        LOADING
                        READY.
                        RUN


                        Bet you could even make the screen colors change

                        Promote a site that actually retains members!

                        Comment

                        • Hot Tropical Babes
                          Confirmed User
                          • Feb 2001
                          • 3014

                          #13
                          Originally posted by Rory


                          LOAD"IAMUSINGAC64",8,1
                          SEARCHING FOR IAMUSINGAC64
                          LOADING
                          READY.
                          RUN


                          Bet you could even make the screen colors change
                          Ok now i am lost completely
                          <BR>
                          Trade with Big Tits TGP
                          Trade with Titman

                          Comment

                          • XXXPaysiteDesign
                            Confirmed User
                            • Mar 2002
                            • 2201

                            #14
                            Originally posted by Hot Tropical Babes

                            Ok now i am lost completely

                            you too?
                            SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

                            Comment

                            • Hot Tropical Babes
                              Confirmed User
                              • Feb 2001
                              • 3014

                              #15
                              LMAO!!! YEAH I IS LOST!
                              <BR>
                              Trade with Big Tits TGP
                              Trade with Titman

                              Comment

                              • Rory
                                Confirmed User
                                • Jul 2002
                                • 616

                                #16
                                Originally posted by Hot Tropical Babes

                                Ok now i am lost completely
                                I thought your technically savy comment :
                                I dont like using php because the mysql data base seems to fail, and I dont have access to that. So i use cgi when i can.
                                was funny.

                                Promote a site that actually retains members!

                                Comment

                                • Gman.357
                                  Confirmed User
                                  • Oct 2002
                                  • 2796

                                  #17
                                  Originally posted by Hot Tropical Babes

                                  Ok now i am lost completely
                                  What he's trying to say is that it's funny if you think PHP requires MYSQL to run small scripts like a link rotator.

                                  Ouch.

                                  Comment

                                  • WhoreHEY
                                    Confirmed User
                                    • Nov 2002
                                    • 120

                                    #18
                                    Peice of cake in php or perl.

                                    ICQ 150243034
                                    I can program better than you

                                    Comment

                                    • Showman
                                      Confirmed User
                                      • Apr 2002
                                      • 269

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

                                      Copy the above into a file called random.php. Your text file (yourfile.txt) should be in the same directory as random.php.
                                      At Sedo.com you can sell your unused domain names and earn money through their paid domain parking program!

                                      Comment

                                      • Hot Tropical Babes
                                        Confirmed User
                                        • Feb 2001
                                        • 3014

                                        #20
                                        well all the php I ever used had to have mysql, and my hosting co. runs that part, in other words, i dont have access to it.
                                        <BR>
                                        Trade with Big Tits TGP
                                        Trade with Titman

                                        Comment

                                        • XXXPaysiteDesign
                                          Confirmed User
                                          • Mar 2002
                                          • 2201

                                          #21
                                          Originally posted by Showman
                                          <?php
                                          $fileName = "./yourfile.txt";
                                          mt_srand( (double) microtime() * 1000000 );
                                          $a = file($fileName);
                                          $randNum = mt_rand( 0, sizeof($a)-1 );
                                          header( "Location: ". $a[$randNum] );
                                          ?>

                                          Copy the above into a file called random.php. Your text file (yourfile.txt) should be in the same directory as random.php.

                                          That easy huh?

                                          Thanks.
                                          SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

                                          Comment

                                          • XXXPaysiteDesign
                                            Confirmed User
                                            • Mar 2002
                                            • 2201

                                            #22
                                            Originally posted by Showman
                                            <?php
                                            $fileName = "./yourfile.txt";
                                            mt_srand( (double) microtime() * 1000000 );
                                            $a = file($fileName);
                                            $randNum = mt_rand( 0, sizeof($a)-1 );
                                            header( "Location: ". $a[$randNum] );
                                            ?>

                                            Copy the above into a file called random.php. Your text file (yourfile.txt) should be in the same directory as random.php.

                                            hmmm...

                                            this did work but it loads incredibly slow..

                                            edit: working great, looks like it was a internet burp on my end.
                                            Last edited by XXXPaysiteDesign; 11-29-2002, 10:16 PM.
                                            SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

                                            Comment

                                            • picindex
                                              Confirmed User
                                              • Oct 2002
                                              • 1038

                                              #23
                                              works fine for me and fast too.
                                              Good Content:

                                              Comment

                                              • picindex
                                                Confirmed User
                                                • Oct 2002
                                                • 1038

                                                #24
                                                thanks!

                                                Good Content:

                                                Comment

                                                • Showman
                                                  Confirmed User
                                                  • Apr 2002
                                                  • 269

                                                  #25
                                                  Yes it is a very simple script. I just noticed though the board took out the first line of the random.php code.

                                                  Check this instead:

                                                  http://www.vbetting.com/random.txt
                                                  At Sedo.com you can sell your unused domain names and earn money through their paid domain parking program!

                                                  Comment

                                                  • Rory
                                                    Confirmed User
                                                    • Jul 2002
                                                    • 616

                                                    #26
                                                    Originally posted by XXXPaysiteDesign



                                                    hmmm...

                                                    this did work but it loads incredibly slow..

                                                    edit: working great, looks like it was a internet burp on my end.
                                                    You probably have a large text file. Text files are slow , if your worried about performance store it in MySQL. That script opens and reads that entire text file to an array every time the page is loaded , so with a large text file or decent loads its gonna bog.

                                                    Promote a site that actually retains members!

                                                    Comment

                                                    • XXXPaysiteDesign
                                                      Confirmed User
                                                      • Mar 2002
                                                      • 2201

                                                      #27
                                                      what is considered too large for php to handle?
                                                      SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

                                                      Comment

                                                      • bawdy
                                                        Confirmed User
                                                        • Feb 2002
                                                        • 1424

                                                        #28
                                                        if u insist on using a text file u could pad each line with spaces so that each url was the same length eg 256 chars long (including cr's)....

                                                        calculate the random number... open the file... move the file pointer to position in file required... read line in.... right trim it then do the header transfer

                                                        something like that....

                                                        u would need to manually add the number of lines in the file to the php script to keep the processing required down

                                                        the overall size of the file should therefore be irrevalent... u would probable would want a script to pad the lines of the text for u

                                                        Comment

                                                        • wsjb78
                                                          Confirmed User
                                                          • Jun 2002
                                                          • 594

                                                          #29
                                                          Well, for performance increase you could also try to store the URLs in mySQL or even store them directly as array in the PHP file...

                                                          $i = 9;
                                                          $url[0] = "www.url1.com";
                                                          $url[1] = "www.url2.com";
                                                          $url[2] = "www.url2.com";
                                                          $url[3] = "www.url3.com";
                                                          $url[4] = "www.url4.com";
                                                          $url[5] = "www.url5.com";
                                                          $url[6] = "www.url6.com";
                                                          $url[7] = "www.url7.com";
                                                          $url[8] = "www.url8.com";
                                                          $url[9] = "www.url9.com";

                                                          Then pick a random number between 0 and $i, read out the array element and make a redirect to "http://".$url[x]

                                                          Comment

                                                          • hyper
                                                            Confirmed User
                                                            • Mar 2002
                                                            • 5294

                                                            #30
                                                            i have one.. when i get on icq i'll send it

                                                            Comment

                                                            • XXXPaysiteDesign
                                                              Confirmed User
                                                              • Mar 2002
                                                              • 2201

                                                              #31
                                                              okay, I'm icqing you now hyper..
                                                              SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.

                                                              Comment

                                                              Working...