![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Ah My Balls
Industry Role:
Join Date: Feb 2007
Location: Under the gold leaf ICQ 388-454-421
Posts: 14,311
|
![]() I am trying to show a set of ads for a group of about 20 sites or so and another set of sites another ad but show a different set of ads for everyone else. This is what I have for a code
Code:
<? $ref = getenv('HTTP_REFERER'); $anchor = preg_replace("/http:\/\//i", "", $ref); $anchor = preg_replace("/^www\./i", "", $anchor); $anchor = preg_replace("/\/.*/i", "", $anchor); if ($anchor=="domain.com") { ?>ads<?} if (($anchor === "domain1.com") OR ($anchor === "domain2.com") OR ($anchor === "domain3.com")) { ?>ad space here<?} else { ?>other ad here<?} ?>
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2003
Posts: 2,424
|
try elseif
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Feb 2003
Posts: 2,424
|
Also, what is "===" doing there? There's one too many.
Should be "==" |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Too lazy to set a custom title
Join Date: Jan 2002
Location: Holland
Posts: 9,870
|
try == ;)
__________________
Don't let greediness blur your vision | You gotta let some shit slide icq - 441-456-888 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Too lazy to set a custom title
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
|
Code:
<?php $ad = 'default'; $ref = (isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : ''); if( $ref != '' ){ $info = parse_url($ref); if( $info !== false && isset($info['host']) ){ $domain = preg_replace('/^(www\.)+/', '', $info['host']); if( in_array($domain, array('domain1.com', 'domain2.com')) ){ $ad = 'ad1'; }elseif( in_array($domain, array('domain3.com', 'domain4.com')) ){ $ad = 'ad2'; } } } echo $ad; ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Ah My Balls
Industry Role:
Join Date: Feb 2007
Location: Under the gold leaf ICQ 388-454-421
Posts: 14,311
|
Tried this, it seems to only work when I have
Code:
elseif ($anchor=="") Quote:
__________________
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Too lazy to set a custom title
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
|
Code:
<?php $ref = getenv('HTTP_REFERER'); $anchor = preg_replace("/http:\/\//i", "", $ref); $anchor = preg_replace("/^www\./i", "", $anchor); $anchor = preg_replace("/\/.*/i", "", $anchor); if( $anchor=="domain.com" ){ ?>ads<? }elseif( $anchor == "domain1.com" || $anchor == "domain2.com" || $anchor == "domain3.com" ){ ?>ad space here<? }else{ ?>other ad here<? } ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Ah My Balls
Industry Role:
Join Date: Feb 2007
Location: Under the gold leaf ICQ 388-454-421
Posts: 14,311
|
Quote:
__________________
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Too lazy to set a custom title
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Making PHP work
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,257
|
If (used PERL) {
x= "you'd be through already"; } ![]()
__________________
Make Money with Porn |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Ah My Balls
Industry Role:
Join Date: Feb 2007
Location: Under the gold leaf ICQ 388-454-421
Posts: 14,311
|
Quote:
![]()
__________________
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Ah My Balls
Industry Role:
Join Date: Feb 2007
Location: Under the gold leaf ICQ 388-454-421
Posts: 14,311
|
If I knew what the fuck I was doing Id be done too
![]() I know just enough to get myself into trouble.
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,072
|
Here is a different way to do it. Not saying it's better, just different ;p
Code:
<?php // Housekeeping // Initialize stuff $domain=array(); $ads=array(); // define the ad that will be shown if the domain is not in your list $ad2use="defaultad"; // define the various ads you will use for domains in your list $ad1="ad 1 code goes here"; $ad2="ad 2 code goes here"; $ad3="ad 3 code goes here"; // for each domain that you want an ad for define the domain in $domain[] and the ad in $ad[] // I store everything like this lower case // site group 1 $domain[1]="domain1"; $ads[1]=$ad1; $domain[2]="domain2"; $ads[2]=$ad1; //site group 2 $domain[3]="domain3"; $ads[3]=$ad2; $domain[4]="domain4"; $ads[4]=$ad2; // site group 3 $domain[5]="domain5"; $ads[5]=$ad3; // etc etc for as many site-ad groups as you want // End of Housekeeping // Mainline // check to see if there is anything in referer if(isset($_SERVER['HTTP_REFERER'])) { // loop through the domain list for($domcnt=1;$domcnt<=count($domain);$domcnt++) { // is the domain name in the referer string? Checking lowercase because I have the domain list lowercased if(substr_count(strtolower($_SERVER['HTTP_REFERER']),$domain[$domcnt])>0) { // if the domain was in the referer string then grab the associated ad $ad2use=$ads[$domcnt]; // break out of the for... loop $break; } } } // put the selected ad up there echo $ad2use; // end of Mainline ?>
__________________
All cookies cleared! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 | |
Confirmed User
Join Date: Feb 2003
Posts: 2,424
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
Code:
<?php header( 'Location: http://exxxpired.com' ); exit();
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |