code php:<?php

session_start();

class mysql{

private $localhost="localhost";
private $db_user="root";
private $db_password="";
private $db_name="php";

function __construct(){
    $connect=mysqli_connect($this->localhost,$this->db_user,$this->db_password,$this->db_name);
}
function sql(){
    $username=$_POST['username'];
    $password=$_POST['password'];

    $sql="SELECT * FROM users WHERE username='$username' AND password='$password'";
    $query=mysqli_query($sql,$connect);
    $num=mysqli_num_rows($query);
    if($num==1){
        $_SESSION["username"]="username";
        $_SESSION["password"]="password";
        header("location:control3.php");
    }
    else{echo"password or username it not true, please enter the right input....";}
}

}

$use=new mysql;

$use->sql();

?>