คือผมเขียน app ตัวนึงแล้วบางทีมันสมัครเข้าบางทีสมัครไม่เข้า
นี่คือโค้ดครับ
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้<?php
require_once 'update_user_info.php';
$db = new update_user_info();
// json response array
$response = array("error" => FALSE);
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['name']) && isset($_POST['email']) && isset($_POST['tel']) && isset($_POST['type'])) {
// receiving the post params
$username = $_POST['username'];
$password = $_POST['password'];
$name = $_POST['name'];
$email = $_POST['email'];
$tel = $_POST['tel'];
$type = $_POST['type'];
// check if user is already existed with the same email
if ($db->CheckExistingUser($username)) {
// user already existed
$response["error"] = TRUE;
$response["error_msg"] = "User already existed with " . $username;
echo json_encode($response);
} else {
// create a new user
$user = $db->StoreUserInfo($username,$password,$name, $email, $tel ,$type);
if ($user) {
// user stored successfully
$response["error"] = FALSE;
$response["user"]["username"] = $user["Username"];
$response["user"]["name"] = $user["Name"];
$response["user"]["email"] = $user["Email"];
$response["user"]["tel"] = $user["Tel"];
$response["user"]["type"] = $user["Type_id"];
echo json_encode($response);
} else {
// user failed to store
$response["error"] = TRUE;
$response["error_msg"] = "Unknown error occurred in registration!";
echo json_encode($response);
}
}
} else {
$response["error"] = TRUE;
$response["error_msg"] = "Required parameters (username, password, name, email, tel or type) is missing!";
echo json_encode($response);
}
?>
ส่วนเวลาที่สมัครไม่เข้ามันจะมาตรง else ตรงนี้
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้else {
// user failed to store
$response["error"] = TRUE;
$response["error_msg"] = "Unknown error occurred in registration!";
echo json_encode($response);
ตอนนี้ใช้ webhost ของ 000webhost ครับ
สอบถามเกี่ยวกับการสมัครสมาชิกผ่าน Application ครับ
นี่คือโค้ดครับ
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
ส่วนเวลาที่สมัครไม่เข้ามันจะมาตรง else ตรงนี้
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
ตอนนี้ใช้ webhost ของ 000webhost ครับ