i have tried checking the code, but cant figure the error
<?php require_once("include/session.php");?>
<?php require_once("include/pdodataconnect.php");?>
<?php require_once("include/functions.php");?>
<?php
//print_r($_POST);
//die();
$username = $_POST['username'];
$password = $_POST['password'];
if ($username==''||$password=='')
echo " Enter a Username and Password";
else{
$query = $handler->prepare("SELECT * From reusers WHERE username= ? and password= ?");
$query->execute(array($username,md5($password)));
if ($query->rowCount() == 1) {
while ($r = $query->fetch(PDO::FETCH_OBJ)){
$active = $r->active;
$email = $r->email;
$regusername = $r->username;
if ($active==0)
echo "You haven't activated your account, please check your email ($email)";
else{
//echo " You are in! <a href='remembers.php'>Click</a> here to enter the member page";
//echo " You are in! <a href='index.html'>Click</a> here to enter the member page";
$_SESSION['username']=$username;
header("location:index.php");
}
}
}
}
?>
How far through the code is it getting if you add some echo() calls for debugging purposes?
as the code was working about 2 hours ago, i am trying to do a back up, since i could not figure it out earlier
I can’t see what it would do if the query returned anything other than exactly one row - nothing, it seems. Could that be it?
i have restored but still not working,
its working on other devices, but don’t know why its not working on my mac
Try this:
<?php
error_reporting(-1); // set to maximum errors
ini_set('display_errors',true); // show on the screen
// start here, then move down until the blank screen error is found.
echo '<br />line: ' . __LINE__; die;
?>
<?php require_once("include/session.php");?>
<?php require_once("include/pdodataconnect.php");?>
<?php require_once("include/functions.php");?>
<?php
//print_r($_POST);
//die();
$username = $_POST['username'];
$password = $_POST['password'];
if ($username==''||$password=='')
echo " Enter a Username and Password";
else{
$query = $handler->prepare("SELECT * From reusers WHERE username= ? and password= ?");
$query->execute(array($username,md5($password)));
if ($query->rowCount() == 1) {
while ($r = $query->fetch(PDO::FETCH_OBJ)){
$active = $r->active;
$email = $r->email;
$regusername = $r->username;
if ($active==0)
echo "You haven't activated your account, please check your email ($email)";
else{
//echo " You are in! <a href='remembers.php'>Click</a> here to enter the member page";
//echo " You are in! <a href='index.html'>Click</a> here to enter the member page";
$_SESSION['username']=$username;
header("location:index.php");
}
}
}
}
// omit to prevent possible white-space errror ? >
Try this slightly modified version.
<?php require_once("include/session.php");?>
<?php require_once("include/pdodataconnect.php");?>
<?php require_once("include/functions.php");?>
<?php
//print_r($_POST);
//die();
if(isset($_POST['username'])){
$username = $_POST['username'];
$password = $_POST['password'];
if(empty($username) || empty($password)){
echo " Enter a Username and Password";
}else{
$query = $handler->prepare("SELECT * From reusers WHERE username= ? and password= ?");
$query->execute(array($username,md5($password)));
if($query->rowCount() == 1){
while ($r = $query->fetch(PDO::FETCH_OBJ)){
$active = $r->active;
$email = $r->email;
$regusername = $r->username;
if($active==0){
echo "You haven't activated your account, please check your email ($email)";
}else{
//echo " You are in! <a href='remembers.php'>Click</a> here to enter the member page";
//echo " You are in! <a href='index.html'>Click</a> here to enter the member page";
$_SESSION['username']=$username;
header("location:index.php");
exit;
}
}
}
}
}
?>
Again another small change
<?php require_once("include/session.php");?>
<?php require_once("include/pdodataconnect.php");?>
<?php require_once("include/functions.php");?>
<?php
//print_r($_POST);
//die();
if(isset($_POST['username'])){
$username = $_POST['username'];
$password = $_POST['password'];
if(empty($username) || empty($password)){
echo " Enter a Username and Password";
}else{
$query = $handler->prepare("SELECT * From reusers WHERE username= ? and password= ?");
$query->execute(array($username,md5($password)));
if($query->rowCount() == 1){
while ($r = $query->fetch(PDO::FETCH_OBJ)){
$active = $r->active;
$email = $r->email;
$regusername = $r->username;
if($active==0){
echo "You haven't activated your account, please check your email ($email)";
}else{
//echo " You are in! <a href='remembers.php'>Click</a> here to enter the member page";
//echo " You are in! <a href='index.html'>Click</a> here to enter the member page";
$_SESSION['username']=$username;
header("location:index.php");
exit;
}
}
}else{
echo " Username and Password did not match";
}
}
}
?>