08-07-2013, 01:22 PM
oh yea ive fixed with login pdo (thanks google the best friend.)
ive fixed with this :
login.php
<?php
// Inialize session
session_start();
// Include database connection settings
include(includes/pdodb/database.php);
// Retrieve username and password from database according to users input
$stmt = $db->prepare("SELECT * FROM bg_user WHERE (`user_id` = :username) and (`truepasswd` = :password)");
$result = $stmt->execute(array(:username=>$_POST[username],:password=>$_POST[password]));
$num_rows = $stmt->rowCount();
// Check username and password match
if ( $num_rows > 0) {
// Set username session variable
$_SESSION[username] = $_POST[username];
// Jump to secured page
header(Location: index.php);
}
else {
// Jump to login page
header(Location: login.php);
}
?>
database.php
<?php
$dsn = mysql:host=localhost;dbname=lc_db_auth;
$username = root;
$password = ;
$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
try {
$db = new PDO($dsn, $username, $password, $options);
} catch (PDOException $e) {
$error_message = $e->getMessage();
include errors/db_error_connect.php;
exit;
}
function display_db_error($error_message) {
global $app_path;
include errors/db_error.php;
exit;
}
?>
and now says :
And thanks to AdiH97 for you help
Here what i do


