ขอรบกวนถามหน่อยครับ ว่าทำไหมว่าที่ทำหน้า Login ทำไหมฐานข้อมูลมี User และ password
Date :
2009-08-25 21:29:18
By :
gangzaclub
<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
$result=mysql_db_query($dbname,$sql) or die(mysql_error());
เพื่อดูว่ามันมี error อะไรรึป่าวครับ
คุณ phung พิมพ์ไรนิดนึงก็ดีนะครับ
Date :
2009-08-25 22:45:10
By :
lozomac
เปลื่ยนเป็น 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
ได้ละครับให้ใส่
ob_start();ที่หัวสุดครับ งง มานานละครับ
Date :
2009-08-25 22:53:46
By :
topdkclub02
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> </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> </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
Load balance : Server 02