Exemple #1
0
<?php

//示例(手机发送消息)
include '../SaeMemcache.php';
include '../SaeMySQL.php';
include '../My.php';
header('Content-Type:text/html;charset=utf-8');
if (MySetParameterInteger("order_id") === false) {
    MyException("缺少order_id参数");
}
if (MySetParameter("information") === false) {
    MyException("缺少information参数");
}
if (MySetParameterInteger("user_id") === false) {
    MyException("缺少user_id参数");
}
$stamp = time();
$time = date("Y-m-d H:i:s", $stamp);
$key = 'phone_to_pc【' . $user_id . '】';
//写法1:
/*
$value = SaeMemcacheRead($key);
if($value===false){
	$value = array(array("order_id"=>$order_id,"information"=>$information,"stamp"=>$stamp,"time"=>$time));
	if(SaeMemcacheSet($key,$value)===false){
		MyError("Memcache写入失败");
	}
}
else{
	$value[] = array("order_id"=>$order_id,"information"=>$information,"stamp"=>$stamp,"time"=>$time);
	if(SaeMemcacheSet($key,$value)===false){
Exemple #2
0
include 'MyPHP/My.php';
include 'MyPHP/MySQLi.php';
//参数
$user_id = MySessionGet('user_id');
if ($user_id === false) {
    MySuccess(1, '用户未登录');
}
if (MySetParameterInteger("group_id") === false) {
    MyException("缺少group_id参数或group_id不是整数");
}
if (MySetParameter("path") === false) {
    $path = '';
    //MyException("缺少path参数");
}
//权限验证
if (MySQLConnect() === false) {
    MyError('数据库连接错误');
}
$authority = MySQLSelectCell("SELECT `authority` FROM `user_group_info` WHERE `user_id` = {$user_id} and `group_id` = {$group_id}");
MySQLDisconnect();
if ((int) $authority < 2048) {
    MySuccess(2, '用户权限不足');
}
//文件保存
if (!isset($_FILES) || !isset($_FILES["file"])) {
    MyException("缺少file文件参数");
}
if (move_uploaded_file($_FILES["file"]["tmp_name"], ".../CloudDisk/{$group_id}/" . $path . $_FILES["file"]["name"]) === false) {
    MyError('文件移动失败');
}
MySuccess("http://115.159.106.238/CloudDisk/{$group_id}/" . $_FILES["file"]["name"], '文件上传成功');
Exemple #3
0
include 'MyPHP/My.php';
include 'MyPHP/MySQLi.php';
//参数
$user_id = MySessionGet('user_id');
if ($user_id === false) {
    MySuccess(1, '用户未登录');
}
if (MySetParameterInteger("group_id") === false) {
    MyException("缺少group_id参数或group_id不是整数");
}
if (MySetParameter("path") === false) {
    $path = '';
    //MyException("缺少path参数");
}
if (MySetParameter("file") === false) {
    MyException("缺少file参数");
}
//权限验证
if (MySQLConnect() === false) {
    MyError('数据库连接错误');
}
$authority = MySQLSelectCell("SELECT `authority` FROM `user_group_info` WHERE `user_id` = {$user_id} and `group_id` = {$group_id}");
MySQLDisconnect();
if ((int) $authority < 2048) {
    MySuccess(2, '用户权限不足');
}
//文件删除
if (@unlink(".../CloudDisk/{$group_id}/" . $path . $file) === false) {
    MyError('文件删除失败');
}
MySuccess(0, '文件删除成功');
Exemple #4
0
<?php 
//示例(用户注册)
include '../SAE/SaeMySQL.php';
include '../My.php';
header('Content-Type:text/html;charset=utf-8');
if (MySetParameter("username") === false) {
    MyException("缺少username参数");
}
if (MySetParameter("password") === false) {
    MyException("缺少password参数");
}
$register_stamp = time();
$register_time = "'" . date("Y-m-d H:i:s", $register_stamp) . "'";
if (SaeMySQLConnect() === false) {
    MyError("数据库连接失败");
}
$username = SaeMySQLCheck($username);
$password = SaeMySQLCheck($password);
$SQL = "INSERT INTO `user_info` (`name`, `password`, `register_time`, `last_login_time`, `last_login_stamp`)\nVALUES ({$username} , {$password}, {$register_time}, {$register_time}, {$register_stamp})\n";
$Result = SaeMySQLInsert($SQL);
if ($Result === false) {
    MySuccess("0", "账号已存在");
}
SaeMySQLDisconnect();
MySuccess($Result, "注册成功");
Exemple #5
0
<?php

//获取文件列表
//By:MoonLord
//2015.11.14
header('Content-Type:text/html;charset=utf-8');
include 'MyPHP/My.php';
include 'MyPHP/MySQLi.php';
//参数
$user_id = MySessionGet('user_id');
if ($user_id === false) {
    MySuccess(1, '用户未登录');
}
if (MySetParameterInteger("group_id") === false) {
    MyException("缺少group_id参数或group_id不是整数");
}
if (MySetParameter("path") === false) {
    $path = '';
    //MyException("缺少path参数");
}
//权限验证
if (MySQLConnect() === false) {
    MyError('数据库连接错误');
}
$authority = MySQLSelectCell("SELECT `authority` FROM `user_group_info` WHERE `user_id` = {$user_id} and `group_id` = {$group_id}");
MySQLDisconnect();
if ((int) $authority < 2048) {
    MySuccess(2, '用户权限不足');
}
//文件列表
$handle = @opendir($path);