<?php
###############################
# OFILE CLASS
# YOU CAN WRITE & READ FROM FILE...
#CREATED BY Saanina
#hide@address.com
#swalif.net
###############################
class ofile {
var $ha, $file, $html, $html2;
# handle .. file..
// file : this variable mean file which will write to ..
function handle ( $file )
{
$this->ha = @fopen ( $file , "a" );
flock ( $this->ha , LOCK_EX );
$this->file = $file;
}
#style
//html : html code for style ... begien
//html2: html code for style ...end
function style ( $html , $html2 )
{
$this->html = $html;
$this->html2 = $html2;
}
#write to file
//content : which will put in file ..
// split : charachter use to split between contents
function write ( $content, $split )
{
@fwrite ( $this->ha , $content."".$split."\r\n" );
}
#read file
//split : use for now where will split contents
//splits : use to now where will split seconary contents.
//re : which will result with results
//re2: which will result with results 2
function read ( $split , $re , $split2 = '' , $re2 = '')
{
$contents = file_get_contents ($this->file);
$sd = explode ( $split , $contents );
echo $this->html;
foreach ( $sd as $we ) {
if ( $split2 == '' )
{
echo $we . $re;
}
else
{
$wi = explode ( $split2 , $we);
$si = implode ($re2 , $wi);
echo $si;
echo $re;
}
}#foreach
echo $this->html2;
}
#end handle
function end ()
{
@fclose ($this->ha);
}
}# end ofile
?>