virt2/api/code/ajax/page.php

21 lines
504 B
PHP
Executable File

<?php
switch(@$_POST['act']) {
case 'add_comment':
if (!$_SESSION['user_id'])die();
$_POST['abtime']=time();
$_POST['user_id']=$_SESSION['user_id'];
$_POST['act']='';
$db->add ( 'pages_comments', $_POST );
break;
case 'like':
unset($a);
unset($b);
$a['id']=$_POST['id'];
$b['likes']=$db->get_val('pages', $a, 'likes')+1;
setcookie ("page_like", $a['id'], time()+31536000, '/', $_SERVER['SERVER_NAME']);
$db->update('pages', $a['id'], $b);
echo 1;
break;
default:
}
?>