Location: PHPKode > projects > Akasha > attachments.php
<?

if ($akashaID == $ID) {

	include ("includes/global.inc"); 	// Global Variables
	include ("includes/functions.inc"); 	// Global Functions
	include ("includes/head.inc"); 		// Standard Headers
	include ("stylesheets/homestyle.inc"); 	// Stylesheets

	$to=rawurlencode($to);
	$cc=rawurlencode($cc);
	$bcc=rawurlencode($bcc);
	$subject=rawurlencode($subject);

	if ($attached ==1) {
		$dosyaadi = "$attach_dir$ID######msgbody.txt";
		$msgbody = fread(fopen($dosyaadi, "r"), filesize($dosyaadi)); 		
		@fclose($fp);
		unlink("$dosyaadi");
	} else {
		$msgbody=stripslashes($msgbody);
		$msgbody=rawurlencode($msgbody);
	}
?>

  <script language="JavaScript">
  <!--
  function submitonce(theform){
  	if (document.all||document.getElementById){
  		for (i=0;i<theform.length;i++){
  			var tempobj=theform.elements[i]
  			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
  				tempobj.disabled=true
  		}
  	}
  }
  //-->
  </script>
<?

  echo "</head>\n";
  echo "<body bgcolor='#FFFFFF' text='#000000' link='#3457A9' vlink='#3457A9' alink='#009966'>\n";
  echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' height='200'>\n";
  echo "  <tr>\n";
  echo "    <td valign='top'>&nbsp;<p>\n";
  echo "				<table width='100%' border='0' cellspacing='0' cellpadding='1' align='center'>\n";
  echo "          <tr bgcolor='#999999'>\n";
  echo "          <td>\n";
  echo "            <table width='100%' border='0' cellspacing='0' cellpadding='0' height='200'>\n";
  echo "              <tr bgcolor='#DCD7CB'>\n";
  echo "                <td height='25' width='4%'>&nbsp;</td>\n";
  echo "                <td height='25' width='92%'>\n";
  echo "                  <form enctype='multipart/form-data' action='upload.php?ID=$ID&to=$to&cc=$cc&bcc=$bcc&subject=$subject' method='post' onSubmit='submitonce(this)'>\n";
  echo "										<input type='hidden' name='msgbody' value='$msgbody'>\n";
  echo "                    <input name='userfile' type='file' size='30'>\n";
  echo "	                  <input type='submit' value='Add to List' name='submit'>\n";
  echo "                  </form>\n";
  echo "                </td>\n";
  echo "                <td height='25' width='4%'>&nbsp;</td>\n";
  echo "              </tr>\n";
  echo "              <tr bgcolor='#DCD7CB'>\n";
  echo "                <td width='4%'>&nbsp;</td>\n";
  echo "                <td width='92%' valign='top'>\n";
  echo "                  <hr size='1'>\n";
  echo "                  <form method='post' action='attachment_delete.php?ID=$ID&to=$to&cc=$cc&bcc=$bcc&subject=$subject' onSubmit='submitonce(this)'>\n";
  echo "                    <select name='slcsil' size='5'>\n";
  echo "                      <option value='0'>-- Waiting Attachments --</option>\n";

  $handle=opendir($attach_dir);
  while ($file = readdir($handle)) {
		$attach_id = substr($file,1,46);

			$idvar = strstr($file,$ID);
			if ($idvar) {
				$attachedfile = strstr($file,"######");
				$attach_name = substr($attachedfile,6);
				$size = filesize("$attach_dir$file");
				$size = ceil($size / 1024);
			  echo "									<option value='$file'>$attach_name ($size K)</option>\n";
			}
  }
  closedir($handle); 
 
  echo "                    </select>\n";
  echo "										<input type='hidden' name='msgbody' value='$msgbody'>\n";
  echo "                    <input type='submit' name='attachmentdelete' value='Delete Attachment'>\n";
  echo "                  </form>\n";
  echo "                  <form method='post' action='new_message.php?ID=$ID&to=$to&cc=$cc&bcc=$bcc&subject=$subject&attached=1' onSubmit='submitonce(this)'>\n";
  echo "										<input type='hidden' name='msgbody' value='$msgbody'>\n";
  echo "                    <input type='submit' name='geridon' value='<- Return'>\n";
  echo "                  </form>\n";
  echo "                </td>\n";
  echo "                <td width='4%'>&nbsp;</td>\n";
  echo "              </tr>\n";
  echo "            </table>\n";
  echo "            </td>\n";
  echo "          </tr>\n";
  echo "        </table>\n";
  echo "      &nbsp;<br></td></div>\n";
  echo "  </tr>\n";
  echo "</table>\n";
  echo "</body>\n";
  echo "</html>\n";


} else {
		Header("Location: main.php?error_code=1");
}

?>
Return current item: Akasha