thedigicraft / Atom.CMS

Atom.CMS
56 stars 50 forks source link

admin login error #30

Open meatyhotpants opened 10 years ago

meatyhotpants commented 10 years ago

hi hows it going. having a problem with part 28 on your Developing a Dynamic Website 2014 Series. hope this has not been posted before, first time on github.com. on the admin login page I get this error. Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\webfolio\dynamic\admin\login.php on line 15.

<?php

Start Session: session_start();

Database connection: include('../config/connection.php');

if ($_POST) {

$q = "SELECT * FROM users WHERE email = '$_POST[email]' AND password = SHA1('$_POST[password]')";
$r = mysqli_query($dbc, $q);

if(mysqli_num_rows($r) == 1) {

    $_SESSION['username'] = $_POST['email'];
    header('Location: index.php');

    }

}

hope i have posted this right. thinks

meatyhotpants commented 10 years ago

this may sound daft but could it be that I'm not putting in the correct password lol

thedigicraft commented 10 years ago

Haha it could be. I don't see anything off here.