Advertisement
kurniawan7

session_start()

Jun 12th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <?php
  2. include('../system/libraries/helpers.php');
  3. include('../system/libraries/crud_pdo.php');
  4.  
  5. session_start();
  6.  
  7. $username = $helpers->sanatizeItem($_POST['username'], "string");
  8. $password = $helpers->encrypt_($helpers->sanatizeItem($_POST['password'], "string"));
  9.  
  10.  
  11.  
  12. if ($helpers->sanatizeItem(@$_POST['login-mahasiswa'], "string")) {
  13. $data = array(
  14. 'mahasiswa_nim' => $username,
  15. 'mahasiswa_password' => $password
  16. );
  17.  
  18. $s = $crud->check_exist('mahasiswa', $data);
  19. print_r($s);
  20. exit();
  21.  
  22. if ($s == true) {
  23. foreach($s as $val) {
  24. $_SESSION['id'] = $val['mahasiswa_nim'];
  25. $_SESSION['name'] = $val['mahasiswa_name'];
  26. $_SESSION['email'] = $val['mahasiswa_email'];
  27. }
  28. $helpers->redirect('../template.php');
  29. } else {
  30. $helpers->redirect('../index.php?info=failed');
  31. }
  32. } else if ($helpers->sanatizeItem(@$_POST['login-kajur'], "string")) {
  33. $data = array(
  34. 'kajur_nip' => $username,
  35. 'kajur_password' => $password
  36. );
  37.  
  38. $s = $crud->check_exist('kajur', $data);
  39. if ($s == true) {
  40.  
  41. } else {
  42. $helpers->redirect('../index.php?info=failed');
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement