NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > Webmaster Tutorials
Reload this Page [TUTORIAL] Forced ads for resellers

Webmaster Tutorials Instructional webmaster-related how-to's and tutorials.

Advanced Search
0 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 06-25-2006, 09:47 AM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: Apr 2005
Location: Joliet, Illinois
Posts: 1,177
RageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to behold
 


Child Abuse

[TUTORIAL] Forced ads for resellers


Ok, well I finally found it... Forced ads with .htaccess file! Right now this works for .html & .htm extensions, but I'm working on getting it to .php as well, I will update as I figure that one out, it's a little more difficult for obvious reasons. (Quotes, syntax, etc. And above all, it parses through a PHP script)

MUST have the php_read function enabled! (Most webservers have this on by default)

YES! This is a free alternative to all the software out there

First, go into your cPanel account. (Reseller)

Now, not in WHM, but cPanel go into File Manager.

Find your cPanel skeleton directory.

In here... What we will do...

First create a new folder... Name it.. header...

In this folder create 3 text documents...

1 text document named: header.php
1 text document named: header.html
1 text document named: footer.html

In header.php insert the following code:
????: NamePros.com http://www.namepros.com/webmaster-tutorials/210622-tutorial-forced-ads-for-resellers.html
PHP Code:
<?php
$header 
"header.html";
$footer "footer.html";
$file $_SERVER['SCRIPT_FILENAME'];

readfile($header);
readfile($file);
readfile($footer);
?>
In header.html insert your ad code you wish to be set in the header.

In footer.html insert your ad code you wish to be set in the footer.


Now go back up one directory... Edit your .htaccess file..

Add this somewhere:

Code:
AddHandler headered .html # Enable adds on HTML pages
AddHandler headered .htm # Enable adds on HTM pages
AddHandler headered .php # Enable adds on PHP pages
Action headered /header/header.php
==============================================
Ok, now that we have that finished, I have an iFrame code you can use!

Now, let's begin..

Open backup your header.html file.. Change it to this: (Footer will not be iFrame unless you do so doing the same process)
HTML Code:
<HTML>
<center><iframe src="http://yoursite.com/header/iframesrc.adsource" scrolling="no" width="48.2%" height="12%"></iframe></center>
</HTML>
<html>
Now, we need to create a new file... Create a new text document and name it: iframesrc.adsource (Be sure to place it in the "header" directory)

Insert you're ad code into that page...


But wait... Perplexed? That is correct, we still need to make the .adsource extension a valid one! So here is what we'll do.

Get out of the skeleton directory and go into the reseller account's /public_html folder. Open the .htaccess file..

In the .htaccess file add this somewhere:
Code:
AddHandler server-parsed adsource
AddType text/html adsource
Do this just in the reseller's .htaccess or wherever the ad code is being read from... This way the .adsource extension is not available for all users.
????: NamePros.com http://www.namepros.com/showthread.php?t=210622

==============================================
At the current time it is not very secure for the user will be able to edit it, but I am working on it.. This is the basic concept and as I make changes I will create a changelog at the bottom of this post! Now creating an account will automatically ad your adcode to the site! Just make sure if needed you ad that domain to your publisher account with the ad company

-RageD
Last edited by RageD; 01-04-2008 at 03:08 PM. Reason: Updated to make work with latest PHP Versions. UPDATES COMING SOON!
RageD is offline  
Old 06-25-2006, 11:16 AM   #2 (permalink)
NamePros Regular
 
Collector's Avatar
Join Date: Nov 2004
Posts: 240
Collector has a spectacular aura aboutCollector has a spectacular aura about
 



Great work!

Got to try that out.

Thanks...
Collector is offline  
Old 07-24-2006, 04:36 PM   #3 (permalink)
New Member
Join Date: Jul 2006
Posts: 2
jplascencia is an unknown quantity at this point
 



