Results 1 to 1 of 1

Thread: Help with Membership website

  1. #1
    kirklogan Guest

    Thumbs down Help with Membership website

    Hey guys ive been working on making a membership website for a day or two now, and have been having some trouble with my code, i dont claim to be an expert in PHP or SQL but i can generally get the job done, ill post my code below, and any help would be greatly appreciated.

    I have a MySQL server set up to handle the input and i am testing this with a login i manually added to the database.

    after i input the login and password i get sent to the log.php page (PHP processing page) and there is nothing there whatsoever and it does not redirect me to my success page.

    Code for login form:

    PHP Code:
      <div id="mainContent">
     <?php
    session_name
    ("MyLogin");
    session_start();
    session_destroy();

    if(
    $_GET['login'] == "failed") {
    print 
    $_GET['cause'];
    }
    ?>
    <form name="login_form" method="post" action="log.php?action=login">
    Login: <input type="text" name="user"><BR>
    Password: <input type="password" name="pwd"><BR>
    <input type="submit">
    </form> 
      </div>


    Code for PHP processing page:
    PHP Code:
     <?php
    session_name
    ("MyLogin");

    if(
    $_GET['action'] == "login") {
    $conn mysql_connect("localhost","thelead2","6WG2NMB("); 
    $db mysql_select_db("thelead2_member"); 
    $name $_POST['user'];
    $q_user mysql_query("SELECT * FROM USERS WHERE login='$name'");

    if(
    $_POST['pwd'] == $data['password']) {
    session_register("name");
    header("Location: success.php");
    exit;

    } else {
    header("Location: login.php?login=failed&cause=".urlencode('Wrong Password'));
    exit;
    }

    } else {
    header("Location: login.php?login=failed&cause=".urlencode('Invalid User'));
    exit;
    }


    // if the session is not registered
    if(session_is_registered("name") == false) {
    header("Location: login.php");
    }
    ?>
    Last edited by is_numeric; 13 Aug 2010 at 09:38 AM. Reason: code tags added

Similar Threads

  1. Replies: 0
    Last Post: 10 Oct 2009, 06:21 AM
  2. Free website templates, website tools & website articles
    By webguruaish in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 27 Apr 2007, 08:09 AM

Posting Permissions

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