Functions
==================
load_data(filename)
-> returns true on success
add_user(username, paasword, email)
-> returns true on success
delete_user(integer)
-> returns true on success
edit_user(integer, username, password, email, status)
-> returns true on success
show_where($username='', $password='', $email='', $status='')
-> returns array(counter, username, password, email, status)
show_all()
-> returns array(counter, username, password, email, status)
select_user(integer)
-> returns array(counter, username, password, email, status)
Text File Layout
================
field type size Phys
========= ================= ================ =====
counter short (unsigned) 16 bit 2
username string (nulled) char 50
password string (nulled) char 50
email string (nulled) char 50
status short (unsigned) 16 bit 2
------------------------------------------------------
Saved as packed file for speed and size
-------------------------------------------
example:
function check_password($login='', $password='')
{
include_once('admin.inc.php');
$admin = new admin();
// Directory 'data' must be chmod 777
// Set Directory for text and image files
$admin->set_directory('data');
$admin->load_data('filename.txt'); if($login==''||$password=='') return false;
$admin->load_data('admin.txt');
if($admin->_loaded)
{
$SandBox = $admin->show_where($login, $password, '', 1);
foreach($SandBox as $loaded)
{
if($loaded['password']==$password && $loaded['username']==$login && $loaded['status'])
{
$_SESSION['login'] = $login;
$_SESSION['pass'] = $loaded['password'];
$_SESSION['email'] = $loaded['email'];
return true;
}
}
}
return false;
}
To setup a default login you need to run the following PHP code ONCE then remove it.
<?php
include_once('/admin.inc.php');
$admin = new admin();
// Directory 'data' must be chmod 1777
// Set Directory for text and image files
$admin->set_directory('data');
$admin->load_data('filename.txt');
$admin-> add_user($username, $password, $email);
// e.g. $admin-> add_user('admin', 'admin', 'address@gmail.com')
?>
This will add the user login details to the file 'data/filename.txt'
You can set whatever filename you want, just make sure that the directory is set to 1777
Further installation instructions:
==================================
If you have the server configuration of
/home/server/www/test/
and you want to put the files in a diretory called secure
you would create the directory secure, set it to chmod 1777 then
$admin->set_directory('/home/server/www/test/secure');
or
$admin->set_directory('secure');
( assuming the script ran from /home/server/www/test/ )
You would then want to write to file hiddenstuff.txt
$admin->load_data('hiddenstuff.txt')
So in conclusion you would use:
$admin->set_directory('/home/server/www/test/secure');
$admin->load_data('hiddenstuff.txt')
or if the script was installed in /home/server/www/test/
$admin->set_directory('secure');
$admin->load_data('hiddenstuff.txt')
|