Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1.  
  2. //Ukrywanie - div3
  3. if($_SESSION['admin']==1){
  4. echo '<form action="hide.php" method="POST">';
  5. echo '<input type="hidden" name="id_art" value="'.$art['id_art'].'">';
  6. if($art['visible_art']==1)
  7. {echo "<input type='submit' name='hide' value='hide'>";}
  8. else{
  9. echo "<input type='submit' name='show' value='show'>";
  10. }
  11. echo '</form>';
  12. }
  13.  
  14.  
  15. // ukrywanie - hide.php
  16.  
  17. <?php
  18. include('conn.php');
  19.  
  20. $art_id=$_POST['id_art'];
  21. if(isset($_POST['hide']) || isset($_POST['show'])){
  22. if(isset($_POST['show'])){$query="UPDATE articles SET visible_art=1 WHERE id_art=$art_id";}
  23. else{$query="UPDATE articles SET visible_art=0 WHERE id_art=$art_id";}
  24. $result=mysql_query($query);
  25. if($result){
  26. header('location:index.php');
  27. exit;
  28. }
  29. else{
  30. echo 'problem';
  31. }
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement