Jump to content

User Bann Script


samowns
 Share

Go to solution Solved by samowns,

Recommended Posts

  • Solution
Posted (edited)
	 i want to embed Bann Script or user deactive or active 
	<?php
session_start();
$message="";
?>
	<?php
include "db.php";
$msg='';
if(isset($_POST['sb']))
{
	  $time=time()-30;
  $ip_address=getIpAddr();
	$name = mysqli_real_escape_string($a, $_POST['eml']);
$pass = mysqli_real_escape_string($a, $_POST['pass']);
	
$query=mysqli_query($a,"select count(*) as total_count from loginlogs where TryTime > $time and IpAddress='$ip_address'");
 $check_login_row=mysqli_fetch_assoc($query);
  $total_count=$check_login_row['total_count'];
  //Checking if the attempt 3, or youcan set the no of attempt her. For now we taking only 3 fail attempted
  if($total_count==3){
    $msg="To many failed login attempts. Please login after 30 sec";
  }else{
    //Getting Post Values
   
	$result=mysqli_query($a,"SELECT * FROM admin WHERE eml='$name' and pass= '$pass'");
	$row  = mysqli_fetch_assoc($result);
$row=mysqli_num_rows($result);
//ban user
if($row==1)
{
  $_SESSION['user_name'] =$name;
  header("location:wel.php?msg=Scuessfull eml");
mysqli_query($a,"delete from loginlogs where IpAddress='$ip_address'");
}
	     
	
           else{
      $total_count++;
      $rem_attm=4-$total_count;
      if($rem_attm==0){
        $msg="To many failed login attempts. Please login after 40 sec";
      }else{
        $msg="<b>Please enter valid login details.<br/>$rem_attm attempts remaining <b>";
      }
	      $try_time=time();
      mysqli_query($a,"insert into loginlogs(IpAddress,TryTime) values('$ip_address','$try_time')");
      
    }
}}
if(isset($_SESSION['user_name']) ){
  header("location:wel.php?msg=Scuessfull ");
?>
	<?php
}
	
?>
	
<form  class="login-form" action="adminscure.php" method="post" >
<div class="message"><?php if($message!="") { echo $message; } ?></div>
<body id="LoginForm">
<div class="container">
	
<div class="main-div">
 <div class="panel">
 
   <h2>Admin Login</h2>
   
   <p>Please enter your email and passwords</p>
   </div>
    <form id="Login">
<div class="form-group">
	
            <input type="name"  name="eml" class="form-control"  id="eml"  placeholder="name">
	        </div>
	        <div class="form-group">
	            <input type="password" name="pass" class="form-control" id="pass" placeholder="Password">
            
	        </div>
        <div>
<input type="submit" name="sb" class="btn btn-primary">
 <div id="result"><?php echo $msg?></div>
	</div>
</form>
<?php
	function getIpAddr(){
    if (!empty($_SERVER['HTTP_CLIENT_IP'])){
       $ipAddr=$_SERVER['HTTP_CLIENT_IP'];
    }elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
       $ipAddr=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }else{
       $ipAddr=$_SERVER['REMOTE_ADDR'];
    }
   return $ipAddr;
}?>
	 
	 
	 
	

 

Edited by samowns
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.