Home arrow PHP arrow Page 3 - A Login System for a PHP Email Application

The code: logging out and registration - PHP

We know from the previous article that the user ID is very important, in that it is used to retrieve various information from the database at various stages of the application. The login form sets this userID when you log in. It is the login system that will be the focus of this second part in a four-part series.

TABLE OF CONTENTS:
  1. A Login System for a PHP Email Application
  2. The code: form verification
  3. The code: logging out and registration
  4. The code: form handling and user profile
By: Leidago
Rating: starstarstarstarstar / 27
November 01, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Logout page. This page basically logs you out of the system and destroys any sessions that were created when you logged in. The application then returns the user to the login page.

Logout.php

<?
ob_start();
session_start();
session_unset();
session_destroy();
header("location:login.php");
?>

register.php. This code registers a new user. The fields provided in the form match those declared in the users table. See the previous article.

form

<table width="100%" border="0" cellspacing="7">
  <tr bgcolor="#FFFFFF">
    <td valign="top">&nbsp;<img src="images/registration.png"
width="661" height="130" /></td>
  </tr>
  <tr>
    <td width="89%" valign="top" colspan="2"><form
action="register.php" method="post" >
              <table width="100%" border="0" cellspacing="1"
class="block">
        <tr class="table">
          <td colspan="2">&nbsp;</td>
          </tr>
        <tr>
          <td colspan="2">*<strong>ALL</strong> fields are
required. </td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;</td>
        </tr>
        <tr class="td">
          <td colspan="2"><strong>User Info: </strong></td>
        </tr>
        <tr>
          <? if($err){?>
                        <td width="87%" valign="bottom"
colspan="2"><? 
                        echo "The following errors where
detected:<br>";
                        echo "<font color = "#ff000
">$errmsg</font><br>"; ?>  </td>
      <? }?>
                 </tr>
        <tr>
          <td width="29%">Login name </td>
          <td width="71%"><input name="uname" type="text"
id="uname" size="60" /></td>
        </tr>
        <tr>
          <td>Login Password </td>
          <td><input name="upass" type="text" id="upass"
size="60" /></td>
        </tr>
                        <tr>
          <td>Email Address </td>
          <td><input name="email" type="text" id="email"
size="60" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr class="td">
          <td colspan="2"><strong>Logon Info: </strong></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>RemoteUsername </td>
          <td><input name="remuser" type="text" id="remuser"
size="60" /></td>
        </tr>
        <tr>
          <td>Remote Password </td>
          <td><input name="rempass" type="text" id="rempass"
size="60" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr class="td">
          <td colspan="2"><strong>Server Info: </strong> </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>Incoming Mail Server: </td>
          <td><input name="pop3" type="text" id="pop3"
size="60" /></td>
        </tr>
        <tr>
          <td>Outgoing Mail Server: </td>
          <td><input name="smtp" type="text" id="smtp"
size="60" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="submit" value="Register
me now!" /></td>
        </tr>
      </table>
              </form>    </td>
  </tr>
  <tr>
    <td colspan="2"><div align="center">Copyright 2005 </div></td>
  </tr>
</table>



 
 
>>> More PHP Articles          >>> More By Leidago
 

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: