View file topic.php

File size: 4.53Kb
<?
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 "<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($row["level"] < 6)
{
 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=\"error\">\n";
echo "<p align=\"center\">\n";
echo "У вас нет прав доступа!\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;
} 

if (!isset($rm)) $rm = 1;
$rmaf = "maf".$rm;

if(!isset($go))
{
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=\"topic\" title=\"&#x0421;&#x043C;&#x0435;&#x043D;&#x0438;&#x0442;&#x044C; &#x0442;&#x043E;&#x043F;&#x0438;&#x043A;\">\n";
echo "<p>\n";     
echo "Новый топик:<br/>\n";
echo "<input name=\"newtopic$ref\" maxlength=\"30\" value=\"\" title=\"change\"/><br/>\n"; 
echo "<anchor title=\"go\">Изменить!<go href=\"topic.php?go=nt&amp;id=$id&amp;ps=$ps&amp;rm=$rm&amp;ref=$ref\" method=\"post\">\n";      
echo "<postfield name=\"newtop\" value=\"$(newtopic$ref)\"/>\n";
echo "</go></anchor><br/><br/>\n";        
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;
}

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=\"changed\" title=\"Топик сменен\" ontimer=\"maf.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;ref=$ref\"><timer value=\"10\"/>\n";
echo "<p>";                                                        
echo "Топик был изменен!<br/>\n";
@$newtop = str_replace(chr("13"), " ", $newtop);
@$newtop = str_replace(chr("10"), " ", $newtop);
@$newtop = str_replace("\\n", " ", $newtop);
@$newtop = trim(" $newtop ");
@$newtop = ereg_replace(" +"," ",$newtop);
@$newtop=substr($newtop,0,60);
@$newtop = str_replace("$", "$$", $newtop);     
@$newtop = str_replace("", "", $newtop);
@$newtop = str_replace("", "", $newtop); 
@$newtop = str_replace("", "", $newtop); 
@$newtop = str_replace("", "", $newtop); 
@$newtop = str_replace("", "", $newtop); 
@$newtop = str_replace("", "", $newtop); 
@$newtop = HtmlSpecialChars($newtop); 
@$newtop = str_replace("|", "&#0166;", $newtop); 
@$newtop = str_replace("'", "&#8216;", $newtop); 
@$newtop = str_replace("\\", "", $newtop); 

mysql_query ("UPDATE $rmaf SET message = '".$newtop."' WHERE klu4 = 1");
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
?>