ถามเรื่อง login ครับ คือตอนนี้ มีกำลังศึกษาเรื่องระบบ login อยู่ครับ แต่ตอนนี้หามาได้แค่นี้เอง มีเรื่องอยากให้พี่ๆช่วยเขียนโค้ดตัว
ลอง copy ตัวนี้ไปใช้ดูนะครับ
admin.php ใช้โค้ด
<html>
<head>
<title></title><meta http-equiv="Content-Type" content="text/html; charset=windows-874"></head>
<body text="#FF0000">
<p align="center"> </p>
<form method="post" action="admin_check.php">
<table width="369" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr bgcolor="#CCCCFF">
<td width="369" height="200" valign="top" bgcolor="#FFFFFF"><p align="center"> </p>
<p align="center"><font color ="#FF0000" size="3" face="MS Sans Serif">Username :</font>
<font color="#FF0000" size="3" face="MS Sans Serif">
<input name="user" type="text" >
*</font></p>
<p align="center"><font color ="#FF0000" size="3" face="MS Sans Serif">Password :</font>
<font color="#FF0000" size="3" face="MS Sans Serif">
<input name="pass" type="password" >
*</font></p>
<p align="center"><font color="#FF0000" size="3" face="MS Sans Serif">
<input type="submit" name="Submit" value="เข้าสู่ระบบ">
<input name="Reset" type="reset" id="Reset" value="ยกเลิก">
</font>
<p align="center"></td>
</tr>
</table>
</form>
</body>
</html>
ฟอร์มเช็คข้อมูล คือ ?
admin_check.php
<?
$user=$_POST['user'];
$pass=$_POST['pass'];
if ($user=="prawjame" and $pass=="07233550917") {
session_start();
session_register("sess_adminid");
$sess_adminid=session_id();
header("Location: admin_home.php");
} else {
echo "<center><H2>Username หรือ Password ไม่ถูกต้อง</H2></center>";
}
?>
Date :
10 มี.ค. 2551 11:30:21
By :
SpyBNC
ขอบคุณครับ
แล้วพี่มีฟอมสมัครด้วยปะครับ
ผมขอด้วยอีก 1 โค้ดได้ไหมครับ
Date :
10 มี.ค. 2551 13:49:27
By :
ต้น
ง่า เอางั้นเลยเหรอครับ...อิอิ
Date :
10 มี.ค. 2551 17:14:17
By :
SpyBNC
หาได้ตามที่มี ระบบนั้นๆครับ
เข้าไปที่ View เลือกหัวข้อ Source ครับ ^^
Date :
2009-08-05 20:09:48
By :
PoU
Code (PHP)
<?
mysql_connect("localhost","root","root");
mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."'
OR Email = '".trim($_POST['txtEmail'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not Found Username or Email!";
}
else
{
echo "Your password send successful.<br>Send to mail : ".$objResult["Email"];
$strTo = $objResult["txtEmail"];
$strSubject = "Your Account information username and password.";
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "From: [email protected] \nReply-To: [email protected] ";
$strMessage = "";
$strMessage .= "Welcome : ".$objResult["Name"]."<br>";
$strMessage .= "Username : ".$objResult["Username"]."<br>";
$strMessage .= "Password : ".$objResult["Password"]."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "ThaiCreate.Com<br>";
$flgSend = mail($strTo,$strSubject,$strMessage,$strHeader);
}
mysql_close();
?>
Go to : PHP Forgot Lost Password and Sending Password to Mail ทำ Form ลืมรหัสผ่าน ด้วย PHP กับ MySQL
Date :
2011-07-07 11:12:03
By :
thaicreate
Load balance : Server 05