Using PHP

Now the site is made with PHP.
It was done with the help of a few utilities and in spite of configuration problems with Windows and Linux.
I found many advantages: maintenance is easier because it is an excellent preprocessor and it is a good way to remove the Javascript functions which made the site difficult to copy and unfriendly to a few navigators.
PHP can manipulate files on the server and control MySQL databases.
PHP can also collect (from the HTTP protocol) public data about you:

 and is interesting for curious people:

A disadvantage, however, the pages are heavier for recent navigators and browsing is slower.
Sending compressed CSS and compressed pages with the function ob_start("ob_gzhandler"); can counterbalance this drawback.

Thus PHP generates this site pages according to the identified browser and the user style and javascript preferences (for this page min 14k/max 19k).
Your navigator is identified as:
CCBot/2.0 (
You can choose only HTML (if your "referrer" is not blocked).
Thus it's useless to generate a message for the problems related to Javascript or CSS2.
The pages may also be loaded more rapidly if you accept javascript.

PHP as a preprocessor

All the pages of the site generated for recent navigators need the following lines:

<link rel="stylesheet" href="css/style_old_nn4.css" type="text/css">
<style type="text/css">
@import url(css/style2.css);
if (strstr($HTTP_USER_AGENT,"MSIE 5") && !strstr($HTTP_USER_AGENT,"Opera"))
echo "@import \"css/style2ie5.5.css\"";

Thus they are in an included file thanks to a script in all the pages:


One included file allows the generation of the two versions of this page.
You can insert any text (HTML or not) outside PHP tags, a PHP or Javascript script...
Maintenance is easier and the size of the site on the server is much smaller (for this site divided by more than 3).
topTop of the page

PHP to replace Javascript

PHP and Javascript can sometimes carry out the same tasks.
It was the case for the menus.
Javascript makes it possible to considerably reduce the weight of the pages, this is not the case of PHP.
In the French version of the site -or the other version of the site- intended to navigators that do not interpret Javascript, the following functions replaced those of the file fonctions.js.

topTop of the page

PHP and javascript

PHP is on the server side and generates HTML pages. It isn't aware of the user settings unless from a form or by sending variables.
Javascript is on the user side and thus can get almost any information about the user's current settings.

PHP -> javascript

A PHP variable can easily be used by javascript. The script to protect a website email can use both languages:
$text="Contact (with a fake address)";
<script type="text/javascript">
var at="@";
var text="<?php echo $text;?>";
var name="my_name";
var hote="my_isp.xy";
document.write("<a hr"+"ef=mai"+"lto:"+name+at+hote+">"+text+"</a>");
$text="Contact (with a fake address)";
echo '
<script type="text/javascript">
var at="@";
var text="'.$text.'"
var name="my_name";
var hote="my_isp.xy";
document.write("<a hr"+"ef=mai"+"lto:"+name+at+hote+">"+text+"</a>");

A script can also generate a list of addresses from a file on the server.

javascript -> PHP

To send information to PHP such as the screen size, the window size with Mozilla, the mouse position or to know if javascript is enabled or to get any information on the user's side, you have to use a form.
This is a real problem as Opera, for example, asks the user whether he accepts to send uncrypted data, you must be sure that javascript is interpreted and write the scripts if it is not.
As an example, here is a html page with a PHP script from php faqts allowing you to know if javascript is enabled:

It works, but the page must be called twice, if you call another page you will have to assume that the visitor has kept the same settings... Use javascript and only test that the content is still displayed if it is not enabled.
The mirror of a website using this technique may not work.

Here is another method without a form but with the same problems

that you can test here.

topTop of the page

PHP and mirrors

With a site made in php (asp, cfm) you must identify the navigator which will be used to browse the capture.
As the code is on the server, it is difficult to interpret the source as PHP can calculate addresses, generate routines in Javascript, generate all kinds of documents, carry out calculations etc...
Moreover, PHP is often used to stop robots or to slow them down. It does it very easily even if it discourages some readers.
If there is no map of the site, the dynamically generated menus will be generally unusable. You can always note the addresses when you visit the site and add them in the addresses to be captured or the scan rules, but it is a lot of work.
You can also examine the Internet cache, but the obstacles are numerous.
PHP (as Javascript) makes it possible to build mono-page sites. In these extreme cases, no solution off-line.
As a simpler example, the page displaying the visitors' country log file uses a form which does not allow the copy of one of the sorted lists:
echo "
<form action=\"$PHP_SELF\" method=\"post\">
<input type=\"submit\" name=\"tri\" value=\"";
if $tri is empty then it is the first time the page has been loaded,
if not, value receives $message3 or $message4 for a possible button click
if ($tri==$message3 || $tri=="") echo $message4;
else echo $message3;
echo "\">

The page is generated according to the variable $tri, any form could have set other values (or send variables -even arrays- that can be tested): only the first (or last) loaded page can be copied (and linked).

Several examples can give you ideas, but although WinHttrack does a good job, a whole site in PHP is rarely functional off-line, seldom "well written" and without bugs.
As for this site, PHP made its capture easier before banned some offline browsers, but as Javascript remains for recent navigators, it may be necessary, in spite of the presence of the site map, to download the js files in MSIE cache and modify the extensions or identify your utility (HTTrack is sometimes filtered) as an old browser (MSIE 4 if you use MSIE) and untick accept cookies.
topTop of the page

With javascript