<?php

session_start();

require '../include/dbconn.php';
$pdo = dbConnforTutle::getConnection();

$getusername = $_POST['username'];
$getpassword = MD5($_POST['password']);

$checkingforuserandpwd = $pdo->prepare("SELECT * FROM admin WHERE username=:username AND password=:password ");
$checkingforuserandpwd->bindParam(':username', $getusername);
$checkingforuserandpwd->bindParam(':password', $getpassword);
$checkingforuserandpwd->execute();
$boolean = $checkingforuserandpwd->fetchAll();
if ($boolean) {
    echo 'ok';
    $_SESSION['username'] = $getusername;
    $_SESSION['password'] = $getpassword;
    exit(0);
} else {
    echo 'Incorrect Username/Password';
    exit(0);
}
//$_SESSION['rolename'] = $rolename;