Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    406
    Thanks
    0
    Thanked 0 Times in 0 Posts

    processing a password not working

    I have a page with username and password. When a user enters a wrong username or password or even he enters the correct ones, it is just displaying a blank page. Why is this happening? Is it to do with the code or the server?

    Here is the page:
    http://chelvisdesign.weezyhost.com/login1.html
    username: test
    password: test1

    Here is the PHP pages that process the code:
    test_processlogin.php
    <?
    session_start();
    include("test_membership.php");
    $username = trim($_POST['loginname']);
    $password = trim($_POST['loginpassword']);
    if ($username == getMember() && $password == getPassword())
    {
    $_SESSION['login'] = 1;
    header("Location: test_membersonlypage.php");
    exit;
    }
    else
    {
    header("Location: test_errorlogin.html");
    exit;
    }
    ?>

    test_membership.php
    <?
    function getMember()
    {
    return "test";
    }
    function getPassword()
    {
    return "test1";
    }
    ?>

    test_membersonlypage.php
    <?
    // membersonlypage.php (and other members' only pages)
    session_start();
    if (!isset($_SESSION['login']))
    {
    header("Location: test_errorlogin.html");
    exit;
    }
    header("Location:welcome.html");
    ?>

  • #2
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The code seems fine. Check your submitted data.

    Also use PHP or CODE tags when posting code

    PHP Code:
    This is PHP code 

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    406
    Thanks
    0
    Thanked 0 Times in 0 Posts
    degsy, I didnt understand what you meant? "Check your submitted data." Can you explain please?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •