Hi! Renze,
Thanks a lot for u'r help. I am in vacation up to
now.
Now i am trying with u'r solution. I am getting the following
error.
I am sending the file also.
Warning: Cannot send session cache limiter - headers already sent in
c:\www\authentication.php on line 34
File:authentication.php
<?php
header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); error_log ("emp_id: $emp_id", 0);
error_log ("Lastname: $emp_pass", 0); // Connect to MySQL
mysql_connect( 'localhost', 'balaji',
'pingpong' )
or die ( 'Unable to connect to server.' ); // Select database on MySQL
server
mysql_select_db( 'imac'
)
or die ( 'Unable to select database.' ); // Formulate the query
$sql = "SELECT * FROM employee
WHERE
emp_id = '$emp_id' AND emp_pass = '$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 )
{
// A matching row was found - the user is authenticated. session_start(); session_register('$emp_id'); $row =
mysql_fetch_object($result);
if
($row->user_type=='S')
{ include('super.php'); }
else if ($row->user_type=='O') { include('ordinary.php'); }
} else
{ file://User does not exist or not authenticated. echo '<center><h1>Authorization Required.</h1></center>'; file://header( 'WWW-Authenticate: Basic realm="Private"' ); file://header( 'HTTP/1.0 401 Unauthorized' ); exit; } ?>
Thanks and regards
-Balaji
|
----------------------------------------------------------------------------------------------------------------------- Information transmitted by this E-MAIL is proprietary to Wipro Limited and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at mailto:[EMAIL PROTECTED] and delete this mail from your records. ------------------------------------------------------------------------------------------------------------------------
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]