Discussion Board Code
  Home arrow Discussion Board Code arrow Internal Mail System
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DISCUSSION BOARD CODE

Internal Mail System
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 7
    2003-06-04

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    With this code you can easily add a internal mail system to your site the varibles are easy to change!

    By : cscartman

    mail.php:
    <?php
    include("dbconn.php");
    $result1=mysql_query("select * from users WHERE username='$username'") or die ("cant do it");
    $row100 = mysql_fetch_array($result1);
    ?>
    | <a href="mail.php?action=compose">Compose</a> | <a href="mail.php?action=inbox">Inbox</a> |
    <table cellpadding="1" cellspacing="1" height="300" width="450">
    <tr><td align=center valign=top>
    <?php
    if($action==compose) {
    echo "<form action=mail.php?action=compose2 method=post>";
    echo "<table>";
    echo "<tr><td>Subject:</td><td><input type=text name=subject size=20 value=$subject></td></tr>";
    echo "<tr><td>To:</td><td><input type=text name=to size=20 value=$to></td></tr>";
    echo "<tr><td>Message:</td><td><textarea rows=16 cols=45 name=message></text></td></tr>";
    echo "<tr><td><button type=submit>Send Mail!</button></td></tr>";
    echo "</table>";
    echo "</form>";
    }
    if($action==compose2) {
    $subject or die("Subject Blank");
    $message or die("Message Black");
    $to or die("To blank");
    $date = date(YmdHis);


    $create = "INSERT INTO mail (UserTo, UserFrom, Subject, Message, SentDate, status)
    VALUES ('$to','$username','$subject','$message','$date','unread')";
    $create2 = mysql_query($create) or die("A letter could not be sent to $to!");
    echo("Message Sent to $to!");

    }
    if($action==inbox) {
    $result=mysql_query("select * from mail where UserTo='$username' ORDER BY SentDate DESC") or die ("cant do it");
    echo "<table cellpadding=2 cellspacing=1 width=500 valign=top>";
    while ($row=mysql_fetch_array($result)) {
    echo "<tr><td width=30>Mail:</td><td><a href=mail.php?action=veiw&mail_id=$row[mail_id]>$row[Subject]</a></td><td width=50> <a href=mail.php?action=delete&id=$row[mail_id]><center>Delete</a><br></td></tr>";
    }
    echo "</table>";
    }
    if($action==veiw) {
    $result=mysql_query("select * from mail where UserTo='$username' and mail_id=$mail_id") or die ("cant do it");
    $row=mysql_fetch_array($result);
    if($row[UserTo]==$username) {
    } else {
    echo "<font face=verdana><b>This isn't your mail!";
    exit;
    }
    $query="UPDATE mail SET status='read' WHERE UserTo='$username' AND mail_id='$row[mail_id]'";
    $query or die("An error occurred resulting that this message has not been marked read.");
    echo "<table border = 1 bordercolor = black width = 50% align=center><tr><td>$row[Subject]</td><td>$row[UserFrom]</td></tr><tr><td colspan='2'>$row[Message]<br><a href=mail.php?action=compose&to=$row[UserFrom]&subject=RE:$row[Subject]>Reply</a></td></tr></table>";
    $rs = mysql_query("UPDATE mail SET status='read' WHERE mail_id='$mail_id'");
    }
    if($action==delete) {
    $query = mysql_query("DELETE FROM mail WHERE mail_id='$id' LIMIT 1");
    if($query) {
    echo "<font face=verdana>Message Deleted.</font>";
    } else {
    echo "The message wasnt deleted.";
    }
    }
    ?>

    dbconn.php:
    <?php

    $vusername = "username"; //your username for you local system
    $pwd ="password"; //password to accecss mySQL
    $host = "localhost"; //host is localhost - even for most web hosts
    $dbname = "database"; //db name to be accessed



    //connect to db
    //$conn=mysql_connect($host, $username, $pwd) or die ("Unable to connect to database");

    if (!($conn=mysql_connect($host, $vusername, $pwd))) {
    printf("We couldn't connect to the database right now!");
    exit;
    }
    $db=mysql_select_db($dbname,$conn) or die("Unable to connect to database!");

    ?>



    tables:
    CREATE TABLE mail (
    UserTo tinytext NOT NULL,
    UserFrom tinytext NOT NULL,
    Subject mediumtext NOT NULL,
    Message longtext NOT NULL,
    status text NOT NULL,
    SentDate text NOT NULL,
    mail_id int(80) NOT NULL auto_increment,
    PRIMARY KEY (mail_id)
    ) TYPE=MyISAM;

    Its easy to embed into your already made member site!

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Discussion Board Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Build Web services with transport-level security using Rational Application Developer V7, Part 1: Build Web services and Web services clients

    Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services.
    FREE! Go There Now!


    NEW! Did you say mainframe? e-kit

    Learn how you can extend modern application lifecycle management to IBM System z through the IBM Rational Software Delivery Platform (SDP). The Did you say mainframe? e-kit includes podcasts, webcasts, tutorials, white and red papers, demos, and articles designed to help ease the challenges of modernizing your enterprise. This complimentary kit for mainframe developers is a practical, how-to guide for making the most of an existing development environment, including the skills and infrastructure already in place at an established enterprise.
    FREE! Go There Now!


    NEW! Download DB2 9.5 for Linux, Unix, and Windows

    Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML.
    FREE! Go There Now!


    NEW! Download DB2 Express-C 9.5

    Visit IBM developerWorks to download IBM DB2 Express-C 9.5, a no-charge version of DB2 Express 9 database server. DB2 Express-C offers the same core data server base features as other DB2 Express editions and provides a solid base to build and deploy applications developed using C/C++, Java, .NET, PHP, and other programming languages.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z: Architecture

    Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server.
    FREE! Go There Now!


    NEW! Improve your build process with IBM Rational Build Forge, Part 1: Create a continuous build and integration environment

    Learn how to implement a build management system that uses and extends your existing automation technologies. This tutorial shows, step-by-step, how to install and configure IBM Rational Build Forge to manage builds for Jakarta Tomcat from source code.
    FREE! Go There Now!


    NEW! Project and Portfolio Management Executive Resource Kit

    Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle.
    FREE! Go There Now!


    NEW! The dirty dozen: preventing common application-level hack attacks

    As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications.
    FREE! Go There Now!


    NEW! Try IBM Rational Asset Manager V7.0 online!

    You can now evaluate IBM Rational Asset Manager V7.0 online without installing or configuring it on your own system! Rational Asset Manager helps create, modify, govern, find, and reuse any type of development assets, including SOA and systems development assets. Rational Asset Manager helps you reduce software development costs and improve quality by facilitating the reuse of all types of software development-related assets. Visit developerWorks to learn more about this product and register to explore its capabilities online.
    FREE! Go There Now!


    NEW! Whitepaper: Achieving consistency between business process models and operational guides

    Explore how Rational and WebSphere software enable enterprise documentation in SOA environments. Specifically, a new integration between IBM WebSphere® Business Modeler and IBM Rational® Method Composer software can help technical writers more easily keep enterprise operations manuals in sync with changes that are made to business processes, resulting in more accurate and timely documentation that benefits the entire enterprise.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    DISCUSSION BOARD CODE ARTICLES

    - phpBB Google Sitemap XML generator v2.1
    - myPHPWiKi
    - Simple Shoutbox 1.3
    - Chipmunk Board
    - TagIt! Tagboard v2.1.B Build 2 - UPDATED 11....
    - Internal Mail System
    - phpAdBoard
    - Super Simple Discussion 4 sysadmins
    - Powerbox Version 0.2
    - SXMB
    - J.A.G. (Just Another Guestbook)
    - PowerBox
    - TagIt! Tagboard
    - Tom's Corkboard
    - MiniChat





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT