|
|
|
unknown column 'tables_in_' in 'where clause' คืออะไรครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php require_once('../Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}
?>
<?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 = "";
$MM_redirectLoginSuccess = "admin_page.php";
$MM_redirectLoginFailed = "test.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conn, $conn);
$LoginRS__query=sprintf("SELECT `User`, Pass FROM `admin` WHERE `User`=%s AND Pass=%s",
GetSQLValueString($loginUsername, "-1"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2013-08-07 13:22:18 |
By :
Motoki99 |
View :
3167 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"SELECT `User`, Pass FROM `admin` WHERE `User`=%s AND Pass=%s", น่าจะผิดครับ ไม่มี fild นั้นอยู่
|
|
|
|
|
Date :
2013-08-07 13:29:00 |
By :
psist |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ.....ผมลองสร้างฐานข้อมูลใหม่ครับ ยังไงก็ขอบคุณครับ
|
|
|
|
|
Date :
2013-08-07 13:42:04 |
By :
Motoki99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ต้องแก้ไข
GetSQLValueString($loginUsername, "-1")
เป็น
GetSQLValueString($loginUsername, "text")
|
|
|
|
|
Date :
2018-04-27 15:06:03 |
By :
ounamo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|