help with my login page
Posted: Tue Jun 01, 2010 11:57 am
i have been having problems with my login page for a online text based game
PLEASE HELLP ME
PLEASE HELLP ME
<?php include_once("config.php");
include_once("lang/lang_".$lang.".php");
include_once("connect.php");
include_once("functions.php"); ?>
<!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=iso-8859-1" />
<title>Vato Loco.</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #999999;
}
body {
background-color: #333333;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a {
font-size: 10px;
color: #999999;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #999999;
}
a:hover {
text-decoration: none;
color: #999999;
}
a:active {
text-decoration: none;
color: #999999;
}
.button {width: 200px; height: 55px;margin-top: 0px; margin-bottom: 0px; background-color: #333333; color: #ffffff; cursor: pointer; border-left: 0px solid #ffffff; border-right: 0px solid #ffffff; border-top: 0px solid #ffffff; border-bottom: 0px solid #ffffff; font-size: 10px; font-family: verdana; background-image: url(http://img250.imageshack.us/img250/7794/login2bg6.jpg);}
.menu { color: #FFFFFF; font-size: 10px; font-family: verdana; width: 98%; background-color:#333333; border:2px solid #000000;width: 150px;}
.menu1 {color: #FFFFFF; font-size: 10px; font-family: verdana; width: 98%; background-color:#333333; border:2px solid #000000;width: 150px;}
-->
</style></head>
<body OnLoad="document.login.mail.focus();">
<center>
<img src="http://img401.imageshack.us/img401/8845/vatolocomw1.jpg" width="732" height="457" />
<form id="form1" name="form1" method="post" action="">
<table width="700" border="0" cellspacing="0">
<tr>
<td colspan="4" align="center" class="style1"><?php
if(isset($_SESSION['user_id'])) {
// if already logged in.
session_unset();
session_destroy();
echo "<font color=\"red\">You have been logged out.</font>";
}
if(isset($_POST['login'])) {
$query = "SELECT password,id,login_ip,login_count FROM login WHERE name='".mysql_real_escape_string($_POST['name'])."'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
if(($_POST['pass']) != $row['password']){
echo "<font color=\"red\">Your username and/or password is incorrect!</font>";
}else{
if($row['login_count'] >= 5 ){
echo "<font color=\"red\">You have tried 5 times to login successfully, if you have forgotten your password, click <a href=\"forget.php\">here.</a></font>";
}else{
$update_login = mysql_query("UPDATE login SET login_count=login_count+'1' WHERE name='".mysql_real_escape_string($_POST['name'])."'")
or die(mysql_error());
if(empty($row['login_ip'])){
$row['login_ip'] = $_SERVER['REMOTE_ADDR'];
}else{
$ip_information = explode("-", $row['login_ip']);
if (in_array($_SERVER['REMOTE_ADDR'], $ip_information)) {
$row['login_ip'] = $row['login_ip'];
}else{
$row['login_ip'] = $row['login_ip']."-".$_SERVER['REMOTE_ADDR'];
}
}
$_SESSION['user_id'] = $row['id'];
$result = mysql_query("UPDATE login SET userip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."',login_ip='".mysql_real_escape_string($row['login_ip'])."',login_count='0' WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'")
or die(mysql_error());
if($row['sitestate'] == "1"){
header("Location: banned.php?name=".$row['name']."");
}
if($row['sitestate'] == "2"){
header("Location: dead.php?name=".$row['name']."");
}
if(($row['sitestate'] == "0") or ($row['sitestate'] == "9")){
header("Location: game.php");
}
}// count check.
}// id check.
}// password check.
// if isset submit.
?></td>
</tr>
<tr>
<td align="right" class="style1"><img src="http://img61.imageshack.us/img61/6730/emailjg3.jpg" width="200" height="50" /></td>
<td width="150" align="center"><input name="mail" type="text" class="menu1" id="mail" style='width: 95%;'/></td>
<td width="60" align="right" class="style1"><img src="http://img523.imageshack.us/img523/8489/passsk4.jpg" width="200" height="50" /></td>
<td width="150" align="center"><input name="pass" type="password" class="menu1" id="pass" style='width: 95%; ' maxlength="20"/></td>
</tr>
<tr>
<td height="35" colspan="4" align="right"><input name="submit" type="submit" class="button" value="" onfocus="if(this.blur)this.blur()"/> </td>
</tr>
<center><tr>
<td colspan="4" align="center"><a href="forgotpass.php">Forgot Password </a>
<label> | Harbor GFX |</label>
<a href="register.php"> Register </a>
<label> | </label>
<a href="screenshots.php"> Screen Shots </a>
</tr></center>
</table>
</form>
</center>
</body>
</html>