Version: 1.02
Type: Class
Category: Networking
License: GNU General Public License
Description: Create a web based POP3 (and IMAP) email system. If you want to provide something like Hotmail to your users, access your own POP mail via the web or offer a generic pop service to users then this class is for you. Please note that the code is still a little buggy in decoding the return header string, but make of it what you want.
<center>Here is the class file, it is very rough, take from it what ever you can, i havent
had much time to do anything with it as I've just got a new job! :-) So, <a href="class.txt">here</a> it is.</center><br>
<?
if (!$a && !$host && !$user && !$pass) {
printf("<center><br><font color=\"white\">[ <a href=\"%s?a=login\">Log into an account</a> | <a href=\"%s?a=kill\">Log out</a> ]<br></font></center>",$PHP_SELF,$PHP_SELF);
}
if ($a=="kill") {
$host="";
$pass="";
$user="";
setcookie("host","");
setcookie("user","");
setcookie("pass","");
printf("<br><center>You have been logged out of your account, thanks for visiting<br>");
printf("<font color=\"white\">[ <a href=\"%s?a=login\">Log into an account</a> | <a href=\"%s?a=kill\">Log out</a> ]<br></font></center>",$PHP_SELF,$PHP_SELF);
exit;
}
if ($a=="login") {
?><html><body bgcolor="#FFFFFF" text="#000000">
<form action="<? echo($PHP_SELF); ?>" method="post">
<table width="600" border="0" cellspacing="0" cellpadding="3" align="center" bgcolor="#669999">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="9" bgcolor="#333333">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><b>Logging
onto your account</b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Please
note that we retain no details of the information you pass to us. Our
log entries do not contain the username / passwords you enter and our
system does not record your details. This system is NOT secure, please
understand that this is a testing system only.</font></div>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b>Type</b></font></div>
</td>
<td>
<select name="type">
<option value="1" selected>POP3 Email</option>
<option value="2">News Server</option>
</select>
</td>
</tr>
<tr>
<td>
<div align="center"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Host:
</font></b></div>
</td>
<td> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<input type="text" name="host">
</font></b></td>
</tr>
<tr>
<td>
<div align="center"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Username:
</font></b></div>
</td>
<td> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<input type="text" name="user">
</font></b></td>
</tr>
<tr>
<td>
<div align="center"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Password:
</font></b></div>
</td>
<td> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<input type="password" name="pass">
</font></b></td>
</tr>
<tr>
<td> </td>
<td>
<div align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<input type="submit" name="submit" value="Login">
</font></b></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?
printf("<center><br><font color=\"white\">[ <a href=\"%s?a=login\">Log into an account</a> | <a href=\"%s?a=kill\">Log out</a> ]<br></font></center>",$PHP_SELF,$PHP_SELF);
exit;
}
if ($host && $user && $pass){
setcookie("host",$host);
setcookie("user",$user);
setcookie("pass",$pass);
printf("<center><br><font color=\"white\">[ <a href=\"%s?a=login\">Log into an account</a> | <a href=\"%s?a=kill\">Log out</a> | <a href=\"%s\"?a=checkInbox>Check Inbox</a> ]<br></font></center>",$PHP_SELF,$PHP_SELF,$PHP_SELF);
require("mailclass.phtml");
$pop = new PhpPop3($host,$user,$pass);
$pop->SetTotalMails();
?>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!-- *********************************************************************************** -->
<table width="600" border="0" cellspacing="0" cellpadding="1" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td>
<table width="600" border="0" cellspacing="0" cellpadding="3" bgcolor="#669999">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="9" bgcolor="#333333">
<tr>
<td><font color="#FFFFFF"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">POP
Mail Reader, v1.0;</font></b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div align="right"><font size="3" color="#CCCCCC"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Mail
box for
<? echo($pop->POPusername); ?>
on
<? echo($pop->POPserver); ?>
</font></font><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><br>
You currently have
<? echo($pop->totMail()); ?>
mail messages</font></div>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<table width="97%" border="0" cellspacing="1" cellpadding="3" align="center">
<tr bgcolor="#003366">
<td><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Date</font></b></td>
<td><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Author</font></b></td>
<td><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Title</font></b></td>
<td><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Flags</font></b></td>
</tr>
<?
$pop->ListMails();
?>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<?
if (@$a=="mail") {
printf("<font face=\"verdana\" size=\"2\" color=\"white\">");
$pop->printHeader($msgid);
$pop->ListSpecificMail($msgid);
printf("</font>");
// $pop->retHeader($msgid);
}
$pop->Destructor();
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?
}
?>