ad.php — the convenient monetization module
1. INFO
ad.php is a lightweight, single-file monetization module for PHP websites. It redirects traffic to your offers, renders banners in predefined positions, applies language and device targeting, and respects exclusions such as bots, referrers, and repeat visits. There is no framework, no database, and no control panel — just one file that is generated by a visual configurator and included at the top of your page.
2. WHY IT IS CONVENIENT
- Single file, zero dependencies — no Composer, no vendor folder, no DB migrations. Just
ad.phpand PHP 7.4+. - Works on any hosting — shared hosting, VPS, Docker, a tiny PHP container; nothing to compile or install.
- Visual configurator — set offers, languages, banners, and exclusions in a GUI; the builder emits the final file ready to upload.
- Non-invasive integration — include it at the top of the page, place banners with
ad_banner('header'), the rest of your code stays untouched. - Built-in targeting — device (desktop / mobile), language (Accept-Language, TLD,
?lang=), and per-language offer pools. - Smart exclusions — bots, referrers, and repeat visits via cookie; nothing fires unless you explicitly allow it.
- Versionable and portable — the whole configuration is one file; back it up, roll it back, or swap it between staging and production in seconds.
3. WHAT IT DOES
At its core the module does three things: redirects traffic to your offers, renders banners in predefined positions, and applies targeting and exclusions. All of it is driven by arrays at the top of ad.php that the configurator generates for you.
- Offer redirect — a random link from the matching pool, with a configurable delay and an optional preloader bar.
- Click hijack — a tap on empty page space opens the offer in a new tab; links, buttons, and inputs are ignored.
- Language targeting — separate pools per
ru,en,de, etc., detected from query, cookie, header, or TLD. - Device targeting — separate pools for desktop and mobile, falling back to the general pool.
- Cookie protection — do not show the redirect again for N hours after it fired once.
- Referrer and bot filters — skip traffic from chosen sources (e.g.
google.com); search bots are skipped by default. - Banner positions —
header,in_content,sidebar,footer,popup; each with image, click URL, alt text, max width, or raw HTML. - Auto-output — header and footer banners can print themselves right on include.
4. HOW TO USE
Installation in four steps:
- Generate
ad.phpin the configurator and copy the file. - Upload it next to your entry script over FTP/SFTP/SSH.
- Include it at the top of the page:
<?php @include __DIR__.'/ad.php'; ?>. - Place banners where you want them:
<?php ad_banner('header'); ?>.
Typical template integration:
<?php @include __DIR__.'/ad.php'; ?>
<!DOCTYPE html>
<html>
<head>...</head>
<body>
<?php ad_banner('header'); ?>
<main>...content...</main>
<?php ad_banner('footer'); ?>
</body>
</html>
Testing tip: deploy the sample landing (index.php) and test-thanks.php next to ad.php to verify redirect, click hijack, banners, cookie protection, and language targeting in a couple of minutes on real hosting.
Excluding elements from click hijack: links, buttons, and inputs are ignored automatically. For anything else, add the data-ad-skip attribute and the ad will not fire on it.
5. WHERE TO MONETIZE
The module is vertical-agnostic — it sends traffic to whatever links you provide. It fits anywhere you already have traffic and want a lightweight revenue layer.
- Affiliate / CPA offers — rotate a pool of affiliate links, target by device or language, keep quality high with cookie protection.
- File and download sites — redirect download pages to an offer pool, exclude search engines, keep UX clean with a small preloader.
- Content and blog networks — monetize mobile traffic on article pages with in-content banners and per-language offer pools.
- Streaming and tube sites — click hijack on empty player area, popup banners, language-based offer routing.
- Directories and catalogs — header and footer banners for advertisers, sidebar banners in listing pages, no CMS changes.
- A/B and traffic arbitrage — swap the generated
ad.phpin seconds to switch the whole site to a new offer pool.
6. WORKFLOW WITH OUR FTP / SSH TOOL
Generating ad.php is only half the job — the other half is getting it onto the server quickly and safely. That is why the module pairs naturally with our FTP/SSH client: the configurator gives you a ready file, the tool puts it where it belongs, and you can immediately verify the result in a browser.
- One-step upload — drag the generated
ad.phpinto the site root over SFTP; no archive, no unpack, no permission guessing. - SSH terminal in the same app — run
php -l ad.php, tail the error log, orcurlthe landing without switching tools. - Edit in place — tweak the offer array in the built-in editor and re-upload without regenerating from scratch.
- Multi-site management — keep connections to several hosts open and push the same
ad.phpto staging and production in two clicks. - Safe rollback — the tool keeps a copy of the previous file before overwriting, so switching between two offer pools is risk-free.
- No CMS required — everything is done at the file level, which is exactly how
ad.phpis designed to be deployed.
The result is a tight loop: configure → generate → upload via FTP/SSH → test in browser, with no control panels, no database migrations, and no downtime between experiments.
7. GET STARTED
Open the configurator to build ad.php for your site, or grab the source code and deploy it on as many hosts as you like.