virabhairava

odjava.php

Oct 4th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require 'dbh.php';
  4. $id = $_SESSION['id'];
  5. if (!$_SESSION['prijava'] == 1 ) {
  6. $_SESSION['poruka'] = "Moras se prvo prijaviti";
  7. header("Location: ../logovan.php");
  8. }
  9. else{
  10. $sql = "UPDATE radnovreme SET vremeOdjave = CURRENT_TIME() WHERE idKorisnika = '$id'";
  11. if ($conn->query($sql)){
  12. session_unset();
  13. session_destroy();
  14. header("Location: ../index.php");
  15. }else{
  16. $_SESSION['poruka'] = "Query nije uspeo";
  17. header("Location: ../logovan.php");
  18. }
  19. }
  20. ?>p
Add Comment
Please, Sign In to add comment