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
func
Scriptlanguage
PHP
Tabwidth
4
Date
03/01/2010 05:01:42 pm
IP
79.222.42.87

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;
}

?>

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