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)
-   -   Some php help please.... (https://gfy.com/showthread.php?t=718143)

Jon Clark - BANNED FOR LIFE 03-25-2007 09:07 PM

Some php help please....
 
I know that if I want to include a file on a page I put the line...

Code:

<? @include("http://www.domain.com/file.html"); ?>
But what if I want the file to change with each refresh of the page what to I put...?


Thanks in advance for any help you give :thumbsup

Beaver Bob 03-25-2007 09:18 PM

one quick way you could do that is create an array of all your links, and then generate a random number between 0 and the number of links - 1 and use that number.

so like this if you had 3

Code:

<?php
$url[0] = 'http://www.fuck.you/fuckoff.html';
$url[1] = 'http://www.suckmyballs.com';
$url[2] = 'http://www.lickmynuts.com';

$fuckingNumber = strval(rand()%3);

include($url[$fuckingNumber]);
?>


Jon Clark - BANNED FOR LIFE 03-25-2007 09:27 PM

Quote:

Originally Posted by Beaver Bob (Post 12147131)
one quick way you could do that is create an array of all your links, and then generate a random number between 0 and the number of links - 1 and use that number.

so like this if you had 3

Code:

<?php
$url[0] = 'http://www.fuck.you/fuckoff.html';
$url[1] = 'http://www.suckmyballs.com';
$url[2] = 'http://www.lickmynuts.com';

$fuckingNumber = strval(rand()%3);

include($url[$fuckingNumber]);
?>


Thanks... But would I put replace "fuckingnumber" with the number of files there are?

Cyrano 03-25-2007 09:30 PM

No. 1234

Beaver Bob 03-25-2007 09:36 PM

Quote:

Originally Posted by Jon Clark (Post 12147179)
Thanks... But would I put replace "fuckingnumber" with the number of files there are?

you would replace the 3 with the number of files you have.

Napolean 03-25-2007 09:37 PM

Quote:

Originally Posted by Jon Clark (Post 12147179)
Thanks... But would I put replace "fuckingnumber" with the number of files there are?

Code:

<?php
$url[] = 'http://www.test1.com';
$url[] = 'http://www.test2.com';
$url[] = 'http://www.test3.com';

$x= strval(rand()%count($url));

include($url[$x]);
?>

simpler version of the example above, only modification needed is to add more url's as you need them.

Jon Clark - BANNED FOR LIFE 03-25-2007 09:40 PM

OK, I have tried to lines of code... Neither are working for me...

First one is located at http://www.freepornation.com/test/index.php
Code:

<? $sl = rand(1,5);include ('1.htm'.$sl.'2.htm'.$sl.'3.htm'.$sl.'4.htm'.$sl.'5.htm'); ?>
Second one is located here http://www.freepornation.com/test/index2.php
Code:

<?php
$url[0] = '1.htm';
$url[1] = '2.htm';
$url[2] = '3.htm';
$url[3] = '4.htm';
$url[4] = '5.htm';

$no. 01234 = strval(rand()%5);

include($url[$no. 01234]);
?>

As you can see neither work :(

Napolean 03-25-2007 09:42 PM

Quote:

Originally Posted by Jon Clark (Post 12147243)
OK, I have tried to lines of code... Neither are working for me...

First one is located at http://www.freepornation.com/test/index.php
Code:

<? $sl = rand(1,5);include ('1.htm'.$sl.'2.htm'.$sl.'3.htm'.$sl.'4.htm'.$sl.'5.htm'); ?>
Second one is located here http://www.freepornation.com/test/index2.php
Code:

<?php
$url[0] = '1.htm';
$url[1] = '2.htm';
$url[2] = '3.htm';
$url[3] = '4.htm';
$url[4] = '5.htm';

$no. 01234 = strval(rand()&#37;5);

include($url[$no. 01234]);
?>

As you can see neither work :(

change "$no. 01234" to simply "$no"

Jon Clark - BANNED FOR LIFE 03-25-2007 09:44 PM

Quote:

Originally Posted by Napolean (Post 12147225)
Code:

<?php
$url[] = 'http://www.test1.com';
$url[] = 'http://www.test2.com';
$url[] = 'http://www.test3.com';

$x= strval(rand()%count($url));

include($url[$x]);
?>

simpler version of the example above, only modification needed is to add more url's as you need them.


Worked perfect...

http://www.freepornation.com/test/index3.php

Thank you very much :thumbsup

Dvae 03-25-2007 09:44 PM

Quote:

Originally Posted by Jon Clark (Post 12147243)
OK, I have tried to lines of code... Neither are working for me...

First one is located at http://www.freepornation.com/test/index.php
Code:

<? $sl = rand(1,5);include ('1.htm'.$sl.'2.htm'.$sl.'3.htm'.$sl.'4.htm'.$sl.'5.htm'); ?>
Second one is located here http://www.freepornation.com/test/index2.php
Code:

<?php
$url[0] = '1.htm';
$url[1] = '2.htm';
$url[2] = '3.htm';
$url[3] = '4.htm';
$url[4] = '5.htm';

$no. 01234 = strval(rand()%5);

include($url[$no. 01234]);
?>

As you can see neither work :(

You should take the time to learn the basics of PHP.

Napolean 03-25-2007 09:44 PM

Quote:

Originally Posted by Jon Clark (Post 12147264)
Worked perfect...

http://www.freepornation.com/test/index3.php

Thank you very much :thumbsup

Cool :) :thumbsup

Beaver Bob 03-25-2007 09:45 PM

Quote:

Originally Posted by Napolean (Post 12147225)
Code:

<?php
$url[] = 'http://www.test1.com';
$url[] = 'http://www.test2.com';
$url[] = 'http://www.test3.com';

$x= strval(rand()%count($url));

include($url[$x]);
?>

simpler version of the example above, only modification needed is to add more url's as you need them.

nice modification man :) i shoulda thought of that but I was jus tryin to get him a quick basic idea.

Jon Clark - BANNED FOR LIFE 03-25-2007 09:47 PM

Quote:

Originally Posted by Napolean (Post 12147253)
change "$no. 01234" to simply "$no"

And so did that....

http://www.freepornation.com/test/index2.php

Thanks :thumbsup






Now which one is better to use....


I plan on haveing several groups on one php page if that makes a difference :upsidedow

sarettah 03-25-2007 09:48 PM

Damn, I didn't get to play :(

Jon Clark - BANNED FOR LIFE 03-25-2007 09:49 PM

Quote:

Originally Posted by Beaver Bob (Post 12147275)
nice modification man :) i shoulda thought of that but I was jus tryin to get him a quick basic idea.


I thank you too :thumbsup

Jon Clark - BANNED FOR LIFE 03-25-2007 09:52 PM

Quote:

Originally Posted by Dvae (Post 12147269)
You should take the time to learn the basics of PHP.


You are more then correct and it is in my plans, but managing the designers, clients and working on this new program I hardly have time for anything at all :(

Beaver Bob 03-25-2007 09:53 PM

Quote:

Originally Posted by Jon Clark (Post 12147294)
And so did that....

http://www.freepornation.com/test/index2.php

Thanks :thumbsup






Now which one is better to use....


I plan on haveing several groups on one php page if that makes a difference :upsidedow

his is better because it counts the number of elements in the array for you. but both will do the job.

Jon Clark - BANNED FOR LIFE 03-25-2007 09:55 PM

Quote:

Originally Posted by sarettah (Post 12147299)
Damn, I didn't get to play :(


I am sure there will be a next time... I am a total newb at alot of things and I am not scared to ask for help :winkwink:

Sly 03-25-2007 09:55 PM

Quote:

Originally Posted by Jon Clark (Post 12147325)
You are more then correct and it is in my plans, but managing the designers, clients and working on this new program I hardly have time for anything at all :(

For starters, you can't have a space in variable names.

Beaver Bob 03-25-2007 09:56 PM

Quote:

Originally Posted by Jon Clark (Post 12147309)
I thank you too :thumbsup

no prob. one of the very basic things about PHP is you can't have spaces in your variable names or periods and certain other special characters that are used as operators.

Jon Clark - BANNED FOR LIFE 03-25-2007 09:57 PM

Quote:

Originally Posted by Beaver Bob (Post 12147334)
his is better because it counts the number of elements in the array for you. but both will do the job.


Thanks Bob... I will play around with them both and see which ends up working best for my application :thumbsup

Kaylum 03-25-2007 10:04 PM

:)

way to go jon, work the php!

Jon Clark - BANNED FOR LIFE 03-25-2007 10:14 PM

Quote:

Originally Posted by Kaylum (Post 12147374)
:)

way to go jon, work the php!


Thanks Kaylum, I am trying :)

Domain Distribution 03-26-2007 09:20 AM

The only gracious way to accept an insult is to ignore it.


All times are GMT -7. The time now is 08:54 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123