![]() |
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 |
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 |
Quote:
|
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".
|
punkworld,
Exactly, what I'm looking for it to do is rotate every 24 hours not everytime it is called. |
Quote:
|
I'm in a hurry, so answer quickly if you want the code.
|
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. |
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. |
cookie-based, unlike the one above it handles other numbers of galleries than just 31 or 365
PHP Code:
|
punkworld, do you have ICQ?
9.3.0.8.6.5.8.6 Could you Oh-Oh me? |
I must be lost or something is not obvious enough. Neither work!
|
Quote:
|
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] ); |
Actually like this:
PHP Code:
$fileName = "./bobotheclown.txt"; $a = file($fileName); $gal = date("j"); header( "Location: ". $a[$gal] ); |
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!!!!!!!!!!!!!! |
Quote:
Otherwise, nope.. it's all good. |
heheh.....no more of a BBW type here sorry ;-)
|
Quote:
|
Quote:
BTW, Trixia, I just tested it myself, and everything is working fine... http://www.captainevil.com/gfytest.php |
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 ;-) |
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! |
:-(
No punkworld or Brujah today? |
One more bump?
Help? Please......pretty please with a strawberry on top? |
All times are GMT -7. The time now is 01:50 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123