Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ขอรบกวนถามหน่อยครับ ว่าทำไหมว่าที่ทำหน้า Login ทำไหมฐานข้อมูลมี User และ password



 

ขอรบกวนถามหน่อยครับ ว่าทำไหมว่าที่ทำหน้า Login ทำไหมฐานข้อมูลมี User และ password

 



Topic : 030785

Guest




ว่าทำไหมว่าที่ทำหน้า Login ทำไหมฐานข้อมูลมี User และ password แล้วตอนล็อกอินทำไหมบอกว่า User และ password ไม่มีครับ บอกหน่อยครับ

โค๊ดphp

index.html

<html>
<head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<h1>::  Login  ::</h1>
<form method="POST" action="chkmember.php">
<table>
<tr>
	<td><b>Username  :</b></td>
	<td><input name="user_reg" type="text"> * </td>
</tr>
<tr>
	<td><b>Password   :  </b></td>
	<td><input name="pass_reg" type="password"> * </td><br></br>
</tr>
</table>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
<p><a href="register.html">สมัครสมาชิก</a> |
<a  href="forgetpassword.html">ลืมรหัสผ่าน</a></p>
</form>
</body>
</html>
?>


chkmember.php

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
$user_login=$_POST[user_login];
$pass_login=$_POST[pass_login];

if ($user_login==" " or $pass_login==" ") {
	echo "<h3>ERROR : กรุณากรอกข้อมูลให้ครบ<h3>"; exit();
}
include "connect.php";
$sql="select * from tb_member where username='$user_login'
and password='$pass_login'";
$result=@mysql_db_query($dbname,$sql);
$num=@mysql_num_rows($result);
mysql_close();

if ($num<=0) {
	echo "<h3>ERROR : Username หรือ Password ไม่ถูกต้อง</h3>";
}else{
	session_start();
	$_SESSION[sess_userid]=session_id();
	$_SESSION[sess_username]=$user_login;
	header("Location: main.php");
}
?>
</head>


chksession.php

<?php
session_start();
$sess_userid=$_SESSION[sess_userid];
$sess_username=$_SESSION[sess_username];
if ($sess_userid<>session_id() or $sess_username=="") {
	header("Location: index.html");		exit();
}
?>



ลองดูหน่อยครับว่ามีผิดตรงไหนครับ+++ช้วยหน่อยครับ++++ ^^



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-08-25 21:02:12 By : topdkclub02 View : 753 Reply : 6
 

 

No. 1



โพสกระทู้ ( 164 )
บทความ ( 0 )



สถานะออฟไลน์









Date : 2009-08-25 21:29:18 By : gangzaclub
 


 

No. 2

Guest


<input name="user_reg" type="text">

<input name="pass_reg" type="password">

รับค่าผิดครับ

user_reg
pass_reg

เปลี่ยนเป็น นะคับ
user_login
pass_login
Date : 2009-08-25 22:38:52 By : phillips
 

 

No. 3



โพสกระทู้ ( 1,357 )
บทความ ( 4 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


$result=mysql_db_query($dbname,$sql) or die(mysql_error());

เพื่อดูว่ามันมี error อะไรรึป่าวครับ

คุณ phung พิมพ์ไรนิดนึงก็ดีนะครับ
Date : 2009-08-25 22:45:10 By : lozomac
 


 

No. 4

Guest


เปลื่ยนเป็น chkmember.php
<?php
session_start();
?>
<?php
$user_login=$_POST[user_reg];
$pass_login=$_POST[pass_reg];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?
if ($user_login=="" or $pass_login=="")
{
echo "<h3>ERROR :กรุณากรอกข้อมูลให้ครบ</h3>"; exit();
}
include "connect.php";
$sql="select * from tb_member where username='$user_login'
and password='$pass_login'";
$result=@mysql_db_query($dbname,$sql);
$num=@mysql_num_rows($result);
mysql_close();

if($num<=0){
echo "<h3>ERROR : username หรือ password ไม่ถูกต้อง </h3>";
}
else
{
$_SESSION[sess_userid]=session_id();
$_SESSION[sess_username]=$user_login;
header("location: main.php");
}
?>
</body>
</html>


แล้วก้ขึ้น Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\COM\chkmember.php:13) in C:\AppServ\www\COM\chkmember.php on line 32 ตัวนี้ขึ้นมาครับดูหน่อยครับว่าผิดไรครับ
Date : 2009-08-25 22:49:24 By : topdkclub02
 


 

No. 5

Guest


ได้ละครับให้ใส่
ob_start();ที่หัวสุดครับ งง มานานละครับ
Date : 2009-08-25 22:53:46 By : topdkclub02
 


 

No. 6



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

edit.php

<?php
include "chksession.php";
include "function.php";
include "connect.php";
$sql="select * from tb_meamber
where username='$sess_username' ";
$result=@mysql_db_query($dbname,$sql);
$result=@mysql_fetch_array($result);

