<?php
session_start();
include_once 'config.php';
if(isset($_POST['authenticate'])){
    try {
    $pdo = new PDO("mysql:host=$dbhost;dbname=$db_name", $dbuser, $dbpass);
                                                    $rows = $pdo->query("SELECT * FROM rockypet_user where email='".$_POST['email']."'");
                                                    while ($row = $rows->fetch()):
        if($row['password'] == $_POST['password']){
            $_SESSION["isloggedin"] = "true";
            header("Location: http://finstechnologies.com/rockypetghana/admin/ui/project_all.php");
            die();
        }else{
            $_SESSION["isloggedin"] = "false";
            echo "Invalid Credentials.. please try again..<a href=\"http://finstechnologies.com/rockypetghana/index.php\">home</a>";
            //header("Location: http://finstechnologies.com/rockypetghana/index.php");
        }
      endwhile;
    }catch(PDOException $e) {
                                                    echo $sql . "<br>" . $e->getMessage();
                                                }
      //echo "Success";
      
}
?>