A szövetségesek parancsnoksága a közelmúltban szerzett tudomást egy szupertitkos náci atomfegyver fejlesztõ laboratóriumról, ami egy kis farm alatt
We will make a very simple block that shows the pages visited in our site the day before. We'll have a single query and a single value, in order to make things easier. Our block is called "hits",
so the complete name of the block will be block-hits.php
First of all, we open the php tag
<?php
Then we insert the protection script we've seen before:
if (eregi("block-hits.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
And now we insert the variables that we want to call (in this case the parameter $prefix and $dbi, which handles the database abstraction):
global $prefix, $dbi;
Now we continue inserting the query that reads from the database how many pages were seen in our site: (the instruction would be "read the first line value of the table nuke_counter in the cell
count")
$result = sql_query("select count from "$prefix."_counter
order by type desc limit 0.1", $dbi);
list($count) = sql_fetch_row($result, $dbi);
Finally, we pass the "$content" variable that will be echoed by the block and close the PHP tag:
$content. = $count
?>
Our complete script will be :
<?php
if (eregi("block-hits,php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
global $prefix, $dbi;
$result = sql_query("select count from "$prefix."_counter
order by type desc limit 0.1", $dbi);
list($count) = sql_fetch_row($result, $dbi);
$content. = $count
?>