|
|
|
ขอโค้ดที่ให้ข้อมูลของเราแสดงออกมาเมื่อคลิกดูข้อมูลหน่อยค่ะ |
|
|
|
|
|
|
|
มีโค๊ดไหมครับ แปะไว้เด๋วมาให้คำแนะนำ
|
|
|
|
|
Date :
2012-03-07 14:34:40 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//โค้ดล็อกอินค่ะ
Code (PHP)
<?php require_once('Connections/dbcon.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_Recordset1 = "-1";
if (isset($_GET['data_id'])) {
$colname_Recordset1 = $_GET['data_id'];
}
mysql_select_db($database_dbcon, $dbcon);
$query_Recordset1 = sprintf("SELECT * FROM m_datd WHERE data_id = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $dbcon) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['User'])) {
$loginUsername=$_POST['User'];
$password=$_POST['Pass'];
$MM_fldUserAuthorization = "login_accesslevel";
$MM_redirectLoginSuccess = "u_function.php";
$MM_redirectLoginFailed = "123.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_dbcon, $dbcon);
$LoginRS__query=sprintf("SELECT login_user, login_pass, login_accesslevel FROM m_login WHERE login_user=%s AND login_pass=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $dbcon) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'login_accesslevel');
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style16 {
font-family: "Angsana New";
font-weight: bold;
font-size: 22px;
color: #000000;
}
body {
background-image: url(image/background/original_moonlight-wallpaper-01-1024x768.jpg);
background-repeat: no-repeat;
}
-->
</style>
</head>
<body>
<table width="908" height="808" border="0" align="center" bgcolor="#FFFFFF">
<tr>
<td height="218" valign="top"><img src="image/header/header1_1.jpg" width="900" height="214" /></td>
</tr>
<tr>
<td height="515" align="center" valign="middle">
<form ACTION="<?php echo $loginFormAction; ?>" id="fmLogin" name="fmLogin" method="POST">
<p> </p>
<table width="478" height="304" border="0" align="center">
<tr>
<td valign="middle" background="image/login copy.jpg"><table width="371" border="0" align="center">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="105"> </td>
<td width="144"> </td>
<td width="108"> </td>
</tr>
<tr>
<td align="right"><span class="style16">Username: </span></td>
<td><input name="User" type="text" id="User" /></td>
<td> </td>
</tr>
<tr>
<td align="right"><span class="style16">Password:</span></td>
<td><input name="Pass" type="text" id="Pass" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" id="Submit" value="Login" />
<input type="reset" name="Reset" id="Reset" value="Cancel" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</form>
<p> </p>
</td>
</tr>
<tr>
<td><img src="image/header/Style7 copy.jpg" width="900" height="65" /></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
//โค้ดแสดงข้อมูล
<?php require_once('Connections/dbcon.php'); ?><?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "form_login.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?><?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_rsEmp = "-1";
if (isset($_GET['login_id'])) {
$colname_rsEmp = $_GET['login_id'];
}
mysql_select_db($database_dbcon, $dbcon);
$query_rsEmp = sprintf("SELECT * FROM m_login WHERE login_id = %s", GetSQLValueString($colname_rsEmp, "int"));
$rsEmp = mysql_query($query_rsEmp, $dbcon) or die(mysql_error());
$row_rsEmp = mysql_fetch_assoc($rsEmp);
$totalRows_rsEmp = mysql_num_rows($rsEmp);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
font-family: "Angsana New";
font-size: 22px;
font-weight: bold;
color: #000033;
}
.style3 {font-family: "Angsana New"}
a:link {
color: #000033;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000033;
}
a:hover {
text-decoration: none;
color: #FF0000;
}
a:active {
text-decoration: none;
color: #FF0000;
}
body {
background-image: url(image/background/original_moonlight-wallpaper-01-1024x768.jpg);
background-repeat: no-repeat;
}
.style10 {font-family: "Angsana New"; color: #FF0000; }
.style5 {font-family: "Angsana New"; color: #000000; }
.style12 {color: #000000}
-->
</style>
</head>
<body>
<table width="908" height="1003" border="0" align="center" bgcolor="#FFFFFF">
<tr>
<td height="218" colspan="2" valign="top"><img src="image/header/header1_1.jpg" width="900" height="214" /></td>
</tr>
<tr>
<td width="280" height="710" align="left" valign="top"><table width="280" height="152" border="0">
<tr>
<td width="279" align="center" valign="top" background="image/menuadmin/menu18 copy.jpg"><table width="245" border="0" align="center">
<tr>
<td width="55"> </td>
<td width="191"> </td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><table width="249" border="0">
<tr>
<td colspan="2" align="center"><span class="style1">เจ้าหน้าที่</span></td>
</tr>
<tr>
<td width="119" align="center"> </td>
<td width="120" align="center"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style1"> </td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style1"><table width="200" border="0">
<tr>
<td width="21"><span class="style3"><img src="image/PNG/48/Home_01.png" width="20" height="20" /></span></td>
<td width="163" align="left" class="style1"><a href="u_function.php">หน้าแรก</a></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="618" align="center" valign="top"><table width="600" height="37" border="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td colspan="2" align="center"><table width="384" border="0">
<tr>
<td width="107"><img src="image/PNG/48/Usercard_01.png" width="70" height="70" /></td>
<td width="300" align="left"><img src="image/menuadmin/menu25 copy.jpg" width="300" height="70" /></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<form id="fmDelete" name="fmDelete" method="post" action="">
<table width="600" border="0">
<tr>
<td width="200"> </td>
<td width="390"> </td>
</tr>
<tr>
<td align="right" class="style1"><label for="checkbox_row_2"><span class="style12">user</span></label>
<span class="style12"> name :<span class="style3">
<label for="checkbox_row_2"></label>
</span></span></td>
<td align="left"><input name="login_user" type="text" id="login_user" value="<?php echo $row_rsEmp['login_user']; ?>" /></td>
</tr>
<tr>
<td align="right" class="style1"><span class="style5">password :</span></td>
<td align="left"><input name="login_pass" type="text" id="login_pass" value="<?php echo $row_rsEmp['login_pass']; ?>" /></td>
</tr>
<tr>
<td align="right" class="style1"><span class="style5">ชื่อ :</span></td>
<td align="left"><input name="login_name" type="text" id="login_name" value="<?php echo $row_rsEmp['login_name']; ?>" /></td>
</tr>
<tr>
<td align="right" class="style1"><span class="style5">นามสกุล :</span></td>
<td align="left"><input name="login_lasname" type="text" id="login_lasname" value="<?php echo $row_rsEmp['login_lasname']; ?>" /></td>
</tr>
<tr>
<td align="right" class="style1"><span class="style5">e-mail :</span></td>
<td align="left"><input name="login_email" type="text" id="login_email" value="<?php echo $row_rsEmp['login_email']; ?>" /></td>
</tr>
<tr>
<td align="right" class="style1"><span class="style5">โทรศัพท์ :</span></td>
<td align="left"><input name="login_phon" type="text" id="login_phon" value="<?php echo $row_rsEmp['login_phon']; ?>" /></td>
</tr>
<tr>
<td align="right" class="style1"><span class="style5">สถานะเจ้าหน้าที่ :</span></td>
<td align="left"><span class="style10">
<input name="login_accesslevel" type="text" id="login_accesslevel" value="<?php echo $row_rsEmp['login_accesslevel']; ?>" />
</span></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
</tr>
</table>
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</td>
</tr>
<tr>
<td colspan="2"><img src="image/header/Style7 copy.jpg" width="900" height="65" /></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rsEmp);
?>
//ช่วยดูให้หน่อยค่ะทำมา 2 วันแล้ว
|
|
|
|
|
Date :
2012-03-07 16:08:33 |
By :
Liw |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คราวหน้าใส่แท็กภาษาด้วยนะครับ
ลอง echo $_SESSION['PrevUrl'] ออกมาดูหน่อยครับว่า มีการเก็บค่าไปแล้วหรือยัง
ถ้ายังให้ใส่ session_start(); ไว้บนสุดของบรรทัดนะครับ
|
|
|
|
|
Date :
2012-03-07 16:22:19 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|