PHP program

 

Userauthentication.php

<?php

$con= mysqli_connect("localhost", "root", "weareteam@2020") or die('could not connect to server');

mysqli_select_db("drgjena", $con) or die('could not connect to database');

$user = $_POST['Uname'];

$pssword = $_POST['password'];

//$query = "SELECT userid from user where userid = '$username' and password = PASSWORD('$password')";

$query = "SELECT * from users";

$result = mysqli_query($query); while($value=mysqli_fetch_array($result))

{

if($user == $value['userid'] && $pssword == $value['password'])

{

echo "login success";

echo "username:".$value['useriname'];

echo "password:".$value['password']."<br>"; break;

}

else

{          echo "not authenticated";        break;              }

}

?>



Comments

Popular posts from this blog

8) User Authentication: Assume four users user1, user2, user3 and user4 having the passwords pwd1, pwd2, pwd3 and pwd4 respectively. Write a PHP for doing the following. 1. Create a Cookie and add these four user id’s and passwords to this Cookie. 2. Read the user id and passwords entered in the Login form and authenticate with the values (user id and passwords) available in the cookies. If he is a valid user (i.e., user-name and password match) you should welcome him by name (user-name) else you should display ―You are not an authenticated user ’’. Use init-parameters to do this

4. Write a C program to implement the Brute force technique of Top down Parsing.

Web development Lab