<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>ICT MA (Computer Services Dept.)</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> </head> <body onload="init()"> <script language = "javascript1.3"> function init() { if(document.form1.txtLogin.value=="") document.form1.txtLogin.focus(); else document.form1.txtPwd.focus(); } </script> <form name="form1" method="post" action="loginProcess.php"> <table width="249" align="center"> <tr> <td width="98">Login :</td> <td width="90"><input name="txtLogin" type="text" size="20" maxlength="15" value="<?print$txtLogin?>"></td> </tr> <tr> <td>Password :</td> <td><input name="txtPwd" type="password" size="20" maxlength="15"></td> </tr> </table> <table width="249" align="center"> <tr> <td align="right"><input name="btnOK" type="submit" onclick="return check_all()" value="OK "></td> <td><input name="btnCancel" type="button" value=" Cancel "></td> </tr> </table> </form> <SCRIPT LANGUAGE="JavaScript"> function check_all() { if ((document.form1.txtLogin.value)=="") { alert("???????? Username"); document.form1.txtLogin.focus(); return false; } else if((document.form1.txtPwd.value)=="") { alert("???????? Password"); document.form1.txtPwd.focus(); return false; } else { return true; } } </SCRIPT> </body> </html>
<?php require('cricom.php'); session_register('L_username'); mysql_connect($host,$username,$password)or die("Can't connect to $host"); mysql_select_db($db)or die("Can't select"); $Name = $_POST["txtLogin"]; echo "Hello ".$Name."." ; $sql = "Select * From cststaff Where st_login='$Name'"; echo $sql; $result=mysql_query($sql) or die ("Can't execute"); if($rwstaff = mysql_fetch_array($result)) { $pass = $rwstaff["st_pwd"]; if ($pass == $_POST["txtPwd"]) { $_SESSION["L_username"]=$Name; echo'<script langugue="javascript1.3">'; echo'location.replace("home.php")'; echo'</script>'; } else { echo'<script langugue="javascript1.3">'; echo'alert("Password Invalid");'; echo"location.replace('index.php?txtLogin=$txtLogin');"; echo'</script>'; } } else { echo'<script langugue="javascript1.3">'; echo'alert("no username");'; echo'location.replace("index.php");'; echo'</script>'; } ?>
session_start(); if($_REQUEST['Logout']=='Y'){ ob_start(); session_start(); // ประกาศตัวแปรไว้สำหรับจำผู้ใช้งาน session_register("L_username"); // ตั้งชื่อตัวแปร $_SESSION["L_username"]=""; }
<?php unset($_SESSION['L_username']); header("Location: index.php"); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง