Просмотр файла superkat/edits.php

Размер файла: 5.62Kb
<?php
include "xconf.php";
header("Cache-Control: no-cache");
header ("Content-type:text/vnd.wap.wml; charset=utf-8");

print"<?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><head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>
<card id=\"edit\" title=\"&#x0418;&#x0437;&#x043C;e&#x043D;&#x0438;&#x0442;&#x044C; &#x041F;po&#x0444;&#x0438;&#x043B;&#x044C;\">
";

If (!isset($_GET['mode']) || $_GET['mode']=="no") $mode="no";
elseif ($_GET['mode']=="edit") $mode="edit";
else $mode="no";

If (!isset($_GET['id']) || !isset($_GET['pass'])){
echo "<p>B&#x0432;e&#x0434;e&#x043D;&#x044B; &#x043D;e &#x0432;ce &#x0434;a&#x043D;&#x043D;&#x044B;e!<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}
If (!is_numeric($_GET['id'])  || $_GET['id']<0 || $_GET['id']==0)

{
echo "<p>He&#x0432;ep&#x043D;o y&#x043A;a&#x0437;a&#x043D; id<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}
$pass=$_GET['pass'];
$id=$_GET['id'];
If (!preg_match('/^[a-z0-9]{1,}$/', $pass)){
echo "<p>&#x041F;apo&#x043B;&#x044C; y&#x043A;a&#x0437;a&#x043D; &#x043D;e&#x043A;oppe&#x043A;&#x0442;&#x043D;o<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}
$result=mysql_query("select * from `cool_site` where id='$id' ");
$rowse=mysql_num_rows($result);
If ($rowse==0){
echo "<p>Ta&#x043A;o&#x0433;o id &#x043D;e cy&#x0449;ec&#x0442;&#x0432;ye&#x0442;<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}
$pas=mysql_result($result,0,"pass");
If ($pas!=$pass){

echo "<p>&#x041F;apo&#x043B;&#x044C; &#x043D;e&#x0432;epe&#x043D;!<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}

if ($mode=="no"){

$link=mysql_result($result,0,"link");
$about=mysql_result($result,0,"about");
$title=mysql_result($result,0,"title");
$email=mysql_result($result,0,"email");
$cat=mysql_result($result,0,"category");
print "<p>";
print"Ha&#x0437;&#x0432;a&#x043D;&#x0438;e:<br/>
		<input type=\"text\" name=\"title\" maxlength=\"30\" value=\"$title\"/><br/>
		A&#x0434;pec:<br/>
		<input type=\"text\" name=\"link\" maxlength=\"100\" value=\"$link\"/><br/>";
		print"Ka&#x0442;e&#x0433;op&#x0438;&#x044F;:<br/><select name=\"k\" value=\"$cat\">";
		$q=mysql_query("select * from `cool_raz` where 1 order by por asc");
		while($datas = @mysql_fetch_array($q)){
		print"<option value=\"".$datas['id']."\">".$datas['text']."</option>";}
		print"</select><br/>
		O&#x043F;&#x0438;ca&#x043D;&#x0438;e:<br/>
		<input type=\"text\" name=\"about\" maxlength=\"250\" value=\"$about\"/><br/>
		Пароль<br/>
		<input type=\"text\" name=\"passw\" maxlength=\"30\" value=\"$pas\"/><br/>
		
		E-Mail:<br/>
		<input type=\"text\" name=\"email\" maxlength=\"70\" value=\"$email\"/><br/>
		<anchor>&#x0418;&#x0437;&#x043C;e&#x043D;&#x0438;&#x0442;&#x044C;&#187;
		<go href=\"edits.php?id=$id&amp;pass=$pass&amp;mode=edit\" method=\"post\">
			<postfield name=\"title\" value=\"$(title)\"/>
		<postfield name=\"passw\" value=\"$(passw)\"/>
		<postfield name=\"link\" value=\"$(link)\"/>
		<postfield name=\"about\" value=\"$(about)\"/>
		<postfield name=\"email\" value=\"$(email)\"/>
		<postfield name=\"k\" value=\"$(k)\"/>
		</go></anchor>
		";
print"<br/>-----<br/><a href=\"index.php\">Ha&#x0437;a&#x0434; B Ka&#x0442;a&#x043B;o&#x0433;</a><br/>
<br/>
</p></card></wml>";

}

if ($mode=="edit")
{
$title=coding_cool(substr(trim($title), 0, 50));
$link=coding_cool(substr(trim($link), 0, 100));
$about=coding_cool(substr(trim($about), 0, 300));
$passw=coding_cool(substr(trim($passw), 0, 30));
$email=coding_cool(substr(trim($email), 0, 70));


$res=mysql_query("select * from `cool_site` where link='".$link."'  && id<>'$id'");
$kol=mysql_num_rows($res);
 If ($kol!=0){
echo "<p>Ta&#x043A;o&#x0439; ca&#x0439;&#x0442; y&#x0436;e ec&#x0442;&#x044C;<br/> <a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}

If (!preg_match("/^(http:\/\/){1}[-0-9a-z_.]+\.[a-z]{2,4}$/i",$link)){
echo "<p>B&#x0432;e&#x0434;&#x0451;&#x043D;&#x043D;&#x044B;&#x0439; a&#x0434;pec &#x043D;e&#x0432;epe&#x043D;!<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}

If (!preg_match("/^[-0-9a-z_.]+@[0-9a-z_^\.]+\.[a-z]{2,4}$/i",$email)){
echo "<p>B&#x0432;e&#x0434;&#x0451;&#x043D;&#x043D;&#x044B;&#x0439; e-mail &#x043D;e&#x0432;epe&#x043D;!<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}

If (!title){
echo "<p>He y&#x043A;a&#x0437;a&#x043D;o &#x043D;a&#x0437;&#x0432;a&#x043D;&#x0438;e ca&#x0439;&#x0442;a!<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}

If (!about){
echo "<p>He y&#x043A;a&#x0437;a&#x043D;o o&#x043F;&#x0438;ca&#x043D;&#x0438;e ca&#x0439;&#x0442;a!<br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}

If (!preg_match("/^[a-z0-9]{1,}$/",$passw)){
echo "<p>&#x0432; &#x043F;apo&#x043B;e &#x043D;e&#x0434;o&#x043F;yc&#x0442;&#x0438;&#x043C;&#x044B;e c&#x0438;&#x043C;&#x0432;o&#x043B;&#x044B;! <br/><a href=\"edit.php\">Ha&#x0437;a&#x0434;</a><br/></p></card></wml>";
exit;
}

mysql_query("update `cool_site` set title='$title',email='$email',pass='$passw',link='$link',about='$about',category='$k' where id='$id';");
print "<p>Ba&#x0448; ca&#x0439;&#x0442; yc&#x043F;e&#x0448;&#x043D;o &#x0438;&#x0437;&#x043C;e&#x043D;e&#x043D;!!!<br/>-----<br/><a href=\"index.php\">Ha&#x0437;a&#x0434; B Ka&#x0442;a&#x043B;o&#x0433;</a><br/>

</p></card></wml>";


}
?>