Advertisement
Guest User

qwe

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