[advanced search]
27 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Webmaster Tutorials
User Name
Password

Reply
 
Thread Tools
Old 06-25-2006, 09:47 AM   · #1
RageD
Senior Member
 
Name: Dennis
Location: Joliet, Illinois
Trader Rating: (41)
Join Date: Apr 2005
Posts: 1,124
NP$: 2254.10 (Donate)
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 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:
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.

==============================================
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


Please register or log-in into NamePros to hide ads

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   Reply With Quote
Old 06-25-2006, 11:16 AM   · #2
Collector
NamePros Regular
 
Collector's Avatar
 
Name: Goh Toh Lee
Location: SG
Trader Rating: (13)
Join Date: Nov 2004
Posts: 230
NP$: 39.05 (Donate)
Collector has a spectacular aura aboutCollector has a spectacular aura about
Great work!

Got to try that out.

Thanks...
__________________
Niche Site Script v1.0 - Automated Content Creation & Updates, Universal Search Engine, Multiple Sources of Income w/ Top Money Making Programs, Search Engine Optimized, Unlimited Websites License!
Collector is offline   Reply With Quote
Old 07-24-2006, 04:36 PM   · #3
jplascencia
New Member
 
Trader Rating: (0)
Join Date: Jul 2006
Posts: 2
NP$: 0.00 (Donate)
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   Reply With Quote
Old 07-24-2006, 07:08 PM   · #4
RageD
Senior Member
 
Name: Dennis
Location: Joliet, Illinois
Trader Rating: (41)
Join Date: Apr 2005
Posts: 1,124
NP$: 2254.10 (Donate)
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 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   Reply With Quote
Old 07-24-2006, 07:14 PM   · #5
jplascencia
New Member
 
Trader Rating: (0)
Join Date: Jul 2006
Posts: 2
NP$: 0.00 (Donate)
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   Reply With Quote
Old 07-28-2006, 03:56 PM   · #7
bquast
NamePros Member
 
bquast's Avatar
 
Name: Brett Quast
Location: Hardisty, Alberta Canada
Trader Rating: (8)
Join Date: Nov 2005
Posts: 180
NP$: 77.50 (Donate)
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   Reply With Quote
Old 10-26-2006, 09:11 AM   · #8
champ_rock
Senior Member
 
champ_rock's Avatar
 
Name: Akshay Jain
Location: http://uck.in
Trader Rating: (99)
Join Date: Oct 2006
Posts: 2,706
NP$: 3778.80 (Donate)
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   Reply With Quote
Old 10-26-2006, 01:28 PM   · #9
RageD
Senior Member
 
Name: Dennis
Location: Joliet, Illinois
Trader Rating: (41)
Join Date: Apr 2005
Posts: 1,124
NP$: 2254.10 (Donate)
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 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);
?>


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   Reply With Quote
Old 10-27-2006, 02:22 AM   · #10
champ_rock
Senior Member
 
champ_rock's Avatar
 
Name: Akshay Jain
Location: http://uck.in
Trader Rating: (99)
Join Date: Oct 2006
Posts: 2,706
NP$: 3778.80 (Donate)
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
Question

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

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   Reply With Quote
Old 10-28-2006, 08:44 AM   · #11
RageD
Senior Member
 
Name: Dennis
Location: Joliet, Illinois
Trader Rating: (41)
Join Date: Apr 2005
Posts: 1,124
NP$: 2254.10 (Donate)
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 behold
Child Abuse
You can try to do this manually:

For $file = $_SERVER['PATH_TRANSLATED']; try this:

PHP Code:
$file = "/home/YOUR_USERNAME/public_html/SCRIPT_DIRECTORY/header.php";


-RageD
RageD is offline   Reply With Quote
Old 10-28-2006, 08:57 AM   · #12
champ_rock
Senior Member
 
champ_rock's Avatar
 
Name: Akshay Jain
Location: http://uck.in
Trader Rating: (99)
Join Date: Oct 2006
Posts: 2,706
NP$: 3778.80 (Donate)
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   Reply With Quote
Old 11-05-2006, 06:50 PM   · #14
ArcticPro
New Member
 
ArcticPro's Avatar
 
Trader Rating: (2)
Join Date: Aug 2006
Posts: 17
NP$: 0.00 (Donate)
ArcticPro is an unknown quantity at this point
Thanks for sharing!
ArcticPro is offline   Reply With Quote
Old 12-15-2006, 06:51 AM   · #15
prowebhoster
New Member
 
Trader Rating: (0)
Join Date: Dec 2006
Posts: 4
NP$: 0.00 (Donate)
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   Reply With Quote
Old 12-15-2006, 07:16 PM   · #16
Kilk
Account Suspended
 
Kilk's Avatar
 
Name: Carsen Klock
Location: Idaho
Trader Rating: (38)
Join Date: Oct 2006
Posts: 556
NP$: 52.50 (Donate)
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 all
Wildlife South Asia Earthquake Relief
Oh I would have never thought of this! Thank you very much, Nice tutorial!
Kilk is offline  
  Reply With Quote
Old 12-19-2006, 01:43 PM   · #17
RageD
Senior Member
 
Name: Dennis
Location: Joliet, Illinois
Trader Rating: (41)
Join Date: Apr 2005
Posts: 1,124
NP$: 2254.10 (Donate)
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 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?

-RageD
RageD is offline   Reply With Quote
Old 12-20-2006, 11:48 AM   · #18
Camron
DNOA Member
 
Camron's Avatar
 
Name: Camron
Location: Portland, Oregon
Trader Rating: (48)
Join Date: Jan 2006
Posts: 2,046
NP$: 24.85 (Donate)
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.
__________________
VPSByte Virtual Solutions
Premium VPS Services - 24/7/365 Support - 1 hour guaranteed support response
*NEW* Remote Backup Services @ $9.95/mo
Camron is offline   Reply With Quote
Old 12-21-2006, 04:08 AM   · #19
champ_rock
Senior Member
 
champ_rock's Avatar
 
Name: Akshay Jain
Location: http://uck.in
Trader Rating: (99)
Join Date: Oct 2006
Posts: 2,706
NP$: 3778.80 (Donate)
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   Reply With Quote
Old 12-21-2006, 04:58 AM   · #20
RageD
Senior Member
 
Name: Dennis
Location: Joliet, Illinois
Trader Rating: (41)
Join Date: Apr 2005
Posts: 1,124
NP$: 2254.10 (Donate)
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 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   Reply With Quote
Old 02-12-2007, 09:13 AM   · #21
champ_rock
Senior Member
 
champ_rock's Avatar
 
Name: Akshay Jain
Location: http://uck.in
Trader Rating: (99)
Join Date: Oct 2006
Posts: 2,706
NP$: 3778.80 (Donate)
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   Reply With Quote
Old 02-12-2007, 03:11 PM   · #22
RageD
Senior Member
 
Name: Dennis
Location: Joliet, Illinois
Trader Rating: (41)
Join Date: Apr 2005
Posts: 1,124
NP$: 2254.10 (Donate)
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 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"]


it seems rather that:
PHP Code:
$_SERVER['SCRIPT_FILENAME']


is a better alternative!

Cheers,
-RageD
RageD is offline   Reply With Quote
Old 02-12-2007, 07:30 PM   · #23
champ_rock
Senior Member
 
champ_rock's Avatar
 
Name: Akshay Jain
Location: http://uck.in
Trader Rating: (99)
Join Date: Oct 2006
Posts: 2,