77 lines
2.0 KiB
PHP
77 lines
2.0 KiB
PHP
<?php
|
|
$ini = parse_ini_file("conf.ini", true);
|
|
|
|
mysql_connect($ini['db']['host'],$ini['db']['user'],$ini['db']['pass']);
|
|
mysql_select_db($ini['db']['db']);
|
|
|
|
if ($ini['db']['log']=="1"){
|
|
$arrival_time=microtime(true);
|
|
$filename=basename(__FILE__);
|
|
$filename="log_".$filename.".txt";
|
|
$chunck=strval($arrival_time)." ".$_SERVER['REQUEST_URI']."\r\n";
|
|
file_put_contents($filename,$chunck,FILE_APPEND);
|
|
}
|
|
|
|
$ID=$_REQUEST['picture_id'];
|
|
$user_id=$_REQUEST['u_id'];
|
|
$password_ban=$_REQUEST['password_ban'];
|
|
|
|
$sql=mysql_query("select user_id from manual_picture where ID=$ID");
|
|
if (mysql_num_rows($sql)){
|
|
$user_toban_id=mysql_result($sql,0,"user_id");
|
|
}
|
|
else{
|
|
$user_toban_id=0;
|
|
}
|
|
|
|
$sql=mysql_query("select * from banned where user_id=$user_toban_id");
|
|
if (mysql_num_rows($sql)){
|
|
$banned=1;
|
|
$output="already";
|
|
}
|
|
else{
|
|
$banned=0;
|
|
}
|
|
|
|
if($banned==0){
|
|
$sql=mysql_query("select canbemoderator,nick from contest_nick where last_known_user_id=$user_id order by date_firstlog desc limit 1");
|
|
if (mysql_num_rows($sql)){
|
|
$moderator=mysql_result($sql,0,"canbemoderator");
|
|
$moderator_nick=mysql_result($sql,0,"nick");
|
|
}
|
|
else{
|
|
$moderator=0;
|
|
}
|
|
|
|
if ($moderator==1){
|
|
if ($password_ban==91280){
|
|
$sql=mysql_query("delete from manual_picture where ID=$ID");
|
|
$sql=mysql_query("select last_known_user_id,canbemoderator,nick from contest_nick where last_known_user_id=$user_toban_id limit 1");
|
|
if (mysql_num_rows($sql)){
|
|
$canbemoderator=mysql_result($sql,0,"canbemoderator");
|
|
if ($user_toban_id<>0 && $canbemoderator==0){
|
|
$sql=mysql_query("insert into banned (user_id,banned_by) values ($user_toban_id,'$moderator_nick')");
|
|
}
|
|
}
|
|
else{
|
|
if ($user_toban_id<>0){
|
|
$sql=mysql_query("insert into banned (user_id,banned_by) values ($user_toban_id,'$moderator_nick')");
|
|
}
|
|
}
|
|
$output="ok";
|
|
}
|
|
else{
|
|
$output="wrongpwd";
|
|
}
|
|
}
|
|
else{
|
|
$output="nomod";
|
|
}
|
|
}
|
|
else{
|
|
$output="nomod";
|
|
}
|
|
print($output);
|
|
mysql_close();
|
|
?>
|