|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/junsu/ |
Upload File : |
<?
include "$DOCUMENT_ROOT/conf/conf_dir.php";
header("Content-Type:application/json");
// 추천 유무
$point =10;
$benddate = get_db("SELECT no FROM board_chuchun where module_name='$division' and module_no='$num' and uid_fk='$sessionIDX'");
if($benddate){
$update_query = "update $division set voted_count = voted_count-1 where no='$num'";
$results = mysql_query($update_query,$db_con);
$query = "delete from board_chuchun where module_no='$num' and module_name='$division' and uid_fk='$sessionIDX'";
$result = mysql_query($query,$db_con);
//포인트 삭제
$poi_action = "いいね";
$point_query = "update user_point set poi_type = 'N',poi_datetime=now() where mem_id='$sessionIDX' and module_name='$division' and module_no='$num' and poi_action='$poi_action'";
$poi_result = mysql_query($point_query,$db_con);
$point_user_query = "update user set m_point = m_point-$point where id='$sessionIDX'";
$user_results = mysql_query($point_user_query,$db_con);
$check_user =0;
}else{
$file_query = "INSERT INTO board_chuchun (module_no,module_name,uid_fk,reg_date)
VALUES
('$num','$division','$sessionIDX',now())";
$result = mysql_query($file_query,$db_con);
$update_query = "update $division set voted_count = voted_count+1 where no='$num'";
$results = mysql_query($update_query,$db_con);
//포인트 주기
$poi_action = "いいね";
$point_no = get_db("SELECT poi_id FROM user_point where module_name='$division' and module_no='$num' and mem_id='$sessionIDX' and poi_action='$poi_action'");
if($point_no){
$point_query = "update user_point set poi_type = 'Y',poi_datetime=now() where poi_id='$point_no'";
$poi_result = mysql_query($point_query,$db_con);
}else{
$contents_name = get_db("select subject from $division where no='$num'");
$point_query = "INSERT INTO `user_point` (`poi_id`, `module_no`, `module_name`, `mem_id`, `poi_datetime`, `poi_content`, `poi_point`, `poi_type`, `poi_related_id`, `poi_action`) VALUES
('', '$num', '$division', '$sessionIDX', now(), '$contents_name', '$point', 'Y', '$sessionIDX', '$poi_action')";
$poi_result = mysql_query($point_query,$db_con);
}
$point_user_query = "update user set m_point = m_point+$point where id='$sessionIDX'";
$user_results = mysql_query($point_user_query,$db_con);
$check_user =1;
}
$voted_count = get_db("SELECT voted_count FROM $division where no='$num'");
$data = array(
'checkUser' => $check_user,
'now' => $voted_count
);
echo json_encode($data);
?>