Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.46 KB | None | 0 0
  1. <?php
  2.  
  3. require('DB/connection.php');
  4. session_start();
  5. include 'functions.php';
  6. if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])):
  7. //your site secret key
  8. $secret = '6LdJGDEUAAAAAGoxoiJqxPvhZgS4VDahzUaTneg3';
  9. //get verify response data
  10. $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
  11. $responseData = json_decode($verifyResponse);
  12. if($responseData->success):
  13.  
  14. //registerglobal('college_id','username','password','usertype','Login_x','Login_y','emsg','location_id');
  15. $username = $_POST['username'];
  16. $password = $_POST['password'];
  17. $usertype = $_POST['usertype'];
  18.  
  19. $error = [];
  20. if($username==""){$error['username']="Enter User Name";}
  21. if($password==""){$error['password']="Enter Password";}
  22.  
  23. if(count($error)==0){
  24.  
  25. if($usertype=='student'){
  26.  
  27.  
  28. $sel_user = "SELECT * FROM tbl_students WHERE preadmission_id='".$username."' AND password='".$password."' AND status!='inactive'";
  29.  
  30.  
  31. $std_records = sqlnumber($sel_user);
  32. if($std_records>0){
  33. $student_info = getarrayassoc($sel_user);
  34.  
  35. if (is_array( $student_info) && count( $student_info) > 0){
  36. // $_SESSION['eschools']['user_school'] = $college_id;
  37. $_SESSION['eschools']['student_name'] = $student_info['student_name'];
  38. $_SESSION['eschools']['user_id'] = $student_info['preadmission_id'];
  39. $_SESSION['eschools']['id'] = $student_info['student_id'];
  40. $_SESSION['eschools']['login_type'] = $usertype;
  41. $_SESSION['eschools']['photo'] = $student_info['image'];
  42. /*$finance_info = getarrayassoc("SELECT * FROM es_finance_master ORDER BY es_finance_masterid DESC LIMIT 0,1");
  43. $_SESSION['eschools']['currency'] = $finance_info['fi_symbol'];
  44. $_SESSION['eschools']['schoollogo'] = $finance_info['fi_school_logo'];
  45. $_SESSION['eschools']['schoolname'] = $finance_info['fi_schoolname'];
  46.  
  47. $_SESSION['eschools']['from_acad'] = $finance_info['fi_ac_startdate'];
  48. $_SESSION['eschools']['to_acad'] = $finance_info['fi_ac_enddate'];
  49. $_SESSION['eschools']['from_finance'] = $finance_info['fi_startdate'];
  50. $_SESSION['eschools']['to_finance'] = $finance_info['fi_enddate'];*/
  51. echo "<script type='text/javascript'>
  52. window.location.href='student/profile.php';
  53. </script>";
  54. }
  55. }else{
  56. $username="";
  57. $password="";
  58. echo '<script>alert("invalid admin");</script>';
  59. //header("location:loginFailure.php");
  60. echo '<script>window.location.href="index.php"</script>';
  61.  
  62. exit;
  63.  
  64. }
  65.  
  66. else : echo '<script type="text/javascript">alert("Robot verification failed, please try again.");</script>';
  67. echo '<script type="text/javascript">window.location.href="index.php"</script>';
  68. endif;
  69. else : echo '<script type="text/javascript">alert("Please click on the reCAPTCHA box.");</script>';
  70. echo '<script type="text/javascript">window.location.href="index.php"</script>';
  71. endif;
  72. }
  73.  
  74.  
  75. /*if($usertype=='staff'){
  76. $sel_user = "SELECT * FROM es_staff WHERE st_username='".$username."' AND st_password='".$password."' AND status='added' AND selstatus='accepted' AND tcstatus='notissued'";
  77. $staff_records = sqlnumber($sel_user);
  78. if($staff_records>0){
  79. $staff_info = getarrayassoc($sel_user);
  80.  
  81. if (is_array( $staff_info) && count( $staff_info) > 0){
  82. $_SESSION['eschools']['user_school'] = $college_id;
  83. $_SESSION['eschools']['user_name'] = $staff_info['st_username'];
  84. $_SESSION['eschools']['user_id'] = $staff_info['es_staffid'];
  85. $_SESSION['eschools']['st_postaplied'] = $staff_info['st_post'];
  86. $_SESSION['eschools']['login_type'] = $usertype;
  87. $_SESSION['eschools']['user_theme'] = $staff_info['st_theme'];
  88.  
  89. $finance_info = getarrayassoc("SELECT * FROM es_finance_master ORDER BY es_finance_masterid DESC LIMIT 0,1");
  90.  
  91. $_SESSION['eschools']['currency'] = $finance_info['fi_symbol'];
  92. $_SESSION['eschools']['schoollogo'] = $finance_info['fi_school_logo'];
  93. $_SESSION['eschools']['schoolname'] = $finance_info['fi_schoolname'];
  94. $_SESSION['eschools']['from_acad'] = $finance_info['fi_ac_startdate'];
  95. $_SESSION['eschools']['to_acad'] = $finance_info['fi_ac_enddate'];
  96. $_SESSION['eschools']['from_finance'] = $finance_info['fi_startdate'];
  97. $_SESSION['eschools']['to_finance'] = $finance_info['fi_enddate'];
  98. echo "<script type='text/javascript'>
  99. window.location.href='dashboard.php';
  100. </script>";
  101. }
  102.  
  103. }else{
  104. $username="";
  105. $password="";
  106. echo "<script type='text/javascript'>
  107. window.location.href='index.php?error';
  108. </script>";
  109. exit;
  110. }
  111. }*/
  112.  
  113. if($usertype=='super'){
  114. $sel_admin = "SELECT * FROM tbl_admins WHERE admin_username='".$username."' AND admin_password='".$password."'";
  115. $admin_records = sqlnumber($sel_admin);
  116. if($admin_records>0){
  117. $admin_info = getarrayassoc($sel_admin);
  118.  
  119. if (is_array( $admin_info) && count( $admin_info) > 0){
  120.  
  121. //$_SESSION['eschools']['user_school']= $college_id;
  122. $_SESSION['eschools']['admin_user'] = $admin_info['admin_username'];
  123. $_SESSION['eschools']['admin_id'] = $admin_info['adminsid'];
  124. $_SESSION['eschools']['user_type'] = $usertype;
  125. if($admin_info['user_type']=='super'){
  126. $_SESSION['eschools']['superadmin_email'] = $admin_info['admin_email'];
  127. }
  128.  
  129. echo "<script type='text/javascript'>
  130. window.location.href='dashboard.php';
  131. </script>";
  132. exit(0);
  133. }
  134.  
  135. }else{
  136. $username="";
  137. $password="";
  138. echo "<script type='text/javascript'>
  139. window.location.href='index.php?error';
  140. </script>";
  141. exit;
  142. }
  143. else : echo '<script type="text/javascript">alert("Robot verification failed, please try again.");</script>';
  144. echo '<script type="text/javascript">window.location.href="index.php"</script>';
  145. endif;
  146. else:echo '<script type="text/javascript">alert("Please click on the reCAPTCHA box.");</script>';
  147. echo '<script type="text/javascript">window.location.href="index.php"</script>';
  148. endif;
  149.  
  150. }
  151. }
  152.  
  153.  
  154. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement