[ PHPXref.com ] [ Generated: Sun Jul 20 19:57:11 2008 ] [ PHP-Update 2.7 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/admin/ -> mailing.php (source)

   1  <?
   2  extract($HTTP_POST_VARS); 
   3  extract($HTTP_GET_VARS); 
   4  extract($HTTP_COOKIE_VARS); 
   5  $adminsect = 1;
   6  include  "protection.php";
   7  if(file_exists("languages/$language.php")) include "languages/$language.php";
   8  else {
   9  echo "<b>Critical error</b><br>Language file <i>$language</i> could not be found.<p>";
  10  exit;
  11  }
  12  
  13  if(!isset($txt_add)) $txt_add = "Add";
  14  if(!isset($txt_addressestoadd)) $txt_addressestoadd = "E-mail addresses (separated by comma and space)";
  15  if(!isset($txt_subject)) $txt_subject= "Subject";
  16  if(!isset($txt_addsadded)) $txt_addsadded = "Addresses have been added.";
  17  
  18  $pagetitle = "$sitetitle $split $title_mailing";
  19  $thispagetitle = "$title_mailing";
  20  if(file_exists("../code/templates/$template}_h.php") && file_exists("../code/templates/$template}_f.php")) {
  21  $tempfilename = "../code/templates/$template}_h.php";
  22  $handle = fopen($tempfilename, "r");
  23  $temp = fread($handle, filesize ($tempfilename));
  24  fclose($handle);
  25  include  "../code/menucode.php";
  26  include  "../code/parsetemplate.php";
  27  parsetemplate($temp, $menucode, $thispagetitle, $pagetitle);
  28  
  29  if($rights[5] == "1") {
  30  
  31  $query = mysql_query("SELECT * FROM $table_prefix}mailing WHERE confirm='1' ORDER BY email ASC");
  32  
  33  $membersno = mysql_num_rows($query);
  34  $members = "<a href=mailing.php?a=m>$membersno ($txt_view)</a>";
  35  echo "<b>$title_mailing</b> $split <i>$txt_members: $members</i> $split <a href=\"mailing.php?a=n\">($txt_add)</a><br><img src=\"../gfx/blank.gif\" width=1 height=6><br>";
  36  
  37  if($a == "m") {
  38  
  39  if($o == "d") {
  40  if(!mysql_query("DELETE FROM $table_prefix}mailing WHERE email='$add'")) $err = 1;
  41  
  42  if($err == "1") echo "$txt_error}!<p>";
  43  else $query = mysql_query("SELECT * FROM $table_prefix}mailing WHERE confirm='1' ORDER BY email ASC");
  44  }
  45  
  46  
  47  for($i = 0; $i < mysql_num_rows($query); $i++) {
  48  $address = mysql_result($query, $i, "email");
  49  echo "$address (<a href=\"mailing.php?a=m&o=d&add=$address\">$txt_delete</a>)<br>";
  50  }
  51  
  52  }
  53  elseif($a == "n") {
  54  if(isset($input)) {
  55  $now = time();
  56  
  57  $addresstxt = explode(", ", $input);
  58  
  59  for($i = 0; $i < count($addresstxt); $i++) {
  60  $table_def = "'', '$addresstxt[$i]', '$now', '1'";
  61  if(!mysql_query("INSERT INTO $table_prefix}mailing VALUES($table_def)")) $err = 1;
  62  }
  63  
  64  if($err == 1) echo "<b>$txt_error</b><br><img src=\"../gfx/blank.gif\" width=1 height=6><br>$txt_noaccess<br><img src=\"../gfx/blank.gif\" width=1 height=6><br>$txt_home";
  65  else echo $txt_addsadded;
  66  
  67  }
  68  else {
  69  echo "<form method=\"post\" action=\"mailing.php?a=n\">
  70  $txt_addressestoadd:<br>
  71  <textarea rows=10 cols=40 name=\"input\"></textarea><br>
  72  <input type=submit value=\"$txt_add\">
  73  </form>";
  74  }
  75  }
  76  else {
  77  if(isset($mailmessage)) {
  78  if($mailsubject != "" && $mailmessage != "") {
  79  
  80  for($i = 0; $i < mysql_num_rows($query); $i++) {
  81  $address = mysql_result($query, $i, "email");
  82  $listaddresses .= "$address, ";
  83  }
  84  
  85  $mailsubject = stripslashes($mailsubject);
  86  $mailmessage = stripslashes($mailmessage);
  87  if(mail($siteemail, $mailsubject, $mailmessage, "From: $siteemail\r\nBcc: $listaddresses")) {
  88  echo "$txt_sent";
  89  }
  90  else {
  91  echo "<b>$txt_error</b><br>$txt_notsent";
  92  }
  93  }
  94  else {
  95  echo "<b>$txt_error</b><br>$txt_notfilled";
  96  }
  97  }
  98  else {
  99  echo "<table cellspacing=2><form method=post action=\"mailing.php\">
 100  <tr><td align=right class=med>$txt_subject:</td><td><input type=text name=mailsubject></td></tr>
 101  <tr><td class=med align=right valign=top>$txt_message:</td><td>
 102  <textarea name=mailmessage cols=50 rows=15></textarea></td></tr>
 103  <tr><td class=med>&nbsp;</td><td><input type=submit value=\"$txt_send\"></td></tr>
 104  </form></table>";
 105  }
 106  }
 107  }
 108  else echo "<b>$txt_error</b><br>$txt_norights<br><img src=\"../gfx/blank.gif\" width=1 height=6><br>$txt_home<p>";
 109  $tempfilename = "../code/templates/$template}_f.php";
 110  $handle = fopen($tempfilename, "r");
 111  $temp = fread($handle, filesize ($tempfilename));
 112  fclose($handle);
 113  parsetemplate($temp, $menucode, $thispagetitle, $pagetitle);
 114  }
 115  else echo "<b>$txt_error</b><br>$txt_tempnofound<p>";
 116  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]