Advertisement
Guest User

Untitled

a guest
May 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. <?php
  2.  
  3.     session_start();
  4.    
  5. if (!isset($_SESSION['zalogowany'])) {
  6.     header('Location: index.php');
  7.     exit();
  8. }
  9.  
  10. require_once "connect.php";
  11.  
  12.     $polaczenie = @new mysqli($host, $db_user, $db_password, $db_name);
  13.     $polaczenie->query("SET NAMES 'utf8' COLLATE 'utf8_polish_ci'");
  14.     $polaczenie->query("SET CHARSET utf8");
  15.  
  16. ?>
  17.  
  18. <!DOCTYPE HTML>
  19. <html lang="pl">
  20. <head>
  21.     <meta charset="utf-8" />
  22.     <title>Panel klienta</title>
  23. </head>
  24.  
  25. <body>
  26.      
  27. Witaj w systemie! [ <a href="logout.php">Wyloguj się!</a> ]<br>
  28.    
  29.     <?php
  30.    
  31.     echo $_SESSION['IMIE'].' '.$_SESSION['NAZWISKO'];
  32.     echo '<br>';
  33.  
  34.     #tu sie robi bagno
  35.    $row=$polaczenie->query('CALL dane_umowa('.$_SESSION['ID_PRACOWNIKA'].')' );
  36.    
  37.     if ($dane_z_umowy = $row->fetch_assoc()) {
  38.         echo 'Stanowisko: '.$dane_z_umowy['OPIS'].'<br>';
  39.         echo 'Stawka: '.$dane_z_umowy['STAWKA'].' PLN/h';
  40.     }
  41.  
  42.     ?>
  43.  
  44.     <br>    
  45.     <form action="panel.php" method="post">
  46.     <input type="hidden" name="start" value="true">
  47.     <input type="submit" value="Start">
  48.     </form>
  49.  
  50.     <form action="panel.php" method="post">
  51.     <input type="hidden" name="stop" value="true">
  52.     <input type="submit" value="Stop">
  53.     </form>
  54.  
  55. <?php
  56. if (isset($_POST['start'])) {
  57.     $polaczenie->query('CALL wejscie_praca('.$_SESSION['ID_PRACOWNIKA'].')' );
  58.     $_SESSION['message']= 'Rozpoczeto pracę!';
  59.     header('Location: panel.php');
  60.     exit();
  61. }
  62.  
  63. if (isset($_POST['stop'])) {
  64.     $polaczenie->query('CALL wyjscie_praca('.$_SESSION['ID_PRACOWNIKA'].')' );
  65.     $_SESSION['message']= 'Zakończono pracę!';
  66.     header('Location: panel.php');
  67.     exit();
  68. }
  69.  
  70. if (isset($_SESSION['message'])) {
  71.     echo $_SESSION['message'];
  72.     unset( $_SESSION['message']);
  73. }
  74.  
  75.     $polaczenie->close();
  76. ?>
  77.  
  78.  
  79. </body>
  80. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement