Not Reviewed
Show More
Add another comment
| @@ -40,6 +40,7 $dbParams = array( | |||
|
|
40 | 40 | 'charset' => 'utf8mb4' |
|
|
41 | 41 | ); |
|
|
42 | 42 | $dbConnection = \Doctrine\DBAL\DriverManager::getConnection($dbParams, $dbConfig); |
|
|
43 | $dbConnection->setFetchMode(PDO::FETCH_OBJ); | |
|
|
43 | 44 | |
|
|
44 | 45 | $mtdb = new MysqlStore(); |
|
|
45 | 46 | $mtdb->connect( DB_SERVER, DB_WRITE_USER, DB_WRITE_PASS, DB_NAME ); |
| @@ -65,7 +66,7 function sanitize_username( $username ) { | |||
|
|
65 | 66 | |
|
|
66 | 67 | // Attempt to login with a username and password. If from cookies, set already_hashed = true. |
|
|
67 | 68 | function mt_login($username, $password, $already_hashed = false) { |
|
|
68 |
global $error, |
|
|
|
69 | global $error, $dbConnection; | |
|
|
69 | 70 | |
|
|
70 | 71 | // Fail login if either user or pass is blank |
|
|
71 | 72 | if ( '' == $username ) |
| @@ -81,7 +82,7 function mt_login($username, $password, $already_hashed = false) { | |||
|
|
81 | 82 | // Get user info from the database |
|
|
82 | 83 | $sql = 'SELECT * FROM contributor WHERE name LIKE ?'; |
|
|
83 | 84 | $stmt = $dbConnection->executeQuery($sql, array($username)); |
|
|
84 |
$login = $stmt->fetch( |
|
|
|
85 | $login = $stmt->fetch(); | |
|
|
85 | 86 | |
|
|
86 | 87 | if (!$login) { |
|
|
87 | 88 | $error = ('<strong>ERROR</strong>: Invalid username or password.'); |
Comments 0
You need to be logged in to leave comments.
Login now
