<?php
include ("ad_header.php");
if (isset ($_POST['action'])) {
$action=$_POST['action'];
}
else {
die("Вы не указали действие!");
}
if ($action=="change") {
$id=$_POST['id'];
$email=$_POST['email'];
$email=mysql_escape_string($email);
$email=str_replace ('"',"'",$email);
$firstname=$_POST['firstname'];
$firstname=mysql_escape_string($firstname);
$firstname=str_replace ('"',"'",$firstname);
$lastname=$_POST['lastname'];
$lastname=mysql_escape_string($lastname);
$lastname=str_replace ('"',"'",$lastname);
$country=$_POST['country'];
$country=mysql_escape_string($country);
$country=str_replace ('"',"'",$country);
$city=$_POST['city'];
$city=mysql_escape_string($city);
$city=str_replace ('"',"'",$city);
$query="update users set email='$email',firstname='$firstname',lastname='$lastname',country='$country',city='$city' where (first='$id')";
mysql_query($query);
}

if ($action=="delete") {
$id=$_POST['id'];
$query="delete from users where (first='$id')";
mysql_query($query);
}
mysql_close ($link);
?>

<form action="ad_users.php" name=redir method=post>
<?php
if (isset($_POST['slog']) && $_POST['slog']!="") {
$magic=get_magic_quotes_gpc();
$slog=$_POST['slog'];
$spar=$_POST['spar'];
if ($magic==1) {
$slog=stripslashes($slog);
}
echo "<input type=hidden name=slog value=\"$slog\">";
echo "<input type=hidden name=spar value=\"$spar\">";
}
?>
</form>
<script language="JavaScript">
redir.submit();
</script> 