Просмотр файла mes.php

Размер файла: 3.01Kb
<?php
include "ini.php";
include "includes/header.php";
include "includes/inc_online.php";
print "<p><small>";

$id=cyr(htmlspecialchars(stripslashes(trim($id))));
$pass=cyr(htmlspecialchars(stripslashes(trim($pass))));
$dbid=cyr(htmlspecialchars(stripslashes(trim($_GET[dbid]))));

if(!empty($id)) 
{
$q = mysql_query("select id,login,pass from users where id='".$id."';"); 
}
else
{
die ($lang['empty_login']."</small></p></card></wml>");
}

if($dbid!=0)
{
if(!empty($dbid)) 
{
$qdb = mysql_query("select id,login,pass from users where id='".$dbid."';"); 
}
else
{
die ($lang['select_user_false']."</small></p></card></wml>");
}
}
$data = mysql_fetch_array($q);

$id=$data['id'];
$login=$data['login'];

if($dbid!=0)
{
$dbdata = mysql_fetch_array($qdb);
$dblogin=$dbdata['login'];
$dbpass=$dbdata['pass'];
}

if($pass!=$data['pass'])
{
die ($lang['empty_login']."</small></p></card></wml>");
}



mysql_query("update users set last='".time()."',city='0' where id='".$id."';");


switch ($mode) 
{  
  case "del":
    mysql_query("delete from messagi where kto='".$dbid."' and komu='".$id."' limit 1;");
    print $lang['mes_deleted']."<br/>";
    break;
  case "reply":
    mysql_query("DELETE FROM messagi WHERE kto='".$dbid."' and komu='".$id."' limit 1;");
    if(!empty($a))
{
if(empty($messaga)) print $lang['mes_empty']."<br/>";
else
{
$predl_que=mysql_query("select komu from messagi where kto='$id' and komu='$dbid';");
$predl_data = mysql_fetch_array($predl_que);
if(!empty($predl_data['komu'])) print $lang['patience']."<br/>";
else
{
print $lang['mes_succes1']." $dblogin ".$lang['mes_succes2']."<br/>";

$messaga=htmlspecialchars(stripslashes(trim($messaga)));
$messaga="<b>".$lang['mes_mes1']." $login:</b><br/>".$messaga."<br/>[<a href=\"./../mes.php?pass=$dbpass&amp;id=$dbid&amp;dbid=$id&amp;mode=reply\">".$lang['mes_reply']."</a>/<a href=\"./../mes.php?pass=$dbpass&amp;id=$dbid&amp;dbid=$id&amp;mode=del\">".$lang['mes_del']."</a>]";
mysql_query("insert into messagi values(0,'$id','$dbid','$messaga');");
}
}
}
else
{
print $lang['mes_for']." <b>$dblogin</b>:";
print "</small><br/>";
print "<input name=\"messaga\" type=\"text\"/><br/><small>";
print "<anchor>".$lang['ok']."
<go href=\"mes.php?id=$id&amp;dbid=$dbid&amp;pass=$pass&amp;mode=reply\" method=\"post\">
<postfield name=\"messaga\" value=\"$(messaga)\"/>
<postfield name=\"a\" value=\"b\"/>
</go>
</anchor><br/>";
}
    break;
  default:
    print $lang['mes_empty']."<br/></small></p></card></wml>";
    exit;
  break;
}

$ref=mysql_fetch_array(mysql_query("select refer from refers where userid='".$id."';"));
$link=$ref['refer'];
if(empty($link))
print "---<br/>&gt;<anchor>".$lang['back']."<prev/></anchor><br/>";
else
{
$link=preg_replace ("'&'", "&amp;", $link);
print "---<br/>&gt;<a href=\"".$link."\">".$lang['back']."</a><br/>";
}

print "&gt;&gt;<a href=\"game.php?id=$id&amp;pass=$pass\">".$lang['menu']."</a><br/>";

mysql_close();
print "</small></p></card></wml>";
?>