PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
  Classes of Sergej Kurakin  >  sdf  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Short instruction, how to use
Class: sdf
File storing utility
Author: By
Last change:
Date: 14 years ago
Size: 1,069 bytes
 

Contents

Class file image Download
<?php

error_reporting
(E_ALL);

function
gettime(){
   
$temp = explode(" ",microtime());
    return (float)
$temp[1] + (float)$temp[0];
}

$pradzia = gettime();

$CLASS_PATH = './classes/';
$CLASS_EXTENSION = '.class.php';

$classes[] = 'sdf';

while(list(,
$class) = each($classes)){
    require_once(
$CLASS_PATH.$class.$CLASS_EXTENSION);
}

$file = new sdf();

$fields = array('ID','name','password');
//$file->createFile('./data/cool.sdf',$fields);

$file->setFile('./data/cool.sdf');

$text = "ahsdfj jdfhaszzzzz jdhfjsahf safsajdhfsjdhfsjkdh\n333333333333333332";

$row = array(
           
'ID'=>rand(100,999),
           
'name'=>md5(rand(100,999)),
           
'password'=>trim($text)
        );
$file->insertData($row);

//$file->updateData(array('ID' => 993), $row);

//$file->deleteData(array('ID' => 370));

//$file->dropData();
//$file->destroyFile();

?>
<pre>
<?php print_r($file->getFields()); ?>
---------
<?php print_r($file->getData()); ?>
</pre>
<?
$pabaiga
= gettime();
echo
"<br><br>Parsed in: ".round($pabaiga-$pradzia, 4)." s.";

?>