Guest User

Untitled

a guest
Jul 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include('data.php');
  4. include('function.php');
  5. head('Akcie');
  6. ?>
  7.  
  8. <div id="bar"></div>
  9. <div id="wrapper">
  10.  
  11. <?php
  12. include('menu.php');
  13. ?>
  14.  
  15. <div id="content">
  16. <h3>Zoznam akcií</h3>
  17. <?php
  18. if (isset($_POST["agent"]) && agent_ok($_POST["agent"])
  19. && isset($_POST["title"]) && title_ok($_POST["title"])
  20. && isset($_POST["text"]) && text_ok($_POST["text"])
  21. && isset($_POST["status"]) && status_ok($_POST["status"])
  22. ) {
  23.  
  24. $_SESSION['agent'] = $_POST["agent"];
  25. $_SESSION['title'] = $_POST["title"];
  26. $_SESSION['text'] = $_POST["text"];
  27. $_SESSION['status'] = $_POST["status"];
  28. }
  29.  
  30. if (isset($_POST['del'])){
  31. session_unset();
  32. session_destroy();
  33. }
  34.  
  35. if (isset($_SESSION['title'])) {
  36. echo '<table>
  37. <tr>
  38. <th>Názov akcie</th>
  39. <th>Popis</th>
  40. <th>Zúčastnení agenti</th>
  41. <th>Status</th>
  42. </tr>';
  43. echo '<td>' . addslashes(strip_tags(trim($_SESSION["title"]))) . '</td>';
  44. echo '<td>' . addslashes(strip_tags(trim($_SESSION["text"]))) . '</td>';
  45. echo '<td>' . agent_out($_SESSION["agent"]) . '</td>';
  46. echo '<td>' . status_out($_SESSION["status"]) . '</td>';
  47.  
  48.  
  49. ?>
  50. <p>
  51. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  52. <p><button type="submit" name="del" id="zrus">Vymaž akciu</button></p>
  53. </form>
  54. </p>
  55. <?php
  56.  
  57. } else {
  58. ?>
  59. <form action="" method="post">
  60. <fieldset>
  61. <legend><strong>Pridaj akciu</strong></legend>
  62. <label for="title">Názov akcie: (max 20 znakov)</label> <br />
  63. <input type="text" name="title" id="title" size="40" maxlength="20" value="<?php if (isset($_POST["title"])) echo $_POST["title"]; ?>"/>
  64. <br />
  65. <label for="text">Popis: (max 70 znakov)</label><br />
  66. <textarea name="text" id="text" rows="3" cols="35"><?php if (isset($_POST["text"])) echo $_POST["text"]; ?></textarea>
  67. <br />
  68. <label for="agent">Agent:</label> <br />
  69. <select name="agent" id="agent" size="1">
  70. <?php agent(isset($_POST['agent']) ? $_POST['agent'] : 0); ?>
  71. </select>
  72. <br/><br/>
  73. Status: <br />
  74. <input type="radio" name="status" id="dopr_kurier" value="ok"<?php if (isset($_POST['status']) && $_POST["status"]=="ok") echo ' checked="checked"'; ?> /> <label for="status_ok">Ukončená</label> <br />
  75. <input type="radio" name="status" id="dopr_taxi" value="in"<?php if (isset($_POST['status']) && $_POST["status"]=="in") echo ' checked="checked"'; ?> /> <label for="status_in">Prebieha</label> <br />
  76. <input type="radio" name="status" id="dopr_vlastna" value="up"<?php if (isset($_POST['status']) && $_POST["status"]=="up") echo ' checked="checked"'; ?> /> <label for="status_up">Plánuje sa</label> <br />
  77. <br />
  78. </fieldset>
  79. <p><button type="submit" name="ok">Pridaj</button></p>
  80. </form>
  81. <?php
  82. }
  83. ?>
  84. </div>
  85. </div>
  86.  
  87. <?php
  88. include('footer.php');
  89. ?>
Add Comment
Please, Sign In to add comment