67 lines
1.6 KiB
PHP
67 lines
1.6 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);
|
|
}
|
|
|
|
$user_id=$_REQUEST['u_id'];
|
|
$nick=$_REQUEST['nick'];
|
|
$nick=mysql_real_escape_string($nick);
|
|
$password=$_REQUEST['password'];
|
|
$user_toban_code=$_REQUEST['user_toban_code'];
|
|
|
|
if ($user_id<>0)
|
|
{
|
|
$sql=mysql_query("select user_code from contest_nick where nick='$nick' and pwd='$password' limit 1");
|
|
if (mysql_num_rows($sql))
|
|
{
|
|
$user_code=mysql_result($sql,0,"user_code");
|
|
$match=1;
|
|
}
|
|
else
|
|
{
|
|
$match=0;
|
|
}
|
|
|
|
if($match==1){
|
|
$sql=mysql_query("select last_known_user_id,nick from contest_nick where user_code=$user_toban_code limit 1");
|
|
if (mysql_num_rows($sql))
|
|
{
|
|
$found=1;
|
|
$last_known_user_id=mysql_result($sql,0,"last_known_user_id");
|
|
$nick_to_ban=mysql_result($sql,0,"nick");
|
|
}
|
|
else
|
|
{
|
|
$found=0;
|
|
}
|
|
|
|
if ($found==1)
|
|
{
|
|
$sql=mysql_query("insert into personal_ban (user_id_from,user_id_to,user_code_from,user_code_to,nick_from,nick_to) values ($user_id,$last_known_user_id,$user_code,$user_toban_code,'$nick','$nick_to_ban')");
|
|
$output="ok";
|
|
}
|
|
else
|
|
{
|
|
$output="wrong";
|
|
}
|
|
}
|
|
else{
|
|
$output="wrong";
|
|
}
|
|
}
|
|
else{
|
|
$output="wrong";
|
|
}
|
|
print($output);
|
|
mysql_close();
|
|
?>
|