Looking to 'force ads' I found something called mod_layout and, better (I believe, but I'm not a real webmaster) http://www.ihostdev.com/ipanel.html . It looks good but I don't have a dedicated server to install it.

Does anybody has install it on a VPS?

I'm looking for a good provider of VPS where I am sure it can be installed.

Any suggestion?

Thanks.
jplascencia is offline  
Old 07-24-2006, 07:08 PM THREAD STARTER               #4 (permalink)
Senior Member
Join Date: Apr 2005
Location: Joliet, Illinois
Posts: 1,177
RageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to behold
 


Child Abuse
There are indeed costly programs such as iPanel, but this is a completely free alternative as mentioned above.

-RageD
RageD is offline  
Old 07-24-2006, 07:14 PM   #5 (permalink)
New Member
Join Date: Jul 2006
Posts: 2
jplascencia is an unknown quantity at this point
 



I agree


In fact, it looks very creative.

By the way, did you find the way to make the appear on PHP scripts?

My previous Reply was only looking if someone else found another way to do that, inclusive, under payment. My problem is that I don't have the money for a dedicated server (and, monthly fees ) but I can try to pay once for a script (that can be installed on a cheaper shared hosting service).

Sorry for any inconvenience i've caused.
jplascencia is offline  
Old 07-26-2006, 06:05 AM   #6 (permalink)
Joe
Senior Member
Join Date: Oct 2005
Location: Kent ~ U.K.
Posts: 3,209
Joe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud of
 


Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
i think this is a nice little way of garanteeing that you have ads on your hosting accounts

nice one

Joe
__________________
Myself and "JackHeskett" are no longer associated with FusedHosting.net. Please pipe all PMs to admin [at] fusedhosting.net.
Joe is offline  
Old 07-28-2006, 03:56 PM   #7 (permalink)
NamePros Member
 
bquast's Avatar
Join Date: Nov 2005
Location: Hardisty, Alberta Canada
Posts: 179
bquast will become famous soon enough
 



there is another way to do this with just using .htaccess and just using the .htaccess file itself forget how to do it right now, if I find my free hosting script ill pull it out of it.
bquast is offline  
Old 10-26-2006, 09:11 AM   #8 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,817
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



i did everything that you said properly.. (i have not used iframes right now.. just the basic one)

but i am getting this error
Quote:
Fatal error: Call to undefined function: () in /home/XXXXX/public_html/header.php on line 6
please tell me whats wrong.. also how to do it directly with .htaccess?
champ_rock is offline  
Old 10-26-2006, 01:28 PM THREAD STARTER               #9 (permalink)
Senior Member
Join Date: Apr 2005
Location: Joliet, Illinois
Posts: 1,177
RageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to behold
 


Child Abuse
You used this code exactly in your header.php file?

PHP Code:
<?php
$header 
"header.html";
$footer "footer.html";

$file $_SERVER["PATH_TRANSLATED"];
$readfile($header);
$readfile($file);
$readfile($footer);
????: NamePros.com http://www.namepros.com/showthread.php?t=210622
?>
It must be like that and you must have your header.html file in the same directory so it can be read by this file.

-RageD
RageD is offline  
Old 10-27-2006, 02:22 AM   #10 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,817
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 




well i dont think that there is any problem with the header.html or footer.html

i did one trick to check that out. i removd all the header and footer entries.. so that now the code stands as
????: NamePros.com http://www.namepros.com/showthread.php?t=210622

Code:
<?php 

$file = $_SERVER["PATH_TRANSLATED"];  
$readfile($file); 
 
?>
here is the error log that i am getting

Code:
[27-Oct-2006 01:57:47] PHP Fatal error:  Function name must be a string in /home/gaurav/public_html/header/header.php on line 4
[27-Oct-2006 01:58:07] PHP Fatal error:  Function name must be a string in /home/gaurav/public_html/header/header.php on line 4
can u please tell me if i have to change somthing with PATH_TRANSLATED or anything according to my server or location?

i think it is some problem with string functions or something as the error log says?
Last edited by champ_rock; 10-28-2006 at 08:51 AM. Reason: added
champ_rock is offline  
Old 10-28-2006, 08:44 AM THREAD STARTER               #11 (permalink)
Senior Member
Join Date: Apr 2005
Location: Joliet, Illinois
Posts: 1,177
RageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to behold
 


Child Abuse
You can try to do this manually:

For $file = $_SERVER['PATH_TRANSLATED']; try this:
????: NamePros.com http://www.namepros.com/showthread.php?t=210622

PHP Code:
$file "/home/YOUR_USERNAME/public_html/SCRIPT_DIRECTORY/header.php"
-RageD
RageD is offline  
Old 10-28-2006, 08:57 AM   #12 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,817
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



did that but it is still not working .. is it possible that my server admins may have blocked this kind of a function ???

and one more thing, i will give u one free cpanel hosting account with 100mb space+ 1gb bandwidth to experiment..
champ_rock is offline  
Old 11-05-2006, 10:06 AM   #13 (permalink)
Joe
Senior Member
Join Date: Oct 2005
Location: Kent ~ U.K.
Posts: 3,209
Joe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud of
 


Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
very nice!
not sure i really want to use it though
but for people who do
this is awesome

Joe
__________________
Myself and "JackHeskett" are no longer associated with FusedHosting.net. Please pipe all PMs to admin [at] fusedhosting.net.
Joe is offline  
Old 11-05-2006, 06:50 PM   #14 (permalink)
New Member
 
ArcticPro's Avatar
Join Date: Aug 2006
Posts: 17
ArcticPro is an unknown quantity at this point
 



Thanks for sharing!
ArcticPro is offline  
Old 12-15-2006, 06:51 AM   #15 (permalink)
New Member
Join Date: Dec 2006
Posts: 4
prowebhoster is an unknown quantity at this point
 



this does not work, tried every way said above?
still get this error

Fatal error: Call to undefined function: () in /home/cbmania/public_html/header/header.php on line 6
prowebhoster is offline  
Old 12-15-2006, 07:16 PM   #16 (permalink)
Powered by Linux
 
Kilk's Avatar
Join Date: Oct 2006
Location: Idaho
Posts: 555
Kilk is a name known to allKilk is a name known to allKilk is a name known to allKilk is a name known to allKilk is a name known to allKilk is a name known to allKilk is a name known to allKilk is a name known to all
 



Wildlife South Asia Earthquake Relief
Oh I would have never thought of this! Thank you very much, Nice tutorial!
Kilk is offline  
Old 12-19-2006, 01:43 PM THREAD STARTER               #17 (permalink)
Senior Member
Join Date: Apr 2005
Location: Joliet, Illinois
Posts: 1,177
RageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to behold
 


Child Abuse
Originally Posted by prowebhoster
this does not work, tried every way said above?
still get this error

Fatal error: Call to undefined function: () in /home/cbmania/public_html/header/header.php on line 6
Ok, is your header.php file named correctly and in the /public_html/header directory? If so, did you check the correction above making $file direct straight to that file?
????: NamePros.com http://www.namepros.com/showthread.php?t=210622

-RageD
RageD is offline  
Old 12-20-2006, 11:48 AM   #18 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,100
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse
Anyone can just delete the folder and edit their htaccess, even the people with no knowledge about this type of stuff.
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Camron is offline  
Old 12-21-2006, 04:08 AM   #19 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,817
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



ok i got to know.. this was a problem with my server... i enquired ..something like "php read file" function must be enabled to successfully implement this technique...
champ_rock is offline  
Old 12-21-2006, 04:58 AM THREAD STARTER               #20 (permalink)
Senior Member
Join Date: Apr 2005
Location: Joliet, Illinois
Posts: 1,177
RageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to behold
 


Child Abuse
Normally this is already on, but I'll make sure I put it up there so people don't have this problem again!

-RageD
RageD is offline  
Old 02-12-2007, 09:13 AM   #21 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,817
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



hey raged, have you found any complete solution which puts headers for php files as well??

thanks a lot
champ_rock is offline  
Old 02-12-2007, 03:11 PM THREAD STARTER               #22 (permalink)
Senior Member
Join Date: Apr 2005
Location: Joliet, Illinois
Posts: 1,177
RageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to behold
 


Child Abuse
Actually I have.. This seems to work on PHP 4.x and 5.x. I will update the original post but instead of:

PHP Code:
$_SERVER["PATH_TRANSLATED"
????: NamePros.com http://www.namepros.com/showthread.php?t=210622
it seems rather that:
PHP Code:
$_SERVER['SCRIPT_FILENAME'
is a better alternative!

Cheers,
-RageD
RageD is offline  
Old 02-12-2007, 07:30 PM   #23 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,817
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



yippie finally a php version as well... desperately waiting for that one dude
champ_rock is offline  
Old 02-15-2007, 01:47 PM   #24 (permalink)
Account Suspended
Join Date: Sep 2006
Posts: 1,059
YesBrilliant is a name known to allYesBrilliant is a name known to allYesBrilliant is a name known to allYesBrilliant is a name known to allYesBrilliant is a name known to allYesBrilliant is a name known to all
 



Originally Posted by champ_rock
yippie finally a php version as well... desperately waiting for that one dude
Just like me.

Thanks for sharing!
YesBrilliant is offline  
Old 08-05-2007, 12:37 PM THREAD STARTER               #25 (permalink)
Senior Member
Join Date: Apr 2005
Location: Joliet, Illinois
Posts: 1,177
RageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to beholdRageD is a splendid one to behold
 


Child Abuse
Just felt I'd revive this one for anyone who is looking for such a solution again!

Also, I have not tested this but here is an idea. If you would like to keep the "header" directory untouchable by the user and have root access (many don't but that's alright. Maybe it would work with just SSH access on a reseller) try this:
????: NamePros.com http://www.namepros.com/showthread.php?t=210622

cd /home/USER/public_html
chown root headers/
chown root headers/*

Again, I have not tried this. You may want to test that apache still allows the file to be executed in the browser but it should. After CHOWN'ing to root or another user (resellers try with chown YOURUSER) the user will be unable to edit the file.

-RageD
Last edited by RageD; 08-05-2007 at 12:48 PM.
RageD is offline  
Closed Thread


LinkBacks (?)
LinkBack to this Thread: http://www.namepros.com/webmaster-tutorials/210622-tutorial-forced-ads-for-resellers.html
Posted By For Type Date
Forced Ads Module - WHMCS Forums This thread Refback 11-23-2011 12:28 PM
Forced Ads Module - WHMCS Forums This thread Refback 04-12-2011 10:17 AM
need a Force ads - FreeWebHostingTalk This thread Refback 11-10-2009 12:21 AM
Forced Ads Module - WHMCS Forums This thread Refback 07-12-2009 08:05 AM
Forced Ads Module - WHMCS Forums This thread Refback 07-01-2009 09:11 AM

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


 
All times are GMT -7. The time now is 12:58 AM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger