本文整理汇总了PHP中getUserIdFromToken函数的典型用法代码示例。如果您正苦于以下问题:PHP getUserIdFromToken函数的具体用法?PHP getUserIdFromToken怎么用?PHP getUserIdFromToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUserIdFromToken函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: header
<?php
header('Content-Type: application/json');
include "../../include/dbcon.inc.php";
include "../../include/functions.php";
include "../../include/pm_functions.inc.php";
include "../../include/push_functions.inc.php";
$user_id = getUserIdFromToken($con, @$_POST["token"]);
$dog_id = $con->real_escape_string($_POST["dog_id"]);
$symptoms = $con->real_escape_string($_POST["symptoms"]);
$place_id = $con->real_escape_string($_POST["place_id"]);
$duedate = $con->real_escape_string($_POST["duedate"]);
$volume = $con->real_escape_string($_POST["volume"]);
$user = getUserById($user_id, $con);
$dog = getDogById($dog_id, $con);
$bloodtype = getBloodTypeById($dog["dog_bloodtype_id"], $con);
$bloodstores = getBloodStoreByBloodTypeId($dog["dog_bloodtype_id"], $con);
$result = 0;
if (sizeof($bloodstores) > 0) {
//Found Blood In Hospital Blood Store
//create bloodstore_id string
$bloodstore_ids = array();
foreach ($bloodstores as $key => $bloodstore) {
array_push($bloodstore_ids, $bloodstore["bloodstore_id"]);
}
$bloodstore_id = implode(",", $bloodstore_ids);
$con->query("INSERT INTO `request`(`request_id`, `from_user_id`, `for_dog_id`, `symptoms`, `place_id`," . " `duedate`, `request_type`, `bloodstore_id`, `created_time`, `amount_volume`) " . "VALUES (null,'{$user_id}','{$dog_id}','{$symptoms}','{$place_id}','{$duedate}',1,'{$bloodstore_id}',now(),'{$volume}')");
//save to db (request_type = 1)
$senthospital_id = array();
//store sent hospital id
$message = "การขอรับเลือดของ" . $dog["dog_name"] . " เมื่อ " . date("j") . " " . $thai_month_short_arr[date("n")] . " " . (date("Y") + 543) . " " . "พบเลือดกรุ๊ป " . $bloodtype["bloodtype_name"] . " ที่โรงพยาบาลดังนี้";
开发者ID:joyfulful,项目名称:DogBloodDonor_Web,代码行数:31,代码来源:create.php
示例2: array
$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 {
// Update postal code
$ret = updatePostalcode($conn, $user_id, $postalcode);
}
mysqli_query($conn, "commit");
} catch (Exception $e) {
mysqli_query($conn, "rollback");
$ret = HandleResponse::badRequestReturn("Invalid Accesstoken");
}
print json_encode($ret);
}
}
} else {
开发者ID:beavis28,项目名称:EventJoiner,代码行数:31,代码来源:updatepostalcode.php
注:本文中的getUserIdFromToken函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论