[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 03-20-2006, 03:56 PM   #1 (permalink)
NamePros Regular
 
Something Vague's Avatar
 
Join Date: Mar 2006
Posts: 878
0.00 NP$ (Donate)

Something Vague is a jewel in the roughSomething Vague is a jewel in the roughSomething Vague is a jewel in the rough


random generator

http://www.insultmonger.com/generators/index.htm

can anyone create a script similar to that process? the ability to push a button, and it randomly displays a line of words from a database. If someone can PM me a script of this, or code it, they're a great person, and I would be glad to give rep points, maybe some NP.

I really need a script like this!
Something Vague is offline  
Old 03-20-2006, 04:34 PM   #2 (permalink)
Senior Member
 
Join Date: Apr 2005
Location: .ma.us
Posts: 1,783
21.95 NP$ (Donate)

DropLister is a splendid one to beholdDropLister is a splendid one to beholdDropLister is a splendid one to beholdDropLister is a splendid one to beholdDropLister is a splendid one to beholdDropLister is a splendid one to beholdDropLister is a splendid one to beholdDropLister is a splendid one to behold

Baby Health Save a Life Save The Children
try something like this, i use it for a random domain generator

the text file consists of one entry per line

<?
//Text files to use
$textfile ="http://www.droplister.com/dom_list1.txt";

//Let's randomize these words
$rand = file("$textfile");
$rando = rand(0, sizeof($rand)-1);

?>
<a class="reload" href="javascript: window.location.reload()"><img src="Your Button"></a> for another.
<textarea>
<?
//Print the random name
echo $rand[$rando];
?>
</textarea>
__________________

Last edited by droplister; 03-20-2006 at 05:52 PM.
DropLister is offline  
Old 03-20-2006, 04:52 PM   #3 (permalink)
NamePros Regular
 
Something Vague's Avatar
 
Join Date: Mar 2006
Posts: 878
0.00 NP$ (Donate)

Something Vague is a jewel in the roughSomething Vague is a jewel in the roughSomething Vague is a jewel in the rough


Hi,

Look at the quick reply box here at namepros. Image that "message;" says "Word Generator" and the box where you type the message displays "random text here". Then if I hit a button like "Post Quick Reply" it displays another "random text here" without loading the entire page again. Just the text in the box changes.

DO you know what I mean? Can you edit your script to suit said needs? I really like how it picks from a text list! Fantastic!

Last edited by Something Vague; 03-20-2006 at 05:05 PM.
Something Vague is offline  
Old 03-20-2006, 05:29 PM   #4 (permalink)
NamePros Regular
 
Jim_'s Avatar
 
Join Date: Aug 2005
Posts: 585
285.40 NP$ (Donate)

Jim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to all

Save The Children
The script is loaded inside an iframe on that page. The go button just reloads the page inside the iframe.
__________________
ask me about the internet
Jim_ is offline  
Old 03-20-2006, 05:48 PM   #5 (permalink)
NamePros Regular
 
Something Vague's Avatar
 
Join Date: Mar 2006
Posts: 878
0.00 NP$ (Donate)

Something Vague is a jewel in the roughSomething Vague is a jewel in the roughSomething Vague is a jewel in the rough


Can anyone integrate this script where the random results are in a text box, and the reload action is an image (like a .gif saying GO!, not button)?
Something Vague is offline  
Old 03-20-2006, 05:59 PM   #6 (permalink)
NamePros Regular
 
Jim_'s Avatar
 
Join Date: Aug 2005
Posts: 585
285.40 NP$ (Donate)

Jim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to all

Save The Children
page:
Code:
<a href="script.php" target="_box"><img src="go.gif" /></a>
<iframe name="_box" src="script.php" width="400" height="50" frameborder="0"></iframe>
script.php:
PHP Code:
<?php
$textfile
="http://www.droplister.com/dom_list1.txt";

$rand = file("$textfile");
$rando = rand(0, sizeof($rand)-1);

echo
$rand[$rando];
?>
__________________
ask me about the internet
Jim_ is offline  
Old 03-20-2006, 06:27 PM   #7 (permalink)
NamePros Regular
 
Something Vague's Avatar
 
Join Date: Mar 2006
Posts: 878
0.00 NP$ (Donate)

Something Vague is a jewel in the roughSomething Vague is a jewel in the roughSomething Vague is a jewel in the rough


Wicked, thank you Jim. Rep added!
Something Vague is offline  
Closed Thread


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

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


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 10:44 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85