I’m defining them trough login:
[php]
<?php
include "lib/configuration.php";
include "language/frontend/portuguese.php";
include "templates/frontend/header.tpl";
if ($_POST) {
$f_user = $_POST['user'];
$f_pass = $_POST['pass'];
$cryptpass = md5($f_pass);
$link = mysqli_connect($host, $user, $pass, $db);
/* check connection */
if (mysqli_connect_errno()) {
echo "";
echo "
" . $error['dbconnection'] . "
";
exit();
}
$query = "SELECT * FROM users";
if ($result = mysqli_query($link, $query)) {
if (mysqli_errno($link)) {
echo "";
echo "
" . $logerror['query'] . "
";
} else {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
$c_fname = $row['first_name'];
$c_lname = $row['last_name'];
$c_user = $row['c_user'];
$c_pass = $row['c_pass'];
if ($f_user == $c_user AND $cryptpass == $c_pass) {
$_SESSION['logedin'] = "YES";
$_SESSION['first_name'] = $c_fname;
$_SESSION['last_name'] = $c_lname;
echo "";
}
}
echo "";
echo "
" . $loginerror['login'] . "
";
}
}
/* free result set */
mysqli_free_result($result);
/* close connection */
mysqli_close($link);
} else {
include "templates/frontend/loginspace.tpl";
include "templates/frontend/registerlogin.tpl";
include "templates/frontend/searchspace.tpl";
include "templates/frontend/search.tpl";
include "templates/frontend/hmenuspace.tpl";
include "templates/frontend/menubar.tpl";
include "templates/frontend/leftspace.tpl";
include "templates/frontend/leftside.tpl";
include "templates/frontend/contentspace.tpl";
include "templates/frontend/login.tpl";
include "templates/frontend/rightspace.tpl";
include "templates/frontend/rightside.tpl";
include "templates/frontend/footerspace.tpl";
include "templates/frontend/footerdiv.tpl";
include "templates/frontend/footer.tpl";
}
?>
[/php]
and the session start is on the include "lib/configuration.php";
among some other things