php - Can Never Seem To Login No Matter What -


i'm complete newb @ php , have been banging head on week trying different tutorials sake of basic login none of them ever work.

i stumbled across 1 able registration work funny enough, have never been successful logging in when comes matching parameters , what's in database , cannot find reason why.

i have copied , pasted code , changed few names tutorial's website -> die('we encountered problems'); have re-written code on , on -> die('we encountered problems'); checked hours straight tiny errors, none , still -> die('we encountered problems');

i cannot log in.

<?php  require 'connection.php';  if (!empty($_post['username']) && !empty($_post['password'])):    $records = $conn->prepare('select id, username, password users username = :username');   $records->bindparam(':username', $_post['username']);   $records->execute();   $results = $records->fetch(pdo::fetch_assoc);  if(count($results) > 0 && password_verify($_post['password'], $results['password'])) {   die('we have log in'); } else {   die('we encountered problems'); } endif; 

i have dropped password column in database , added in again, put new passwords, still no go goes straight die('we encountered problems');.

basically same message receive time upon entering right password , username on , on again.

please me, i'm desperate find out reason why have tried concerning login faulty full stop. yet able register , add in new information database... makes no sense me.

---update---

<?php var_dump($results, $_post);  require 'connection.php';  if (!empty($_post['username']) && !empty($_post['password'])):    $records = $conn->prepare('select id, username, password users username = :username');   $records->bindparam(':username', $_post['username']);   $records->execute();   $results = $records->fetch(pdo::fetch_assoc);  if(count($results) > 0 && password_verify($_post['password'], $results['password'])) {   die('we have log in'); } else {   die('we encountered problems'); } endif; 

changed $results['password'] $results['password'] , added var_dump($results, $_post);, unfortunately results remain same output mentioned before.

only new output null array(3) { ["username"]=> string(5) "admin" ["password"]=> string(4) "pass" ["login"]=> string(5) "login" } encountered problems after adding var_dump.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -