I have a PHP login script that I made. My previous version was made in mySQL, but now I am converting to POD for various reasons. This has already happened several times, DO NOT get yourself confused!
It runs by posting to a file called access.php. I tried to implement some debugging, but it returns nothing.
After sending my username, and password, it results in this:Code:<?php try { $host = 'localhost'; $port = 3306; $database = 'members'; $db_username = 'stencil_access'; $db_password = ''; $DSN = new PDO("mysql:host=$host;port=$port;dbname=$database", $db_username, $db_password); } catch (PDOException $e) { echo $e->getMessage(); } date_default_timezone_set('Europe/London'); date('Y-m-d H:i:s'); $username = $_POST['username']; $password = sha1(sha1($_POST['username']) . sha1($_POST['password'])); $STH = $DSN->prepare("SELECT * FROM members WHERE username = $username AND password = $password AND expiry > NOW() OR type > 0 LIMIT 1"); //Line 20 $STH->execute(array($username,$password)); //Debugging echo "<pre>"; var_dump($STH); echo "</pre>"; //End if ($STH->fetchColumn() == false) { header("location:invalid.php"); } else { session_start(); $_SESSION['username'] = $username; $_SESSION['password'] = $password; header("Location:main.php"); die(); } ?> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> </html>
SQLSTATE[28000] [1045] Access denied for user 'stencil_access'@'int.web6.vital.x10hosting.com' (using password: NO)
Fatal error: Call to a member function prepare() on a non-object in access.php on line 20


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

