Hi,
  I am able to produce the following problem 100% in WINDOWS. 

  Problem is u can not produce success message in new browser context ..

        Error: php.exe has generated some errors and will be closed by
windows.

  I am facing this problem from last 1 year.

Files

Login.html 
======================

<!DOCTYPE html public "-//w3c//dtd html 4.0 transitional//en">
<html>

<body ONLOAD="document.login.emp_id.focus()">
<font face="arial" >
   <br><br><center>  <h1> WELCOME TO LOGIN PAGE </h1></center><br><br>
<center>
 <form name="login" method="post" action="./authentication.php">
 <table border="0" width="100%">
 <center>
 <tr><td width="50%" align="right"><b><font size="2"
face="Arial">Employee No&nbsp;</font></b></td><td width="5%"></td><td
width="50%"><input type="text" size="10" name="emp_id" maxlength="10"
value=""></td></tr>
 <tr><td width="50%" align="right"><b><font size="2"
face="Arial">Password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></
b></td><td width="5%"></td><td width="50%" ><input type="password"
size="10" name="emp_pass" maxlength="10" value=""></td></tr>
 <tr>
                <td width="50%" align="right">
                <p align="left">

                </td>
                <td width="5%">
                </td>
                <td width="50%">
                <p align="left"> <input type="submit"
Value="LOGIN"></td>
 </tr>

 </center>
</table>
</center>
</form>
</body>
</html>
===============================

Authentication.php
====================================
<?php

        // Connect to MySQL

        if (isset ($HTTP_POST_VARS{"emp_id"}) && isset
($HTTP_POST_VARS{"emp_pass"}))
        {
                $connection=mysql_connect( 'localhost', 'balaji',
'pingpong' )
                                or die ( 'Unable to connect to server.'
);

                // Select database on MySQL server

                mysql_select_db( 'amerm' ) or die ( 'Unable to select
database.' );

                // Formulate the query


                $sql = "SELECT * FROM employee WHERE emp_id = '$emp_id'
AND  emp_pass = PASSWORD('$emp_pass')";

                // Execute the query and put results in $result

                $result = mysql_query( $sql )   or die ( 'Unable to
execute query.' );

                // Get number of rows in $result.

                $num = mysql_numrows( $result );



                if ( $num != 0 )
                {
                        $row = mysql_fetch_object($result);

                        // A matching row was found - the user is
authenticated.
                        //start a new session by registering the
employee number.
                        session_start();
                        session_register("user","pw");
                        $user=$emp_id;
                        $pw  =$emp_pass;
                        
                        //This is the value from employee table ..just
simplified for simulating this problem
                        
                  $n=2; 

                        if ($n=="2")
                        {
                                //close mysql connection
                                mysql_close($connection);
                                header("Location: success.php");
                                exit;
                        }
                }

                else
                {
                        //close mysql connection
                        mysql_close($connection);
                        //User does not exist or not authenticated.
                        header("Location:not_authorized.html");
                        exit;
                }
        }

        else
        {
                //User does not exist or not authenticated.
                header("Location:wrongusage.html");
                exit;
        }
?>
=================================================

Success.php
========================================

<?php


        echo "you have logged in successfully!!!!!<br>";

        echo "Session variables<br>";

        echo $HTTP_SESSION_VARS["user"].$HTTP_SESSION_VARS["pw"];

?>

=======================================

Can anybody tell me what is causing the problem.

Any help would be very appreciable.

Thanks in advance
Balaji

**************************Disclaimer************************************
      


Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.



 ********************************************************************

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

Reply via email to