gnopaste

Sorry for this ugly message. We are searching for some translators.
Please take a look here
Thanks to all translators, you're doing a great job!

Name
editform
Scriptlanguage
PHP
Tabwidth
4
Date
03/01/2010 05:00:56 pm
IP
79.222.42.87

The user was too lazy to give a description

  1. <?php
  2.  
  3. if(isset($_GET["edit"]) && isset($_GET["id"])){
  4.  
  5.     $edit = $_GET["edit"];
  6.     $id = $_GET["id"];
  7.     
  8.     $position = $inputs[$id];
  9.     $position = array_search($position, $uniqueinputs);
  10.     $position++;
  11.     
  12.     if($edit == 'up' || $edit == 'down'){
  13.         // Code zum Verschieben eines Eingabefelds nach oben
  14.         if($edit == 'up' && $position > '1'){
  15.             $direction = 'up';
  16.             $msg = 'Eintrag '.$id.' erfolgreich eine Position nach oben verschoben!';
  17.         }
  18.         // Code zum Verschieben eines Eingabefelds nach unten
  19.         if($edit == 'down' && $position < count($uniqueinputs)){
  20.             $direction = 'down';
  21.             $msg = 'Eintrag '.$id.' erfolgreich eine Position nach unten verschoben!';
  22.         }
  23.         $to = getPositionId($id, $inputs, 'none', $direction);
  24.         $inputs = switchPositions($id, $to, $inputs);
  25.         updateDB($tmpfile, $inputs);
  26.     }
  27.  
  28.     // Code zum Bearbeiten eines Eingabefelds
  29.     if($edit == 'edit'){
  30.         
  31.     }
  32.  
  33.     // Code zum Loeschen eines Eingabefelds
  34.     if($edit == 'delete'){
  35.         $inputs[$id] = 'none'; // Loeschen des Datensatzes
  36.         updateDB($tmpfile, $inputs);
  37.         $msg = 'Eintrag '.$id.' erfolgreich gel&ouml;scht!';
  38.     }
  39. }
  40.  
  41. // Code zum Hinzufuegen eines Eingabefelds
  42. if(isset($_POST["addtxt"]) || isset($_POST["addselect"]) || isset($_POST["addradio"]) || isset($_POST["addcheckbox"]) || isset($_POST["addtxtarea"])){
  43.     $tmp = fopen($tmpfile, "a+"); // Modus: Lesen und Schreiben, Dateizeiger: am Ende, Anlegen: True
  44.     
  45.     $id = count($inputs); // Berechnen der ID
  46.     $type = $_GET["type"]; // Eingabefeld-Typ
  47.     $name = $_POST["label"]; // Name,Label,Bezeichnung
  48.     $req = $_POST["req"]; // Pflichtfeld
  49.     $req = ($req != '1') ? '0' : '1'; // 1= Pflichtfeld, 0= kein Pflichtfeld
  50.     
  51.     # Struktur: [input]ID[#]TYPE[#]NAME[#]REQUIRED[#]VALUE/OPTIONS([#]SELECTED){[#]CUSTOM}
  52.     
  53.     if($name != ''){ // Prüfen ob alle erforderlichen Angaben gemacht worden sind
  54.     
  55.         $data = '[input]'; // Indikator fuer den neuen Eintrag
  56.         $data .= $id;
  57.         $data .= '[#]'.$type;
  58.         $data .= '[#]'.$name;
  59.         $data .= '[#]'.$req;
  60.     
  61.         if(isset($_POST["addtxt"])){
  62.             $value = $_POST["value"];
  63.             $data .= '';
  64.         }elseif(isset($_POST["addselect"])){
  65.             $options = $_POST["opt_1"].'[o]'.$_POST["opt_2"]; // !!! Weitere Optionen auslesen
  66.             $selected = $_POST["selected"]; // Auslesen der Vorauswahl
  67.             $custom = $_POST["custom"];
  68.             $data .= '';
  69.         }elseif(isset($_POST["addradio"])){
  70.             $options = $_POST["opt_1"].'[o]'.$_POST["opt_2"]; // !!! Weitere Optionen auslesen
  71.             $selected = $_POST["selected"]; // Auslesen der Vorauswahl
  72.             $custom = $_POST["custom"];
  73.             $data .= '';
  74.         }elseif(isset($_POST["addcheckbox"])){
  75.             $value = $_POST["value"];
  76.             $selected = $_POST["selected"]; // Auslesen der Vorauswahl
  77.             $custom = $_POST["custom"];
  78.             $data .= '';
  79.         }elseif(isset($_POST["addtxtarea"])){
  80.             $value = $_POST["value"];
  81.             $data .= '';
  82.         }
  83.     
  84.         fwrite($tmp, $data); // Datensatz in Datei schreiben
  85.     }else{    // Falls nicht alle erforderlichen Angaben gemacht worden sind
  86.         echo 'Bitte f&uuml;llen Sie alle erforderlichen Felder aus!';
  87.     }
  88.         fclose($tmp);
  89. }
  90.  
  91. echo '<b>$inputs</b> =<pre>';
  92. print_r($inputs);
  93. echo '</pre>';
  94.  
  95. ?>
submitter » gnopaster | imprint « imprint     
» Terms of use «


Donate via Bitcoin:
1KCq5UvwuTMwgSAHUsd7eqkBWTHZau1ydN