Jump to content

PHP Login Help


invisionx

Recommended Posts

Alright i got this login script from a guy and i want to add a few features to it which is Ip Logging, 3 failed login and cant login for 30 mins, and Online users (also includes how many Visitors are on the site and stuff like that).

 

I seen that you had a Online users Tutorial but for some reason it wouldnt work on my script i might have done something wrong. and the 3 failed logins thing i found a tutorial but i couldnt figure it out. and finally i havent found a tutorial on ip logging

 

can someone help me with these 3 things please

 

Thank you

invisionx

Link to comment
https://forums.phpfreaks.com/topic/53599-php-login-help/
Share on other sites

i accually used the

and also i had the site up for 2 days its my test server and also i know how to make it where people can view the script all you need is macromedia just start a new document and click on Design and insert your code then click on Code and it will be in html format so that people can see your code

 

checkuser.php

 

<?

/* if (isset($_COOKIE['user_name'])) {

$user_name = $_COOKIE['user_name'];

} else { */

$user_name = $_POST['user_name'];

/* }

if (isset($_COOKIE['password'])) {

$password = $_COOKIE['password'];

} else { */

$password = $_POST['password'];

// }

if ((!$user_name) || (!$password)) {

echo '<center><font class="txt">Please enter ALL of the information!</font></center><br><br>';

include 'login_form.php';

return;

}

$sql = mysql_query("SELECT * FROM users WHERE user_name='$user_name' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);

if ($login_check > 0) {
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
	$$key = stripslashes( $val );
}

	session_register('userid');
	$_SESSION['userid'] = $userid;
	session_register('user_name');
	$_SESSION['user_name'] = $user_name;
	session_register('email_address');
	$_SESSION['email_address'] = $email_address;
	session_register('msn');
	$_SESSION['msn'] = $msn;
	session_register('aim');
	$_SESSION['aim'] = $aim;
	session_register('yahoo');
	$_SESSION['yahoo'] = $yahoo;
	session_register('show_email');
	$_SESSION['show_email'] = $show_email;
	session_register('show_msn');
	$_SESSION['show_msn'] = $show_msn;
	session_register('show_aim');
	$_SESSION['show_aim'] = $show_aim;
	session_register('show_yahoo');
	$_SESSION['show_yahoo'] = $show_yahoo;
	session_register('about_me');
	$_SESSION['about_me'] = $about_me;
	session_register('special_user');
	$_SESSION['user_level'] = $user_level;
	session_register('last_login');
	$_SESSION['last_login'] = $last_login;

	/* if (isset($_POST['rememberme'])) { 
      	
	setcookie("user_name", $user_name, time()+60*60*24*100, "/"); 
      	setcookie("password", $password, time()+60*60*24*100, "/");

	} */

	mysql_query("UPDATE users SET last_login=now(), online_time=now(), WHERE userid='$userid'");

	header("Location: ../index.php?pages=members_news");

}

} else {

echo '<center><font class="txt">You could not be logged in, Either the username and password do not match or you have not validated your membership.<br><br>Please try again!<br><br></font></center>';
include 'login_form.php';

}

?>

 

login_forum.php

<?php

if(isset($_SESSION['user_name'])){

header("Location: index.php?pages=login_success");

} else {

?>
<form action="../index.php?pages=checkuser" method="post" name="" id="">
   
  <table width="42%" height="20" border="0" cellpadding="2" cellspacing="0" bgcolor="#CFC095" class="Header_box" align="center">
            <tr>
              <th align="center" bgcolor="#514833" class="background_head">Login</th>
            </tr>
          </table>
<table width="42%" border="0" cellpadding="2" cellspacing="0" bgcolor="#CFC095" class="Box_border" align="center">
    <tr> 
<td width="47%" valign="top" bgcolor="#4D4531" class="background">Username</td>
    <td width="53%" valign="top" bgcolor="#4D4531" class="background"><input name="user_name" type="text" id="user_name" class="input-box"></td>
    </tr>
    <tr> 
      <td width="47%" valign="top" bgcolor="#4D4531" class="background">Password</td>
      <td width="53%" valign="top" bgcolor="#4D4531" class="background"><input name="password" type="password" id="password" class="input-box"></td>
     </tr> 
<tr> 
  <td width="47%" valign="top" bgcolor="#4D4531" class="background">Remember Me</td>
      <td width="53%" valign="top" bgcolor="#4D4531" class="background">
<div align="left">
          <input name="rememberme" type="checkbox">
        </div>
        <div align="right"></div>
        </td>
    </tr>
    <tr>      
  <td width="47%" valign="top" bgcolor="#4D4531" class="background"> </td>
      <td width="53%" valign="top" bgcolor="#4D4531" class="background"><div align="right">
          <input type="submit" name="Submit" value="Submit" class="submit-button">
        </div></td>
    </tr>
  </table>
</form>
  
<table width="23%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
      <td><div align="right" class="txt"><a href="../index.php?pages=sendpassword">Forgoten your password?</a></div></td>
  </tr>
</table>

<?php
}
?>

Link to comment
https://forums.phpfreaks.com/topic/53599-php-login-help/#findComment-267036
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.