[Help] Problem with login

silviosing

New Member
Joined
Mar 19, 2013
Messages
16
Reaction score
0
i have this but is not completly help me plis this is for addstat

Code:
<?
session_start();
global $maxstat;
$acc=secure($_SESSION['user']);
if(isset($_GET['logout'])){
unset($_SESSION['user']);
echo "<script>location.reload();</script>";
}
if(isset($_POST['login'])){
$account=secure($_POST['username']);
$password=secure($_POST['password']);
$login_check=mssql_num_rows(mssql_query("SELECT * FROM MEMB_INFO WHERE memb___id='$account' and memb__pwd='$password'"));
if($login_check != 1){
echo "<font color='red'><b>Invalid username or password</b></font><br>";
}
else{
$_SESSION['user'] = $account;
}
}
if(!isset($adonay)){
?>
<form name="login" method="post" action="">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="25%">&nbsp;</td>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td>Login name:</td>
		<td colspan="2"><input name="username" type="text" id="username" maxlength="10"><font color="#fff">This is your Login ID.</font></td>
	</tr>
	<tr>
		<td>Password:</td>
		<td colspan="2"><input name="password" type="password" id="password" maxlength="12"><font color="#fff">This is your password</font></td>
	</tr>
	<tr>
		<td width="15%">&nbsp;</td>
		<td width="15%"><input type="submit" class="submit" name="login" value="Login" /></td>
		<td width="70%"><input type="reset" class="reset" name="reset" value="Reset" /></td>
	</tr>
	</table>
</form>
</br>
<?
}
else{
if(isset($_GET['id'])){
$account = secure($_SESSION['user']);
echo"<form name='form1' method='post' action=''>";	

}


?>
<form name="form1" method="post" action="">
<table align="center" width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
	<td><font color="white">Name :</font></td>
	<td><select name="character"></select> <font color="white">This is your Character's name.</font></td>
</tr>
<tr>
	<td><font color="white">Strength :</td>
	<td><input name="strength" type="text" id="strength" maxlength="5" size="8"><font color="white">Amount of points added to Strength</font></td>
</tr>
<tr>
	<td><font color="white">Agility :</font></td>
	<td><input name="dexterity" type="text" id="dexterity" maxlength="5" size="8"><font color="white">Amount of points added to Agility</font></td>
</tr>
<tr>
	<td><font color="white">Vitality :</font></td>
	<td><input name="vitality" type="text" id="vitality" maxlength="5" size="8"><font color="white">Amount of points added to Vitality</font></td>
</tr>
<tr>
	<td><font color="white">Energy :</font></td>
	<td><input name="energy" type="text" id="energy" maxlength="5" size="8"><font color="white">Amount of points added to Energy</font></td>
</tr>
<tr>
	<td colspan="2" align="center">
		<input class=button type="submit" name="add" value="Add stats"><input class=button type="reset" name="reset" value="Reset">
	</td>
</tr>
</table>
</form></br>
<?php
}
?>
 
Try this

PHP:
<?php
session_start();
global $maxstat;
$acc=secure($_SESSION['user']);
if(isset($_GET['logout'])){
unset($_SESSION['user']);
echo "<script>location.reload();</script>";
}
if(isset($_POST['login'])){
$account=secure($_POST['username']);
$password=secure($_POST['password']);
$login_check=mssql_num_rows(mssql_query("SELECT * FROM MEMB_INFO WHERE memb___id='$account' and memb__pwd='$password'"));
if($login_check != 1){
echo "<font color='red'><b>Invalid username or password</b></font><br>";
}
else{
$_SESSION['user'] = $account;
 }
}
if(!isset($_SESSION['user']) && !empty($_SESSION['user'])){
echo '
<form name="login" method="post" action="">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="25%">&nbsp;</td>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td>Login name:</td>
		<td colspan="2"><input name="username" type="text" id="username" maxlength="10"><font color="#fff">This is your Login ID.</font></td>
	</tr>
	<tr>
		<td>Password:</td>
		<td colspan="2"><input name="password" type="password" id="password" maxlength="12"><font color="#fff">This is your password</font></td>
	</tr>
	<tr>
		<td width="15%">&nbsp;</td>
		<td width="15%"><input type="submit" class="submit" name="login" value="Login" /></td>
		<td width="70%"><input type="reset" class="reset" name="reset" value="Reset" /></td>
	</tr>
	</table>
</form>
</br>
';
}
else{
echo '
<form name="form1" method="post" action="">
<table align="center" width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
	<td><font color="white">Name :</font></td>
	<td><select name="character"></select> <font color="white">This is your Characters name</font></td>
</tr>
<tr>
	<td><font color="white">Strength :</td>
	<td><input name="strength" type="text" id="strength" maxlength="5" size="8"><font color="white">Amount of points added to Strength</font></td>
</tr>
<tr>
	<td><font color="white">Agility :</font></td>
	<td><input name="dexterity" type="text" id="dexterity" maxlength="5" size="8"><font color="white">Amount of points added to Agility</font></td>
</tr>
<tr>
	<td><font color="white">Vitality :</font></td>
	<td><input name="vitality" type="text" id="vitality" maxlength="5" size="8"><font color="white">Amount of points added to Vitality</font></td>
</tr>
<tr>
	<td><font color="white">Energy :</font></td>
	<td><input name="energy" type="text" id="energy" maxlength="5" size="8"><font color="white">Amount of points added to Energy</font></td>
</tr>
<tr>
	<td colspan="2" align="center">
		<input class=button type="submit" name="add" value="Add stats"><input class=button type="reset" name="reset" value="Reset">
	</td>
</tr>
</table>
</form></br>';

}


