public function ins() { $pid = isset($_GET['pid']) ? addslashes($_GET['pid']) : die("no pid"); $tex = isset($_POST['tex']) ? addslashes($_POST['tex']) : die("no pid"); $type = isset($_GET['type']) ? addslashes($_GET['type']) : "page"; $json = array(); $json['bool'] = 0; $pc = new PageComment(); $pc->comment_text = $tex; $pc->comment_date = leap_mysqldate(); $pc->comment_author = Account::getMyID(); $pc->comment_page_id = $pid; $pc->comment_type = $type; $json['bool'] = $pc->save(); die(json_encode($json)); }