krakjoe August 22nd, 2007, 07:44 I'm bored outa my brain ... and so ....
I assume you're the root user ... or can point the root user in the direction of this post ...
Install mod_layout either your way or
login to shell as root
wget http://download.tangent.org/mod_layout-3.4.tar.gz
tar xzf mod_layout-3.4.tar.gz
cd mod_layout*
make
make install
http://krakjoe.com/mod-layout-php.zip
Above archive contains both php scripts to be uploaded to /scripts/ on your server ... but wait ...
open mod-layout.conf.php and edit the values as necessary, making sure you change the email address, and plan names to force ads on BEFORE you run the code ... once edited upload both scripts and chmod /scripts/postwwwacct to 755 ( a+x )
When accounts are created and use a plan include in mod-layout.conf.php the ads specified in the config array will be forced on head and foot ..... changes take effect as soon as WHM says it created the account ...
Enjoy ....
AMC August 22nd, 2007, 08:01 Nice one Joe :) I really like some of your stuff. I do have one question though, I know bidvitiser have a way of dedecting if you have their ads on your page. Do you reckon (in your opinion) it would be possible to have a script that sent an email to you (the host) and the client to notify them that they are not placing your ads (whether they be google adsense or whatever). Maybe the script would email every 24 hours, and then after three warnings automatically suspend the account.
But ignoring all that fancy stuff, do you reckon its possible to have a script monitoring your free clients with some kind of email notification is a specific ad code is not placed. Have you heard of such a script maybe ?
Thanks, amc
krakjoe August 22nd, 2007, 08:11 Yeah in most cases it's possible ... ads are normally just a block of javascript so you use a regular expression to check that the block of code exists inside the <body></body> tags of the page ( if <body> tags ) exist ...
It might get a bit more difficult if you use one of these scripts that randomize your ad placement, like phpadsnew ( or whatever ) ... you would then have to edit the phpadsnew code and create a new lambada function ( and|or possibly regex patterns ) each time your ran the code to check for the correct format of ads ....
It would also depend on what management software you used to get a list of account, or if you used none then some sort of interface would be in order to add and remove account names you want to check, or leave out of scanning httpd.conf for all accounts .... or something that done all three ....
While it's quite easy to do that, theres a lotta ways around it .... in the simplest terms ...
<?php
$ads = '~<script language="javascript">whatever</script>~si'; # regex pattern that matches your ads
$handle = fopen( '/usr/local/apache/conf/httpd.conf', 'r' ); # httpd.conf handle
while( !feof( $handle ) ) # loop over lines
{
if( preg_match( 'ServerAlias (.*?)', fgets( $handle ), $address ) ) # try to get a serverAlias result
{
if( ( $website = file_get_contents( $address[1] ) ) )
{
if( !preg_match( $ads, $website ) )
{
// do the action here, email echo or whatever
}
}
}
}
?>
Add some code like that to a crontab every 24 hours and you're good to go ...
krakjoe August 22nd, 2007, 08:22 you should download the archive again, I messed up the message( ) function, amazingly ...
AMC August 22nd, 2007, 16:28 Wow, thanks Joe, I think ill try and set that up :)
XT-iZac August 23rd, 2007, 06:39 Thanks for the guide! Very informative :D
webadpro August 23rd, 2007, 06:59 Wow Joe, keep it up with all your ideas!
krakjoe August 23rd, 2007, 07:45 I better else I'll die of boredom ...
krakjoe September 12th, 2007, 03:10 If you get output similar to
/bin/sh: apxs: command not found
/bin/sh: apxs: command not found
/bin/sh: apxs: command not found
/bin/sh: -I: command not found
when trying to install mod_layout, you should
declare PATH=$PATH:/usr/local/apache/bin
do that .... then
make && make install
Gamer4u September 12th, 2007, 13:55 mod_layout corrupts GD images in PHP. I spent hours researching and found users reporting the problem, but no solution posted.
krakjoe September 12th, 2007, 16:30 yeah, actually it corrupts anything that uses gzcompression, mod_layout isn't compatible with gzcompressed streams, and most images use gzcompression ....
impactgc September 13th, 2007, 07:37 Great Job!
I did everything above and it doesn't seem to work.. No errors nothing.
What could I have done wrong? :)
Thanks,
Adam
krakjoe September 13th, 2007, 09:28 what do you mean by "it doesn't work" which part doesn't work ?
impactgc September 13th, 2007, 10:26 Sorry..
Ads do not show up on the users sites.
Plans are configured in the conf file as well.
Thanks,
Adam
krakjoe September 13th, 2007, 10:38 did you remember to prepend username_ to the package name ?
post the conf file without hash or send it me in a pm ....
iBrightDev September 13th, 2007, 11:49 nice one joe, i will keep this for future projects that i might have.
impactgc September 13th, 2007, 12:29 PM sent
krakjoe September 13th, 2007, 14:06 I think we got it sorted ...
alley September 13th, 2007, 21:40 This is awesome Joe!
Too bad this wasn't around when I was dabbling in the Hosting World.
is this the first forced ads script ever for cpanel accounts?
Tree September 13th, 2007, 21:43 This is awesome Joe!
Too bad this wasn't around when I was dabbling in the Hosting World.
is this the first forced ads script ever for cpanel accounts?
First free one I've ever seen.
alley September 13th, 2007, 21:47 well Joe has been known to do some real cool things for members on here.
That boy's karma/Rep should be off the map!!!
First free one I've ever seen.
krakjoe September 14th, 2007, 02:27 well Joe has been known to do some real cool things for members on here.
That boy's karma/Rep should be off the map!!!
:angel:
Glad people find it useful...
raversworld September 14th, 2007, 06:58 Do you have to be root? and can you make a script that only needs php and mysql or cgi or sumthing cause i was looking for a free script like this to incorporate my google ads
alley September 14th, 2007, 08:11 OH if it can be made, .. he can make it. The question is .. does he have the time or interest.
Do you have to be root? and can you make a script that only needs php and mysql or cgi or sumthing cause i was looking for a free script like this to incorporate my google ads
krakjoe September 14th, 2007, 08:49 It says on the second line of my original post that you do have to be root to install scripts in postwwwacct, however if you can get your host to install the code and give them the package names you want to force ads on they should be able to setup without a problem ...
Its possible to get php to insert headers and footers on pages automatically, but actually it breaks even more sites than mod_layout does, and there are other ramifications, like the ability to serve xml, and most importantly, if you're not root the only place you have to edit the php runtime is each webroot .htaccess, which can be changed by the user, and will be, quite easily ....
I think mod_layout is the only real solution to forcing content into sites.... maybe one day I'll come up with an idea and write something, but for the moment work with what you have ....
HostingMe November 5th, 2007, 10:49 Does anyone still have the zip? I downloaded it a while ago but seem to of lost it. :@ and the op doesn't have it either.
Dan
Jovial November 6th, 2007, 11:17 good script
saves it for future use
thanks joe
HostingMe November 7th, 2007, 07:20 Does no one have the zip file?
Dan
webadpro November 8th, 2007, 11:23 Great work Joe!
Keep coming with those ideas!
krakjoe November 8th, 2007, 12:57 http://interviolet.com/temp/mod-layout-php.zip
Armed November 10th, 2007, 01:02 Nice! *Bookmarked* Gonna use this later! =D
JonnyH November 20th, 2007, 10:49 Your link is broke Joe.
krakjoe November 20th, 2007, 14:11 Is later on in the thread ... http://interviolet.com/temp/mod-layout-php.zip
[JSH]John December 5th, 2007, 16:39 Thanks for the new link, this will come in handy. :)
[JSH]John December 6th, 2007, 07:57 I've been trying to get this script to work for the past hour, but can't seem to get it to show ads on any free accounts.
I've installed mod_layout, set up a free hosting plan, renamed postwwwacct.php to postwwwacct and everything else, but can't seem to figure out where I've gone wrong.
Here's my mod-layout.conf.php:
<?php
/**
* /scripts/postwwwacct configuaration for mod-layout ...
*/
$config = array(
'admine' => 'john@jshosts.com', # Administration email address, MAKE SURE YOU CAN READ THESE EMAILS
'timestamp' => DATE_RFC822, # Date format, for most people default is good
'httpd.conf' => '/usr/local/apache/conf/httpd.conf', # Location of httpd.conf to edit
'plans' => array( # Array of plans you want to apply ads on
'jslaneh_FreeHosting' # Plan one and then a comma ( if only one plan no comma needed after it's name )
),
'ads' => array(
'header' => '/home/jslaneh/public_html/adsh.html', # HTML file containing the code for header ads
'footer' => '/home/jslaneh/public_html/adsf.html' # HTML file containing the code for footer ads
),
);
?>
I'm sure I've done everything right but as you can see ( http://free.jshosts.net/ ) it doesn't seem to show any ads.
krakjoe December 6th, 2007, 08:09 Did you get any email, and did you chmod 755 /scripts/postwwwacct ??
[JSH]John December 6th, 2007, 12:01 I haven't received any emails and I've just double checked to make sure it's chmodded to 755 and yes it's chmodded.
krakjoe December 6th, 2007, 12:17 ok then, create an account that should have the ads forced, then copy paste the right frame output of whm here .... obviously something is going on ...
alternatively if you would like me to just fix it for you ... then send me a login .... there's no need to worry about trusting me ... ---- I must have about 100 logins for people on fws ... root logins ....
[JSH]John December 6th, 2007, 12:24 I trust you, I'll send you a login now, easier than keep trying things myself. :P Let me know what I did wrong or what went wrong. :)
krakjoe December 6th, 2007, 12:52 All fixed ...
FYI people, make sure there are no line breaks in the config file ... I suggest using winscp to browse remote filesystems over ssh, not using putty and text editors, especially as you'all prolly use windows and it sucks boobies ....
[JSH]John December 6th, 2007, 12:58 All fixed now, thanks :). I've just downloaded winscp, I copied and pasted the code into pico on putty so that's probably what caused the problems lol.
ppx December 27th, 2007, 22:11 Is it possible to upload this again?
I've been trying to access both links in the thread with no success.
Thanks :)
Skylar December 27th, 2007, 23:41 it sucks boobies ....
Nice wordplay there..
krakjoe December 28th, 2007, 06:00 Is it possible to upload this again?
I've been trying to access both links in the thread with no success.
Thanks :)
http://interviolet.com/temp/mod-layout-php.zip
ppx December 28th, 2007, 07:51 Thank you :D
soundey February 17th, 2008, 21:25 Please could you help me get this working?
I have followed all the steps yet it doesnt seem to display the adverts
i dont get any errors, and from what i can see all is set up ok
Thanks
krakjoe February 22nd, 2008, 06:21 http://freehostmanger.com
Decker February 22nd, 2008, 06:40 Not showing Joe!
HostingMe February 22nd, 2008, 07:22 Whats not showing?
krakjoe February 22nd, 2008, 09:28 http://www.freehostmanager.com
sorry typo ...
Patrick March 1st, 2008, 19:08 Joe, FHM was working fine a few days ago, however today when I try to access it I get this message: License Error: Invalid license key. Please contact your software vendor for support.
Any help would be greatly appreciated! :)
I also tried ordering a new license, but I'm getting the same error with the new license key... :(
Edit: My mistake, didn't see the other topic, sorry.
krakjoe March 2nd, 2008, 03:37 For everyone else with that problem, you need to download sources again from freehostmanager.com client area, we changed slightly the way we build new versions and this affected old licenses and also the ionCube license ....
Dan March 20th, 2008, 16:03 I tried installing Mod Layout following your tut Joe but being honest and truthful, I am stuck.
Getting nothing but errors.
krakjoe March 20th, 2008, 17:03 show me errors .... I will analyze and interpret them for you ....
analyze and interpret
analyze and interpret
analyze and interpret
analyze and interpret
analyze and interpret
analyze and interpret
Dan March 20th, 2008, 17:29 Ah the usual bull---- you get in SSH like,
No such file or directory
No such command, blah blah blah
Richard March 20th, 2008, 18:29 Ah the usual bull---- you get in SSH like,
No such file or directory
No such command, blah blah blah
Or more exact:
[root@freeserver mod_layout-3.2]# cd /tmp/
[root@freeserver tmp]# wget http://download.tangent.org/mod_layout-3.4.tar.gz
--23:28:15-- http://download.tangent.org/mod_layout-3.4.tar.gz
=> `mod_layout-3.4.tar.gz'
Resolving download.tangent.org... 216.39.139.198
Connecting to download.tangent.org|216.39.139.198|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41,454 (40K) [application/x-gzip]
100%[====================================>] 41,454 24.26K/s
23:28:18 (24.22 KB/s) - `mod_layout-3.4.tar.gz' saved [41454/41454]
[root@freeserver tmp]# tar xzf mod_layout-3.4.tar.gz
[root@freeserver tmp]# cd mod_layout*
[root@freeserver mod_layout-3.4]# make
`apxs -q CC` -I`apxs -q INCLUDEDIR` `apxs -q CFLAGS` -c mod_layout.c -Wall
/bin/sh: apxs: command not found
/bin/sh: apxs: command not found
/bin/sh: apxs: command not found
/bin/sh: -I: command not found
make: *** [mod_layout.o] Error 127
[root@freeserver mod_layout-3.4]# declare PATH=$PATH:/usr/local/apache/bin
[root@freeserver mod_layout-3.4]# make
`apxs -q CC` -I`apxs -q INCLUDEDIR` `apxs -q CFLAGS` -c mod_layout.c -Wall
`apxs -q CC` -I`apxs -q INCLUDEDIR` `apxs -q CFLAGS` -c utility.c -Wall
`apxs -q CC` -I`apxs -q INCLUDEDIR` `apxs -q CFLAGS` -c origin.c -Wall
`apxs -q CC` -I`apxs -q INCLUDEDIR` `apxs -q CFLAGS` -c layout.c -Wall
apxs -c mod_layout.o utility.o origin.o layout.o
gcc -shared -o mod_layout.so mod_layout.o utility.o origin.o layout.o
[root@freeserver mod_layout-3.4]# make install
strip mod_layout.so
apxs -i -a -n 'layout' mod_layout.so
[activating module `layout' in /usr/local/apache/conf/httpd.conf]
cp mod_layout.so /usr/local/apache/libexec/mod_layout.so
cp: cannot create regular file `/usr/local/apache/libexec/mod_layout.so': Text file busy
apxs:Break: Command failed with rc=1
make: *** [install] Error 1
[root@freeserver mod_layout-3.4]#
Dan March 20th, 2008, 18:44 Yeah that's it.
krakjoe March 21st, 2008, 08:05 do
which apxs
open the Makefile of mod_layout and change the line that reads ( root of source structure )
APXS=apxs
to reflect the proper path of apxs, for example
APXS=/usr/local/apache/bin/apxs
EDIT: are you not using apache2, you know there are different versions of mod_layout for different versions of apache, I thought everyone was running 2 now ??
sellwhm March 21st, 2008, 11:54 I feel like giving up on this seriously.....I am using IPanel to force ads and its a pain in the arse....I'll give you root access krakjoe and IPanel access if you have time.
Dynash March 21st, 2008, 18:14 I feel like giving up on this seriously.....I am using IPanel to force ads and its a pain in the arse....I'll give you root access krakjoe and IPanel access if you have time.
https://www.ihostdev.com/isupport/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=23&nav=0,1
if you have already done all that, have you ask iHostDev through support ticket?
sellwhm March 21st, 2008, 19:03 I found out how to install mod_layout correctly and I do have forced ads now. :) http://ralph.0cpanel.com
cd /usr/local/src
wget http://0cpanel.com/mod_layout-3.2.1.tar.gz
tar xvfz mod_layout-3.2.1.tar.gz
cd mod*
make clean
make
make install
service httpd restart
This is for apache 1.3 and make sure that you have enable curl ssl with your php4 and php5.
I ran php -q /home/someuser/public_html/ipanel/cron/cronjob.php --job=httpd_conf --debug --force --verbose to force the ads whenever I felt like the cronjob wasn't doing its job......
ihostdev March 22nd, 2008, 03:41 i would suggest reinstalling mod_layout and using v3.4 as they fixed some issues.
Chris.S June 11th, 2008, 15:58 Does anyone have the download that krakjoe posted? None of the links work anymore
krakjoe June 12th, 2008, 03:02 sorry I forgot it was there ....
http://interviolet.com/temp/mod-layout-php.zip
JonnyH August 28th, 2008, 05:10 Joe, I'm struggling to get this to work. I'm using mod layout for apache 2.2, does that affect it ?
With linebreaks do you mean the whole config. So no line breaks anywhere? I edited the config to this:
<?php $config = array('admine' => 'Jonnyhux@gmail.com','timestamp' => DATE_RFC822, 'httpd.conf' => '/usr/local/apache/conf/httpd.conf', 'plans' => array('adsplan'),'ads' => array('header' => '/home/***/adsh.html', 'footer' => '/home/***/adsf.html')); ?>
I don't think it's running at all. I edited the emails, so it sends nevermind the package and added a array at the top. Still didn't send anything..
krakjoe August 28th, 2008, 06:38 Tried using full plan names ?
JonnyH August 28th, 2008, 06:43 It's a root plan. Doesn't use usernames.
krakjoe August 28th, 2008, 06:57 Well the line breaks thing was only for if you had the comments left in, which you don't need and don't have ...
When I wrote the code apache2.2 was available, and I tested on all versions that there were, I remember, because it took forever to build all the versions ...
1. Make certain that mod_layout is installed, have a look at server signature on a 404, or make manual edits to httpd.conf to place ads on an account ( make sure you restart apache after httpd.conf edits )
2. Check the file is named /scripts/postwwwacct NOT /scripts/postwwwacct.php
3. Check permissions on the file, make certain it's executable ( +x | 0755 | 755 )
4. Add
echo "<pre>";
print_r( $whm );
print_r( $config ) ;
print_r( $email );
echo "</pre>"; right at the end of the script
5. Make an account inside of WHM as root, copy and paste all the output ( displayed after the stupid ajax thing goes away ) to a pm or this thread, so I can have a look see at it ...
JonnyH August 28th, 2008, 07:38 I think I know whats up with it.
Too bad i'm setting off soon and won't be on untill tommorrow. I'll get a response back to you.
hamster August 31st, 2008, 09:49 Anyone got a mirror for mod-layout-php.zip?
[JSH]John August 31st, 2008, 10:05 Can you not download it from the link Joe posted hamster?
http://interviolet.com/temp/mod-layout-php.zip
hamster August 31st, 2008, 20:17 Can't seem to download it from there... not surprised though, my ISP has loads of problems. Anyway, I've already gotten my friend to download it and then send it to me, so I don't need a mirror anymore :p
william232 September 8th, 2008, 03:56 Are you able to make it so it shows for a selected client of a certain reseller or hosting plan?
krakjoe September 8th, 2008, 05:51 It works per plan, so long as the root user sets up, you can force ads on whatever plans exist on the server from whatever reseller you like ...
DanTheMan November 14th, 2008, 23:20 So does this script still work with the new updates and everything?
.Andy November 15th, 2008, 13:04 iPanel is alwyas a option.
DanTheMan November 16th, 2008, 12:15 iPanel is alwyas a option.
I tried I ipanel before it wasn't what I was looking for...
Dynash November 16th, 2008, 14:33 What about just iAds?
DanTheMan November 22nd, 2008, 21:47 I was trying to go free :(
krakjoe November 30th, 2008, 12:17 Sorry bout the delay, real busy...
This was tested with all versions of apache and mod_layout, it should work with whatever you throw at it ...
You should bear in mind that, mod_layout and mod_gzip ( or any gzip compression output filters ) do not get along, lots of forums and CMS' use gzip to reduce bandwidth, as yet there is no solution or workaround other than disabling gzip compression wherever it is a problem ...
-Rsmiley- November 30th, 2008, 13:49 The tut you provided wouldnt install on my server i had to use mod layout 5.1 and your APX or w.e fix but it works now ;)
krakjoe December 1st, 2008, 02:17 This thread is quite old, I'm not surprised you had to read the whole thing, might be useful for other people if you wrote down what you did in detail ??
Glad you got it working anyway ...
-Rsmiley- December 1st, 2008, 13:55 This thread is quite old, I'm not surprised you had to read the whole thing, might be useful for other people if you wrote down what you did in detail ??
Glad you got it working anyway ...
Old yes, Useless No :)
I will sometime later write it down for others if someone dont beat me to it.
jaspert December 30th, 2008, 15:11 I've filtered though this thread for most of the day (as it has the most information related to my issues) and I still cannot get the ads to show on client sites.
-I have followed the instructions to the dot:
-downloaded mod_layout 5.1 for Apache 2.2
-unzipped & edited Makefile to show path to APXS
-make, make install....
-verified in phpinfo.php that mod_layout is showing as a handler
-downloaded and unzipped the other zip to /scripts
-edited mod-layout.conf.php to show valid values (root account packages no reseller prefix)
-renamed postwwwacct.php to postwwwacct and chmod 755
-restarted httpd.conf
On WHM account creation, I see where it runs postwwwacct:
System has 1 free ip.
Running post creation scripts (/scripts/legacypostwwwacct, /scripts/postwwwacct, /scripts/postwwwacctuser)......Done
This is my mod-layout.conf.php:
<?php
/**
* /scripts/postwwwacct configuaration for mod-layout ...
*/
$config = array(
'admine' => 'removed on purpose', # Administration email address, MAKE SURE YOU CAN READ THESE EMAILS
'timestamp' => DATE_RFC822, # Date format, for most people default is good
'httpd.conf' => '/usr/local/apache/conf/httpd.conf', # Location of httpd.conf to edit
'plans' => array( # Array of plans you want to apply ads on
'Free Hosting', # Plan one and then a comma ( if only one plan no comma needed after it's name )
'free' # Plan two NO COMMA because there are no more plans ....
),
'ads' => array(
'header' => '/home/inxangoo/public_html/ad.html', # HTML file containing the code for header ads
'footer' => '/home/inxangoo/public_html/powered.html' # HTML file containing the code for footer ads
),
);
?>
I am 100% stumped at this point and will take whatever assistance I can get.
krakjoe January 2nd, 2009, 02:22 If you'd like to PM/Email me a login for this server Il'l have a look for you ... happy new year :)
codevtechnology January 21st, 2009, 14:13 Followed the instructions.
Doesnt seem to be working
http://free.codevhosting.net
System has 0 free ips.
Running post creation scripts (/scripts/legacypostwwwacct, /scripts/postwwwacct, /scripts/postwwwacctuser)......Done
theraptor January 22nd, 2009, 13:34 'plans' => array( # Array of plans you want to apply ads on
'Free Hosting', # Plan one and then a comma ( if only one plan no comma needed after it's name )
'free' # Plan two NO COMMA because there are no more plans ....
.
Your plan names are incorrect. You want the backend plan names, which in cPanel are
'yourcpusername_planname' format. just click "edit plan" in whm to see the backend plan name
Danni_X July 16th, 2009, 16:07 Hi my friends!
where I download the script?
omar14 September 7th, 2009, 02:54 but mod_layout is no longer supported and updated .
is there another way to force ads ?
OpticHosts September 16th, 2009, 13:47 Hey Guys,
I know this thread is getting quite old, however i have been looking for something like this for some time. Just happened to really get into it today. Is there any ways to have the Scripts posted again for download. The link is broken from previous posts.
Thanks in advance.
theraptor September 16th, 2009, 16:16 you can get this file with some basic installation instructions from here. We have edited it a little to make it work better for THT, but with a little work you can use it for manual account creation/another script.
http://thehostingtool.com/forum/thread-335.html
OpticHosts September 17th, 2009, 09:20 Thank you for the prompt responce.
I have browsed your sites and seen your links i have even emailed you directly that your link for the download is broken.
http://thehostingtool.com/forum/downloads/ForcedAds.zip
Let me know if you fix this.
Thanks
theraptor September 24th, 2009, 13:57 The download link has been updated, view it here:
http://thehostingtool.com/forum/thread-335.html
|
|