<?php
/*
by ivi.
www: newsroot.net
E-mail: hide@address.com
ICQ# 4405730
*/
/*
Class API
You Need redeclare 2 functions for integration to Your system.
int getUserId(); // functio return (int id) for logged user.
String getUserName($id) // return username for $id
*/
require_once("db.php"); // include simple database inteface
// You can comment this line. But You need replace api functions
class C_API
{
var $db = NULL;
function C_API()
{
$this->__construct();
}
function __construct()
{
global $db_host, $db_name, $db_user, $db_pass;
// initiate simple database interface
$this->db = new db($db_user, $db_pass, $db_name, $db_host) ;
}
// please replace this function
// You need remake this function with using your database connection.
function db_getAll($sql) // extract all assoc recorts from database. Possible You have other db connection. You can use Your functions
{
return $this->db->getAll($sql);
}
function getLastId() // get last insert id
{
return $this->db->getLastId();
}
function db_getOne($sql) // get one assoc array from database
{
return $this->db->getOne($sql);
}
function db_query($sql) // execute sql query
{
return $this->db->query($sql);
}
function getUserId() // get id for logged user; if userid <= 0 user not logged
{
return 1;
}
function getUserName($id) // get User name
{
return "Anonimous";
}
}
?>