|
 |
|
[มือใหม่php]มีปัญหาเรื่องระบบการสมัครสมาชิกอ่าครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<?php
$hostname="localhost";
$user="root";
$password="1234";
$dbname="project";
$tbname="register";
mysql_connect($hostname,$user,$password) or die("Not Connection Mysql");
mysql_select_db($dbname) or die("Not Select Date Base");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
if($_POST['username']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุชื่อผู้ใช้งาน');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else if($_POST['password']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุรหัสผ่าน');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else if(!$_POST['password']==$_POST['passc']){
echo "<script language='javascript'>";
echo "alert('กรุณากรอกรหัสผ่านให้ตรงกัน');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else if($_POST['id_alumnis']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุรหัสนักศึกษา');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else if($_POST['name']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุชื่อของท่าน');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else if($_POST['lastname']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุรหัสผ่าน');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else if($_POST['address']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุที่อยู่');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else if($_POST['email']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุอีเมล');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else if($_POST['tel']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาเบอร์โทรศัพท์');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
else{
$sql_insert = sprintf("INSERT INTO register (username,password,id_alumnis,status, perfix,name,lastname,address,email,tel,work,work_location) VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",$_POST['username'],$_POST['password'],$_POST['id_alumnis'],$_POST['status'],$_POST['perfix'],$_POST['name'],$_POST['lastname'],$_POST['address'], $_POST['email'],$_POST['tel'],$_POST['work'],$_POST['work_location']);
//echo $sql_insert;
$result=mysql_db_query($dbname,$sql_insert);
$sql_insert = sprintf("INSERT INTO alumnis (id_alumnis, perfix,name,lastname,address,email,tel,work,work_location) VALUES('%s','%s',%s','%s','%s','%s','%s','%s','%s')",$_POST['id_alumnis'],$_POST['perfix'],$_POST['name'],$_POST['lastname'],$_POST['address'], $_POST['email'],$_POST['tel'],$_POST['work'],$_POST['work_location']);
//echo $sql_insert;
$result=mysql_db_query($dbname,$sql_insert);
if(!$result){
echo "<script type='text/javascript'>alert('การสมัครสมาชิกล้มเหลว')</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}else{
echo"<script type='text/javascript'>alert('การสมัครสมาชิกเสร็จสิ้นเรียบร้อย')</script>";
echo "<meta http-equiv='refresh' content='0;url=register.php'>";
}
}
?>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2013-11-20 13:37:06 |
By :
adisorn99 |
View :
821 |
Reply :
7 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อยากทราบว่าผมผิดขั้นตอนไหนหรอครับ พอกรอกช้อมูลเสร็จมันบอกว่าการสมัครล้มเหลว
ผมลองเช็คในส่วนการเชื่อมต่อฐานข้อมูลก็ไม่มีอะไรผิดพลาดนะฮะ
|
 |
 |
 |
 |
Date :
2013-11-20 13:40:22 |
By :
adisorn99 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ระบบสมัครสมาชิกมันทำไมหรอครับ โดนแฮก insert แล้ว เข้าบ้างไม่เข้าบ้าง หรือมัน insert แล้ว username password เพี้ยน หรอครับ
|
 |
 |
 |
 |
Date :
2013-11-20 13:41:42 |
By :
anotherdie |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ใช่ครับๆ คือตอนนี้ทำโปรเจคอยู่แล้วระบบมันรันไม่ผ่านเวลาทำการสมัครอ่าครับ
พอกรอกข้อมูลครบแล้วก็เกิดปัญหามันขึ้นแจ้งเตือนว่าการสมัครล้มเหลวอ่าครับ
ลองๆตรวจดูแล้วก็ไม่น่าจะมีอะไรผิดนะครับ
|
 |
 |
 |
 |
Date :
2013-11-20 13:54:25 |
By :
adisorn99 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ได้ละครับ ไม่ต้องละฮะ
|
 |
 |
 |
 |
Date :
2013-11-20 14:06:48 |
By :
adisorn99 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2013-11-21 06:08:19 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2013-11-21 08:18:57 |
By :
TRIBIIZ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2013-11-21 09:28:29 |
By :
telesyn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|