GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Help! Someone experienced in PHP (https://gfy.com/showthread.php?t=112054)

HS-Trixxxia 02-28-2003 07:15 PM

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

inthestars 02-28-2003 08:50 PM

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

Libertine 02-28-2003 08:53 PM

Quote:

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?

Libertine 02-28-2003 08:56 PM

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".

HS-Trixxxia 03-01-2003 07:15 AM

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

Libertine 03-01-2003 07:19 AM

Quote:

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?

Libertine 03-01-2003 07:24 AM

I'm in a hurry, so answer quickly if you want the code.

Brujah 03-01-2003 07:36 AM

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.

HS-Trixxxia 03-01-2003 08:48 AM

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.

Libertine 03-01-2003 01:47 PM

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_rand0sizeof($a)-);
 
setcookie ("bobotheclown"$a[$randNum], time()+86400);
 
header("Location: " $a[$randNum]);
}
?>


HS-Trixxxia 03-01-2003 10:06 PM

punkworld, do you have ICQ?
9.3.0.8.6.5.8.6

Could you Oh-Oh me?

HS-Trixxxia 03-02-2003 05:01 PM

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

Brujah 03-02-2003 05:20 PM

Quote:

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.

HS-Trixxxia 03-02-2003 05:24 PM

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] );

Brujah 03-02-2003 05:27 PM

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] );

HS-Trixxxia 03-02-2003 08:32 PM

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!!!!!!!!!!!!!!

Brujah 03-02-2003 10:59 PM

Quote:

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.

HS-Trixxxia 03-02-2003 11:21 PM

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

Plat 03-02-2003 11:45 PM

Quote:

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

Libertine 03-04-2003 07:27 AM

Quote:

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

HS-Trixxxia 03-17-2003 09:09 PM

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 ;-)

HS-Trixxxia 10-17-2003 12:55 PM

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!

HS-Trixxxia 10-17-2003 01:07 PM

:-(
No punkworld or Brujah today?

HS-Trixxxia 10-17-2003 01:53 PM

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