Location: PHPKode > projects > PHP Enter > www/admin/signin.php
<?php session_start();
include('config.php');
include('options.php');
if(isset($_POST['Submit'])){
$ccuser = $_POST['username'];
$ccpass = $_POST['password'];
$ccuser = addslashes($ccuser);
$ccpass = addslashes($ccpass);
$name=array($ccuser,$ccpass);
foreach ($name as $name) 
{
if(preg_match('#[^A-Za-z0-9-]#', $name)) { echo "Illegal Characters"; Die();
}
if (strlen($name) < 4) {
echo "<center><div id=\"toprow\">The field must be at least 4 characters long.";    
 Die();
}}
$ccpass = md5($_POST['password']);
$query="SELECT * FROM cpadmin WHERE ausername = '" . mysql_real_escape_string($ccuser) ."' and apassword = '" . mysql_real_escape_string($ccpass) ."'";
$result=mysql_query($query);
if($result) {
if(mysql_num_rows($result) == 1) {
session_regenerate_id();
$sesrow = mysql_fetch_assoc($result);
$_SESSION['AINC_US_ID'] = $sesrow['ausid'];
$_SESSION['AINC_US_NAME'] = $sesrow['ausername'];
session_write_close();
header("location: index.php");
exit();
}else {
header("location: signin.php");
exit();
}
}else {
die("Query failed");
}
}else{
?>
<html>
<head>
<meta charset="UTF-8">
<link type="text/css" href="style.css" rel="stylesheet">
<title></title>
</head>
<body style="background-color: #ffffff;color:#555555;">
<div style="width:368px;background-color:#E4EBF8;align:center;margin:0px auto;border:1px dotted #B1C7DE;margin-top:28px;padding:8px;">
<form action="signin.php" name="ccform" method="post">
<font style="font-size:18px;color:#555555">Login</font>
<br /><font style="font-size:12px;color:#555555">Username<br />
<input class="incc" maxlength="25" name="username" type="text" />
<br /><br />
<font style="font-size:12px;color:#555555">Password <br />
<input class="incc" name="password" size="30" type="password" /><br /><br />
<input class="incc" type="submit" value="Sign In" name="Submit" type="button"><br /><br />
</form>
<center><a href="http://www.phpenter.net"><font style="font-size:11px;color:#555">PHP Enter</font></a></center>
</div>

<?php } ?>

Return current item: PHP Enter