Advertisement
max_tre

editorbis.php

Apr 11th, 2017
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. <?php
  2.  
  3. $park=$_GET['park'];
  4. $disp=$_GET['disp'];
  5. $reading=fopen('mapbis.html','r');
  6. $writing=fopen('temp.html','w');
  7. $replaced=false;
  8. while (!feof($reading)) {
  9.     $line = fgets($reading);
  10.     if (strpos($line,"label: 'P".$park."',")!==false) {
  11.         $line = "            type: '".$disp."', label: 'P".$park."',\n";
  12.         $replaced = true;
  13.     }
  14.     fputs($writing, $line);
  15. }
  16. fclose($reading); fclose($writing);
  17. if ($replaced) {   
  18.     rename('temp.html', 'mapbis.html');
  19. }
  20. else {
  21.     unlink('temp.html');
  22. }
  23.  
  24. echo '<html>
  25. <head><title>Editor</title><meta name="viewport" content="width=device-width, user-scalable=0, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" /></head>
  26. <body><center>
  27. <form action="editorbis.php" method="get">
  28. <br><br>
  29. Parcheggio n°: <select name="park"><option value="1">P1: Corriere</option><option value="2">P2: Residence 2000</option><option value="3">P3: S. Pietro fronte</option><option value="4">P4: S. Pietro lato</option><option value="5">P5: Rosti</option><option value="6">P6: Stazione scambiatore</option><option value="7">P7: Via Marconi</option><option value="8">P8: Autoscuola</option><option value="9">P9: Rosso di sera</option><option value="10">P10: Viale Venezia</option><option value="11">P11: Via Ghandi</option><option value="12">P12: San Marco</option></select><br><br>
  30. Posti liberi: &nbsp;&nbsp;&nbsp;&nbsp; <select name="disp"><option value="verde">VERDE: 20+ posti</option><option value="giallo">GIALLO: 1-19 posti</option><option value="rosso">ROSSO: 0 posti!</option></select><br><br>
  31. <input type="submit" value="AGGIORNA">
  32. </form>
  33. <br><br>
  34. <a href="mapbis.html" target="_blank">Vedi mappa</a>
  35. </center></body>';
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement