Advertisement
Guest User

Untitled

a guest
Aug 6th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>HX's Guestbook v0.1</title>
  4. <link REL="stylesheet" TYPE="text/css" HREF="index.css">
  5. </head>
  6.  
  7. <body>
  8. Powered by HX's Guest by Destroyer<br><br>
  9. <a href="?action=firma" ><font color='#FF0000'>Firma  </font></a><br>
  10. <a href="?action=aggiorna" ><font color='#FF0000'>Aggiorna pagina  </font></a><br>
  11. <a href="?action=admin" ><font color='#FF0000'>Admin  </font></a><br><br>
  12. COMMENTI: <br><br>
  13.  
  14. <?php
  15. include("guestfile/messaggi.txt");
  16.  
  17. $action = $_GET['action'];
  18. switch($action) {
  19.  
  20. case 'firma';  
  21.        
  22. echo"
  23. <br><br>
  24. <form action='' method=POST>
  25. Username: <br><input type=text name=user ><br>
  26. Messaggio: <br><textarea name = 'messaggio' rows = '10' cols = '50'><textarea><br><br>    
  27. <input type=submit name=invia value=INVIA>
  28. </form>
  29. ";
  30.  
  31. $user = $_POST['user'];
  32. $messaggio = $_POST['messaggio'];
  33.  
  34. if (isset($_POST['invia'])) {
  35. $o = fopen('guestfile/messaggi.txt','a+');
  36. fwrite($o, "User: $user - Messaggio: $messaggio\n <br>");
  37. fclose($o);
  38. }
  39. break;
  40.  
  41. case 'aggiorna';  
  42. header("location:guestbook01.php");
  43. break;
  44.  
  45. case 'admin';  
  46. echo"
  47. <br>
  48. <form action='' method=POST>
  49. Inserisci la password:
  50. <input type='text' name='pass'><br><br>
  51. <input type='submit' value='Accedi'><br>
  52. ";
  53. $pass = $_POST['pass'];
  54.  
  55. if ($pass == "abc"){
  56.  
  57. echo"
  58. <br>
  59. <a href='?action=edit' >Edit txt </a><br>
  60. <a href='?action=delete' >Cancella txt </a><br>
  61. <a href='?action=exit' >Esci </a><br><br>
  62. ";
  63.  
  64. $action = $_GET['action'];
  65. switch($action) {
  66.  
  67. case 'edit';
  68.  
  69. $file = ("guestfile/messaggi.txt");
  70. $fp = fopen ($file, "r");
  71. echo"
  72. <br>
  73. <form action='' method=POST>
  74. <textarea name = 'textfile' rows = '10' cols = '50'>'$fp'<textarea><br><br>
  75. <input type='submit' value='SAVE'><br>
  76. ";
  77.  
  78. break;  
  79.  
  80. case 'delete';  
  81. $file = "guestfile/messaggi.txt";
  82. ­if (file_exist($file))
  83. ­{
  84. ­unlink($file);
  85. echo "FIle rimosso";
  86. ­} else {
  87. ­echo "Il file non esiste";
  88. ­}
  89. break;
  90.  
  91. case 'exit';  
  92. header("location:guestbook01.php");
  93. break;
  94.  
  95. }
  96. }
  97. break;
  98. }
  99.  
  100. ?>
  101. </body>
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement