Location: PHPKode > projects > lcdata > lcdata-0.0.1/frontend-web/frmmail.php3
<?
$frm_color='b0a0c0';
include 'includes/funktions.php';

$conn = connectdb();
getuserdaten();

require 'includes/labels.php';

$frm_color_row=$frm_color_high;


if (!empty($save)&&(!empty($ml_to))) {

    for ($i=0;$i<sizeof($ml_to);$i++) {
   
      $result=SQL_exec ($conn, "SELECT * FROM known_users WHERE ku_userid=$ml_to[$i]"); 

    if (pg_numrows($result)>0){
          $data = pg_fetch_object ($result,0);
            if ($data->ku_isgroup==0){
		
			$result=SQL_exec ($conn, "INSERT INTO mail (ml_from,ml_to,ml_subject,ml_text) VALUES ($usrd->us_userid,$ml_to[$i],'$ml_subject','$ml_text')");	 
					
				
 	    }else{
      $result=SQL_exec ($conn,"SELECT * FROM user2group, known_users WHERE ug_groupid=$ml_to[$i] AND ku_userid=ug_userid AND ku_isgroup=0");
      for($row=0;$row<pg_numrows( $result );$row++)
      {
        $data = pg_fetch_object ($result, $row);
        SQL_exec ($conn, "INSERT INTO mail (ml_from,ml_to,ml_subject,ml_text) VALUES ($usrd->us_userid,$data->ug_userid,'$ml_subject','$ml_text')");
     
      }
    }
  }
}
$ml_subject='';
}


print "<html>\n<head>";
?>
   <script language="JavaScript">
   <!--
    // Popup Window
    function popup(nr,page, width, height) {

        var tmp;

        if (oPopupWin) {

            // Make sure oPopupWin is empty before
            // calling .close() or we could throw an
            // exception and never set it to null.

            tmp = oPopupWin;
            oPopupWin = null;

            // Only works in IE...  Netscape crashes
            // if you have previously closed it by hand

            if (navigator.appName != "Netscape")
                tmp.close();
        }

        //Open the popup window
        if  (nr==0){
          oPopupWin = window.open(page, "IntlPopup"+nr, "alwaysRaised=1,dependent=1,height=" + height + ",location=0,menubar=0,personalbar=0,scrollbars=0,status=0,toolbar=0,width=" + width + ",resizable=0");
          oPopupWin.focus();
        }

        return !oPopupWin;
    }

    // Global to store handle to popup window.
    var oPopupWin;
   //-->
  </script>
<?
print "</head>\n<body bgcolor=\"#$frm_color\">\n";
print "<center><h3>$lb_lcdatamail</h3></center>\n";

print "<center>";
print "<form action=\"frmmail.php3\" Method=\"POST\">\n";

 print "<table border=0>\n";
 print "<tr valign=top><td>\n";

  print "<table border=0>\n";
  print "<tr>\n";
  print "<th height=$row_height bgcolor=\"#$frm_color_head\">$lb_mail_to</th>\n";
  print "<td bgcolor=\"#$frm_color_row\">";


  print "<select name=\"ml_to[]\" size=\"5\" multiple>\n";

  $sql= "SELECT * FROM known_users ORDER by ku_isgroup, ku_name";
  $result = SQL_exec ($conn,$sql);
  
  for($row=0;$row<pg_numrows( $result );$row++)
  {
    $data = pg_fetch_object ($result, $row);
    print " <option value=\"$data->ku_userid\"";
    if ($ml_to_var==$data->ku_userid){
      print "selected";
    }
    print ">$data->ku_name</option>";
  }
  
  print "</select>\n";
  print "</td>\n";
  
  print "<tr>";
  print "<th height=$row_height bgcolor=\"#$frm_color_head\">$lb_subject</th><td bgcolor=\"#$frm_color_row\"> <input type=\"text\" size=\"35\" name=\"ml_subject\" value=\"$ml_subject\"></td>\n";
  print "</tr>\n";
  print "<tr>\n";
  print "<th height=$row_height bgcolor=\"#$frm_color_head\">$lb_text</th><td bgcolor=\"#$frm_color_row\"><textarea name=\"ml_text\" value=\"$ml_text\" cols=\"35\" rows=\"8\"></textarea></td>\n";
  print "</tr>\n";
  print "<tr><td></td><td><input type=\"reset\" value=\"$lb_cancel\"><input type=\"submit\" name=\"save\" value=\"$lb_send\"></td></tr>";
  print "</table>\n";
 print "</td><td>\n";

  print "<table border=0>\n"; 


dohistory("frmmail.php3");
timerefresh('mail_page',"SELECT ml_lasttime as lasttime FROM mail WHERE ml_to=$usrd->us_userid ORDER by ml_lasttime DESC");

   $sql= "SELECT * FROM mail, known_users WHERE ml_from=ku_userid AND ml_to=$usrd->us_userid ORDER by ml_lasttime";
   $result = SQL_exec ($conn,$sql);
   $treffer=0;

   print "<th colspan=5 height=$row_height bgcolor=\"#$frm_color_head\" width=200>$lb_mail_for $usrd->ku_pname</th>";
  print "<tr>\n";
  print "<td bgcolor=\"#$frm_color_row\" width=50>&nbsp;</td>\n";
  print "<td bgcolor=\"#$frm_color_row\">$lb_status</td>\n";
  print "<td bgcolor=\"#$frm_color_row\" width=50>$lb_username</td>\n";
  print "<td bgcolor=\"#$frm_color_row\" width=200><center>$lb_subject</ce
nter></td>\n";
  print "<td bgcolor=\"#$frm_color_row\" width=100><center>$lb_recived</ce
nter></td>\n";
  print "</tr>\n"; 
  
 
  for($row=0;$row<pg_numrows( $result );$row++){
     $data = pg_fetch_object ($result, $row);
       if($treffer%2){
         $frm_color_row=$frm_color_row1;
       }
       else{
         $frm_color_row=$frm_color_row2;
       }
       $treffer++;
       
	print "<tr>\n";
       print "<td bgcolor=\"#$frm_color_row\" >";

if ($usrd->us_javascript=='y') {
       		print "<input type=button value=\"$lb_show\"  onClick=\"popup(0,'frmnewmail.php3?ml_gid=$data->ml_gid',500,400);\">\n";
	}
	else{
		print "<a href=\"frmnewmail.php3?ml_gid=$data->ml_gid\" target=\"_blank\"> $lb_show</a>\n";
	}
	if ($data->ml_flag == "o") {
	print "</td> <td bgcolor=\"#$frm_color_row\"><center>$lb_old</center></td>\n";}
	elseif ($data->ml_flag == "n") {
	print "</td> <td bgcolor=\"#$frm_color_row\"><center>$lb_new</center></td>\n";}
	else {print "</td><td bgcolor=\"#$frm_color_row\"><center>$lb_unkown</center></td>\n";}	

       print "<td bgcolor=\"#$frm_color_row\" width=50><center>$data->ku_name</center></td>\n";
       print "<td bgcolor=\"#$frm_color_row\" width=200><center>$data->ml_subject&#160;</center></td>\n";
       print "<td bgcolor=\"#$frm_color_row\" width=100><center>$data->ml_lasttime</center></td>\n";
       print "</tr>";
   }
 print "</table>"; 

 print "</td></tr>\n";
 print "</table>\n";
 
print "</form>\n";
print "</center>\n";
print "</body></html>";
?>

Return current item: lcdata