codice:
<?
###########################################
#-----------Users login system------------#
###########################################
//skip the config file if somebody call it from the browser.
if (eregi("config.php", $_SERVER['SCRIPT_NAME'])) {
    Header("Location: index.php"); die();
}

//your databse hostname.
$dbhost = "localhost";
//your database username.
$dbuname = "orgoglioromeno.i";
//your db password
$dbpass = "dd2585";
$dbname = "orgoglioromeno_it";
//don't change unless you change this value in the db.
$prefix = "maaking";

//change this
$site_name  = "Orgoglio romeno";
$site_email = "info@orgoglioromeno.it";
$site_url = "http://www.orgoglioromeno.it/";

include("mysql.class.php");
$db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
if(!$db->db_connect_id) {
      include("header.php");

      echo "
<font color=red><h3>
<center>Error:[/b]
<hr>

            [b]Connection to database faild</center>
            








";

      include("footer.php");
      exit();
}


//global function for checkig user is logged in or not.
//you will notice we will use it everwhere in the script.
function is_logged_in($user) {
    global $db,$prefix;

    if(!is_array($user)) {

	$user = explode("|", base64_decode($user));
        $uid = "$user[0]";
	$pwd = "$user[2]";
    } else {
        $uid = "$user[0]";
	$pwd = "$user[2]";
    }
    $uid = addslashes($uid);
        $uid = intval($uid);
    if ($uid != "" AND $pwd != "") {
        $result = mysql_query("SELECT password FROM ".$prefix."_users WHERE userid='$uid'");
	$row = mysql_fetch_array($result);
        $pass = $row['password'];
	if($pass == $pwd && $pass != "") {

           return 1;
	}
    }
    return 0;
}

?>