View file game/chat/frlist.php

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.'&amp;nocache='.$nocache.'"><timer value="10"/>';
echo '<p align="left">';
echo "<small>$nku удален из вашего &#x441;&#x43F;&#x438;&#x441;&#x43A;&#x430; &#x434;&#x440;&#x443;&#x437;&#x435;&#x439;\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 "&#x41D;&#x430;&#x436;&#x43C;&#x438;&#x442;&#x435; &#x43D;&#x430;  &#x437;&#x432;&#x435;&#x437;&#x434;&#x43E;&#x447;&#x43A;&#x443; &#x440;&#x44F;&#x434;&#x43E;&#x43C; &#x441; &#x43D;&#x438;&#x43A;&#x43E;&#x43C; &#x434;&#x43B;&#x44F; &#x443;&#x434;&#x430;&#x43B;&#x435;&#x43D;&#x438;&#x44F; &#x44E;&#x437;&#x435;&#x440;&#x430; &#x438;&#x437; &#x412;&#x430;&#x448;&#x435;&#x433;&#x43E; &#x441;&#x43F;&#x438;&#x441;&#x43A;&#x430; &#x434;&#x440;&#x443;&#x437;&#x435;&#x439;:<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."&amp;toid=$adr&amp;mod=send&amp;nocache=$nocache&amp;ver=html\">$nkd</a>\n";
echo "<anchor title=\"go\">*<go href=\"frlist.php?".SID."&amp;go=del&amp;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."&amp;s=$next\">След.10</a><br/>\n";
}
if(1<$s) {
echo "<a href=\"frlist.php?".SID."&amp;s=$prev\">Пред.10</a><br/>\n";
}
} else { 
echo "У вас нет друзей!<br/>\n";
}        
echo "<a href =\"letters.php?".SID."&amp;nocache=".$nocache."\">Ваши письма</a><br/>\n";
echo "<a href=\"menu.php?".SID."&amp;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 удален из вашего &#x441;&#x43F;&#x438;&#x441;&#x43A;&#x430; &#x434;&#x440;&#x443;&#x437;&#x435;&#x439;\n";
include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
exit();
}  
//END DELETE A FRIEND

if (strpos ($fr,"|") !== false){
echo "&#x41D;&#x430;&#x436;&#x43C;&#x438;&#x442;&#x435; &#x43D;&#x430;  &#x437;&#x432;&#x435;&#x437;&#x434;&#x43E;&#x447;&#x43A;&#x443; &#x440;&#x44F;&#x434;&#x43E;&#x43C; &#x441; &#x43D;&#x438;&#x43A;&#x43E;&#x43C; &#x434;&#x43B;&#x44F; &#x443;&#x434;&#x430;&#x43B;&#x435;&#x43D;&#x438;&#x44F; &#x44E;&#x437;&#x435;&#x440;&#x430; &#x438;&#x437; &#x412;&#x430;&#x448;&#x435;&#x433;&#x43E; &#x441;&#x43F;&#x438;&#x441;&#x43A;&#x430; &#x434;&#x440;&#x443;&#x437;&#x435;&#x439;:<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."&amp;toid=$adr&amp;mod=send&amp;nocache=$nocache&amp;ver=html\">$nkd</a>\n";
echo "<a href=\"frlist.php?".SID."&amp;go=del&amp;unuser=$adr&amp;nocache=".$nocache."&amp;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."&amp;s=$next\">След.10</a><br/>\n";
}
if(1<$s) {
echo "<a href=\"frlist.php?".SID."&amp;s=$prev\">Пред.10</a><br/>\n";
}
} else { 
echo "У вас нет друзей!<br/>\n";
}        
echo "<a href =\"letters.php?".SID."&amp;nocache=".$nocache."&amp;ver=html\">Ваши письма</a><br/>\n";

echo "<a href=\"menu.php?".SID."&amp;ver=html\">Меню чата</a><br/>\n";
include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
break;
}
?>