Help! Someone experienced in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HS-Trixxxia
    Confirmed User
    • Mar 2002
    • 2946

    #1

    Help! Someone experienced in PHP

    I have a code that is supplied to me from a sponsor that rotates the galleries in the database with every refresh. I'd like that simple code to rotate only after 24 hours. Anybody have the secret?

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


    Thanks

    Trixxxia

    ~~~~~~~~~~~~~~~~~~
    Patrizia
    COO - MassiveDollars
    Email: patrizia at MassiveDollars dot com
    ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com
  • inthestars
    Registered User
    • Sep 2002
    • 2021

    #2
    If you go to either of the these sites, there are plenty of PHP experts on the message boards to help:

    http://www.codewalkers.com
    http://phpbuilder.org

    Comment

    • Libertine
      sex dwarf
      • May 2002
      • 17860

      #3
      Originally posted by Trixxxia
      I have a code that is supplied to me from a sponsor that rotates the galleries in the database with every refresh. I'd like that simple code to rotate only after 24 hours. Anybody have the secret?

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


      Thanks

      Trixxxia
      Could you give a bit more info on what exactly you want?
      /(bb|[^b]{2})/

      Comment

      • Libertine
        sex dwarf
        • May 2002
        • 17860

        #4
        BTW, the code you have now is not time-based, and does not rotate the galleries in the "database". The time thing in it is only to seed the "random" function. Right now a random gallery is chosen from the file every time the script is called, there is no "refresh" or "rotation".
        /(bb|[^b]{2})/

        Comment

        • HS-Trixxxia
          Confirmed User
          • Mar 2002
          • 2946

          #5
          punkworld,
          Exactly, what I'm looking for it to do is rotate every 24 hours not everytime it is called.

          ~~~~~~~~~~~~~~~~~~
          Patrizia
          COO - MassiveDollars
          Email: patrizia at MassiveDollars dot com
          ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

          Comment

          • Libertine
            sex dwarf
            • May 2002
            • 17860

            #6
            Originally posted by Trixxxia
            punkworld,
            Exactly, what I'm looking for it to do is rotate every 24 hours not everytime it is called.
            In other words, send the surfer to the same gallery for 24 hours to come once he's clicked the link?
            /(bb|[^b]{2})/

            Comment

            • Libertine
              sex dwarf
              • May 2002
              • 17860

              #7
              I'm in a hurry, so answer quickly if you want the code.
              /(bb|[^b]{2})/

              Comment

              • Brujah
                Beer Money Baron
                • Jan 2001
                • 22157

                #8
                How many galleries are in the file ? If you're only sending once a day, you can go by the day # ( day of month, day of year ).

                $fileName = "./bobotheclown.txt";
                $a = file($fileName);
                #$gal = date("j"); // day of month
                #$gal = date("z"); // day of year
                header( "Location: ". $a[$gal] );

                if you only have around 30 or so then use day of month. if you have 100 or more then just fill the file up with enough to equal 367 or so, duplicate as necessary if you don't have enough of them. only one will show per day.

                Comment

                • HS-Trixxxia
                  Confirmed User
                  • Mar 2002
                  • 2946

                  #9
                  You guys are great!

                  Thanks I appreciate it.

                  I couldn't for the life of me understand what had to be changed - all the resource sites wanted me to install their own code.

                  The simpler for me, the better!

                  Again, thank you.

                  ~~~~~~~~~~~~~~~~~~
                  Patrizia
                  COO - MassiveDollars
                  Email: patrizia at MassiveDollars dot com
                  ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                  Comment

                  • Libertine
                    sex dwarf
                    • May 2002
                    • 17860

                    #10
                    cookie-based, unlike the one above it handles other numbers of galleries than just 31 or 365


                    PHP Code:
                    <?php
                    if(isSet($_COOKIE['bobotheclown'])){
                     header("Location: " . $_COOKIE['bobotheclown']);
                    } else {
                     $fileName = "./bobotheclown.txt";
                     $a = file($fileName);
                     mt_srand( (double) microtime() * 1000000 ); 
                     $randNum = mt_rand( 0, sizeof($a)-1 );
                     setcookie ("bobotheclown", $a[$randNum], time()+86400);
                     header("Location: " . $a[$randNum]);
                    }
                    ?>
                    /(bb|[^b]{2})/

                    Comment

                    • HS-Trixxxia
                      Confirmed User
                      • Mar 2002
                      • 2946

                      #11
                      punkworld, do you have ICQ?
                      9.3.0.8.6.5.8.6

                      Could you Oh-Oh me?

                      ~~~~~~~~~~~~~~~~~~
                      Patrizia
                      COO - MassiveDollars
                      Email: patrizia at MassiveDollars dot com
                      ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                      Comment

                      • HS-Trixxxia
                        Confirmed User
                        • Mar 2002
                        • 2946

                        #12
                        I must be lost or something is not obvious enough. Neither work!

                        ~~~~~~~~~~~~~~~~~~
                        Patrizia
                        COO - MassiveDollars
                        Email: patrizia at MassiveDollars dot com
                        ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                        Comment

                        • Brujah
                          Beer Money Baron
                          • Jan 2001
                          • 22157

                          #13
                          Originally posted by Trixxxia
                          I must be lost or something is not obvious enough. Neither work!
                          Mine requires you remove one of the two # before the two lines with dates, depending on the number of lines in your gallery file.

                          Comment

                          • HS-Trixxxia
                            Confirmed User
                            • Mar 2002
                            • 2946

                            #14
                            In other words...Brujah...would this be what it should look like?


                            $fileName = "./bobotheclown.txt";
                            $a = file($fileName);
                            #$gal = date("j"); /31/ day of month
                            header( "Location: ". $a[$gal] );

                            ~~~~~~~~~~~~~~~~~~
                            Patrizia
                            COO - MassiveDollars
                            Email: patrizia at MassiveDollars dot com
                            ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                            Comment

                            • Brujah
                              Beer Money Baron
                              • Jan 2001
                              • 22157

                              #15
                              Actually like this:

                              PHP Code:
                              <?php
                              $fileName = "./bobotheclown.txt"; 
                              $a = file($fileName); 
                              $gal = date("j"); 
                              header( "Location: ". $a[$gal] );
                              ?>

                              $fileName = "./bobotheclown.txt";
                              $a = file($fileName);
                              $gal = date("j");
                              header( "Location: ". $a[$gal] );
                              Last edited by Brujah; 03-02-2003, 03:30 PM.

                              Comment

                              • HS-Trixxxia
                                Confirmed User
                                • Mar 2002
                                • 2946

                                #16
                                Brujah! God Bless! Thank you!
                                Do I owe you anything?
                                Have any sponsors you want me to sign-up under you?

                                Thanks again.........it works!!!!!!!!!!!!!!

                                ~~~~~~~~~~~~~~~~~~
                                Patrizia
                                COO - MassiveDollars
                                Email: patrizia at MassiveDollars dot com
                                ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                                Comment

                                • Brujah
                                  Beer Money Baron
                                  • Jan 2001
                                  • 22157

                                  #17
                                  Originally posted by Trixxxia
                                  Brujah! God Bless! Thank you!
                                  Do I owe you anything?
                                  Have any sponsors you want me to sign-up under you?

                                  Thanks again.........it works!!!!!!!!!!!!!!
                                  Do you shoot gothic content by any chance ?

                                  Otherwise, nope.. it's all good.

                                  Comment

                                  • HS-Trixxxia
                                    Confirmed User
                                    • Mar 2002
                                    • 2946

                                    #18
                                    heheh.....no more of a BBW type here sorry ;-)

                                    ~~~~~~~~~~~~~~~~~~
                                    Patrizia
                                    COO - MassiveDollars
                                    Email: patrizia at MassiveDollars dot com
                                    ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                                    Comment

                                    • Plat
                                      Confirmed User
                                      • Jan 2002
                                      • 2680

                                      #19
                                      Originally posted by punkworld
                                      BTW, the code you have now is not time-based, and does not rotate the galleries in the "database". The time thing in it is only to seed the "random" function. Right now a random gallery is chosen from the file every time the script is called, there is no "refresh" or "rotation".
                                      i smell aebn
                                      Im fuckin retired

                                      Comment

                                      • Libertine
                                        sex dwarf
                                        • May 2002
                                        • 17860

                                        #20
                                        Originally posted by Plat


                                        i smell aebn
                                        Smells good, doesn't it?

                                        BTW, Trixia, I just tested it myself, and everything is working fine...
                                        http://www.captainevil.com/gfytest.php
                                        /(bb|[^b]{2})/

                                        Comment

                                        • HS-Trixxxia
                                          Confirmed User
                                          • Mar 2002
                                          • 2946

                                          #21
                                          Brujah or punkworld,
                                          Can I get more complicated and add a picture to represent the link or have a random text?

                                          /me wants to complicate her life some more ;-)

                                          ~~~~~~~~~~~~~~~~~~
                                          Patrizia
                                          COO - MassiveDollars
                                          Email: patrizia at MassiveDollars dot com
                                          ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                                          Comment

                                          • HS-Trixxxia
                                            Confirmed User
                                            • Mar 2002
                                            • 2946

                                            #22
                                            I just feel like complicating life a little........
                                            Anyone know how to add a pic & description to the loop?
                                            What has to be added to the code& what has to be added to the .txt file?

                                            Thanks for your help!

                                            ~~~~~~~~~~~~~~~~~~
                                            Patrizia
                                            COO - MassiveDollars
                                            Email: patrizia at MassiveDollars dot com
                                            ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                                            Comment

                                            • HS-Trixxxia
                                              Confirmed User
                                              • Mar 2002
                                              • 2946

                                              #23
                                              :-(
                                              No punkworld or Brujah today?

                                              ~~~~~~~~~~~~~~~~~~
                                              Patrizia
                                              COO - MassiveDollars
                                              Email: patrizia at MassiveDollars dot com
                                              ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                                              Comment

                                              • HS-Trixxxia
                                                Confirmed User
                                                • Mar 2002
                                                • 2946

                                                #24
                                                One more bump?
                                                Help? Please......pretty please with a strawberry on top?

                                                ~~~~~~~~~~~~~~~~~~
                                                Patrizia
                                                COO - MassiveDollars
                                                Email: patrizia at MassiveDollars dot com
                                                ICQ: 465.826.441 Yahoo: trixxxia_me MSN: trixxxia at hotmail dot com

                                                Comment

                                                Working...