<?php session_start() ?>

<!DOCTYPE html>

<!-- Website template by freewebsitetemplates.com -->

<html>

<head>

	<meta charset="UTF-8">

	<title>Tournaments - Family Chess Club Website Template</title>

	<link rel="stylesheet" href="css/style.css" type="text/css">

	<!--[if IE 7]>

		<link rel="stylesheet" href="css/ie7.css" type="text/css">

	<![endif]-->

</head>

<body>

	<div class="page">

		<div class="background">

				





	



	

<style>

div

{

text-align:justify;

text-justify:inter-word;

}

</style>

<!-- /#header -->



<div class="body">





<div id="main_container">

</br>





		

</div>

<div>

	





<?php

funa();

funagree();







function funa(){

'<script type="text/javascript">

parent.location="access1.php";



</script>';

}





function funagree(){

'<script type="text/javascript">

        document.exm.action="loginx.php";



</script>';

}









?>

<?php

    function do_alert($msg) 

    {

        echo '<script type="text/javascript">alert("' . $msg . '") 

           parent.location="portal.html";



</script>';

       

    }

?>

<?php

    function do_aler($msg) 

    {

        echo '<script type="text/javascript">alert("' . $msg . '") 

           parent.location="licvbth.php";



</script>';

       

    }

?>

<?php

    function do_ale($msg) 

    {

        echo '<script type="text/javascript">alert("' . $msg . '") 

           parent.location="licvbthstu.html";



</script>';

       

    }

?>

<?php

    function do_alerit($msg) 

    {

        echo '<script type="text/javascript">alert("' . $msg . '") 

           parent.location="licvbthvist.php";



</script>';

       

    }

?>

<?php

    function do_aleritp($msg) 

    {

        echo '<script type="text/javascript">alert("' . $msg . '") 

           parent.location="dashboard.php";



</script>';

       

    }

?>

<?php

    function do_aleri($msg) 

    {

        echo '<script type="text/javascript">alert("' . $msg . '") 

           parent.location="dashboard.php";



</script>';

       

    }

?>



<?php

    function do_aleripp($msg) 

    {

        echo '<script type="text/javascript">alert("' . $msg . '") 

           parent.location="licvbthprinter.php";



</script>';

       

    }

?>



<?php

include('config.php');

if (filter_has_var(INPUT_POST, "pass")){





$tyr=$_POST['name'];



$rt=$_POST['pass'];

}else {

do_alert("enter your details");

}

//make the database connection



$sql = "select * from access where userid = '$tyr' and password = '$rt'";

 $data = mysqli_query($conn,$sql);



$rows = mysqli_num_rows($data);



if($rows <= 0){

   do_alert("user does not exist contact system admin");

}

else{



while($row= mysqli_fetch_array($data))

{



$serial=  $row['name'];

 $input= $row['userid'];

$stat= $row['type'];

$pass=$row['password'];

$cla=$row['class'];

$aam=$row['arm'];

$eam=$row['email'];

$a="admin";

$b="formteacher";

$c="student";

$d="subjectteacher";

$ssa="printer";



}







$_SESSION['name']=$serial;



$_SESSION['num']=$input;

$_SESSION['class']=$cla;

$_SESSION['arm']=$aam;

$_SESSION['email']=$eam;









if ($rt != $pass ){

do_alert("wrong password entered");





}



if ($stat == $a ){

do_aler("Welcome Dear $serial please proceed");



}else if ($stat == $b) {

do_aleritp("welcome Dear $serial please proceed");

}else if ($stat ==$c){

do_alerit("welcome Dear $serial please proceed");





}else if ($stat ==$d){

do_aleri("welcome Dear $serial please proceed");





}else if ($stat ==$ssa){

do_aleripp("welcome Dear $serial please proceed");





}else{



 do_alert("wrong password entered");



}

}

?>





<!-- end of main_container -->								</p>

			</div>

		</div>

	</div>



</div></body>

</html>