File size: 7.62Kb
<?php
//POWERED by ILI
// ICQ : 197042
//site: ili.wab.ru
// ilichat v4.0
error_reporting(0);
require_once"./includes/functions/gzip.php";
include('start.php');
include("config.php");
include("./includes/".$ver."/banned");
list($msec, $sec) = explode(chr(32), microtime());
$headtime = $sec + $msec;
$nocache = rand(0, 999999999);
switch($ver)
{
////////////////////////////////////////////////////////
//WML VERSION
////////////////////////////////////////////////////////
case 'wml':
header("Content-type: text/vnd.wap.wml; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");
//AUTH
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT `friends` FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");
if(mysql_affected_rows() == 0)
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
echo "<card title=\"ERROR\" ontimer=\"index.php?ver=wml\"><timer value=\"15\"/><p align=\"left\">\n";
echo "<small>Ошибка авторизации!<br/>\n";
list($msec, $sec) = explode(chr(32), microtime());
echo "<br/>[".round(($sec+$msec)-$headtime,5)."] sec<br/>\n";
echo "</small>";
require_once "includes/functions/gzip_foot.php";
echo "</p></card></wml>";
ob_end_flush();
exit();
}
//END AUTH
//USER DATA
$user = mysql_fetch_array($q);
$fr = $user['friends'];
//END USER DATA
//DELETE A FRIEND
if(isset($_GET['go'])){
$unuser = intval($_POST['unuser']);
$fr = str_replace($unuser."|","",$fr);
mysql_query ("UPDATE chat_users SET friends = '".$fr."' WHERE id = '".$id."'");
$nkuq = mysql_query("SELECT `nickname` FROM `chat_users` WHERE `id` = '".$unuser."';");
$nku = mysql_result($nkuq, 0);//nick unusera :)
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
echo '<card id="ok" title="Ok" ontimer="frlist.php?'.SID.'&nocache='.$nocache.'"><timer value="10"/>';
echo '<p align="left">';
echo "<small>$nku удален из вашего списка друзей\n";
list($msec, $sec) = explode(chr(32), microtime());
echo "<br/>[".round(($sec+$msec)-$headtime,5)."] sec<br/>\n";
echo "</small>";
require_once "includes/functions/gzip_foot.php";
echo "</p></card></wml>";
ob_end_flush();
exit();
}
//END DELETE A FRIEND
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"><wml>';
echo '<card id="frlist" title="Друзья">';
echo '<p>';
if (strpos ($fr,"|") !== false){
echo "Нажмите на звездочку рядом с ником для удаления юзера из Вашего списка друзей:<br/>\n";
$record=split("\|", $fr);
$num=count($record)-1;
if(IsSet($_GET['s']))$s = intval($_GET['s']);
if(!IsSet($s))$s=1;
@$max=round(($num/10)+0.45);
echo "Стр. $s из $max<br/>\n";
$ot=(($s-1)*10);
$do=$s*10;
//CYCLE
for ($i=$ot;$i<$do;$i++){
if($i>=$num)break;
$adr=$record[$i];//id druga
$nkdq = mysql_query("SELECT `nickname` FROM `chat_users` WHERE `id` = '".$adr."';");
$nkd = mysql_result($nkdq, 0);//nick druga
echo "<a href=\"letters.php?".SID."&toid=$adr&mod=send&nocache=$nocache&ver=html\">$nkd</a>\n";
echo "<anchor title=\"go\">*<go href=\"frlist.php?".SID."&go=del&nocache=".$nocache."\" method=\"post\">\n";
echo "<postfield name=\"unuser\" value=\"$adr\"/>\n";
echo "</go></anchor><br/>\n";
}
//END CYCLE
$next=$s+1;
$prev=$s-1;
echo"*********<br/>\n";
if ($max>$s) {
echo "<a href=\"frlist.php?".SID."&s=$next\">След.10</a><br/>\n";
}
if(1<$s) {
echo "<a href=\"frlist.php?".SID."&s=$prev\">Пред.10</a><br/>\n";
}
} else {
echo "У вас нет друзей!<br/>\n";
}
echo "<a href =\"letters.php?".SID."&nocache=".$nocache."\">Ваши письма</a><br/>\n";
echo "<a href=\"menu.php?".SID."&ver=html\">Меню чата</a><br/>\n";
list($msec, $sec) = explode(chr(32), microtime());
echo "<br/>[".round(($sec+$msec)-$headtime,5)."] sec<br/>\n";
require_once "includes/functions/gzip_foot.php";
echo "</p></card></wml>";
ob_end_flush();
break;
////////////////////////////////////////////////////////
//HTML VERSION
////////////////////////////////////////////////////////
case 'html':
$my_title = "Embassies";
if(!isset($_COOKIE['theme'])) $_COOKIE['theme'] = 1;
include_once "themes/".intval($_COOKIE['theme'])."/index.php";
//AUTH
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT * FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");
if(mysql_num_rows($q) == 0)
{
echo "Ошибка авторизации!<br/>\n";
include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
exit();
}
//END AUTH
//USER DATA
$user = mysql_fetch_array($q);
$fr = $user['friends'];
//END USER DATA
//DELETE A FRIEND
if(isset($_GET['go'])){
$unuser = intval($_GET['unuser']);
$fr = str_replace($unuser."|","",$fr);
mysql_query ("UPDATE chat_users SET friends = '".$fr."' WHERE id = '".$id."'");
$nkuq = mysql_query("SELECT `nickname` FROM `chat_users` WHERE `id` = '".$unuser."';");
$nku = mysql_result($nkuq, 0);//nick unusera :)
echo "$nku удален из вашего списка друзей\n";
include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
exit();
}
//END DELETE A FRIEND
if (strpos ($fr,"|") !== false){
echo "Нажмите на звездочку рядом с ником для удаления юзера из Вашего списка друзей:<br/>\n";
$record=split("\|", $fr);
$num=count($record)-1;
if(isset($_GET['s']))$s = intval($_GET['s']);
if(!isset($s))$s=1;
@$max=round(($num/10)+0.45);
echo "Стр. $s из $max<br/>\n";
$ot=(($s-1)*10);
$do=$s*10;
//CYCLE
for ($i=$ot;$i<$do;$i++){
if($i>=$num)break;
$adr=$record[$i];//id druga
$nkdq = mysql_query("SELECT `nickname` FROM `chat_users` WHERE `id` = '".$adr."';");
$nkd = mysql_result($nkdq, 0);//nick druga
echo "<a href=\"letters.php?".SID."&toid=$adr&mod=send&nocache=$nocache&ver=html\">$nkd</a>\n";
echo "<a href=\"frlist.php?".SID."&go=del&unuser=$adr&nocache=".$nocache."&ver=html\">*</a><br/>\n";
echo "<br/>\n";
}
//END CYCLE
$next=$s+1;
$prev=$s-1;
echo"*********<br/>\n";
if ($max>$s) {
echo "<a href=\"frlist.php?".SID."&s=$next\">След.10</a><br/>\n";
}
if(1<$s) {
echo "<a href=\"frlist.php?".SID."&s=$prev\">Пред.10</a><br/>\n";
}
} else {
echo "У вас нет друзей!<br/>\n";
}
echo "<a href =\"letters.php?".SID."&nocache=".$nocache."&ver=html\">Ваши письма</a><br/>\n";
echo "<a href=\"menu.php?".SID."&ver=html\">Меню чата</a><br/>\n";
include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
break;
}
?>