php/index.php

[Ritorna]

<?php /* index.php * * Copyright (C) 2016 Ing. Stefano Salvi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ ?><!DOCTYPE html> <html lang="it"> <head> <title>Raspberry-My Programmazione in PHP</title> <meta name="author" content="Ing. Stefano Salvi"> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="../css/index.css"> <script type="text/javascript" src="../js/index.js"></script> </head> <body> <!-- Dialog --> <div id="isf_overlay"> <div id="isf_overlay_frame"> <div id="isf_overlay_content"> <h2> Dialog modale visualizzato dal Javascript </h2><p> &Egrave; possibile fare comparire un dialog sopra la pagina, che scompaia con un bottone. </p> </div> <div id="isf_overlay_bottom"> <input id="isf_overlay_close_button" type="button" onClick="closeDialog()" value="Chiudi"> </div> </div> </div> <!-- Fine Dialog --> <!-- Slideshow --> <div id="testa-carousel"> <div id="testa-slideshow"> <img src="../img/little_pi.png" alt="Raspberry Pi 3" width="400" height="400" /> <img src="../img/raspberry-pi-2-angle-100569133-orig.png" alt="Raspberry Pi 3" width="400" height="400" /> <img src="../img/Raspberry_Pi_-_Model_A.jpg" alt="Raspberry Pi Model A" width="400" height="400" /> <img src="../img/rpi1bplus.png" alt="Raspberry Pi 2" width="400" height="400" /> </div> </div> <!-- Fine Slideshow --> <script type="text/javascript">var slides = new Slideshow('testa-slideshow', 1000, 400);</script> <h1>Esempi di programmazione in PHP</h1> <p>[<a href="../index.html#php">Ritorna</a>]</p> <p><input type="button" onClick="openDialog()" value="Apri Dialog"></p> <?php print "
\n"; print " <p>Primo numero: <input type=\"text\" name=\"primo\" value=\"$_REQUEST[primo]\"><br>\n"; print " Secondo numero: <input type=\"text\" name=\"secondo\" value=\"$_REQUEST[secondo]\"><br>\n"; print " <input type=\"submit\" value=\"Somma\"></p>\n"; print " </form>\n"; if (array_key_exists("primo", $_REQUEST)) { if ($_REQUEST["primo"] === '') { print "<div class=\"error\">Il Primo numenro non pu&ograve; essere vuoto</div>"; } elseif ($_REQUEST["secondo"] === '') { print "<div class=\"error\">Il Primo numenro non pu&ograve; essere vuoto</div>"; } elseif (!preg_match("/^-?[0-9]*$/", $_REQUEST["primo"])) { print "<div class=\"error\">Il Primo numenro non &egrave; un numero</div>"; } elseif (!preg_match("/^-?[0-9]*$/", $_REQUEST["secondo"])) { print "<div class=\"error\">Il Secondo numenro non &egrave; un numero</div>"; } else { print "<div class=\"display\">$_REQUEST[primo] + $_REQUEST[secondo] = " . ($_REQUEST["primo"] + $_REQUEST["secondo"]) . "</div>"; } } print ' <div class="display">'; print ' <h2>Directory del Web</h2>'; print ' <ul>'; $dir = "../"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { $type = filetype($dir . $file); print "<li>$type: $file</li>"; } closedir($dh); } } print ' </div>'; print ' <div id="footer">'; print ' <span class="author">Autore Stefano Salvi</span> <a href="mailto:stefano@salvi.mn.it" title="Indirizzo Mail di Salvi">stefano@salvi.mn.it</a>'; print ' Rilasciato su licenza <a href="https://creativecommons.org/licenses/by-sa/3.0/it/legalcode" title="Attribuzione CC-by-sa">CC-BY-SA</a><br>'; print ' <a href="https://creativecommons.org/licenses/by-sa/3.0/it/legalcode" title="Attribuzione CC-by-sa"><img src="../img/cc_by_sa_88x31.png" alt="Logo Creative Commons" title="Logo Creative Commons"></a>'; print ' </ul>'; print ' </div>'; ?> </body> </html>