I've problem with login.php
#5

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 Wink

 



Messages In This Thread
[No subject] - by ReturnKratos - 08-07-2013, 08:16 AM
[No subject] - by ReturnKratos - 08-07-2013, 11:12 AM
[No subject] - by AdiH97 - 08-07-2013, 12:27 PM
[No subject] - by ReturnKratos - 08-07-2013, 01:10 PM
[No subject] - by ReturnKratos - 08-07-2013, 01:22 PM
[No subject] - by luoo - 08-20-2013, 09:29 AM
[No subject] - by Nymphetamine - 08-20-2013, 09:35 AM
[No subject] - by Johnny5 - 08-20-2013, 09:35 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)