67 lines
1.5 KiB
PHP
67 lines
1.5 KiB
PHP
<?php
|
|
// Parse with sections
|
|
$ini = parse_ini_file("conf.ini", true);
|
|
|
|
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'];
|
|
$code=$_REQUEST['e_code'];
|
|
|
|
if ($user_id<>0){
|
|
mysql_connect($ini['db']['host'],$ini['db']['user'],$ini['db']['pass']);
|
|
mysql_select_db($ini['db']['db']);
|
|
mysql_set_charset("utf8");
|
|
|
|
$sql=mysql_query("select ID from manual_history where user_id=$user_id AND code=$code limit 1");
|
|
if (mysql_num_rows($sql))
|
|
{
|
|
$id=mysql_result($sql,0,"ID");
|
|
$error=0;
|
|
}
|
|
else
|
|
{
|
|
$error=1;
|
|
}
|
|
|
|
if ($error==0)
|
|
{
|
|
$sql=mysql_query("update manual_history set msg='".$_REQUEST['message']."' where ID=$id");
|
|
}
|
|
|
|
$sql=mysql_query("select ID from manual where user_id=$user_id AND code=$code limit 1");
|
|
if (mysql_num_rows($sql))
|
|
{
|
|
$id=mysql_result($sql,0,"ID");
|
|
$error=0;
|
|
}
|
|
else
|
|
{
|
|
$error=1;
|
|
}
|
|
|
|
if ($error==0)
|
|
{
|
|
$sql=mysql_query("update manual set msg='".$_REQUEST['message']."' where ID=$id");
|
|
}
|
|
|
|
if ($error==0)
|
|
{
|
|
$output[]="ok";
|
|
}
|
|
else
|
|
{
|
|
$output[]="nok1";
|
|
}
|
|
|
|
$out=json_encode($output);
|
|
print($out);
|
|
mysql_close();
|
|
}
|
|
?>
|