"Fossies" - the Fresh Open Source Software Archive

Member "node-runner-0.6.0/html/addedit-mail.php" (21 Sep 2004, 6428 Bytes) of package /linux/www/old/node-runner-0.6.0.tar.gz:


The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "addedit-mail.php" see the Fossies "Dox" file reference documentation.

    1 <?
    2 require_once("connect.php");
    3 if ($_SESSION["isloggedin"] != $glbl_hash) {
    4     header("Location: ".$nr_url."login.php?referrer=addedit-mail.php");
    5     exit;
    6 } else if (($_SESSION["isloggedin"] == $glbl_hash) && ($_SESSION["isadmin"] != $glbl_hash)) {
    7     header("Location: ".$nr_url);
    8     exit;
    9 }
   10 
   11 unset($err_msg,$magic_quotes_gpc);
   12 
   13 $magic_quotes_gpc = ini_get('magic_quotes_gpc');
   14 
   15 // Sanitize incoming GET variables
   16 unset($get_id);
   17 if (($_SESSION["isadmin"] == $glbl_hash) && ($_GET["id"])) {
   18     $get_id = strip_tags(rtrim(ltrim($_GET["id"])));
   19     if (($_GET["del"] == 1) && $get_id) {
   20       $del_group = "DELETE FROM mail_group WHERE id='".$get_id."'";
   21       $result_group = db_query($del_group);
   22       if ($result_group == 1) {
   23         $err_msg .= '<b><br>Group deleted successfully.</b><br>&nbsp;';
   24       }
   25     } else if (($_GET["edit"] == 1) && $get_id) {
   26       $select_group = "SELECT * FROM mail_group WHERE id='".$get_id."'";
   27       $result_group = db_query($select_group);
   28       list($edit_group_id,$edit_group_name,$edit_group_addresses) = db_fetch_array($result_group);
   29     }
   30 }
   31 
   32 
   33 
   34 if (($_SESSION["isadmin"] == $glbl_hash) && ($_POST["add_groupname"]) && ($_POST["add_addresses"])) {
   35   $add_groupname = strip_tags(rtrim(ltrim($_POST["add_groupname"])));
   36   $add_addresses = strip_tags(rtrim(ltrim($_POST["add_addresses"])));
   37   $add_group_id = strip_tags(rtrim(ltrim($_POST["group_id"])));
   38   if (!$magic_quotes_gpc) { // Check for magic quotes, if it's Off, addslashes
   39     $add_groupname = addslashes($add_groupname);
   40   }
   41   if ($add_group_id) {
   42     // UPDATE existing mail group in database
   43     $update_mail_group = "UPDATE mail_group SET name='".$add_groupname."',email='".$add_addresses."' WHERE id='".$add_group_id."'";
   44     $result_mail_group = db_query($update_mail_group);
   45     if ($result_mail_group == 1) {
   46       $err_msg .= '<b><br>Group updated successfully.</b><br>&nbsp;';
   47       $edit_group_id = $add_group_id;
   48     }
   49   } else {
   50     // INSERT new mail group into database
   51     $insert_mail_group = "INSERT INTO mail_group VALUES ('','".$add_groupname."','".$add_addresses."')";
   52     $result_mail_group = db_query($insert_mail_group);
   53     if ($result_mail_group == 1) {
   54       $err_msg .= '<b><br>Group added successfully.</b><br>&nbsp;';
   55       $select_recent_id = "SELECT id FROM mail_group ORDER BY id DESC LIMIT 1";
   56       $result_recent_id = db_query($select_recent_id);
   57       list($edit_group_id) = db_fetch_array($result_recent_id);
   58     }
   59   }
   60   $edit_group_name = $add_groupname;
   61   $edit_group_addresses = $add_addresses;
   62   unset($add_groupname,$add_addresses,$add_group_id);
   63 
   64   // stripslashes for re-display
   65   $edit_group_name = stripslashes($edit_group_name);
   66   
   67 }
   68 
   69 
   70 
   71 $title = "Configure Mail Groups";
   72 require_once("header.php");
   73 
   74 if ($err_msg) {
   75   echo '<center><div style="width:400px;" class="errmsg">'.$err_msg.'</div></center><br><br>';
   76 }
   77 
   78 
   79 echo '<table class="addedit-mail" align="center" width="400" border="0" cellspacing="0" cellpadding="3">
   80       <form name="mailgroups" action="'.$_SERVER["PHP_SELF"].'" method="POST">
   81          <tr valign="top">
   82            <td colspan="2" align="left">';
   83            if ($edit_group_id) {
   84              echo '<span style="border-bottom:1px solid #A00000;font-weight:bold;">EDIT MAIL GROUP:</span><font size="1">';
   85            } else {
   86              echo '<span style="border-bottom:1px solid #A00000;font-weight:bold;">ADD A NEW MAIL GROUP:</span><font size="1">';
   87            }
   88            
   89 echo '
   90            <br><br></font></td>
   91          </tr>
   92          <tr>
   93            <td align="right"><b>Group Name:</b>&nbsp;</td>
   94            <td align="left"><input type="text" name="add_groupname" size="25" value="'.$edit_group_name.'"></td>
   95          </tr>
   96          <tr>
   97            <td align="right"><b>Email Addresses:</b>&nbsp;</td>
   98            <td align="left"><input type="text" name="add_addresses" size="25" value="'.$edit_group_addresses.'"></td>
   99          </tr>
  100          <tr>
  101            <td colspan="2" align="center">
  102              <b><font color="#A00000">NOTE: Use commas to separate with no spaces.</font></b>&nbsp;[<a href="help.php?topic=mail_group_syntax" style="text-decoration:none" onClick="return(openHelp(\'help.php?topic=mail_group_syntax\',300,130))">?</a>]
  103              <input type="hidden" name="group_id" value="'.$edit_group_id.'">
  104              <font size="1"><br><br></font>';
  105              
  106              if ($edit_group_id) {
  107                 echo '<input type="button" value="EDIT MAIL GROUP" onClick="javascript:verify();">';
  108              } else {
  109                 echo '<input type="button" value="ADD MAIL GROUP" onClick="javascript:verify();">';
  110              }
  111              
  112 echo '
  113              <font size="1"><br>&nbsp;</font>
  114            </td>
  115          </tr>
  116        </form>
  117        </table>
  118        <br><br>
  119        <table class="addedit-mail" align="center" width="400" border="0" cellspacing="0" cellpadding="5">
  120          <tr>
  121            <td align="left"><span style="border-bottom:1px solid #A00000;font-weight:bold;">MODIFY EXISTING GROUPS:</span><br></td>
  122          </tr>';
  123 
  124   $i = 0;
  125   $query_mail_groups = "SELECT * FROM mail_group ORDER BY name ASC";
  126   $result_mail_groups = db_query($query_mail_groups);
  127   while ($r = db_fetch_array($result_mail_groups)) {
  128          $edit_mail_id = $r["id"];
  129          $edit_mail_name = $r["name"];
  130          $edit_mail_addresses = $r["email"];
  131          $edit_mail_addresses = explode(",", $edit_mail_addresses);
  132 
  133   echo '
  134          <tr>
  135            <td align="left">';
  136            
  137          if ($i>0) {
  138             echo '<div style="border-top:1px solid #AD8802;">';
  139          } else {
  140             echo '<div>';
  141          }
  142          
  143          
  144   echo '
  145              <script language="Javascript">
  146              function deleteMailGroup'.$x.'(url) {
  147                if (confirm("Are you sure you want to delete this mail group?")) {
  148                  location.href = url;
  149                }
  150              }
  151              </script>
  152              
  153              <br>'.$edit_mail_name.'&nbsp;&nbsp;&nbsp;
  154              <span style="font-size:11px;font-weight:bold;">(&nbsp;<a style="font-size:11px;text-decoration:none;color:#AD8802;" href="'.$_SERVER["PHP_SELF"].'?edit=1&id='.$edit_mail_id.'">EDIT</a>&nbsp;|&nbsp;
  155              <a style="font-size:11px;text-decoration:none;color:#AD8802;" href="javascript:deleteMailGroup'.$x.'(\''.$_SERVER["PHP_SELF"].'?del=1&id='.$edit_mail_id.'\');">DEL</a>&nbsp;)</span><br>
  156              <ul>';
  157                for ($x=0; $x<sizeof($edit_mail_addresses); $x++) {
  158                  echo '<li>'.$edit_mail_addresses[$x].'</li>';
  159                }
  160   echo '
  161              </ul>
  162              </div>
  163 
  164            </td>
  165          </tr>';
  166          
  167     $i++;
  168          
  169   }
  170   
  171   echo '</table>';
  172 
  173 
  174 require_once("footer.php");
  175 
  176 ?>