Watch 1 Star 5 Fork 61

冒泡鱼 / MarkNotePHP

forked from WuSiYu / MarkNote 
加入码云
与超过 300 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
PHP轻量级MarkDown云记事本系统,使用GPL v2协议开源. 展开 收起

克隆/下载
api.php 1.06 KB
一键复制 编辑 Web IDE 原始数据 按行查看 历史
<?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';
}
}

评论 ( 0 )

你可以在登录后,发表评论

搜索帮助