root/dev/common/post_igb.php @ 2

Revision 2, 2.7 KB (checked in by andrewgunn, 14 years ago)

Created "dev", "mods", and "stable" folders. "Dev" folder currently contains the base EVE-Killboard.net source code. The folder "original" should continue to hold the original code, and never be edited.

Line 
1<?
2  require_once( "class.page.php" );
3  require_once( "class.killboard.php" );
4  require_once( "class.parser.php" );
5  require_once( "class.phpmailer.php" );
6  require_once( "class.kill.php" );
7
8  $kb = new Killboard( KB_SITE );
9
10  $html = "<html><head><title>".KB_TITLE." Killboard - Post Mail"."</title></head></html><body>";
11
12  $config = $kb->getConfig();
13
14  if ( isset( $_POST['killmail'] ) ) {
15
16    if ( $_POST['password'] == $config->getPostPassword() ) {
17      $parser = new Parser( $_POST['killmail'] );
18
19      $killid = $parser->parse( true );
20
21      if ( $killid == 0 || $killid == -1 || $killid == -2 ) {
22        if ( $killid == 0 )
23          $html = "Killmail is malformed.";
24        if ( $killid == -1 )
25          $html = "That killmail has already been posted.";
26        if ( $killid == -2 )
27          $html = "You are not authorized to post this killmail.";
28           
29        $html .= "<br><br><a href=\"?a=post_igb\">Try again</a>";
30      }
31      else {
32        if ( $config->getPostMailTo() != "" ) {
33          $mailer = new PHPMailer();
34          $kill = new Kill( $killid );
35
36          $mailer->From = "mailer@eve-killboard.net";
37          $mailer->FromName = "eve-killboard.net";
38          $mailer->Subject = "Killmail #".$killid;
39          $mailer->Host = "localhost";
40          $mailer->Port = 25;
41          $mailer->Helo = "localhost";
42          $mailer->Mailer = "smtp";
43          $mailer->AddReplyTo( "no_reply@eve-killboard.net", "No-Reply" );
44          $mailer->Sender = "mailer@eve-killboard.net";
45          $mailer->Body = $kill->getRawMail();
46          $mailer->AddAddress( $config->getPostMailto() );
47          $mailer->Send();
48        }
49
50        $qry = new DBQuery();
51        $qry->execute( "insert into kb3_log
52                               values( ".$killid.", '".KB_SITE."',
53                                       '".$_SERVER['REMOTE_ADDR']."',
54                                       now() )" );
55
56        $html .= "Killmail posted successfully.<br><br>";
57        $html .= "<a href=\"?a=post_igb\">Post another killmail</a>";
58      }
59    }
60    else {
61      $html .= "Invalid password.";
62      $html .= "<br><br><a href=\"?a=post_igb\">Try again</a>";
63    }
64  }
65  else {
66    $html .= "Paste the killmail from your EVEMail inbox into the box below. Make sure you post the <b>ENTIRE</b> mail.<br>Posting fake or otherwise edited mails is not allowed. All posts are logged.";
67    $html .= "<br><br>Remember to post your losses as well.<br><br>";
68    $html .= "<b>Killmail:</b><br>";
69    $html .= "<form name=postform method=\"post\" action=\"?a=post_igb\">";
70    $html .= "<textarea name=killmail id=killmail cols=\"70\" rows=\"24\"></textarea>";
71    $html .= "<br><br><b>Password:</b><br><input name=\"password\" type=\"password\">";
72    $html .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id=submit name=\"submit\" type=\"submit\" value=\"Process !\">";
73    $html .= "</form>";
74
75  }
76
77  $html .= "</body></html>";
78
79  echo $html;
80?>
Note: See TracBrowser for help on using the browser.