>> php ข้อมูหน้า Login มีปัญหา <<

เริ่มโดย bankker6480, 21 กุมภาพันธ์ 2013, 18:22:14

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

bankker6480


Login ไม่ได้ครับ
ในฐานข้อมูล

ตาราง
member

ฟิล์ด
UserName
Password
......

index.php
<form id="loginForm" name="loginForm" method="post" action="login-exec.php">
    &nbsp;&nbsp;ชื่อผู้ใช้ :
              <input name="UserName" type="text" id = "UserName"/>
         
          รหัสผ่าน :
            <input name="Password" type="password" id = "Password" />
           
            <input name="Submit" type="submit" value="เข้าสู่ระบบ" />
    </form>


login-exec.php
<?php
//Start session
session_start();

//Include database connection details
require_once('config.php');

//Array to store validation errors
$errmsg_arr = array();

//Validation error flag
$errflag false;

//Connect to mysql server
$link mysql_connect(DB_HOSTDB_USERDB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' mysql_error());
}

//Select database
$db mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}

//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str stripslashes($str);
}
return mysql_real_escape_string($str);
}

//Sanitize the POST values
$login clean($_POST['UserName']);
$password clean($_POST['Password']);

//Input Validations
if($login == '') {
$errmsg_arr[] = 'Login ID missing';
$errflag true;
}
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag true;
}

//If there are input validations, redirect back to the login form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: index.php");
exit();
}

//Create query
$qry="SELECT * FROM member WHERE UserName='PAA' AND Password='".md5($_POST['18813432'])."'";
$result=mysql_query($qry);

//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result) == 1) {
//Login Successful
session_regenerate_id();
$member mysql_fetch_assoc($result);
// $_SESSION['SESS_MEMBER_ID'] = $member['member_id'];
$_SESSION['SESS_FIRST_NAME'] = $member['FirstName'];
$_SESSION['SESS_LAST_NAME'] = $member['LastName'];
session_write_close();
header("location: index2.php");
exit();
}else {
//Login failed
header("location: login-failed.php");
exit();
}
}else {
die("Query failed");
}
?>

xvlnw.com

แล้วที่ีไม่ได้ มันโชว์ Error ว่ายังไงครับ ?
[direct=https://cloudhost.in.th/wordpress-hosting]ツ ⓌⓄⓇⒹⓅⓇⒺⓈⓈ ⒽⓄⓈⓉⒾⓃⒼ [/direct] :wanwan014:  :D
[direct=https://cloudhost.in.th/cloudhosting.html]Cloud Hosting[/direct] [direct=https://cloudhost.in.th/cloudvps.html]Cloud Server[/direct] [direct=https://cloudhost.in.th/vpshosting.html]Cloud VPS Hosting[/direct] [direct=https://cloudhost.in.th/windowsvps.html]Cloud Windows[/direct] Tel: 080-348-0843 LINE: ixvlnw

bankker6480

อ้างถึงจาก: xvlnw.com ใน 21 กุมภาพันธ์ 2013, 18:53:56
แล้วที่ีไม่ได้ มันโชว์ Error ว่ายังไงครับ ?

มันโชว์โค้ดมาทั้งดุ้น login-ex

xvlnw.com

อ้างถึงจาก: bankker6480 ใน 21 กุมภาพันธ์ 2013, 19:07:41
อ้างถึงจาก: xvlnw.com ใน 21 กุมภาพันธ์ 2013, 18:53:56
แล้วที่ีไม่ได้ มันโชว์ Error ว่ายังไงครับ ?

มันโชว์โค้ดมาทั้งดุ้น login-ex

มันเป็นไฟล์ PHP นะครับ มันโชว์โค๊ดทั้งดุ้นออกมาให้ผู้ใช้งานเห็นไม่ได้หรอกครับ
ผมว่าน่าจะทำการรันผิดหรือปล่าวครับ
[direct=https://cloudhost.in.th/wordpress-hosting]ツ ⓌⓄⓇⒹⓅⓇⒺⓈⓈ ⒽⓄⓈⓉⒾⓃⒼ [/direct] :wanwan014:  :D
[direct=https://cloudhost.in.th/cloudhosting.html]Cloud Hosting[/direct] [direct=https://cloudhost.in.th/cloudvps.html]Cloud Server[/direct] [direct=https://cloudhost.in.th/vpshosting.html]Cloud VPS Hosting[/direct] [direct=https://cloudhost.in.th/windowsvps.html]Cloud Windows[/direct] Tel: 080-348-0843 LINE: ixvlnw

nst_nk

save file เป็นนามสกุล .php นะครับ เลือก encode ให้ถูกต้อง

ถ้าเป็น +BOM  ( ส่วนมากจะเจอเวลา save จาก notepad ) มันจะไม่รันครับ  :wanwan011:

  ◤◤ รับเขียนระบบต่างๆครับ เช่น ระบบ Shipping , ร้านค้าออนไลน์ , อสังหาริมทรัพย์ , ระบบจัดการหลังบ้านทุกประเภท  สอบถามได้ครับ Line : bigznst ◥◥

amazegu


bankker6480

ใครมีระบบ login แบบง่ายๆ
เอามาแบ่งกันใช้บ้างนะครับ

MeenyFancy

ลองเรียก phpinfo ดูว่าขึ้นมั้ย
บางทีอาจเป็นที่ server ของเรา config ผิดครับ

ถ้าเป็นพวกจำลอง server ลอง remove ออกแล้วติดตั้งใหม่ครับ
Have a good trip.
[direct=http://petdeecare.com]สุนัขป่วย[/direct] [direct=http://petdeecare.com]แมวป่วย[/direct]
[direct=http://petdeecare.com]หนูป่วย[/direct] [direct=http://petdeecare.com]อาหารแมว[/direct] [direct=http://petdeecare.com]อาหารหมา[/direct]