Skip to content

Commit

Permalink
user Validation in php
Browse files Browse the repository at this point in the history
  • Loading branch information
arwazkhan189 authored Oct 1, 2021
1 parent 612891b commit 97ec7a7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions php/validation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Validate a user credential in php
<?php

session_start();

$conn = mysqli_connect('localhost:3306','root','','userregistration');

mysqli_select_db($conn,'userregistration');

$username = $_POST['username'];
$password = $_POST['password'];

$s = "select * from usertable where username = '$username'&& password='$password' ";

$result = mysqli_query($conn,$s);

$num = mysqli_num_rows($result);

if($num == 1){
$_SESSION['username']=$username;
header('location:home-gecbconfession.php');
}else{
header('location:index.php');
}


?>

0 comments on commit 97ec7a7

Please sign in to comment.