Description of PHP-scripts usage
Deutsch Français Español Русский English
GENERAL INFORMATION

When activating PHP service for the website, the account is created on a dedicated server. The execution of all PHP-scripts is done there. Access to the following account, data upload, change and removal is accomplished via FTP with login and password (they were indicated when activating the PHP service), which you can see in the Control panel of the website.

When creating an account, the “scripts” directory is created automatically. All PHP-scripts that are called at the website pages, should be placed there. All the scripts should have the ".php" extension. Only such files are available under the direct address links. All the other files (their content) can be received only by means of PHP-scripts.
All the accounts are created with the following limitations:


HOW TO USE

 It is possible to use PHP-scripts on the website pages in the current domain via proxy mechanism:

http://SITE_ADDRESS/php/SCRIPT_NAME.php?param0=valueA&param1=valueB...&paramN=valueM

To call PHP-script in the template, PHPCODE function may be used in such a way:

<?$PHPCODE$("http://SITE_ADDRESS/php/SCRIPT_NAME.php?param0=valueA&param1=valueB...&paramN=valueM")?>

where:


This function sends GET-request to the mentioned script. The answer should be returned only in json format. It means that when using this function in the page templates, the called script shouldn't change the type of the returned data to any other (by setting the $___notjson variable, using header('Content-type: TYPE') function etc). It may be used once per page. To call several scripts on one page via GET method, you may use the source javascript code of the $PHPCODE$ function by changing the tag identifier (id) <div id="phpdiv">.

 You may use POST-requests via forms, iframe, other scripts of this domain etc, for example:

in the template file:

<script type="text/javascript">
    function updatepostdata(result) { $('#postdiv').html(result); }
</script>
<div id="postdiv"></div>
<iframe frameborder="0" src="http://SITE_ADDRESS/php/SCRIPT_NAME.php?param0=valueA&param1=valueB...&paramN=valueM"></iframe>

in the script SCRIPT_NAME.php:

<?
$___notjson=1;
if ($_POST)
{
    $ret="POST OK:<br>";
    foreach ($_POST as $i => $val) $ret.="$i=$val<br>";
    echo "<script type=\"text/javascript\">
    window.parent.updatepostdata(\"$ret\");
    </script>";
}
echo "<form action=\"http://SITE_ADDRESS/php/SCRIPT_NAME.php?param0=valueA&param1=valueB...&paramN=valueM\" method=\"POST\">
<input type=\"hidden\" name=\"field0\" value=\"test_".rand()."\">
<input type=\"submit\" value=\"Go\">
</form>";
?>


OR

 in the template file:

<script type="text/javascript">
    function updatepostdata(result) { $('#postdiv').html(result); }
</script>
<div id="postdiv"></div>
<iframe frameborder="0">
    <form action=\"http://SITE_ADDRESS/php/SCRIPT_NAME.php?param0=valueA&param1=valueB...&paramN=valueM\" method=\"POST\">
        <input type=\"hidden\" name=\"field0\" value=\"test_".rand()."\">
        <input type=\"submit\" value=\"Go\">
    </form>
</iframe>

in the script SCRIPT_NAME.php:

<?
$___notjson=1;
if ($_POST)
{
    $ret="POST OK:<br>";
    foreach ($_POST as $i => $val) $ret.="$i=$val<br>";
    echo "<script type=\"text/javascript\">
    window.parent.updatepostdata(\"$ret\");
    </script>";
}
else echo "No data<br>";
?>

There are several parameters that can be managed in the script:


Do not use __FILE__ because the scripts are executed via wrapper. And this variable is defined as the name of the wrapper script.

Attention!
1. Any attempt to use PHP-scripts for malicious actions, like sending a huge amount of HTTP-requests anywhere, will be punished by deletion the website!
2. The result of the script's work is returned in JSON FORMAT by default.

PHP LIMITATIONS

 In this realization, the following language functions are forbidden to use:

 

CHRONOLOGY OF CHANGES AND UPDATES