本文整理汇总了PHP中scriptReturn函数的典型用法代码示例。如果您正苦于以下问题:PHP scriptReturn函数的具体用法?PHP scriptReturn怎么用?PHP scriptReturn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scriptReturn函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: myQuery
} else {
if (!underPath($file)) {
$return['error'] = true;
$return['errorText'][$db_name] = 'is not in your image path';
} else {
if (!rename($file, $destination)) {
$return['error'] = true;
$return['errorText'][$db_name] = 'could not be deleted';
} else {
if ($ext == 'jpg') {
// delete database entry if it is an image
//$q = new myQuery("SELECT id FROM img WHERE name='{$db_name}'");
//$id = $q->get_one();
$q = new myQuery("DELETE FROM img WHERE name='{$db_name}'");
if ($q->get_affected_rows() != 1) {
//$return['error'] = true;
$return['errorText'][$db_name] = 'deleted (not from db)';
} else {
$return['errorText'][$db_name] = 'deleted';
}
//$q = new myQuery("DELETE FROM tag WHERE id='{$id}'");
}
}
}
}
}
}
}
}
scriptReturn($return);
exit;
示例2: auth
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/include/main_func.php';
auth();
$return = array('error' => false, 'errorText' => '');
// register logout
$q = new myQuery("UPDATE login SET logouttime=NOW() WHERE user_id='{$_SESSION['user_id']}' \n AND logouttime IS NULL ORDER BY logintime DESC LIMIT 1");
// remove any persistent cookies
setcookie('user_id', '', time() + 60 * 60 * 24 * 365, '/', $_SERVER['SERVER_NAME']);
setcookie('id_hash', '', time() + 60 * 60 * 24 * 365, '/', $_SERVER['SERVER_NAME']);
//setcookie('email', '', time()+60*60*24*365, '/', $_SERVER['SERVER_NAME']);
session_destroy();
scriptReturn($return, true);
// don't wait for tmp dir emptying
require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/dirTmpEmpty.php';
示例3: scriptReturn
//检查是否是正常文件
if ($_FILES["upload"]["error"] > 0) {
scriptReturn('', '未选择文件', 422);
}
//图片大小不能超过4M,像素宽高不能超过4000
if (filesize($_FILES['upload']['tmp_name']) > 4 * 1024 * 1024) {
scriptReturn('', '图片大小不能超过4M', 422);
}
$imageInfo = getimagesize($_FILES['upload']['tmp_name']);
if (!$imageInfo || $imageInfo[0] > 4000 || $imageInfo[1] > 4000) {
scriptReturn('', '图片像素宽高不能超过4000', 422);
}
//上传处理
$fileExt = pathinfo($_FILES['upload']['name'], PATHINFO_EXTENSION);
$target = UPLOAD_DIR . "/" . basename($_FILES['upload']['tmp_name']) . ".{$fileExt}";
//如果需要裁剪图片则裁剪,不需要直接保存
if (isset($_POST['x']) && isset($_POST['y']) && !empty($_POST['w']) && !empty($_POST['h']) && !empty($_POST['iw'])) {
cropImage($target, $_FILES['upload']['tmp_name'], $_POST['x'], $_POST['y'], $_POST['w'], $_POST['h'], $_POST['iw']);
} else {
move_uploaded_file($_FILES['upload']['tmp_name'], $target);
}
//传文件
$post_data = array('upload' => "@{$target}");
$uploadUrl = "http://api.grocery.pptv.com/upload_file.php?app={$_GET['app']}&tk={$_GET['tk']}&prod={$_GET['prod']}";
$return = json_decode(send_post_pic($uploadUrl, $post_data), 1);
@unlink($target);
if (empty($return['data'])) {
scriptReturn('', '公有云接口出错', 500);
}
scriptReturn($return['data'], 'success', 0);
示例4: checkAllocation
function checkAllocation()
{
// check permissions for this project
$q = new myQuery("SELECT perm\n FROM project_user\n WHERE user_id='{$_SESSION['user_id']}'\n AND project_id='{$_SESSION['project_id']}'");
$perm = $q->get_one();
if ($perm !== 'all') {
$return = array("error" => true, "errorText" => "You do not have permission to save files to this project.");
scriptReturn($return);
exit;
}
// check overall allocation
$ua = userAllocation($_SESSION['user_id']);
if ($ua['size'] > $ua['allocation']) {
$return = array("error" => true, "size" => $ua['size'], "allocation" => $ua['allocation'], "errorText" => "You have exceeded your allocation of " . round($ua['allocation'] / 1024, 1) . " GB");
scriptReturn($return);
exit;
}
// return true if all fine
return true;
}