Advertisement
Guest User

www

a guest
Jan 3rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ERROR);
  3. session_start();
  4. require_once("class/Oracle.php");
  5. if (isset($_POST['logout'])) {
  6. unset($_SESSION);
  7. session_destroy();
  8. }
  9. $atts = array('username' => "", 'password' => null);
  10.  
  11. if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
  12. echo 'testik';
  13.  
  14. $_SESSION['username'] = $jmeno;
  15. $_SESSION['password'] = $heslo;
  16. echo $_SESSION['username'];
  17.  
  18. $stid = $db->parseAndExecute("SELECT * FROM USERSS where username='" . $_SESSION['username'] . "'
  19. AND password = MD5HASH('" . $_SESSION['password'] . "')");
  20.  
  21. oci_execute($stid);
  22.  
  23. while (($row = oci_fetch_array($stid, OCI_BOTH))) {
  24. //echo 'test';
  25. if (count($row) > 0) {
  26. $dbusername = $row['USERNAME'];
  27. $dbpassword = $row['PASSWORD'];
  28. $dbgroup_id = $row['ADMIN'];
  29. $dbemail = $row['EMAIL'];
  30. echo $dbusername . " ";
  31. echo $dbpassword . " ";
  32. }
  33. }
  34. if ($username == $dbusername) {
  35. echo 'test22';
  36. session_start();
  37. $_SESSION['admin'] = $dbgroup_id;
  38. $_SESSION['session_username'] = $username;
  39. $_SESSION['user_email'] = $dbemail;
  40. echo $username;
  41. } else {
  42. $messageLogin = 'Uzivatel s takovym jmenem neexistuje';
  43. }
  44. }
  45.  
  46.  
  47. if (isset($_POST['reset'])) {
  48. unset($atts['username']);
  49. unset($atts['password']);
  50. $atts['username'] = "";
  51. $atts['password'] = "";
  52. }
  53.  
  54.  
  55. if ($_SESSION['admin'] == 'yes') {
  56. echo 'jsi admin';
  57. } else if ($_SESSION['admin'] == 'no') {
  58. echo 'jsi user';
  59. } else {
  60. echo 'jsi trumpeta';
  61. }
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement