I've got the following routine in a login page. What happens is that the
first time the user goes to the page, a form is shown. The user enters ID &
password and clicks a button. This calls the same page again but with a
POSTed variable 'mode' set to "checklog" so that this is what the user gets
the second time.

Now, it works fine on my local system. When I upload it to my hosting
service, it works in as much as if the user enters the wrong details (ie,
that aren't in the user database) they get the "we can't find your details
message". If they enter the correct details, it accepts them, and prints '1'
for the $dbidrows variable. But here's the rub:

* on my local machine, the page prints the 'welcome' message with the
person's first and last name, looked up from the database, with no trouble.
* on the hosting service's server, it prints 'Welcome .' - the names are
missing.

Both I and the hosting service are running the same version of MySQL.
They're running PHP 4.1 as CGI - I'm running 4.3 as an Apache module. I'd
appreciate any thoughts on what's happening here.

CASE ("checklog"):
 // CHECK LOGIN DETAILS TO SEE IF USER REGISTERED
 extract($_POST); // creates $user_id, $password
 // Connecting, selecting database */
  include('db1conn.inc'); // these contains the mysql_connect() and
mysql_select_db() routines.
 /* Performing SQL query */
 $dbquery = "SELECT * FROM users WHERE user_id = '".$user_id."' AND password
= '".$password."'";
// the $user_id and $password variables were extracted from $_POST
 $dbfindid = mysql_query($dbquery) or die("Query failed");
 $dbidrows = mysql_num_rows($dbfindid);
 echo "dbidrows: ",$dbidrows;  // this does indeed return '1' if the person
entered the correct details
 /* displaying results */
  if ($dbidrows == 0) {
      // entered id & password not found in database
           echo "No matches found...We can't find your details in our user
database.";
    }
  else {
       // user found in database
       $userdetails = mysql_fetch_assoc($dbfindid);
       echo "<h6>Login succeeded...</h6>";
       echo "Welcome ",$userdetails['firstname'],"
",$userdetails['lastname'],".";  // *** THIS IS WHERE THE PROBLEM COMES ***
   }
 /* Closing connection */
  include('dbclose.inc');
 break;



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to