Go Back   Gaming Gutter > Non-Gaming > Programming > Source Code


Source Code - Have a source code/project files you want to post? Do so here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post mOBSCENE's score sender...
Today 01:11 AM
Last post by Arthritis
Today 04:15 AM
5 Replies, 27 Views
Go to first new post I *think* I just got...
Today 02:03 AM
Last post by Hodizzle
Today 03:07 AM
6 Replies, 24 Views
Go to first new post Lil Wayne
10-21-2008 09:33 PM
Last post by Toffie
Today 02:49 AM
46 Replies, 389 Views
Go to first new post forgot my birthday i put...
10-30-2008 09:27 AM
by dookie
Last post by seleporx
Today 02:29 AM
23 Replies, 487 Views
Go to first new post Plastic Surgery Hell
Yesterday 08:02 PM
by Li-Shun
Last post by Hodizzle
Today 01:51 AM
11 Replies, 60 Views
Reply
 
LinkBack Thread Tools Display Modes

 [PHP] Random Text
Old 12-10-2006, 03:13 PM   #1 (permalink)
emit
Guest

 
Posts: n/a
GPoints: 0 [Check]
iTrader: / %
Post [PHP] Random Text

PHP - RANDOM TEXT

Here's how you can display a random link or text from a text file.
Create a new file called random.php. Copy this code into it and save it. This is the script that will retrieve a random entry from random.txt.

PHP Code:
<?

$textfile 
="random.txt";



$items file("$textfile");

$item rand(0sizeof($items)-1);

echo 
$items[$item];

?>
Now you've got to create another new file, this time a text file. This is where you enter the links (as HTML) or text, make sure each entry is on its own line. Save it as random.txt
Use this code where you want the random event to appear:
PHP Code:
<? include 'http://www.YOURSITE.com/random.php' ?>
That's it.
  Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 04:28 AM.


vBulletin skin developed by: eXtremepixels
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.09481907 seconds (100.00% PHP - 0% MySQL) with 17 queries