Home arrow PHP arrow Page 4 - Login and Logout Authentication for a Project Management Application

The Script - PHP

In this article we continue to look at the login and logout scripts of the project management application. We ended the previous article by looking at the PHP code of the login script. In this article we will be looking at the HTML login form and the logout script.

TABLE OF CONTENTS:
  1. Login and Logout Authentication for a Project Management Application
  2. The HTML Form
  3. The Logout Form
  4. The Script
By: David Web
Rating: starstarstarstarstar / 9
August 04, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

This is how your entire logout script should look:

<?

ob_start();

include "dbcon.php";

//update the users table

if(isset($_SESSION['name'])){

$uname =$_SESSION['name'];

$save = "UPDATE users SET lastlogin ='".$td."'";

mysql_query($save);

//destroy session

session_start();

session_unset();

session_destroy();

}else{

//user is not suppose to be on this page

//redirect to login page

header("location:login.php");


}

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/userauth.dwt.php" codeOutsideHTMLIsLocked="false" -->

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<!-- InstanceBeginEditable name="doctitle" -->

<title>Project Management::Logout</title>

<!-- InstanceEndEditable -->

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->

<link href="Templates/loginstyle.css" rel="stylesheet" type="text/css" />

</head>


<body>

<table width="100%" border="0">

<tr>

<td bgcolor="#6699CC" class="headertxt">Project Management:: User Authentication </td>

</tr>

<tr>

<td><!-- InstanceBeginEditable name="main" -->

<table width="100%" border="0">

<tr>

<td width="33%">&nbsp;</td>

<td width="30%">&nbsp;</td>

<td width="37%">&nbsp;</td>

</tr>

<tr>

<td colspan="3"><div align="center" class="loginheader"><strong><?php echo $uname.",";?></strong> you are now logged out. </div></td>

</tr>

<tr>

<td colspan="3"><div align="center" class="loginheader">Click <a href="login.php">here</a> to login </div></td>

</tr>

</table>

<!-- InstanceEndEditable --></td>

</tr>

<tr>

<td align="right" class="cright">copyright &copy; 2007 PM</td>

</tr>

</table>

</body>

<!-- InstanceEnd --></html>


Conclusion

Thatís it for this section of user authentication. In the next section we will discuss password and user management.



 
 
>>> More PHP Articles          >>> More By David Web
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: