Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 25th, 2007, 11:38 AM
Registered User
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default having a problem with login script

(these scripts are based off of chapter 13 in the "Beginning PHP, MySQL and APACHE" book.)
Whenever I try to login to my site, the login page passes through transact-user.php, but never redirects back to index.php. it sits at transact-user.php and shows a blank white page. I have also customized it so that none of the pages include the "header.php" that is in the book.

heres the login page, it's just a form and there is no PHP scripting on the page:
<form action="transact-user.php" method="post">

    <input name="email" type="text">
    <br /><br />
    <input name="passwd" type="password">
    <br /><br />
    <input type="submit" name="submit" value="Login">

and heres the login/logout part of the transact-user.php page:

require_once 'conn.php';

if (isset($_REQUEST['action'])) {
  switch ($_REQUEST['action']) {
    case 'Login':
      if (isset($_POST['email'])
          and isset($_POST['passwd']))
        $sql = "SELECT user_id, access_lvl,name " .
               "FROM cms_users " .
               "WHERE email='" . $_POST['email'] . "' " .
               "AND passwd='" . $_POST['passwd'] . "'";
        $result = mysql_query($sql, $conn)
          or die('Could not look up user information; ' .

        if ($row = mysql_fetch_array($result)) {
          $_SESSION['user_id'] = $row['user_id'];
          $_SESSION['access_lvl'] = $row['access_lvl'];
          $_SESSION['name'] = $row['name'];

      case 'Logout':

     ..... etc

I cannot for the life of me figure out why it does nothing after clicking the "login" button on the form except go to a blank white page. am I missing something?
Old November 14th, 2007, 02:12 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran

i can not see any mistake on your code, but did u create a page conn.php with connection details

(Anything is Possible)

Similar Threads
Thread Thread Starter Forum Replies Last Post
login script: user can't hit "return" for login dmerrill Java Basics 13 July 14th, 2006 07:25 PM
PHP Login script problem columbo1977 Beginning PHP 1 May 21st, 2006 10:47 PM
login script Apocolypse2005 Javascript 3 June 24th, 2005 04:07 PM
login script problem hosefo81 PHP How-To 9 August 20th, 2004 11:28 AM
problem with auto login script to MSDE cmedley007 Access VBA 1 July 8th, 2004 11:01 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.