|
|
|
สอบถามเรื่อง อัพไฟล์ php ขึ้น host จริง แล้วเพิ่มข้อมูลไปยัง database ไม่ได้ ทั้งที่รันใน localhost เพิ่มข้อมูลได้ปกติ |
|
|
|
|
|
|
|
ไฟล์ที่ใช้เชื่อมข้อมูลไปยัง database
Code (PHP)
<?php include 'configdatabase.php';
$sAction = $_POST['s']['action'];
$username = $_POST['username'];
$password = $_POST['password'];
$money = $_POST['money'];
$date = date('Y-m-d H:i:s');
if (isset($sAction) && $sAction == 'insert_user') {
if ($username != '') {
if ($password != '') {
$sql_login = $sqlite->prepare("SELECT * FROM users WHERE username=:username");
$sql_login->execute(array('username' => $username));
$rs_login = $sql_login->fetch(PDO::FETCH_ASSOC);
if ($rs_login['id'] == '') {
if (strlen($username) > 4) {
if (strlen($password) > 4) {
if ($money >= 100 && $money != '' && $money != '0') {
$sql_users = "INSERT INTO users(
username,
password,
date,
last_login,
credit,
facebook_id,
level
)VALUES(
:username,
:password,
:date,
:last_login,
:credit,
:facebook_id,
:level
)";
$result_users = $sqlite->prepare($sql_users);
$result_users->execute(array(
':username' => $username,
':password' => md5($password),
':date' => $date,
':last_login' => '',
':credit' => '100',
':facebook_id' => $money,
':level'=>'user'
));
if ($result_users) {
$sql_history = "INSERT INTO credit_history(
user,
date,
txid,
cashcard_password,
cashcard_amount,
client_ip,
credit,
type
)VALUES(
:user,
:date,
:txid,
:cashcard_password,
:cashcard_amount,
:client_ip,
:credit,
:type
)";
$result_history = $sqlite->prepare($sql_history);
$result_history->execute(array(
':user' => $username,
':date' => $date,
':txid' => '-',
':cashcard_password' => '',
':cashcard_amount' => $money,
':client_ip' => 'สมัครสมาชิก',
':credit' => '100',
':type' => 'ผู้ดูแลระบบ'
));
if ($result_history) {
echo '1';
} else {
echo '2';
}
} else {
echo '2';
}
} else {
echo '8';
}
} else {
echo '3';
}
} else {
echo '4';
}
} else {
echo '5';
}
} else {
echo '6';
}
} else {
echo '7';
}
} else {
echo '0';
}
?>
Tag : Mobile, MySQL, HTML5, Ajax, Web Hosting, Windows
|
|
|
|
|
|
Date :
2019-05-17 12:37:39 |
By :
topone |
View :
835 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|