<?php
$xreserveddbstrings=1000;
function mkfile($path){
fclose(fopen($path, 'a'));
}
function putdata($data, $size=256){
$i=1;
while(true){
if($i<16)
$pre=0;
if(!file_exists('./db/'.$pre.dechex($i).'.list'))
mkfile('./db/'.$pre.dechex($i).'.list');
if($i>hexdec('ff')){
return false;
$GLOBALS[xreservederror].='<t>[u01] Database is full.</t>';
break;
}
if(filesize('./db/'.$pre.dechex($i).'.list')<($GLOBALS[xreserveddbstrings]*($size+1))){
$data.=str_repeat(' ', $size);
$data=substr($data, $size);
file_put_contents('./db/'.$pre.dechex($i).'.list', $data."\n", LOCK_EX|FILE_APPEND);
break;
}
$i++;
unset($pre);
}
function getdata($index, $size=256){
$listindex=ceil($index/$GLOBALS[xreservedmaxstrings]);
$liststring=($index-($listindex-1)*$GLOBALS[xreservedmaxstrings]);
$pre='';
if($listindex<16)
$pre=0;
if(!file_exists('./db/'.$pre.dechex($listindex).'.list')){
$GLOBALS[xreservederror].='<t>[u02] Requested list is not exists.</t>';
return false;
}elseif(filesize('./db/'.$pre.dechex($listindex).'.list')<($liststring*($size+1))){
$GLOBALS[xreservederror].='<t>[u03] Requested string is not exists.</t>';
return false;
}else{
$listf=fopen('./db/'.$pre.dechex($listindex).'.list', 'r');
fseek($listf, ($liststring*($size+1)));
$string=fgets($listf, $size);
return rtrim($string, ' ');
}
}
- Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.30, 5.6.7 - 5.6.14
- Parse error: syntax error, unexpected end of file in /in/oHIcK on line 58
Process exited with code 255.
preferences:
190.11 ms | 1395 KiB | 65 Q