If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > login problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-26-11, 13:26
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
login problems

I ran into some problems in the login.
The index page shows this:
PHP Code:
<form action="login/login.php" method="post"
  <
label for="login-username" style="float: left; margin: 0px 0px 0px 5px;">Username:</label><br /> 
  <
input type="text" name="username" id="login-username" value="" style="float: left; margin: 0px 0px 0px 5px; border: 1px solid #7A1010; color: #7A1010;" />
  <
label for="login-password" style="float: left; margin: 0px 0px 0px 5px;" >Password:</label><br /> 
  <
input type="password" name="password" id="login-password" value="" style="float: left; margin: 0px 0px 0px 5px; border: 1px solid #7A1010; color: #7A1010;" /><br /> 
  <
br />
  <
label for="login-remember" style="float: left; margin: 0px 0px 0px 5px;">Remember me?</label>
  <
input type="checkbox" name="remember" id="login-remember" style="float: left; margin: 5px 0px 0px 5px;" /><br />
  <
input type="submit" value="Login" style="float: left; margin: 0px 0px 0px 5px; background-color: #7A1010; color: #EAE8C8;" />
</
form
The form leads to here:
PHP Code:
<?php
// Database connection file
require_once("includefiles/dbconnection.php");
$un=isset($_POST['username']) ? $_POST['username'] : "";
$pw=isset($_POST['password']) ? $_POST['password'] : "";
echo 
"Hellooooooo!!!!!!!!!!!!".$un." ".$pw;
// Form submitted?
if($_SERVER['REQUEST_METHOD'] == "POST"){
    
$errors = array();
    
// Validate form
    
foreach($_POST as $key => $value){
        if(empty(
$value)){
            
$errors[$key] = $key " was empty";
        }
    }
    
// If no errors, continue
    
if(count($errors) == 0){
        
$sql sprintf("SELECT usergroup AS success FROM {$dbTable} WHERE username='%s' AND password=MD5('%s')"$un$pwextract(mysql_fetch_assoc(mysql_query($sql)));
        
//echo $sql;
        // If this is not set, there was an error
        
if(!isset($success)){
            
$errors[] = "that username and password combination are incorrect";
        }else{
            
// Remember me?
            
if(isset($_POST['remember'])){
                
setcookie("login"$_POST['username'] . ":" $successtime() + (3600 24 30)); // store for 30 days
            
}
            
// Log the user in
            
$_SESSION['login'] = true;
            
$_SESSION['username'] = $_POST['username'];
            
$_SESSION['group'] = $success;
            
$_SESSION['just_logged_in'] = true// to display a message
            // Redirect back to the main page
            
$redirect true;
            unset(
$errors);
        }
    }
}else{
    
// The form was not submitted, so they shouldn't be here
    
$redirect true;
}
// Redirect if needed
if(isset($redirect)){
    
header("Location: " $baseURL);
    exit;
}
include(
"login-form.php");
?>
But this page shows blank.
__________________
Compare bible texts (and other tools):
TheWheelofGod
Reply With Quote
  #2 (permalink)  
Old 05-26-11, 19:45
futurity futurity is offline
Registered User
 
Join Date: May 2008
Posts: 270
Most likely there's some sort of fatal error in your included file, otherwise your 'echo Helloooo!' line should be displayed, at the very least. Make sure error reporting is turned on before including any files.
Reply With Quote
  #3 (permalink)  
Old 05-27-11, 03:55
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
make the first line of your php scripts (after the <?php)
error_reporting (E_ALL | E_STRICT);
PHP: error_reporting - Manual
this turns on error reporting. my suspisicions that you have a syntax error or possibly a logic error. PHP can be a very frustrating development environment unless you use one of the tools such as eclipse with debugging turned on
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On