The user was too lazy to give a description
<?php function inputarray($tmpf){ $tmpfile = fopen($tmpf, "r"); $tmpbuffer = ''; while(!feof($tmpfile)){ $tmpbuffer .= fgets($tmpfile, 4096); } fclose($tmpfile); $strsplit = '[input]'; $inputs = explode($strsplit, $tmpbuffer); return $inputs; } function addedinputs($tmpf){ if(is_file($tmpf)){ $inputs = inputarray($tmpf); }else{ $tmpfile = fopen($tmpf, "w+"); fwrite($tmpfile, 'none'); fclose($tmpfile); $inputs = inputarray($tmpf); } return $inputs; } function switchPositions($id, $to, $targetar){ $valueone = $targetar[$id]; $valuetwo = $targetar[$to]; $targetar[$id] = $valuetwo; $targetar[$to] = $valueone; return $targetar; } function updateDB($tmpf, $targetar){ $newdb = implode('[input]', $targetar); // Erzeugen der neuen Datensaetze unlink($tmpf); // Ersetzen der alten Datensaetze $dbfile = fopen($tmpf, "w+"); fwrite($dbfile, $newdb); fclose($dbfile); } function getPositionId($id, $targetar, $criterion, $direction){ if($direction == 'up'){ $id--; }else{ $id++; } while($targetar[$id] == $criterion){ if($direction == 'up'){ $id--; }else{ $id++; } } return $id; } ?>