Advertisement
Guest User

Untitled

a guest
Jul 12th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.46 KB | None | 0 0
  1. <?php
  2. /* Table Struct
  3.     CREATE TABLE `wolfplex`.`webhosting` (
  4.     `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
  5.     `nick` VARCHAR( 50 ) NOT NULL ,
  6.     `mail` VARCHAR( 50 ) NOT NULL ,
  7.     `plus` TEXT NOT NULL ,
  8.     `minus` TEXT NOT NULL ,
  9.     `next` TEXT NOT NULL ,
  10.     `date` DATE NOT NULL
  11.     ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin;
  12. */
  13.    
  14.     if ( isset($_POST["send"]) )
  15.     {
  16.         $host="127.0.0.1";
  17.         $user="root";
  18.         $password="";
  19.         $db="wolfplex";
  20.         $table="webhosting";
  21.        
  22.         // Row Name
  23.         $idRow="id";
  24.         $nickRow="nick";
  25.         $mailRow="mail";
  26.         $plusRow="plus";
  27.         $minusRow="minus";
  28.         $nextRow="next";
  29.         $dateRow="date";
  30.        
  31.         if ( isset($_POST["nick"]) ) {  $nick=$_POST["nick"]; }
  32.         else { $nick=""; }
  33.         if ( isset($_POST["mail"]) ) {  $mail=$_POST["mail"]; }
  34.         else { $mail=""; }
  35.         if ( isset($_POST["plus"]) ) {  $plus=$_POST["plus"]; }
  36.         else { $plus=""; }
  37.         if ( isset($_POST["minus"]) ) { $minus=$_POST["minus"]; }
  38.         else { $minus=""; }
  39.         if ( isset($_POST["next"]) ) {  $next=$_POST["next"]; }
  40.         else { $next=""; }
  41.         if ( isset($_POST["date"]) ) {  $date=$_POST["date"]; }
  42.         else { $date="0000-00-00"; }
  43.            
  44.         try
  45.         {
  46.             $serverConnection = mysql_connect($host, $user, $password);
  47.             $dbConnection = mysql_select_db($db, $serverConnection);
  48.             $request = "INSERT INTO ".$table." VALUES ('', '".$nick."', '".$mail."', '".$plus."', '".$minus."', '".$next."', '".$date."');";
  49.             $result = mysql_query($request, $serverConnection);
  50.             mysql_close($serverConnection);
  51.         }
  52.         catch(Exception $e)
  53.         {
  54.             $errorCode = "Code : ".$e->getCode()." <br> Reason : ".$e->getMessage()." <br>";
  55.         }
  56.     }
  57. ?>
  58.  
  59. <html>
  60.     <head>
  61.         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  62.         <title>
  63.             Web Hosting Workshop Feedback
  64.         </title>
  65.         <style type="text/css">
  66.         <!--
  67.             body{
  68.                 font-size: 13px;
  69.                 font-family: Verdana, Geneva, sans-serif;
  70.                 background:#999;
  71.                 color:#333;
  72.                 border:hidden;
  73.             }
  74.             h1.title {
  75.                 color:#000;
  76.                 text-decoration:underline;
  77.             }
  78.             td.desc {
  79.                 font-size: 13px;
  80.                 text-align: right; padding-top:4px;
  81.             }
  82.             input.shell, textarea.shell{
  83.                 font-size: 13px;
  84.                 font-family: Verdana, Geneva, sans-serif;
  85.                 background:#CCC;
  86.                 border:double;
  87.             }
  88.             input.shell:hover, textarea.shell:hover {
  89.                 border-color:#6C0;
  90.             }
  91.         -->
  92.         </style>
  93.     </head>
  94.    
  95. <body>
  96.         <h1 class="title">
  97.             Web Hosting Workshop Feedback
  98.         </h1>
  99.    
  100.         <font lang="fr">
  101.             <p class="notes">
  102.                 <div style="text-decoration:underline">FR: </div>
  103.                 Bonjour &agrave; tous, le but de ce formulaire est simplement de nous permettre d'avoir un feedback et d'am&eacute;liorer la qualit&eacute; des workshops.<br />
  104.                 Le mail et le pseudo ne sont pas requis, ne floodez le serveur avec ce script svp ^^<br />
  105.                 Merci pour vos remarques, l'equipe du wolfplex hackerspace.<br />
  106.                 A bientôt pour la suite.
  107.             </p>
  108.         </font>
  109.        
  110.         <font lang="en">
  111.             <p class="notes">
  112.                 <div style="text-decoration:underline">EN: </div>
  113.                 Hi folk's, the goal of this form is simply to allow us to have feedback to improve the quality of ours workshops.<br />
  114.                 The mail address and the nick aren't required, please don't flood our servers with this script ^^<br />
  115.                 Thank's for your comments, the wolfplex hackerspace team.<br />
  116.                 See you soon for next.
  117.             </p>
  118.         </font>
  119.         <br />
  120.         <?php
  121.             if (isset($errorCode))
  122.             {
  123.                 echo '<p style="color:#F00">';
  124.                 echo $errorCode;
  125.                 echo '</p>';
  126.             }
  127.             else
  128.             {
  129.                 echo 'Merci pour votre retour / Thank\'s for your feedback';
  130.             }
  131.         ?>
  132.         <form action="index.php" method="post" name="postfeedback">
  133.             <table border="0">
  134.                 <tr>
  135.                     <td valign="top" class="desc">Pseudo/Nick</td>
  136.                     <td ><input name="nick" type="text" class="shell"/></td>
  137.                 </tr>
  138.                 <tr>
  139.                     <td valign="top" class="desc">Email</td>
  140.                     <td><input name="mail" type="text" class="shell"/></td>
  141.                 </tr>    
  142.                 <tr>
  143.                     <td valign="top" class="desc">+</td>
  144.                     <td><textarea name="plus" cols="80" rows="5" class="shell"></textarea></td>
  145.                 </tr>
  146.                 <tr>
  147.                     <td valign="top" class="desc">-</td>
  148.                     <td><textarea name="minus" cols="80" rows="5" class="shell"></textarea></td>
  149.                 </tr>
  150.                 <tr>
  151.                     <td valign="top" class="desc">Pour les workshops <br /> suivants ? <br /> <br /> For the next <br /> workshops ?</td>
  152.                     <td><textarea name="next" cols="80" rows="5" class="shell"></textarea></td>
  153.                 </tr>
  154.                 <tr>
  155.                     <td valign="top" class="desc">Date</td>
  156.                     <td class="desc">
  157.                         <input name="date" type="radio" value="2011-01-15" checked="checked"> 15/01/2011
  158.                     </td>
  159.                 </tr>
  160.                 <tr>
  161.                     <td valign="top" class="desc"></td>
  162.                     <td><input name="send" type="submit" value="Envoyer/Send" class="shell"/></td>
  163.                 </tr>
  164.             </table>
  165.         </form>
  166.  
  167.     </body>
  168. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement