Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('DB/connection.php');
- session_start();
- include 'functions.php';
- if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])):
- //your site secret key
- $secret = '6LdJGDEUAAAAAGoxoiJqxPvhZgS4VDahzUaTneg3';
- //get verify response data
- $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
- $responseData = json_decode($verifyResponse);
- if($responseData->success):
- //registerglobal('college_id','username','password','usertype','Login_x','Login_y','emsg','location_id');
- $username = $_POST['username'];
- $password = $_POST['password'];
- $usertype = $_POST['usertype'];
- $error = [];
- if($username==""){$error['username']="Enter User Name";}
- if($password==""){$error['password']="Enter Password";}
- if(count($error)==0){
- if($usertype=='student'){
- $sel_user = "SELECT * FROM tbl_students WHERE preadmission_id='".$username."' AND password='".$password."' AND status!='inactive'";
- $std_records = sqlnumber($sel_user);
- if($std_records>0){
- $student_info = getarrayassoc($sel_user);
- if (is_array( $student_info) && count( $student_info) > 0){
- // $_SESSION['eschools']['user_school'] = $college_id;
- $_SESSION['eschools']['student_name'] = $student_info['student_name'];
- $_SESSION['eschools']['user_id'] = $student_info['preadmission_id'];
- $_SESSION['eschools']['id'] = $student_info['student_id'];
- $_SESSION['eschools']['login_type'] = $usertype;
- $_SESSION['eschools']['photo'] = $student_info['image'];
- /*$finance_info = getarrayassoc("SELECT * FROM es_finance_master ORDER BY es_finance_masterid DESC LIMIT 0,1");
- $_SESSION['eschools']['currency'] = $finance_info['fi_symbol'];
- $_SESSION['eschools']['schoollogo'] = $finance_info['fi_school_logo'];
- $_SESSION['eschools']['schoolname'] = $finance_info['fi_schoolname'];
- $_SESSION['eschools']['from_acad'] = $finance_info['fi_ac_startdate'];
- $_SESSION['eschools']['to_acad'] = $finance_info['fi_ac_enddate'];
- $_SESSION['eschools']['from_finance'] = $finance_info['fi_startdate'];
- $_SESSION['eschools']['to_finance'] = $finance_info['fi_enddate'];*/
- echo "<script type='text/javascript'>
- window.location.href='student/profile.php';
- </script>";
- }
- }else{
- $username="";
- $password="";
- echo '<script>alert("invalid admin");</script>';
- //header("location:loginFailure.php");
- echo '<script>window.location.href="index.php"</script>';
- exit;
- }
- else : echo '<script type="text/javascript">alert("Robot verification failed, please try again.");</script>';
- echo '<script type="text/javascript">window.location.href="index.php"</script>';
- endif;
- else : echo '<script type="text/javascript">alert("Please click on the reCAPTCHA box.");</script>';
- echo '<script type="text/javascript">window.location.href="index.php"</script>';
- endif;
- }
- /*if($usertype=='staff'){
- $sel_user = "SELECT * FROM es_staff WHERE st_username='".$username."' AND st_password='".$password."' AND status='added' AND selstatus='accepted' AND tcstatus='notissued'";
- $staff_records = sqlnumber($sel_user);
- if($staff_records>0){
- $staff_info = getarrayassoc($sel_user);
- if (is_array( $staff_info) && count( $staff_info) > 0){
- $_SESSION['eschools']['user_school'] = $college_id;
- $_SESSION['eschools']['user_name'] = $staff_info['st_username'];
- $_SESSION['eschools']['user_id'] = $staff_info['es_staffid'];
- $_SESSION['eschools']['st_postaplied'] = $staff_info['st_post'];
- $_SESSION['eschools']['login_type'] = $usertype;
- $_SESSION['eschools']['user_theme'] = $staff_info['st_theme'];
- $finance_info = getarrayassoc("SELECT * FROM es_finance_master ORDER BY es_finance_masterid DESC LIMIT 0,1");
- $_SESSION['eschools']['currency'] = $finance_info['fi_symbol'];
- $_SESSION['eschools']['schoollogo'] = $finance_info['fi_school_logo'];
- $_SESSION['eschools']['schoolname'] = $finance_info['fi_schoolname'];
- $_SESSION['eschools']['from_acad'] = $finance_info['fi_ac_startdate'];
- $_SESSION['eschools']['to_acad'] = $finance_info['fi_ac_enddate'];
- $_SESSION['eschools']['from_finance'] = $finance_info['fi_startdate'];
- $_SESSION['eschools']['to_finance'] = $finance_info['fi_enddate'];
- echo "<script type='text/javascript'>
- window.location.href='dashboard.php';
- </script>";
- }
- }else{
- $username="";
- $password="";
- echo "<script type='text/javascript'>
- window.location.href='index.php?error';
- </script>";
- exit;
- }
- }*/
- if($usertype=='super'){
- $sel_admin = "SELECT * FROM tbl_admins WHERE admin_username='".$username."' AND admin_password='".$password."'";
- $admin_records = sqlnumber($sel_admin);
- if($admin_records>0){
- $admin_info = getarrayassoc($sel_admin);
- if (is_array( $admin_info) && count( $admin_info) > 0){
- //$_SESSION['eschools']['user_school']= $college_id;
- $_SESSION['eschools']['admin_user'] = $admin_info['admin_username'];
- $_SESSION['eschools']['admin_id'] = $admin_info['adminsid'];
- $_SESSION['eschools']['user_type'] = $usertype;
- if($admin_info['user_type']=='super'){
- $_SESSION['eschools']['superadmin_email'] = $admin_info['admin_email'];
- }
- echo "<script type='text/javascript'>
- window.location.href='dashboard.php';
- </script>";
- exit(0);
- }
- }else{
- $username="";
- $password="";
- echo "<script type='text/javascript'>
- window.location.href='index.php?error';
- </script>";
- exit;
- }
- else : echo '<script type="text/javascript">alert("Robot verification failed, please try again.");</script>';
- echo '<script type="text/javascript">window.location.href="index.php"</script>';
- endif;
- else:echo '<script type="text/javascript">alert("Please click on the reCAPTCHA box.");</script>';
- echo '<script type="text/javascript">window.location.href="index.php"</script>';
- endif;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement