Thread: form position
View Single Post
Old 12-17-2018, 07:01 AM   #5
joekanan
 
Join Date: Mar 2018
Posts: 9
Default

This is my code, can you tell me where should I put the syntax ?

<?php require_once('Connections/bis_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['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "Menu.php";
$MM_redirectLoginFailed = "Gagal.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_bis_conn, $bis_conn);

$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $bis_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 );
}
}
?>
<style type="text/css">
body,td,th {
color: #000;
}
body {
background-color: #FFF;
background-image: url();
}
</style>
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="500" border="1">
<tr>
<th width="118" rowspan="4" scope="col">&nbsp;</th>
<th colspan="3" bgcolor="#FFFFFF" scope="col"><div align="center">LOGIN</div></th>
</tr>
<tr>
<td width="139" bgcolor="#FFFFFF"><div align="center">Username</div></td>
<td width="7" bgcolor="#FFFFFF"><div align="center">:</div></td>
<td width="208" bgcolor="#FFFFFF"><label for="username"></label>
<div align="center">
<input type="text" name="username" id="username">
</div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center">Password</div></td>
<td bgcolor="#FFFFFF"><div align="center">:</div></td>
<td bgcolor="#FFFFFF"><label for="password"></label>
<div align="center">
<input type="text" name="password" id="password">
</div></td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF"><div align="center">
<input type="submit" name="submit" id="submit" value="Submit">
</div></td>
</tr>
</table>
</form>
joekanan is offline   Reply With Quote