?>
 
Last edited:
dont wok bro and i need put the button of logout for exit account. like this

<form method="post" action="">
You are logged as: <b><?=$account ?></b><br />
<input type="submit" name="logout" value="Logout" />
</form>
 
PHP:
<?
session_start();
   global $maxstat;
   $acc=secure($_SESSION['user']);
if(isset($_POST['logout'])){
   unset($_SESSION['user']);
   session_destroy();
   echo "<script>location.reload();</script>";
}
if(isset($_POST['login'])){
$account=secure($_POST['username']);
$password=secure($_POST['password']);
$login_check=mssql_num_rows(mssql_query("SELECT * FROM MEMB_INFO WHERE memb___id='$account' and memb__pwd='$password'"));
if($login_check != 1){
echo "<font color='red'><b>Invalid username or password</b></font><br>";
}
else{
$_SESSION['user'] = $account;
}
}
if(!isset($_SESSION['user'])){
?>
<form name="login" method="post" action="">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="25%">&nbsp;</td>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td>Login name:</td>
		<td colspan="2"><input name="username" type="text" id="username" maxlength="10"><font color="#fff">This is your Login ID.</font></td>
	</tr>
	<tr>
		<td>Password:</td>
		<td colspan="2"><input name="password" type="password" id="password" maxlength="12"><font color="#fff">This is your password</font></td>
	</tr>
	<tr>
		<td width="15%">&nbsp;</td>
		<td width="15%"><input type="submit" class="submit" name="login" value="Login" /></td>
		<td width="70%"><input type="reset" class="reset" name="reset" value="Reset" /></td>
	</tr>
	</table>
</form>
</br>
<?
}
else{

?>


You are logged as: <b><?php echo $account ?></b><br />

<form name="form1" method="post" action="">
<table align="center" width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
	<td><font color="white">Name :</font></td>
	<td><select name="character"></select> <font color="white">This is your Character's name.</font></td>
</tr>
<tr>
	<td><font color="white">Strength :</td>
	<td><input name="strength" type="text" id="strength" maxlength="5" size="8"><font color="white">Amount of points added to Strength</font></td>
</tr>
<tr>
	<td><font color="white">Agility :</font></td>
	<td><input name="dexterity" type="text" id="dexterity" maxlength="5" size="8"><font color="white">Amount of points added to Agility</font></td>
</tr>
<tr>
	<td><font color="white">Vitality :</font></td>
	<td><input name="vitality" type="text" id="vitality" maxlength="5" size="8"><font color="white">Amount of points added to Vitality</font></td>
</tr>
<tr>
	<td><font color="white">Energy :</font></td>
	<td><input name="energy" type="text" id="energy" maxlength="5" size="8"><font color="white">Amount of points added to Energy</font></td>
</tr>
<tr>
	<td colspan="2" align="center">
		<input class=button type="submit" name="add" value="Add stats"><input class=button type="reset" name="reset" value="Reset">
	</td>
</tr>
</table>
<input type="submit" name="logout" value="Logout" />
</form></br>
<?php
}
?>