User Tools

Site Tools

Translations of this page:

Sidebar

Documentation index

  • New Style Rotation
hints

Hints

PHP Includes

Some people include files like

include('http://otherdomain/1.html');

or

virtual('/scj/top/top.html');

or

readfile('http://domsin/1.html')

moreover they use it may times per page.

You should NOT use it.

Why:

PHP creates page BEFORE user gets it. So if you have something like include('http://otherdomain/1.html') PHP has to load that page each time user load a page with that include.

There 2 downsides of this approach:

  • PHP create a regular connection to that host requesting a page. If you have 10 such includes - 1 request to such page generates 10 subrequests loading server.
  • If for some reason PHP won't be able to connect to that domain and load that page - it will wait and first page won't be loaded until PHP gets that include. So if that otherdomain is down - first domain will be virtually down too.

What to do:

Use only local includes. Ie virtual('/scj/top/top.html') should be include('/home/user/domain/scj/top/top.html');

if file is located at another server - ask admin to setup rsync or copy file using crontab and so on.

Including local script with parameters

Let's say you have include like

<?php
include('http://domain.com/banner.php?x=3&y=2');
?>

so you have some parameters here. You can pass it as

<?php
$_GET['x'] = 3;
$_GET['y'] = 2;
include('banner.php');
?>

Close site for some countries

Example for .htaccess

RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(RU|CN)$ [NC] 
RewriteRule ^$ http://google.com [R,L]

Count productivity from feeders

There's a common task how to select feed traders (let's say when you buy traffic at at a traffic exchange) based on it's productivity.

The easiest way is to switch on the option “add notrade as feed traders” in Cj settings - Processed Data. Thus the script will add all new referers as traders and you will be able to see all the stats for each domain you get traffic from.

hints.txt · Last modified: 2016/03/27 17:11 by admin