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

  1. <?php
  2.  
  3. function inputarray($tmpf){
  4.         $tmpfile = fopen($tmpf, "r");
  5.         $tmpbuffer = '';
  6.         while(!feof($tmpfile)){
  7.             $tmpbuffer .= fgets($tmpfile, 4096);
  8.         }
  9.         fclose($tmpfile);
  10.         $strsplit = '[input]';
  11.         $inputs = explode($strsplit, $tmpbuffer);
  12.         return $inputs;
  13. }
  14. function addedinputs($tmpf){
  15.     if(is_file($tmpf)){
  16.         $inputs = inputarray($tmpf);
  17.     }else{
  18.         $tmpfile = fopen($tmpf, "w+");
  19.         fwrite($tmpfile, 'none');
  20.         fclose($tmpfile);
  21.         $inputs = inputarray($tmpf);
  22.     }
  23.     return $inputs;
  24. }
  25.  
  26. function switchPositions($id, $to, $targetar){
  27.     $valueone = $targetar[$id];
  28.     $valuetwo = $targetar[$to];
  29.     $targetar[$id] = $valuetwo;
  30.     $targetar[$to] = $valueone;
  31.     return $targetar;
  32. }
  33.  
  34. function updateDB($tmpf, $targetar){
  35.     $newdb = implode('[input]', $targetar); // Erzeugen der neuen Datensaetze
  36.     unlink($tmpf); // Ersetzen der alten Datensaetze
  37.     $dbfile = fopen($tmpf, "w+");
  38.     fwrite($dbfile, $newdb);
  39.     fclose($dbfile);
  40. }
  41.  
  42. function getPositionId($id, $targetar, $criterion, $direction){
  43.     if($direction == 'up'){
  44.         $id--;
  45.     }else{
  46.         $id++;
  47.     }
  48.     while($targetar[$id] == $criterion){
  49.         if($direction == 'up'){
  50.             $id--;
  51.         }else{
  52.             $id++;
  53.         }
  54.     }
  55.     return $id;
  56. }
  57.  
  58. ?>
submitter » gnopaster | imprint « imprint     
» Terms of use «


Donate via Bitcoin:
1KCq5UvwuTMwgSAHUsd7eqkBWTHZau1ydN