Просмотр файла mafia/mafhist.php

Размер файла: 4.5Kb
<?
header("Cache-Control: no-cache");
header("Content-type:text/vnd.wap.wml");  
$ref=rand(10000,1000000);
require("inc.php");
$link = @mysql_pconnect ($MySQL_Hostname, $MySQL_Username, $MySQL_Password)
                or die ("<wml>
<card id=\"error\" title=\"error\">
<do type=\"prev\" label=\"Back\"><prev/></do><p align=\"center\">Can not connect to MySQL</p>
</card>
</wml>");
     
     @mysql_select_db($MySQLDatabasename) or die ("<wml>
<card id=\"error\" title=\"error\">
<do type=\"prev\" label=\"Back\"><prev/></do><p align=\"center\">error select the database...</p>
</card>
</wml>");  

        $result = @mysql_query ("Select * from mafusers where id='".$id."'");
         
         if (mysql_affected_rows() == 0) {
          echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<card id=\"error\" title=\"&#x041E;&#x0448;&#x0438;&#x0431;&#x043A;&#x0430;\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>\n";
echo "<p align=\"center\">\n";
echo "User was not found\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close($link);
exit;
}
                
$row = mysql_fetch_array ($result);
if ($ps !== $row["pass"]){
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"error\" title=\"&#x041E;&#x0448;&#x0438;&#x0431;&#x043A;&#x0430;\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>\n";
echo "<p align=\"center\">\n";
echo "Your login failed\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close($link);   
exit;
}  
if (!isset($rm)) $rm = 1;
$rmaf = "maf".$rm;
$ringame = "ingame".$rm;    
         
$us=$row["user"]; 
$smset = $row["smiles"]; 

//В игре человек или нет:
mysql_query ("select * from $ringame WHERE gamer_id = '".$id."'");
if (mysql_affected_rows()!=0) $gmes = 1; else $gmes = 0;
  
  //if ($rm<0||$rm>9) exit; 
  //$room="room".$rm;

$max = $row["max"];    
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"history\" title=\"Р?стория\">\n";
echo "<do type=\"options\" name=\"refresh\" label=\"Обновить\"><go href=\"maf.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;ref=$ref\"/></do>\n";
echo "<p mode=\"wrap\">\n"; 

echo "<a href=\"maf.php?id=$id&amp;ps=$ps&amp;rm=$rm#add\">Сказать</a><br/>\n";
echo "<a href=\"maf.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;ref=$ref\">Обновить</a>\n";
$res = @mysql_query ("Select * from $rmaf order by id desc LIMIT 400");
$kol = mysql_affected_rows();   
@$total=$kol -1;
if (!isset($num)) $num=0; 
$ignor = $row["ignor"];
$mread = $num; 
for ($i = 1; $i<=$num; $i++) $data = mysql_fetch_array ($res);
$i = $num;
while (($mread < $num+$max)&&($i<=$total)){ 
$data = mysql_fetch_array ($res);
$date = $data["time"];
$name = $data["who"];
$usid = $data["usid"];
$msg = $data["message"];
//echo "$message<br/>\n"; 
$gm = $data["gamemes"];
if ($smset==0&&$data["messagewosm"]!="") $msg = $data["messagewosm"]; 
if ($smset==2&&$data["messagewoasm"]!="") $msg = $data["messagewoasm"];
$time = $data["id"];
$th = $data["towhom"]; 
$hid = $data["hid"];
 $i++;    
 if ((strpos($ignor, $name."|") === false)&&(($hid != 2)||($id == $usid))&&($gmes==0||($gmes==1&&$gm==1))){
if ($th == "") {
echo "<br/><b><a href=\"inside.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;nk=$usid&amp;ref=$ref\">$name</a></b>($date)&gt;$msg\n"; $mread++;}
else if (($th == $id)||($id == $usid)){ 
echo "<br/><b><a href=\"inside.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;nk=$usid&amp;ref=$ref\">$name</a>[P!]</b>($date)&gt;$msg\n";$mread++;}
}    
}
mysql_close ($link);
$page_next = $num + $max-1;
$page_prev = $num - $max+1;
if ($num + $max < $total) {
echo "<br/><a href=\"mafhist.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;num=$page_next\">&gt;&gt;&gt;</a>";
}
if ($num >= $max) {
echo "<br/><a href=\"mafhist.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;num=$page_prev\">&lt;&lt;&lt;</a>\n";
}
echo "<br/><a href=\"enter.php?id=$id&amp;ps=$ps\">На улицу</a>\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n"; 
?>