Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-11-2003, 01:02 PM   #1
version4
Registered User
 
Join Date: Mar 2003
Posts: 13
Help with PHP

Hi

I'm wondering if someone might be able to provide me with a few lines of code to complete the following task in PHP.

I have three text files (a.txt, b.txt, c.txt), each containing text.

The script would randomly take a line of text from each file, merge them to make a phrase and hyperlink it to a url with dashes between the words. The output from the script would be vertical. Each time the script runs, the output would be different.

The script would have a variable x that could be set to say how many lines of output there would be.

Thanks for the help and I have an example below to clarify.

******************

Contents of a.txt

this
that
what

Contents of b.txt

will be
was
is

Contents of c.txt

good
bad
funny

*******************

In the php script, x=5

An example of the output of the script which is vertical consists of 5 hyperlinks.

<a href="http://www.url.com/what-will-be-funny.shtml">what will be funny</a>
<a href="http://www.url.com/this-is-good.shtml">this is good</a>
<a href="http://www.url.com/that-is-bad.shtml">that is bad</a>
<a href="http://www.url.com/what-was-funny.shtml">what was funny</a>
<a href="http://www.url.com/that-will-be-bad.shtml">this will be bad</a>
version4 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-11-2003, 02:16 PM   #2
pornanza
Confirmed User
 
Join Date: Jul 2003
Location: East Village
Posts: 238
PHP Code:

<?php

 $links 
5;

 
$a file('a.txt');
 
$b file('b.txt');
 
$c file('c.txt');


 for (
$i 0$i $links$i++) {

  
$link $a[rand(0sizeof($a)-1)] . '-' $b[rand(0sizeof($b)-1)] . '-' $c[rand(0sizeof($c)-1)];
  echo 
"<a href=\"http://www.url.com/$link.shtml\">" str_replace('-'' '$link) . "</a><br />\r\n";

 }


?>
ryan
http://pornanza.net
pornanza is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-11-2003, 07:57 PM   #3
version4
Registered User
 
Join Date: Mar 2003
Posts: 13
Thank you for the code, it worked great
version4 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.