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 Mark Forums Read
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-16-2012, 09:23 AM   #1
Webmaster Advertising
So Fucking Banned
 
Join Date: Sep 2003
Posts: 1,360
PHP Assistance... How Do I Do This Please?

Lets say i have an index.php file and 2 lists of words for example;

List One:

Red
Blue
Green
Yellow

List Two:

Cats
Dogs
Birds
Fish

How would i go about dynamically changing the content to automagically insert combinations of both lists in specific areas of the index.php page so it changes like below:

This page is about selling Red Fish
This page is about selling Blue Fish
This page is about selling Green Fish
This page is about selling Yellow Fish

Or;

This page is about selling Red Dogs
This page is about selling Blue Dogs
This page is about selling Green Dogs
This page is about selling Yellow Dogs

Using all combinations of words in list 1 as the primary word and list 2 as the secondary word?

Would it be something like this...

Code:
<?php
 if ($_GET['list1'])
if ($_GET['list2'])
 {echo htmlentities($_GET['list1']);}
{echo htmlentities($_GET['list2']);}
 else
 {echo ucwords("Colored Animals");}
 ?>
So i could link:

domain.com/?list1&list2

Does that make sense to any of you who are technically inclined?

Basically, i want to generate a list of URL to throw in a site map and have the page dynamically show whatever 'phrase' based on list1 and list2 the url contains.
Webmaster Advertising is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 09:36 AM   #2
helterskelter808
So Fucking Banned
 
Industry Role:
Join Date: Sep 2010
Posts: 3,405
Quote:
Originally Posted by Webmaster Advertising View Post
Basically, i want to generate a list of URL to throw in a site map and have the page dynamically show whatever 'phrase' based on list1 and list2 the url contains.
Then you don't need a list. All you need to do is display whatever values are in the request on the page. Something like:

Code:
<?php

$color = $_GET['color'];
$animal = $_GET['animal'];

echo 'This page is about '.$color.' '.$animal;

?>
Would produce:

This page is about Red Dogs

When you visited:

yoursite.com/?color=Red&animal=Dogs

Edit: Obviously you'd need to perform sanitization to protect against malicious requests.

Last edited by helterskelter808; 10-16-2012 at 09:41 AM..
helterskelter808 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 10:03 AM   #3
helterskelter808
So Fucking Banned
 
Industry Role:
Join Date: Sep 2010
Posts: 3,405
helterskelter808 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 10:05 AM   #4
KillerK
Confirmed User
 
Join Date: May 2008
Posts: 3,406
I normally do it as

$colors = array("Red","Blue","Green","Yellow");
$pets = array("Cat","Dog","Bird","Fish");

$color = $colors[array_rand($colors)];
$pet = $pets[array_rand($pets)];

print "The Color of the " . $pet . " is " . $color . "!";
KillerK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 10:11 AM   #5
ProG
Confirmed User
 
Join Date: Apr 2009
Posts: 1,319
I think you guys missed the "Using all combinations" part

Code:
// URL http://www.domain.com/?colors[]=Red&colors[]=Blue&colors[]=Green&colors[]=Yellow&animals[]=Fish&animals[]=Dogs

parse_str($_SERVER['QUERY_STRING'], $values);
foreach($values['animals'] as $animal) {
	foreach($values['colors'] as $color) {
		echo "This page is about selling " . $color . " " . $animal . PHP_EOL;
	}
}
__________________
History will be kind to me for I intend to write it.
ProG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 10:19 AM   #6
helterskelter808
So Fucking Banned
 
Industry Role:
Join Date: Sep 2010
Posts: 3,405
Okay, LIMIT 1. But something's still not quite right...



(I hope the OP appreciates the effort being put in here.)
helterskelter808 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 10:24 AM   #7
Webmaster Advertising
So Fucking Banned
 
Join Date: Sep 2003
Posts: 1,360
Quote:
Originally Posted by helterskelter808 View Post
Then you don't need a list. All you need to do is display whatever values are in the request on the page. Something like:

Code:
<?php

$color = $_GET['color'];
$animal = $_GET['animal'];

echo 'This page is about '.$color.' '.$animal;

?>
Would produce:

This page is about Red Dogs

When you visited:

yoursite.com/?color=Red&animal=Dogs

Edit: Obviously you'd need to perform sanitization to protect against malicious requests.
Ah okay (on not needing a list for the actual colors and animals).

Id still need a list of combinations ?color=Red&Animal=Dogs though to include in the sitemap.xml file though.

As far as the sanitization goes, do you know if its possible to have 'exclusion words' in the code you posted above or would that be something different?

Thanks everyone for their assistance (and the funny pics )
Webmaster Advertising is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 10:26 AM   #8
Webmaster Advertising
So Fucking Banned
 
Join Date: Sep 2003
Posts: 1,360
Quote:
Originally Posted by helterskelter808 View Post
Okay, LIMIT 1. But something's still not quite right...



(I hope the OP appreciates the effort being put in here.)
What happens if you add &echo=H2O to the code that produced that?
Webmaster Advertising is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 02:01 PM   #9
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,073
Quote:
Originally Posted by Webmaster Advertising View Post
What happens if you add &echo=H2O to the code that produced that?

$gremlin_parts=explode(" ",$gremlin);
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 04:28 PM   #10
helterskelter808
So Fucking Banned
 
Industry Role:
Join Date: Sep 2010
Posts: 3,405
Quote:
Originally Posted by Webmaster Advertising View Post
Ah okay (on not needing a list for the actual colors and animals).

Id still need a list of combinations ?color=Red&Animal=Dogs though to include in the sitemap.xml file though.

As far as the sanitization goes, do you know if its possible to have 'exclusion words' in the code you posted above or would that be something different?

Thanks everyone for their assistance (and the funny pics )
Sorry, I didn't see the part about the sitemap when I replied. Not sure what you mean by exclusion words. If you mean words you don't want in the request, if there's a specific list of words you'll accept, just check against those, and if the word isn't one of them, reject it. Or, if there's an unknown number or type of 'word' you'll accept, reject the word based on regular expressions. Like, reject anything that's not ascii letters of 3-12 characters or whatever.

Last edited by helterskelter808; 10-16-2012 at 04:29 PM..
helterskelter808 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2012, 09:05 PM   #11
amateurcanada
Confirmed User
 
amateurcanada's Avatar
 
Industry Role:
Join Date: Jul 2001
Posts: 3,766
<? echo "hello world"; ?>
__________________

be our partner - join nichepartners today
will.assum.producer @ AmateurCanada.com / icq: 30146166 / facebook.com/will.assum / #amateurcanada
amateurcanada 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
Thread Tools



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.