อยากได้ตัวอย่างโค้ด PHP การแก้ไขข้อมูลส่วนตัวของสมาชิกที่ได้ล็อคอินเข้ามา

wave
สุรชัย วงษา
7,365
สังคมนักพัฒนาระบบ (Community)
อยากได้ตัวอย่างโค้ด PHP การแก้ไขข้อมูลส่วนตัวของสมาชิกที่ได้ล็อคอินเข้ามา

PHP การแก้ไขข้อมูลส่วนตัวของสมาชิกที่ได้ล็อคอินเข้ามา ท่านใดพอจะมีตัวอย่างให้ผมได้เอาไปประยุกต์ใช้บ้างไหมครับ ขอบคุณล่วงหน้าครับ

1 ความคิดเห็น

  • บัก'ก 'ห่า

#By Developer Fram.orgfree.com

หน้าล็อกอิน PHP + MYSQL

login.php

<html>
<head>
<title>Fram.Login.com</title>
<link href="https://fonts.googleapis.com/css?family=Kanit" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Trirong" rel="stylesheet">
</head>
<body>
<img src="img/gear.gif" width="100" height="100"
<form name="form1" method="post" action="check_login.php">
 <center> <font size="5" class="h1"><b>กรุณาล็อกอิน</b></font>
<br>
<div class="userthai">ชื่อบัญชี</div>
          <input name="txtUsername" type="text" id="txtUsername3" class="user" placeholder="Username">
<br>
    <div class="userpass">รหัสผ่าน</div>
        <input name="txtPassword" type="password" id="txtPassword" class="pass" placeholder="Password">
  <br>
  <input type="submit" name="Submit" value="Login" class="login">
</form>
<p class="copy">CopyRight &copy <b>Framgamer.orgfree.com</b> All Rights Reserved</p>
</center>
<style type="text/css">
font.h1 {
   font-family: Trirong;
}
div.userpass {
   font-family: Kanit;
   margin-right: 110px;
}
div.userthai {
   font-family: Kanit;
   margin-right: 110px;
} 
input.pass {
   margin-bottom: 20px;
   background-image:url(img/icon_pass.gif);
   background-repeat: no-repeat;
   padding-left: 18px;
}
input.user {
   background-image:url(img/icon_user.gif);
   background-repeat: no-repeat;
   padding-left: 18px;
}
p.copy {
   background-image:url(img/bg-copy.png);
   color:white;
   border-style-bottom: ridge;
}
input.login {
   padding:8px 11px 8px 11px;
   background-image:url(img/bg-copy.png);
}
input.login:hover {
   background-image:url(img/bg-copy-hover.png);
}
</style>
</body>
</html>

อธิบาย* ไฟล์นี้ จะมีส่วนเข้ามาใหม่คือ stylesheet สำหรับรูปภาพจะจัดเตรียมไว้ให้ ด้านล่าง *

ไฟล์เช็คว่ามีข้อมูลหรือไม่ check_login.php

<?
	session_start();
	mysql_connect("localhost","1261358","fram123");
	mysql_select_db("1261358");
	$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."' 
	and Password = '".trim($_POST['txtPassword'])."'";
	$objQuery = mysql_query($strSQL);
	$objResult = mysql_fetch_array($objQuery);
	if(!$objResult)
	{
			echo "Username and Password Incorrect!";
	}
	else
	{
			$_SESSION["UserID"] = $objResult["UserID"];
			$_SESSION["Status"] = $objResult["Status"];

			session_write_close();
			
			if($objResult["Status"] == "ADMIN")
			{
				header("location:admin_index.php");
			}
			else
			{
				header("location:user_index.php");
			}
	}
	mysql_close();
?>

นี่คือหน้าหลักๆ 

ดาวน์โหลด

http://resource.thaicreate.com/upload/community/20101207204821.zip

อ้างอิงจาก 

http://www.thaicreate.com/community/php-mysql-login-form-check-username-password.html