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

<?php

if(isset($_GET["edit"]) && isset($_GET["id"])){

    $edit = $_GET["edit"];
    $id = $_GET["id"];
    
    $position = $inputs[$id];
    $position = array_search($position, $uniqueinputs);
    $position++;
    
    if($edit == 'up' || $edit == 'down'){
        // Code zum Verschieben eines Eingabefelds nach oben
        if($edit == 'up' && $position > '1'){
            $direction = 'up';
            $msg = 'Eintrag '.$id.' erfolgreich eine Position nach oben verschoben!';
        }
        // Code zum Verschieben eines Eingabefelds nach unten
        if($edit == 'down' && $position < count($uniqueinputs)){
            $direction = 'down';
            $msg = 'Eintrag '.$id.' erfolgreich eine Position nach unten verschoben!';
        }
        $to = getPositionId($id, $inputs, 'none', $direction);
        $inputs = switchPositions($id, $to, $inputs);
        updateDB($tmpfile, $inputs);
    }

    // Code zum Bearbeiten eines Eingabefelds
    if($edit == 'edit'){
        
    }

    // Code zum Loeschen eines Eingabefelds
    if($edit == 'delete'){
        $inputs[$id] = 'none'; // Loeschen des Datensatzes
        updateDB($tmpfile, $inputs);
        $msg = 'Eintrag '.$id.' erfolgreich gel&ouml;scht!';
    }
}

// Code zum Hinzufuegen eines Eingabefelds
if(isset($_POST["addtxt"]) || isset($_POST["addselect"]) || isset($_POST["addradio"]) || isset($_POST["addcheckbox"]) || isset($_POST["addtxtarea"])){
    $tmp = fopen($tmpfile, "a+"); // Modus: Lesen und Schreiben, Dateizeiger: am Ende, Anlegen: True
    
    $id = count($inputs); // Berechnen der ID
    $type = $_GET["type"]; // Eingabefeld-Typ
    $name = $_POST["label"]; // Name,Label,Bezeichnung
    $req = $_POST["req"]; // Pflichtfeld
    $req = ($req != '1') ? '0' : '1'; // 1= Pflichtfeld, 0= kein Pflichtfeld
    
    # Struktur: [input]ID[#]TYPE[#]NAME[#]REQUIRED[#]VALUE/OPTIONS([#]SELECTED){[#]CUSTOM}
    
    if($name != ''){ // Prüfen ob alle erforderlichen Angaben gemacht worden sind
    
        $data = '[input]'; // Indikator fuer den neuen Eintrag
        $data .= $id;
        $data .= '[#]'.$type;
        $data .= '[#]'.$name;
        $data .= '[#]'.$req;
    
        if(isset($_POST["addtxt"])){
            $value = $_POST["value"];
            $data .= '';
        }elseif(isset($_POST["addselect"])){
            $options = $_POST["opt_1"].'[o]'.$_POST["opt_2"]; // !!! Weitere Optionen auslesen
            $selected = $_POST["selected"]; // Auslesen der Vorauswahl
            $custom = $_POST["custom"];
            $data .= '';
        }elseif(isset($_POST["addradio"])){
            $options = $_POST["opt_1"].'[o]'.$_POST["opt_2"]; // !!! Weitere Optionen auslesen
            $selected = $_POST["selected"]; // Auslesen der Vorauswahl
            $custom = $_POST["custom"];
            $data .= '';
        }elseif(isset($_POST["addcheckbox"])){
            $value = $_POST["value"];
            $selected = $_POST["selected"]; // Auslesen der Vorauswahl
            $custom = $_POST["custom"];
            $data .= '';
        }elseif(isset($_POST["addtxtarea"])){
            $value = $_POST["value"];
            $data .= '';
        }
    
        fwrite($tmp, $data); // Datensatz in Datei schreiben
    }else{    // Falls nicht alle erforderlichen Angaben gemacht worden sind
        echo 'Bitte f&uuml;llen Sie alle erforderlichen Felder aus!';
    }
        fclose($tmp);
}

echo '<b>$inputs</b> =<pre>';
print_r($inputs);
echo '</pre>';

?>

submitter » gnopaster | imprint « imprint     
» Terms of use «