Размер файла: 5.71Kb
<?php
include 'guestbook/mylib.php';
include 'config.php';
session_start();
header("Cache-Control: no-cache");
header("Content-type: text/vnd.wap.wml");
$reg=0;
$lang=$_GET['lang'];
$agent=$_SERVER['HTTP_USER_AGENT'];
if (($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
if (isset($_SESSION['id'])) {
$uid=$_SESSION['id'];
$id=$uid;
$reg=1;
$res=pg_query($conn,"select moder from users where id='$uid';");
$moder=pg_result($res,0,0);
} else {
if ((trim($_COOKIE['Login'])!='')&&(trim($_COOKIE['Password'])!='')) {
$login=htmlspecialchars(trim($_COOKIE['Login']),ENT_QUOTES);
$pass=htmlspecialchars(trim($_COOKIE['Password']),ENT_QUOTES);
}
if (($login=='')||($pass=='')) {
$login=htmlspecialchars(trim($_GET['login']),ENT_QUOTES);
$pass=htmlspecialchars(trim($_GET['pass']),ENT_QUOTES);
$uid=htmlspecialchars(trim($_GET['uid']),ENT_QUOTES);
}
if (($login!='')&&($pass!='')) {
$res=pg_query($conn,"select id,moder from users where login='$login' and passwd='$pass';");
if (pg_numrows($res)==1) {
$reg=1;
$id=pg_result($res,0,0);
$_SESSION['id']=$id;
$moder=pg_result($res,0,1);
$timex=time();
pg_query($conn,"update users set lastact='$timex',lastagent='$agent' where id='$id';");
}
}
if (($uid!='')&&($pass!='')) {
$res=pg_query($conn,"select moder from users where id='$uid' and passwd='$pass';");
if (pg_numrows($res)==1) {
$reg=1;
$id=$uid;
$_SESSION['id']=$id;
$moder=pg_result($res,0,0);
$timex=time();
pg_query($conn,"update users set lastact='$timex',lastagent='$agent' where id='$id';");
}
}
}
$res=pg_query($conn,"select v_num from site_var where id=2;");
$numusers=pg_result($res,0,0);
$timex=time()-300;
$res_chat=pg_query($conn,"select distinct fr_u from chat where time > '$timex';");
$numchat=pg_numrows($res_chat);
if ($reg) {
$res_pmsg=pg_query($conn,"select count(*) from messages where to_u='$id';");
$pmsg=pg_result($res_pmsg,0,0);
$res_pmsg=pg_query($conn,"select count(*) from messages where to_u='$id' and flag=0;");
$npmsg=pg_result($res_pmsg,0,0);
}
pg_close($conn);
}
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.dtd">
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="MainCard" title="wap.katrinka.ru">
<p align="center">
<?php if (color_phone($agent)) { ?>
<img src="katrinka_1.gif" alt="" /><br/>
<?php } else { ?>
<img src="img/logo.wbmp" alt="" /><br/>
<?php } ?>
<?php if ($lang=='eng') { ?>
<a href="index.php">Russian Version</a><br/>
<br/>
<b>Welcome!</b><br/>
<?php if (!$reg) {
loginform(0);
print "<a href=\"regform.php?lang=eng\">FREE Registration</a><br/>\n";
print "<a href=\"passremind.php?lang=eng\">Forgot your password?</a><br/>\n";
}
?>
*******<br/>
<a href="/midi.php?lang=eng" accesskey="1">Polyphonic Ringtones For Nokia Mobile Phones</a><br/>
<?php if ($gbenable) { ?>
<a href="guestbook/english.wml" accesskey="4">Guestbook</a><br/>
<?php }
print "<a href=\"chat.php\" accesskey=\"5\">Chat (".$numchat.")</a><br/>\n";
print "<a href=\"forum.php\" accesskey=\"3\">Forum</a><br/>\n";
print "<a href=\"messages.php\" accesskey=\"6\">Private messages (".$npmsg."/".$pmsg.")</a><br/>\n";
?>
<a href="user_pref.php?lang=eng" accesskey="8">Your Profile</a><br/>
<a href="faq/" accesskey="9">FAQ</a><br/>
<br/>
<?php } else { ?>
<a href="index.php?lang=eng">English Version</a><br/>
<br/>
<?php if (!$reg) {
loginform(0);
print "<a href=\"regform.php\">Регистрация</a><br/>\n";
print "<a href=\"passremind.php\">Забыли пароль?</a><br/>\n";
} ?>
<a href="user_pref.php">Ваш Профайл</a><br/>
<br/>
<a href="nokia.php" accesskey="1">Nokia</a><br/>
<a href="users/index.php" accesskey="2">Пользователи</a><br/>
<?php if ($gbenable) { ?>
<a href="guestbook/" accesskey="4">Книга отзывов</a><br/>
<?php }
print "<a href=\"chat.php\" accesskey=\"5\">Чат (".$numchat.")</a><br/>\n";
print "<a href=\"forum.php\" accesskey=\"3\">Форум</a><br/>\n";
print "<a href=\"messages.php\" accesskey=\"6\">Личные сообщения (".$npmsg."/".$pmsg.")</a><br/>\n";
print "<a href=\"links.wml\" accesskey=\"7\">Полезные ссылки</a><br/>\n";
print "<a href=\"search.php\" accesskey=\"8\">Поиск по WAP</a><br/>\n";
?>
<a href="bbs/">Объявления</a><br/>
<a href="faq/" accesskey="9">FAQ</a><br/>
<?php } ?>
<br/>
<?php if ($lang=='eng') print "Registered users: <a href=\"users/user_search.php?lang=eng\">".$numusers."</a><br/>\n";
else print "Зарегистрировано пользователей: <a href=\"users/user_search.php\">".$numusers."</a><br/>\n"; ?>
<br/>
<a href="http://petr.putel.org"><img src="http://petr.putel.org/counters/counter.php?xking" alt="Petr`s Counters"/></a><br/>
</p>
<?php counters(); ?>
</card>
</wml>