Advertisement
Guest User

www

a guest
Jan 3rd, 2017
87
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. $_SESSION['username'] = $jmeno;
  12. $_SESSION['password'] = $heslo;
  13. echo $_SESSION['username'];
  14.  
  15. if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
  16. echo 'testik';
  17.  
  18.  
  19.  
  20. $stid = $db->parseAndExecute("SELECT * FROM USERSS where username='" . $_SESSION['username'] . "'
  21. AND password = MD5HASH('" . $_SESSION['password'] . "')");
  22.  
  23. oci_execute($stid);
  24.  
  25. while (($row = oci_fetch_array($stid, OCI_BOTH))) {
  26. //echo 'test';
  27. if (count($row) > 0) {
  28. $dbusername = $row['USERNAME'];
  29. $dbpassword = $row['PASSWORD'];
  30. $dbgroup_id = $row['ADMIN'];
  31. $dbemail = $row['EMAIL'];
  32. echo $dbusername . " ";
  33. echo $dbpassword . " ";
  34. }
  35. }
  36. if ($username == $dbusername) {
  37. echo 'test22';
  38. session_start();
  39. $_SESSION['admin'] = $dbgroup_id;
  40. $_SESSION['session_username'] = $username;
  41. $_SESSION['user_email'] = $dbemail;
  42. echo $username;
  43. } else {
  44. $messageLogin = 'Uzivatel s takovym jmenem neexistuje';
  45. }
  46. }
  47.  
  48.  
  49. if (isset($_POST['reset'])) {
  50. unset($atts['username']);
  51. unset($atts['password']);
  52. $atts['username'] = "";
  53. $atts['password'] = "";
  54. }
  55.  
  56.  
  57. if ($_SESSION['admin'] == 'yes') {
  58. echo 'jsi admin';
  59. } else if ($_SESSION['admin'] == 'no') {
  60. echo 'jsi user';
  61. } else {
  62. echo 'jsi trumpeta';
  63. }
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement