<?php
/********************************************************************
Borrowed and adapted from Sepia (sepia.lp-musix.net)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General
Public License along with this program; if not, write to
the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
********************************************************************/
class session
{
var $pin;
var $loggedin;
function session()
{
session_set_cookie_params(60*60*24*365);
session_start();
}
function loggedin()
{
if(isset($_SESSION['uid']))
{
return 1;
}
else
{
return 0;
}
}
function login($pin)
{
$this->pin = $user;
$sql = "SELECT NULL FROM users WHERE uid='" . intval($this->pin) . "'";
$result = sql_query($sql);
$num = count($result);
if($num > 0)
{
$user = $this->pin;
session_register("uid");
}
else
{
echo "UID not found, create one here";
}
}
}
$session = &new session();
global $session;
?>