DIR : /home/kozerus/public_html/eidogo/backend/save.php

/home/kozerus/public_html/eidogo/backend

<?php

function to_base($numstring, $frombase, $tobase) {
    $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
   $tostring = substr($chars, 0, $tobase);

   $length = strlen($numstring);
   $result = '';
   for ($i = 0; $i < $length; $i++) {
       $number[$i] = strpos($chars, $numstring{$i});
   }
   do {
       $divide = 0;
       $newlen = 0;
       for ($i = 0; $i < $length; $i++) {
           $divide = $divide * $frombase + $number[$i];
           if ($divide >= $tobase) {
               $number[$newlen++] = (int)($divide / $tobase);
               $divide = $divide % $tobase;
           } elseif ($newlen > 0) {
               $number[$newlen++] = 0;
           }
       }
       $length = $newlen;
       $result = $tostring{$divide} . $result;
   }
   while ($newlen != 0);
   return $result;
}
$stamp = microtime(true) * (rand() / getrandmax()) * 100;
$id = to_base((string)$stamp, 10, 62);

$sgf = $_POST['sgf'];
if (get_magic_quotes_gpc()) $sgf = stripslashes($_POST['sgf']);
if (strlen($sgf) > 30000) {
    // ~ 30 KB limit
    exit;
}
file_put_contents("../sgf/saved/$id.sgf", $sgf);

echo $id;

?>
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer