Example #1
0
function reply()
{
    global $PHP_SELF;
    global $uid;
    global $id;
    $sth = mysql_query("select * from mail where id='{$id}'");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    $mail = mysql_fetch_array($sth);
    if ($mail["uid"] != $uid) {
        show_error("I'm not stupid guy! :)");
        return 0;
    }
    if (!(substr($mail["subject"], 0, 4) == "RE: ")) {
        $subject = "RE: " . $mail["subject"];
    } else {
        $subject = $mail["subject"];
    }
    $sth = mysql_query("select name from users where id='" . $mail["fuid"] . "'");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    $user = mysql_fetch_array($sth);
    echo "<form action=\"" . $PHP_SELF . "\" method=post>\n";
    table_border_start("Send new message");
    table_form_text("Send to", "name", $user["name"]);
    table_form_text("Subject", "subject", $subject);
    table_form_textarea("Message", "text", $mail["text"]);
    table_form_submit("Send message", "send");
    echo "</form>";
    table_end();
}
function foreignreply()
{
    global $id;
    global $uid;
    global $PHP_SELF;
    if (has_alliance_lock($uid)) {
        show_message("You can't use any alliance options due to an alliance lock!");
        return false;
    }
    $sth = mysql_query("select *,a.name as aname, u.name as uname from foreignforum as f,alliance as a,users as u where (f.id={$id} or f.fid={$id}) order by f.time desc");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    if (mysql_num_rows($sth) == 0) {
        show_error("Sending all processes the TERM signal");
        return 0;
    }
    $posting = mysql_fetch_array($sth);
    echo "<form action=\"" . $PHP_SELF . "\" method=post>";
    table_start("center", "500");
    table_text_open("head");
    table_text_design("<strong>" . $posting["aname"] . "</strong> (" . $posting["uname"] . "", "100", "", "", "head");
    table_text_design($posting["time"], "400", "right", "", "smallhead");
    table_text_close();
    table_text_open("head", "left");
    table_text_design("&nbsp;", "100", "", "", "smallhead");
    table_text_design("" . $posting["text"] . "", "400", "", "", "text");
    table_text_close();
    table_end();
    echo "<br>\n";
    table_border_start("center", "500", "#302859", "#140f55", "#f1edfc");
    table_head_text(array("Reply"), "2");
    table_form_textarea("Content", "content");
    form_hidden("id", $id);
    table_form_submit("Post", "proc_foreignreply");
    table_end();
    echo "</form>";
}