Jump to content

psoug.org Mini-mail / Private Messaging system help


Ciilense

Recommended Posts

I am trying to include this small mail script into a site I am building and am having trouble... I have it to where it will send the messages, and they are inserted into the table correctly, but I can not get it so the messages show up in the in box for each member.

 

http://patch.ciilent-scape.com/mem_panel.php

If you need to see any coding or get a temp log in for the member panel let me know. I really want to get this all figured out.

 

Thank You

 

 

Code for Mail.php

<?php include("mytcg/settings.php");
include("$header");

$result1=MYSQL_QUERY("select * from `members`") 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></textarea></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','$name','$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='$name' and mail_id=$mail_id") or DIE ("cant do it"); 
$row=MYSQL_FETCH_ARRAY($result); 
IF($row[userTo]==$name) { 
} ELSE { 
ECHO "<font face=verdana><b>This isn't your mail!"; 
EXIT; 
} 
$query="UPDATE mail SET status='read' WHERE UserTo='$name' 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."; 
} 
} 
include($footer); ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.