Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <title>LOG IN</title>
- </head>
- <?php
- session_start();
- $username = (@$_POST['username']);
- $password = (@$_POST['password']);
- $attempts = ($_POST ['attempts']);
- $error['alert'] = '';
- $error['username'] = '';
- $error['password'] = '';
- $input['username'] = '';
- $input['password'] = '';
- if (isset($_POST['submit']))
- {
- if ($_POST['username'] == '' || $_POST['password'] == '')
- {
- if ($_POST['username'] == '') {
- $error['username'] = 'required'; }
- if ($_POST['password'] == '') {
- $error['password'] = 'required'; }
- $error['alert'] = 'Please fill in required fields!';
- $_POST['username'];
- $_POST['password'];
- include('v_login.php');
- if($username!=$dbusername&& md5($password)!=$dbpassword)
- {
- $connect = mysql_connect("mysql1.000webhost.com","a4063609_renz","ny4n93");
- mysql_select_db("a4063609_phplogi") or die ("Couldn't find db");
- // Increment login count...
- mysql_query("UPDATE users SET attempts = attempts + 1 WHERE username = '$username'");
- // Fetch login count...
- $result = mysql_query("SELECT attempts WHERE username = '$username'");
- $attempts = mysql_result($result);
- if($attempts >= 3)
- {
- echo "Please Wait!";
- }
- }
- }
- else
- $error['alert'] = "Username or Password is incorrect";
- {
- if ($username&&$password)
- {
- $connect = mysql_connect("mysql1.000webhost.com","a4063609_renz","ny4n93");
- mysql_select_db("a4063609_phplogi") or die ("Couldn't find db");
- $query = mysql_query("SELECT * FROM users WHERE username='$username'");
- $numrows= mysql_num_rows($query);
- if($numrows!==0)
- {
- while($row=mysql_fetch_assoc($query))
- {
- $dbusername= $row['username'];
- $dbpassword= $row['password'];
- $activated= $row['activated'];
- if($activated=='0')
- {
- header("location:not_active.php");
- exit();
- }
- }
- if($username==$dbusername&& md5($password)==$dbpassword)
- {
- mysql_query("UPDATE Users SET $attempts = 0 WHERE $username = 'username'");
- header("location:member.php");
- $_SESSION['username']=$username;
- }
- else
- $error['alert'] = "Username or Password is incorrect";
- include('v_login.php');
- }
- else
- {
- $error['alert'] = "Username or Password is incorrect";
- include('v_login.php');
- }
- }
- else
- {
- echo "";
- }
- }
- }
- else
- {
- include('v_login.php');
- }
- ?>
- </html>