File size: 3.91Kb
<?php
# This is config page;
$start_time = array_sum ( explode(chr(32), microtime()) );
ini_set ('max_execution_time', 10);
ini_set ('arg_separator.output','&');
ini_set("session.use_trans_sid", true);
session_start();
$pagesize = 5; // Сообщений на странице;
$rules = './rules.tpl'; // Файл с правилами;
$this_uri = $_SERVER['PHP_SELF'];
$request = $_SERVER['REQUEST_URI'];
$copy = '<small>©</small> <a href="http://адрес сайта">его название</a>';
function tmp_page($pagetitle)
{
header ("Content-type: text/vnd.wap.wml; charset=UTF-8");
$out = '';
$out.= '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="d'.rand(10,100).'" title="'.$pagetitle.'">';
echo $out;
};
function tmp_foot()
{
global $start_time;
echo '<br/><small>['.round(array_sum(explode(chr(32),microtime()))-$start_time, 4).']</small>';
echo '</p></card></wml>';
}
function html_page($title)
{
header ("Content-type: application/xhtml+xml; charset=UTF-8");
echo'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<title>'.$title.'</title>
</head><body style="font-family:Verdana;font-size:12px;background-color:lightgreen;">';
};
function foot_html()
{
global $start_time;
echo '<p align="center">['.round(array_sum(explode(chr(32),microtime()))-$start_time, 4).']</p>';
echo'</body></html>';
}
// Подключение к БД;
mysql_pconnect ('localhost', 'greece_alb', '123') or die (mysql_error());
mysql_select_db('greece_alb') or die (mysql_error());
$password = '202cb962ac59075b964b07152d234b70'; // Пароль админа (получить md5()-хэш) по умолчанию стоит 12345;
function utf_url($string, $value, $type=0, $vals=0)
{
$out = '';
if (!$type)
{
$out .= '<a href="'.$string.'">'. to_utf($value).'</a>';
}
else {
$out .= '<anchor>'. to_utf($value) ."<go href='$string' method='post'>\r\n";
foreach ($vals as $key=>$index)
{
if (!is_numeric($key)){
$val = $key;
$print=$index;
}
else {
$val= $index;
$print='$('.$index.')';
};
$out .= "<postfield name='$val' value='$print'/>\r\n";
};
$out.= "</go></anchor>\r\n";
};
return $result =$out;
};
function to_utf ($value){
return iconv('CP1251', 'UTF-8', $value);
};
function listpages ($curr_page, $radius, $count, $url){
global $this_uri;
$result = '';
$rad=--$radius;
if ($curr_page>$radius*2 && $curr_page!=1)$result .= '<a href="'.$this_uri.'?p=1'.$url.'">1</a>...';
for ($i=$curr_page-$rad; $i<=$curr_page+$rad; $i++)
{
if ($i>=1 && $i<=$count){
if ($i!=$curr_page)$result .= '<a href="'.$this_uri.'?p='.$i.$url.'">'.$i.'</a>';
else $result .= $i;
if ($count!=$i)$result .= ',';
}
};
if ($curr_page+$radius<$count)$result .= '...<a href="'.$this_uri.'?p='.$count.$url.'">'.$count.'</a>';
return $result;
};
function sql ($val){
return mysql_fetch_array(mysql_query($val));
};
function is_active ($var, $title,$val)
{
if ($val.'x'.($val-20)==$title) echo '['.$title.'] ';
else echo utf_url ($var,$title).chr(32);
};
function is_page ($count)
{
global $p,$pagesize;
if (!isset($p))$p=1;
$pages = ceil($count/$pagesize);
$start = (($p-1) * $pagesize);
$finish = $start + $pagesize;
if ($finish >= $count) $finish=$count;
if ($p >= $pages) $p=$pages;
if (!$finish)$finish = 1;
return array('start'=>$start,'finish'=>$finish,'p'=>$p,'page'=>$page);
}
?>