$headInfo="<?die('ACCESS DENIED!');?>n";
$fp=fopen($f,"w");
fputs($fp,$headInfo);
fclose($fp);
chmod($f,0777);//修改文件的模式,在Unix下也可用
return(1);
}
function opendb($f){
$this->$dbfile=$f;
if(file_exists($f)){
return true;
}else{
$this->createdb($f);
}
}
function insertline($info){
$fields=explode("|",$info);
while(list($key,$val)=each($fields)){
$therow.="$val=$".$val."&";
$var1.="$".$val.",";
}
$var1.='$tail';
eval("global $var1;"); //为了取得环境变量
eval("$therow="$therow";");
$fp=fopen($this->$dbfile,"a");
fputs($fp,"$therown");
fclose($fp);
}
function readall($f){
if(file_exists($f)){
$this->$dbfile=$f;
$rows=file($f);
for($i=1;$i<count($rows);$i++){
$temp[]=$rows[$i];
}
return $temp;
}
}
//以倒序的方式读入所有的数据行
function revread($f){
if(file_exists($f)){
$this->$dbfile=$f;
$rows=file($f);
$d=count($rows);
$j=$d-1;
for($i=0;$i<$d;$i++){
if($i<$j){
$temprow=$rows[$i];
$rows[$i]=$rows[$j];
$rows[$j]=$temprow;
$j--;
}







