Watch 1 Star 6 Fork 60

冒泡鱼 / MarkNotePHP

forked from WuSiYu / MarkNote 
Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
PHP轻量级MarkDown云记事本系统,使用GPL v2协议开源. spread retract

Clone or download
api.php 1.06 KB
Copy Edit Web IDE Raw Blame History
<?php
require_once dirname(__FILE__).'/include/user.php';
if(!hasLogin() or !isset($_REQUEST['act'])) exit();
if(!checkUsername($USERNAME)) return -1;
switch ($_REQUEST['act']) {
case 'setting':
userset($USERNAME);
break;
default:
# code...
break;
}
function userset($username){
global $sql;
if(isset($_POST['setting']) && is_array($_POST['setting'])){
$_POST['setting']['noteid']=(int)$_POST['setting']['noteid'];
$_POST['setting']['math']=isset($_POST['setting']['math'])&&$_POST['setting']['math']=='on'?1:0;
$_POST['setting']['code']=isset($_POST['setting']['code'])&&$_POST['setting']['code']=='on'?1:0;
$_POST['setting']['interval']=$_POST['setting']['interval']>2000?(int)$_POST['setting']['interval']:2000;//偷懒了,应该页面给提示的,这里不提示强制设置不低于2秒
$_POST['setting']['black']=isset($_POST['setting']['black'])&&$_POST['setting']['black']=='on'?1:0;
$json=json_encode($_POST['setting']);
$sql->query("UPDATE note_users SET settings = '$json' WHERE username = '$username'");
echo 'ok';
}else{
echo '-1';
}
}

Comment ( 0 )

You need to Sign in for post a comment

Help Search