Tom-
27-03-2008, 07:39 PM
i dno where my other threads have gone
my index.php for my mafia game
can anyone edit it so it is not password protected..
<?php
session_start();
include 'includes/db_connect.php';
// *** Validate request to login to this site.
if (($_POST['username']) || ($_POST['password'])){
if(!$_POST['username']){
echo "<div class=prob>- Please enter a username.<br></div>";
}elseif(!$_POST['password']){
echo "<div class=prob>- Please enter a password.<br></div>";
}else{
$username = $_POST['username'];
$password =$_POST['password'];
$sql = mysql_query("SELECT id FROM users WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
$targetstats = mysql_query("SELECT username, password, status FROM users WHERE username='$username'");
while($ts = mysql_fetch_array($targetstats)){
$username= $ts[0];
$pw = $ts[1];
$status = $ts[2];
}
if($pw!=$password){
echo "Invalid username and password combination";
}elseif($login_check == 0 ){
echo "Invalid username and password combination";
}elseif($pw!=$password){
echo "Invalid username and password combination";
}elseif ($status == "Dead"){
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=Dead.php\">";
}elseif ($status == "Banned"){
echo "<link REL=stylesheet TYPE=text/css HREF=includes/in.css>You have been banned!";
exit();
}else{
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
$now = time();
$domain = $_SERVER['REMOTE_ADDR'];
mysql_query("UPDATE users SET ip='$domain' WHERE username='$username'");
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=logged_in.php\">";
}
}
}
if(session_is_registered('username')){
$checkpassword = $_SESSION['password'];
$checkusername = $_SESSION['username'];
$checklogin = mysql_query("SELECT id FROM users WHERE username='$checkusername' AND password='$checkpassword'");
$checkloginrows = mysql_num_rows($checklogin);
if($checkloginrows > 0 ){
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=logged_in.php\">";
exit();
}else{
unset($_SESSION['username'],$_SESSION['password']);
}
}
?>
<html>
<head>
<title>Gangster-Town</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/out.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {font-style: italic; font-size: 18px; color: #000000;}
-->
</style>
</head>
<body>
<center>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="114" colspan="3" valign="top"><img src="images/bannergoed.gif" alt="banner"></td>
</tr>
<tr>
<td width="178" height="100"> </td>
<td width="402" valign="top"><table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class=thinline>
<!--DWLayoutTable-->
<tr>
<td colspan="2" background="includes/grad.jpg"><div align="center">Login
to Gangster-Town</div></td>
</tr>
<tr>
<form name="form1" method="post" action="index.php">
<td width="190" height="20">Username:</td>
<td width="198"><input name="username" type="text" id="username"></td>
<tr>
<td height="20">Password</td>
<td height="20"><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td height="20"> </td>
<td height="20"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</form>
</table></td>
<td width="190"> </td>
</tr>
<tr>
<td height="14"></td>
<td valign="top"><div align="center"><a href="register.php">Register</a> |
<a href="lost.php">Lost password</a> | <a href="index.php">Login</a></div></td>
<td></td>
</tr>
<tr>
<td height="87"></td>
<td> </td>
<td></td>
</tr>
</table>
</center>
</body>
</html>
Closed by Hitman (Forum Moderator): Your other thread is here (http://www.habboxforum.com/showthread.php?t=470256). Please don't mae any more threads on the subject, post in the one you already have, thanks!
my index.php for my mafia game
can anyone edit it so it is not password protected..
<?php
session_start();
include 'includes/db_connect.php';
// *** Validate request to login to this site.
if (($_POST['username']) || ($_POST['password'])){
if(!$_POST['username']){
echo "<div class=prob>- Please enter a username.<br></div>";
}elseif(!$_POST['password']){
echo "<div class=prob>- Please enter a password.<br></div>";
}else{
$username = $_POST['username'];
$password =$_POST['password'];
$sql = mysql_query("SELECT id FROM users WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
$targetstats = mysql_query("SELECT username, password, status FROM users WHERE username='$username'");
while($ts = mysql_fetch_array($targetstats)){
$username= $ts[0];
$pw = $ts[1];
$status = $ts[2];
}
if($pw!=$password){
echo "Invalid username and password combination";
}elseif($login_check == 0 ){
echo "Invalid username and password combination";
}elseif($pw!=$password){
echo "Invalid username and password combination";
}elseif ($status == "Dead"){
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=Dead.php\">";
}elseif ($status == "Banned"){
echo "<link REL=stylesheet TYPE=text/css HREF=includes/in.css>You have been banned!";
exit();
}else{
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
$now = time();
$domain = $_SERVER['REMOTE_ADDR'];
mysql_query("UPDATE users SET ip='$domain' WHERE username='$username'");
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=logged_in.php\">";
}
}
}
if(session_is_registered('username')){
$checkpassword = $_SESSION['password'];
$checkusername = $_SESSION['username'];
$checklogin = mysql_query("SELECT id FROM users WHERE username='$checkusername' AND password='$checkpassword'");
$checkloginrows = mysql_num_rows($checklogin);
if($checkloginrows > 0 ){
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=logged_in.php\">";
exit();
}else{
unset($_SESSION['username'],$_SESSION['password']);
}
}
?>
<html>
<head>
<title>Gangster-Town</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/out.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {font-style: italic; font-size: 18px; color: #000000;}
-->
</style>
</head>
<body>
<center>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="114" colspan="3" valign="top"><img src="images/bannergoed.gif" alt="banner"></td>
</tr>
<tr>
<td width="178" height="100"> </td>
<td width="402" valign="top"><table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class=thinline>
<!--DWLayoutTable-->
<tr>
<td colspan="2" background="includes/grad.jpg"><div align="center">Login
to Gangster-Town</div></td>
</tr>
<tr>
<form name="form1" method="post" action="index.php">
<td width="190" height="20">Username:</td>
<td width="198"><input name="username" type="text" id="username"></td>
<tr>
<td height="20">Password</td>
<td height="20"><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td height="20"> </td>
<td height="20"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</form>
</table></td>
<td width="190"> </td>
</tr>
<tr>
<td height="14"></td>
<td valign="top"><div align="center"><a href="register.php">Register</a> |
<a href="lost.php">Lost password</a> | <a href="index.php">Login</a></div></td>
<td></td>
</tr>
<tr>
<td height="87"></td>
<td> </td>
<td></td>
</tr>
</table>
</center>
</body>
</html>
Closed by Hitman (Forum Moderator): Your other thread is here (http://www.habboxforum.com/showthread.php?t=470256). Please don't mae any more threads on the subject, post in the one you already have, thanks!