View file wap_snapshot/wap_privmsg.php

File size: 2.82Kb
<?php
session_start();
include('wap_common.php');

if(!isset($_SESSION['un']) || $_SESSION['un'] = ""){
    wapheader();
    start_card("id","Error");
    print("<p>You must be logged in to check PMs</p>");
    print("<p>Hit the back button on your browser or login <a href=\"wap_login.php\">HERE</a></p>");
    end_card();
    print("</wml>");
}else{

$op = $HTTP_GET_VARS['op'];
$user = $_SESSION['id'];

switch($op){
    case "inbox":
    wapheader();
    start_card("id","Inbox");
    $sql="SELECT * FROM " . $TABLE_PREFIX ."privmsgs WHERE privmsgs_to_userid = " . $user . " AND privmsgs_type = 1";
    $result=$db->sql_query($sql);
                if(!$result) {
                    $error.="p0";
                    $ERR = $db->sql_error();
                 }
    while($row=$db->sql_fetchrow($result)){
        print("<p>NEW: <a href=\"wap_privmsg.php?op=view&msg=" . $row['privmsgs_id'] . "\">" . $row['privmsgs_subject']. "</a> FROM: </p>");
    }
    
    $sql="SELECT * FROM " . $TABLE_PREFIX ."privmsgs WHERE privmsgs_to_userid = " . $user . " AND privmsgs_type = 5";
    $result=$db->sql_query($sql);
                if(!$result) {
                    $error.="p1";
                    $ERR = $db->sql_error();
                 }
    while($row=$db->sql_fetchrow($result)){
        print("<p>UNREAD: <a href=\"wap_privmsg.php?op=view&msg=" . $row['privmsgs_id'] . "\">" . $row['privmsgs_subject'] . "</a> FROM: </p>");
    }
    $sql="SELECT * FROM " . $TABLE_PREFIX ."privmsgs WHERE privmsgs_to_userid = " . $user . " AND privmsgs_type = 0";
    $result=$db->sql_query($sql);
                if(!$result) {
                    $error.="p2";
                    $ERR = $db->sql_error();
                 }
    while($row=$db->sql_fetchrow($result)){
        print("<p>OLD: <a href=\"wap_privmsg.php?op=view&msg=" . $row['privmsgs_id'] . "\">" . $row['privmsgs_subject'] . "</a> FROM: </p>");
    }
    $sql="UPDATE " . $TABLE_PREFIX . "privmsgs SET privmsgs_type = 5 WHERE privmsgs_to_userid = " . $user . " AND privmsgs_type = 1";
    if(!$db->sql_query($sql)){
                    $error.="px";
                    $ERR = $db->sql_error();
                 }
    break;
    case "sent":
    break;
    case "outbox":
    break;
    case "post":
    break;
    case "":
    default:
        wapheader();
        start_card("id","PM Menu");
        print("<p><a href=\"wap_privmsg.php?op=inbox\">Inbox</a></p>");
        print("<p><a href=\"wap_privmsg.php?op=sent\">Sent Items</a></p>");
        print("<p><a href=\"wap_privmsg.php?op=outbox\">Outbox</a></p>");
        print("<p><a href=\"wap_privmsg.php?op=post\">Send New PM</a></p>");
        
    break;
}

if($DEBUG) print( $error . "  " . $ERR['message'] . "   " . $ERR['code'] );
end_card();
print("</wml>");


}
    





?>