Her er hele greia:
Kode
include ("functions.php");
// the Default function.
//note for functions: if you want to include a value of some variables inside the funtions,
//then you have to GLOBAL it first.
function index($user) {
global $db, $prefix;
//check if the user is logged in or not.
if (is_logged_in($user)) {
include("header.php");
//get_my_info($user);
$cookie_read = explode("|", base64_decode($user));
//define variables to hold cookie values.
$userid = $cookie_read[0];
$username = $cookie_read[1];
$password = $cookie_read[2];
$ipaddress = $cookie_read[3];
$lastlogin_date = $cookie_read[4];
$lastlogin_time = $cookie_read[5];
if($ipaddress == "") $ipaddress = "Hêshata diyar niye";
//print wilcome message
echo ""._WELCOME." <b>$username</b>, Siste login fra: [$ipaddress] [$lastlogin_date @ $lastlogin_time] (<a href=users.php?laper=Logout>"._LOGOUT."</a>)";
echo "<br><br><br><br>";
dugmekan_menu();
include("footer.php");
}else{
//if the user is not logged in then show the login form.
// header("Location: users.php?laper=Login"); die();
include("header.php");
chunejur_form();
include("footer.php");
}
}