Dynadot

[TUTORIAL] Forced ads for resellers

Spaceship Spaceship
Watch
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:
<?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:
<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
 
Last edited:
1
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
well i owe this thread a lot of things. this was a the primary reason i got interested in Namepros and subsequently domains. i must agree that i do not regret that decision at all :)
 
0
•••
I am glad to see the post was of service :)

-RageD
 
0
•••
0
•••
asp100

网站优化可以为网站运营带来哪些效果?网站优化与搜索引擎优化是什么关系?为什么说网站优化是落后的方式?提供最专业的网站优化分析与网站优化解决
 
0
•••
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back