Public paste
tester
By: ruben | Date: Nov 12 2007 22:10 | Format: PHP | Expires: never | Size: 7.54 KB | Hits: 1355

  1. <script language="javascript" type="text/javascript">
  2. tinyMCE.init({
  3.         mode : "textareas",
  4.         theme : "advanced"
  5.        
  6. });
  7. </script>
  8. <?php
  9.  
  10. if ($_POST['submit']) {
  11.     foreach ($_POST as $key => $value) {
  12.         $value = stripslashes($value);
  13.         $_POST[$key] = "'".mysql_real_escape_string($value)."'";
  14.     }
  15.     $titel                      = $_POST['titel'];
  16.     $dag                        = $_POST['dag'];
  17.     $maand                      = $_POST['maand'];
  18.     $jaar                       = $_POST['jaar'];
  19.         $uren                   = $_POST['uren'];
  20.         $minutes                = $_POST['minutes'];
  21.         $seconds                = $_POST['seconds'];
  22.     $functie            = $_POST['functie'];
  23.     $salaris            = $_POST['salaris'];
  24.     $status                     = $_POST['status'];
  25.     $omschrijving       = $_POST['omschrijving'];
  26.        
  27.     $datum = mktime($uren, $minutes, $seconds, $maand, $dag, $jaar);
  28.     $datum_db = mysql_real_escape_string($datum);
  29.  
  30. if (empty($titel)) $titel = " '' ";
  31. if (empty($functie)) $functie = " '' ";
  32. if (empty($salaris)) $salaris = " '' ";
  33. if (empty($status)) $status = " '' ";
  34. if (empty($omschrijving)) $omschrijving = " '' ";
  35.  
  36.     mysql_query("INSERT INTO vacatures (`titel` , `datum` , `functie`, `salaris` , `status` , `omschrijving`)
  37.     VALUES ($titel, $datum, $functie, $salaris, $status, $omschrijving)
  38.    ");
  39.  
  40.                         print '<h5>Klaar is <span>KEES</span>! Pagina is succesvol aangemaakt!</h5>
  41.                         ';
  42.  
  43. }
  44. ?>    
  45.             <div class="panel-groot">
  46.             <h1>Pagina toevoegen</h1>  
  47.    
  48.                <form action="" method="post">
  49.             <table cellspacing="0" class="groot">
  50.                 <tr>
  51.                     <th class="coltopl" colspan="2">&nbsp;</th>
  52.                     <th class="coltop">&nbsp;</th>
  53.                     <th class="coltopr">&nbsp;</th>
  54.                 </tr>
  55.                 <tr>
  56.                     <td class="form-l odd">
  57.                     <h2>Titel</h2>
  58.                     </td>  
  59.                     <td class="breed odd" colspan="2">
  60.                     <input name="titel" size="30" />
  61.                     </td>
  62.                 </tr>
  63.                 <tr>    
  64.                     <td class="form-l even">
  65.                     <h2>Datum</h2>
  66.                     </td>            
  67.                     <td class="form-r even" colspan="2">
  68. <?php
  69.  
  70. $tijd = time();
  71.  
  72. $stakker = getDates($tijd);
  73.  
  74. print '<select name="days">'."n";
  75. foreach ($stakker['days'] as $key => $value) {
  76.     if ($key !== 'selected') {
  77.         print '<option value="'.$value.'"';
  78.         if ($key == $stakker['days']['selected']) {
  79.             print ' selected="selected"';
  80.         }
  81.         print ">$value</option>n";
  82.     }
  83. }
  84. print '</select>&nbsp;';
  85.  
  86. print '<select name="months">'."n";
  87. foreach ($stakker['months'] as $key => $value) {
  88.     if ($key !== 'selected') {
  89.         print '<option value="'.$value.'"';
  90.         if ($key == $stakker['months']['selected']) {
  91.             print ' selected="selected"';
  92.         }
  93.         print ">$value</option>n";
  94.     }
  95. }
  96. print '</select>&nbsp;';
  97.  
  98. print '<select name="year">'."n";
  99. foreach ($stakker['year'] as $key => $value) {
  100.     if ($key !== 'selected') {
  101.         print '<option value="'.$value.'"';
  102.         if ($key == $stakker['year']['selected']) {
  103.             print ' selected="selected"';
  104.         }
  105.         print ">$value</option>n";
  106.     }
  107. }
  108. print '</select>&nbsp;';
  109.  
  110. print '<select name="hours">'."n";
  111. foreach ($stakker['hours'] as $key => $value) {
  112.     if ($key !== 'selected') {
  113.         print '<option value="'.$value.'"';
  114.         if ($key == $stakker['hours']['selected']) {
  115.             print ' selected="selected"';
  116.         }
  117.         print ">$value</option>n";
  118.     }
  119. }
  120. print '</select>&nbsp;';
  121.  
  122. print '<select name="minutes">'."n";
  123. foreach ($stakker['minutes'] as $key => $value) {
  124.     if ($key !== 'selected') {
  125.         print '<option value="'.$value.'"';
  126.         if ($key == $stakker['minutes']['selected']) {
  127.             print ' selected="selected"';
  128.         }
  129.         print ">$value</option>n";
  130.     }
  131. }
  132. print '</select>&nbsp;';
  133.  
  134. print '<select name="seconds">'."n";
  135. foreach ($stakker['seconds'] as $key => $value) {
  136.     if ($key !== 'selected') {
  137.         print '<option value="'.$value.'"';
  138.         if ($key == $stakker['seconds']['selected']) {
  139.             print ' selected="selected"';
  140.         }
  141.         print ">$value</option>n";
  142.     }
  143. }
  144. print '</select>&nbsp;';
  145.  
  146.  
  147. function getDates($timestamp = false) {
  148.    
  149.     $maanden = array(1 => "januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december");
  150.     $toret['months'] = $maanden;
  151.    
  152.     if ($timestamp) {
  153.         $dag = date('d', $timestamp);
  154.         $uur = date('G', $timestamp);
  155.         $minuten = date('i', $timestamp);
  156.         $maand = date('n', $timestamp);
  157.         $seconden = date('s', $timestamp);
  158.         $jaar = date('Y', $timestamp);
  159.        
  160.         $toret['months']['selected'] = $maand;
  161.         $toret['days']['selected'] = $dag;
  162.         $toret['hours']['selected'] = $uur;
  163.         $toret['minutes']['selected'] = $minuten;
  164.         $toret['seconds']['selected'] = $seconden;
  165.         $toret['year']['selected'] = $jaar;
  166.     }
  167.    
  168.     for ($i = 1; $i <= 31; $i++) {
  169.         $toret['days'][$i] = $i;
  170.     }
  171.     for ($i = 0; $i <= 23; $i++) {
  172.         $toret['hours'][$i] = $i;
  173.     }
  174.     for ($i = 0; $i <= 59; $i++) {
  175.         if (strlen($i) == 1) {
  176.             $toret['minutes'][$i] = '0'.$i;
  177.             $toret['seconds'][$i] = '0'.$i;
  178.         }
  179.         else {
  180.             $toret['minutes'][$i] = $i;
  181.             $toret['seconds'][$i] = $i;
  182.         }
  183.     }
  184.     for ($i = 1970; $i <= date('Y') + 2; $i++) {
  185.         $toret['year'][$i] = $i;
  186.     }
  187.     return $toret;
  188. }
  189.  
  190. ?>
  191.                     </td>
  192.                 </tr>
  193.                 <tr>    
  194.                     <td class="form-l odd">
  195.                     <h2>Functie</h2>
  196.                     </td>            
  197.                     <td class="form-r odd" colspan="2">
  198.                     <input name="functie" size="30" />
  199.                     </td>
  200.                 </tr>
  201.                 <tr>    
  202.                     <td class="form-l even">
  203.                     <h2>Salaris</h2>
  204.                     </td>            
  205.                     <td class="form-r even" colspan="2">
  206.                     <input name="salaris" size="30" />
  207.                     </td>
  208.                 </tr>
  209.                 <tr>    
  210.                     <td class="form-l odd">
  211.                     <h2>Status</h2>
  212.                     </td>            
  213.                     <td class="form-r odd" colspan="2">
  214.                     <select name="status">
  215.                     <option value="1">open</option>
  216.                     <option value="2">gepauzeerd</option>
  217.                     <option value="3">vervuld</option>
  218.                     </select>
  219.                     </td>
  220.                 </tr>
  221.                 <tr>    
  222.                     <td class="form-l even">
  223.                     <h2>Omschrijving</h2>
  224.                     </td>            
  225.                     <td class="form-r even" colspan="2"  style="padding: 10px 0 10px 0;">
  226.                         <textarea name="omschrijving" cols="60" rows="15"></textarea>
  227.                     </td>
  228.                 </tr>
  229.                 <tr>    
  230.                     <td class="form-l odd">
  231.                     </td>            
  232.                     <td class="form-r odd" colspan="2">
  233.                         <input type="submit" name="submit" value="verzend" />
  234.                     </td>
  235.                 </tr>
  236.             </table>
  237.                 </form>
  238.             <div class="panel-groot-footer">&nbsp;</div>
  239.             </div>