$username=$record[username];
$name=$record[name];
$sex=$record[sex];
$email=$record[email];
$telephone=$record[telephone];
$address=$record[address];
$reg_date=$record[reg_date];
mysql_close();
?>
<html>
<head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<h1>:: Edit Menber ::</h1>
<form method="post" action="edit2.php">
<table cellspacing="2">
<tr>
<td><b>Username : </b></td><td><?=$username?></td>
</tr>
<tr>
<td><b>ชื่อ -สกุล : </b></td><td><?=$name?></td>
</tr>
<tr>
<td><b>เพศ : </b></td><td><?=$sex?></td>
</tr>
<tr>
<td><b>อีเมล : </b></td>
<td><input name="email_edit" type="text"
value="<?=$email?>" size="26"> * </td>
</tr>
<tr>
<td><b>โทรศัพท์ : </b></td>
<td><input name="tel_edit" type="text"
value="<?=$telephone?>" size="26"></td>
</tr>
<tr>
<td valign="top"><b>ที่อยู่ติดต่อ :</b></td>
<td><textarea name="address_edit" cols="35"
rows="3"><?=$address?></textarea></td>
</tr>
<tr>
<td><b>สมัครเมื่อ :</b></td>
<td><?=displaydate($reg_date)?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="submit">
<input type="reset" value="reset"></td>
</tr>
</table>
</form>
[ <a href="main.php">กลับหน้าหลัก</a>]
</body>
</html>

edit.php

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
include "chksession.php";
$email_edit=$_POST[email_edit];
$tel_edit=$_POST[tel_edit];
$address_edit=$_POST[address_edit];

include "function.php";
if (!checkemail($email_edit)) {
echo"<h3>ERROR : รูปแบบอีเมลที่กรอกไม่ถูกต้อง</h3>"; exit();
}
include "connect.php";
$sql="update tb_member set email='$email_edit',
telephone='$tel_edit' ,address='$address_edit',
where username='$sess_username' ";
$result=@mysql_db_query($dbname,$sql);
if ($result) {
echo "<h3>ข้อมูลของท่านถูกแก้ไขเรียบร้อยแล้ว</h3>";
echo "[<a href=main.php>กลับหน้าหลัก</a>]";
}else{
echo "<h3>ไม่สามารถแก้ไขข้อมูลได้</h3>";
}
mysql_close();
?>
</head>

changepw.php

<?php
include "chksession.php";
?>
<html>
<head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<h1>:: Change Password ::</h1>
<form method="post" action="changepw2.php">
<table cellspacing="2">
<tr>
<td><b>Username : </b></td><td><?=$sess_username?>
</td>
</tr>
<tr>
<td><b>รหัสผ่านเดิม :</b></td><td><input name="oldpass"
type="password"> * </td>
</tr>
<tr>
<td><b>รหัสผ่านใหม่ : </b></td><td><input name="newpass"
type="password"> * </td>
</tr>
<tr>
<td><b>ยืนยันรหัสผ่านใหม่ : </b></td><td><input name="newpass2"
type="password"> * </td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="submit">
<input type="reset" value="reset"></td>
</tr>
</table>
</form>
[<a href="main.php">กลับหน้าหลัก</a>]
</body>
</html>

changepw2.php

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
include "chksession.php";
$oldpass=$_POST[oldpass];
$newpass=$_POST[newpass];
$newpass2=$_POST[newpass2];

if ($oldpass=="" or $newpass=="" or $newpass2=="" or
$newpass<>$newpass2) {
echo "<h3>ERROR: กรุณากรอกข้อมูลให้ครบ<h3>"; exit();
}
include "connect.php";
$sql="select * from tb_mamber where username='$sess_username'
and password='$lodpass' ";
$result=@mysql_db_query($dbname,$sql);
$num=@mysql_num_rows($result);
if ($num<1) {
echo "<h3>ERROR : รหัสผ่านเดิม ไม่ถูกต้อง<h3>"; exit();
}
$sql="update tb_member set password='$newpass'
where username='$sess_username'";
$result=@mysql_db_query($dbname,$sql);
if ($result) {
echo "<h3>เปลี่ยนรหัสผ่านเรียบร้อยแล้ว</h3>";
echo "[<a href=main.php >กลับหน้าหลัก</a>]";
} else {
echo "<h3>ไม่สามารถเปลี่ยนรหัสผ่าได้</h3>";
}
mysql_close();
?>
</head>


ดูให้หน่อยครับว่าผิดตรงไหนว่าทำไหมเข้าล็อกอินแล้วจะเข้าไปแก้ไขน่าจะมีข้อมูลของ User ออกมาว่าผิดตรงไหนบอกด้วยครับ++++++
Date : 2009-08-26 01:45:18 By : topdkclub02
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ขอรบกวนถามหน่อยครับ ว่าทำไหมว่าที่ทำหน้า Login ทำไหมฐานข้อมูลมี User และ password
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่