本文整理汇总了PHP中Validation::includeBlank方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::includeBlank方法的具体用法?PHP Validation::includeBlank怎么用?PHP Validation::includeBlank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validation
的用法示例。
在下文中一共展示了Validation::includeBlank方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
* This is update address API for mobile
*
* http://eventjoiner.io/client/mobile/v1.0/user/updateaddress.php
*
* POST : access_token address
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// image, access_token, address
$ret = array();
$access_token = $_POST["access_token"];
$address = $_POST["address"];
if (Validation::includeBlank($access_token, $address)) {
http_response_code(400);
HandleResponse::badRequest("Parameters are blank");
} else {
if (!Validation::isValidAddress($address)) {
HandleResponse::badRequest("Invalid user address");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$user_id = getUserIdFromToken($conn, $access_token);
if ($user_id == null) {
$ret = HandleResponse::badRequestReturn("Invalid Accesstoken");
示例2: array
* This is to update postalcode API for mobile
*
* http://eventjoiner.io/client/mobile/v1.0/updatepostalcode.php
*
* POST : access_token postalcode
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// access_token, occupation
$ret = array();
$access_token = $_POST["access_token"];
$postalcode = $_POST["postalcode"];
if (Validation::includeBlank($access_token, $postalcode)) {
HandleResponse::badRequest("Parameters are blank");
} else {
if (!Validation::isValidPostalcode($postalcode)) {
HandleResponse::badRequest("Invalid user postalcode");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$user_id = getUserIdFromToken($conn, $access_token);
if ($user_id == null) {
$ret = HandleResponse::badRequestReturn("Invalid Accesstoken");
} else {
示例3: array
* This is update last name API for mobile
*
* http://eventjoiner.io/client/mobile/v1.0/updatelastname.php
*
* POST : access_token lastname
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// access_token, lastname
$ret = array();
$access_token = $_POST["access_token"];
$last_name = $_POST["lastname"];
if (Validation::includeBlank($access_token, $last_name)) {
HandleResponse::badRequest("Parameters are blank");
} else {
if (!Validation::isValidUserName($last_name)) {
HandleResponse::badRequest("Invalid user last name");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$user_id = getUserIdFromToken($conn, $access_token);
if ($user_id == null) {
$ret = HandleResponse::badRequestReturn("Invalid user last name");
} else {
示例4: array
* This is to save image from user post
*
* http://eventjoiner.io/client/mobile/v1.0/user/updateimage.php
*
* POST : access_token image (form/multipart)
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/image.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// image, access_token
$ret = array();
$access_token = $_POST["access_token"];
if (Validation::includeBlank($access_token)) {
HandleResponse::badRequest("Parameters are blank");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$user_id = getUserIdFromToken($conn, $access_token);
if ($user_id == null) {
$ret = HandleResponse::badRequestReturn("Invalid Accesstoken");
} else {
// Limitation 1MB
if (!isset($_FILES['profile']['error']) || is_array($_FILES['profile']['error'])) {
$ret = HandleResponse::badRequestReturn("Failed to upload iamge");
示例5: DBConnection
* @copyright 2015 Eventjoiner
*
* This is to show user image
*
* http://eventjoiner.io/client/mobile/v1.0/user/image.php?key=xxxxx
*
* GET : key : key is user UUID(not secure user id)
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/image.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "GET") {
$uuid = $_GET['key'];
if (Validation::includeBlank($uuid)) {
HandleResponse::badRequest("Parameters are blank");
} else {
// Retrieve image data and analysis and show
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$image = getUserImage($conn, $uuid);
mysqli_query($conn, "commit");
if ($image != null && ImageUtil::isSupport($image)) {
header("Content-Type: " . ImageUtil::contentType($image));
echo $image;
} else {
示例6: array
*
* This is to sign out(invalidate accesstoken) from device
*
* http://eventjoiner.io/client/mobile/v1.0/user/signout.php
*
* POST : deviceid(iOS, Android)
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// device
$ret = array();
$deviceid = $_POST["device"];
if (Validation::includeBlank($deviceid)) {
HandleResponse::badRequest("Parameters are blank");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$ret = invalidToken($conn, $deviceid);
mysqli_query($conn, "commit");
print json_encode($ret);
} catch (Exception $e) {
mysqli_query($conn, "rollback");
HandleResponse::badRequest($e->getMessage());
}
示例7: array
*
* POST : email, password, deviceid(iOS, Android)
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// TODO : Request Validation
$ret = array();
// email, password, device_id (required)
$email = $_POST["email"];
$password = $_POST["password"];
$deviceid = $_POST["device"];
// Validation
if (Validation::includeBlank($email, $password, $deviceid)) {
HandleResponse::badRequest("Parameters are blank");
} else {
if (!Validation::isValidEmail($email)) {
HandleResponse::badRequest("Email is invalid");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$user_id = matchUser($conn, $email, $password);
if ($user_id == -1) {
$ret = HandleResponse::badRequestReturn("Email or Password is wrong");
} else {
示例8: array
* This is update occupation API for mobile
*
* http://eventjoiner.io/client/mobile/v1.0/updateoccupation.php
*
* POST : access_token occupation
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// access_token, occupation
$ret = array();
$access_token = $_POST["access_token"];
$occupation = $_POST["occupation"];
if (Validation::includeBlank($access_token, $occupation)) {
HandleResponse::badRequest("Parameters are blank");
} else {
if (!Validation::isValidOccupation($occupation)) {
HandleResponse::badRequest("Invalid user occupation");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$user_id = getUserIdFromToken($conn, $access_token);
if ($user_id == null) {
$ret = HandleResponse::badRequestReturn("Invalid user occupation");
} else {
示例9: array
*
* http://eventjoiner.io/client/mobile/v1.0/user/updatepassword.php
*
* POST : access_token oldpass, newpass
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// image, access_token, oldpass, newpass
$ret = array();
$access_token = $_POST["access_token"];
$oldpass = $_POST["oldpass"];
$newpass = $_POST["newpass"];
if (Validation::includeBlank($access_token, $oldpass, $newpass)) {
HandleResponse::badRequest("Parameters are blank");
} else {
if (Validation::isMatchPassword($oldpass, $newpass)) {
HandleResponse::badRequest("Old password and new password are same");
} else {
if (!Validation::isValidPassword($newpass)) {
HandleResponse::badRequest("Invalid user firstname");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$user_id = getUserIdFromToken($conn, $access_token);
示例10: array
* POST : email, password, firstname, lastname, birthday(YYYY-mm-dd)
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// TODO : Request Validation by UA
$ret = array();
// email, password, firstname, lastname, birthday (required)
$email = $_POST["email"];
$password = $_POST["password"];
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$birthday = $_POST["birthday"];
if (Validation::includeBlank($email, $password, $firstname, $lastname, $birthday)) {
HandleResponse::badRequest("Parameters are blank");
} else {
if (!Validation::isValidEmail($email)) {
HandleResponse::badRequest("Email is invalid");
} else {
if (!Validation::isValidPassword($password)) {
HandleResponse::badRequest("Password should be over 6!");
} else {
if (!Validation::isValidTime($birthday)) {
HandleResponse::badRequest("Birthday style is wrong!");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
示例11: array
* This is update phone API for mobile
*
* http://eventjoiner.io/client/mobile/v1.0/updatephonenum.php
*
* POST : access_tokenm phone_number
*/
include_once "../../common/validation.php";
include_once "../../common/dbconfig.php";
include_once "../../common/database.php";
include_once "../../common/handleresponse.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// image, access_token, phone number
$ret = array();
$access_token = $_POST["access_token"];
$phone_number = $_POST["phone_number"];
if (Validation::includeBlank($access_token, $phone_number)) {
HandleResponse::badRequest("Parameters are blank");
} else {
if (!Validation::isValidPhonenumber($phone_number)) {
HandleResponse::badRequest("Invalid phone number");
} else {
$conn = null;
try {
$db = new DBConnection();
$conn = $db->getConnection();
mysqli_query($conn, "set autocommit = 0");
mysqli_query($conn, "begin");
$user_id = getUserIdFromToken($conn, $access_token);
if ($user_id == null) {
$ret = HandleResponse::badRequestReturn("Invalid Accesstoken");
} else {