Location: PHPKode > scripts > txtSQL MailBox > txtsql-mailbox/index.php
<?
 /*************************************************************************/
 # txtSQL MailBox 0.1 by Nexami Engeo (http://www.n-e-x.co.uk)     #
 # txtSQL MailBox is based on phpMailBox 1.1     #
 # Lasy Modified : 5th April, 2005  22:50 GMT     #
 # txtSQL MailBox 0.1 is Copyright (C) by John Urquhart Ferguson     #
 # All previous licensing applies     #
 #
 # More information on the txtSQL project can be found at: http://txtsql.sourceforge.net)
 #
 #  phpMailbox 1.1   by Sivaprasad R.L (http://netlogger.net/phpmailbox)  #
 #                                                                        #
 #          --  A php pop3 client --              			  #
 #                                                                        #
 # This program is distributed in the hope that it will be useful,        #
 # but WITHOUT ANY WARRANTY; without even the implied warranty of         #
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          #
 # GNU General Public License for more details.                           #
 #                                                                        #
 # You should have received a copy of the GNU General Public License      #
 # along with this program; if not, write to the Free Software            #
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.              #
 #                                                                        #
 #             phpMailBox 1.1 is Copyright (C) by Sivaprasad R.L                            #
 #                                                                        #
/*************************************************************************/

 include "emailconfig.php";
 
 if(isset($username)) {
 
	//Old MySQL
    /*mysql_connect($db_host, $db_username, $db_passwd);
	@mysql_select_db("$db_name") or die ("Unable to select database");

	$query = "Select * from $db_authtable where $db_usernamefield = '$username' and 
		  $db_passwordfield = '$password'";
	$res = mysql_query($query);
	if(@mysql_num_rows($res) < 1) {
		echo "<center><b><font size=2 color=\"#cc0000\">Sorry, Invalid username/password!</font></b></center>";
	} else {
	    $row = mysql_fetch_array($res);
 	    $uid = $row[$db_userid];
	    //session_register(uid);
	    //header("Location: mailbox.php");
   	    //exit();
        }*/
		
	//New txtSQL
	//n.b. Connect and Select DB are in emailconfig.php
	$res = $sql->query('SELECT * FROM '.$sqlDB.'.'.$db_authtable.'
             WHERE '.$db_usernamefield.' = "'.$username.'" AND '.$db_passwordfield.' = "'.md5($password).'"');
	if( sizeof($res) < 1 ) {
		echo "<center><b><font size=2 color=\"#cc0000\">Sorry, Invalid username/password!</font></b></center>";
	} else {
		$row = $res[0];
		$uid = $row[$db_userid];
		session_start();
		$_SESSION['uid'] = $uid;
	        header("Location: mailbox.php");
   	        exit();
	}
 }
?>

<html>

<body>
<title>MailBox</title>
<link rel="stylesheet" TYPE="text/css" HREF="style.css">

<?
      echo "<br><br><br>
	        <table align=center  width=70%>
			  <tr>
			    <td class=\"bgrowcolor1\">
                  <table align=center width=100%>
				    <tr>
					  <td class=\"bgrowcolor2\">
                        <B class=\"font1\"> M &nbsp; a &nbsp;  i &nbsp; l &nbsp;  &nbsp; B &nbsp;  o &nbsp;  x</b>
                      </td>
					</tr>
					<tr>
					  <td valign=center class=\"bgrowcolor1\"><br><br>";
?>

<form name=loginform action=index.php method=post>
<table valign=center align=center border=0>
<tr>
	<td><b class="font1">Username </td>
	<td><input type=text name=username value=""></td>
</tr>
<tr>
	<td><b class="font1">Password  </td>
	<td><input type=password name=password value=""></td>
</tr>
<tr>
	<td colspan=2 align=center><br><input type=submit name=login value="Login"></td>
</tr>
</form>
</table>
<?

 global $imgpath;
 echo "         </td>
              </tr>
	          <tr>
			    <td align=\"right\"><br><a href=\"http://netlogger.net\"><img src=\"$imgpath/nlpowered.gif\" alt=\"Mailbox powered by Netlogger.net\" border=0 align=right></a>";

  echo "        </td>
              </tr>
	        </table>
          </td>
        </tr>
       </table>";
	   
  echo "<center><table cellspacing=\"0\" cellpadding=\"3\"><tr><td>
        <a href=\"http://txtsql.sourceforge.net\" target=\"_blank\"><img src=\"$imgpath/txtsql.gif\" border=\"0\" /></a></td></tr></table></center>";

?>

</body>
</html>
Return current item: txtSQL MailBox