Hello. I have a problem with login into the admin panel. Here are the scripts involved to this procedure. Also you have a picture with the admin table.
admin.login.php
<?php
include('lib/config.inc.php');
class Login{
var $query;
function Login($idFld, $usernameFld, $passwordFld, $tbl, $usernameVar, $passwordVar){
$con = new Connection(MYSQL_HOST, MYSQL_USER, MYSQL_PWD, MYSQL_DB);
$this->query = 'select
'.$idFld.', '.$usernameFld.'
from
'.$tbl.'
where
'.$usernameFld.' = "'.$usernameVar.'" and '.$passwordFld.' = MD5("'.$passwordVar.'")';
Login::checkUser();
}
function checkUser(){
$sql = new Query($this->query);
print $sql->err;
if($sql->rows != 0){
$_SESSION['loggedUser']['id'] = $sql->resultArray[0][0];
$_SESSION['loggedUser']['username'] = $sql->resultArray[0][1];
header('location: admin.index.php');
}else{
header('location: index.php?err=1');
}
}
}
$c = new Login('id', 'username', 'password', 'admin', $_POST['username'], $_POST['password']);
?>
config.inc.php
<?php
//MYSQL DATA
include('mysql.data.php');
//GLOBALS
define('CLASS_DIR', 'lib/classes/');
define('CSS_DIR', 'lib/css/');
define('TPL_DIR', 'lib/tpl/');
define('GFX_DIR', 'lib/gfx/');
define('MODULE_DIR', 'lib/mods/');
define('USER_PHOTO_DIR', 'images/');
session_name(md5('USER_SESSION'));
session_start();
include('libs.php');
?>
mysql.data.php
<?php
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'luci');
define('MYSQL_PWD', 'parola');
define('MYSQL_DB', 'masini');
?>
http://uploadimage.ro/images/22771091011925998819.jpg