Re: Re: prob with session start
| From: | Balaji Ankem | Date: | Tue, 14 Aug 2001 06:32:04 +0000 |
| Subject: | Re: Re: prob with session start | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62588@lists.php.net to get a copy of this message | ||
Hi! Renze,
good afternoon.
oh i forgot attachments are not allowed to this group...so i am pasting here...
login.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<HEAD>
<TITLE>IMAC</TITLE>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
</HEAD>
<SCRIPT language="Javascript">
function check(){
if (document.login.emp_id.value=='')
{
alert('Please enter your employee number');
document.issue.emp_id.focus();
return false;
}
else if(document.login.emp_pass.value=='')
{
alert("Please enter the password");
document.issue.emp_pass.focus();
return false;
}
else
{
document.login.method = "POST";
document.login.action="http://10.145.2.23/authentication.php";
document.login.submit();
return true;
}
}
</script>
</head>
<body text="arial" background="imacbg1.gif"
ONLOAD="document.login.emp_id.focus()">
<font face="arial" >
<center> <h1> WELCOME TO IMAC TOOL </h1></center>
<center>
<img SRC="logo.gif" height=100 width=100></img>
<pre>
<form name="login" >
<b>Employee No:</b> <input type="text" size="10"
name="emp_id" maxlength="10" value=""><br>
<b>Password :</b> <input type="password" size="10"
name="emp_pass" maxlength="10" value=""><br>
<input type="button" Value="LOGIN"
OnClick="check();">
</form>
</pre>
</center>
</font>
</body></html>
authentication.php
<?php
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
// 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');
error_log ("emp_id: $emp_id", 0);
error_log ("Lastname: $emp_pass", 0);
$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;
}
?>
logout.php
<?php
session_start();
session_unregister($emp_id);
session_destroy();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Thankyou </TITLE>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
</HEAD>
<BODY background="nightsky.gif" text="white">
<p>
<center><h1>THANKYOU FOR USING IMAC TOOL</h1></center><br><br>
<center> <h3>Do you want to login again?</h3><a
href="login.html">clickhere</a> </center>
</p>
</BODY>
</HTML>
Thanks in advance
Regards
-Balaji
Original Message -----
From: Renze Munnik
To: Balaji Ankem
Sent: Monday, August 13, 2001 5:46 PM
Subject: Re: [PHP] Re: prob with session start
On Mon, Aug 13, 2001 at 05:45:27PM +0530, Balaji Ankem wrote:
> Hi,these are the pages...
>
>
> see u tomorrow..
>
> thankyou..
>
> -Balaji
Ehmmmm... I get the impression you forgot to attach something. You
announce the files, but they didn't follow... :)
--
* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: renze@datalink.nl
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
-- H: +31 23 5516190
--
-- Stationsplein 82
-- 2011 LM HAARLEM
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««
----------------------------------------------------------------------------------------------------------------------- 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:mailadmin@wipro.com and delete this mail from your records. ------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------- 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:mailadmin@wipro.com and delete this mail from your records. ------------------------------------------------------------------------------------------------------------------------