HOME > PHP > PHP Forum > ช่วยดู code ให้หน่อยค่ะ มันขึ้นว่า Warning: fread(): supplied argument is not a valid stream resource in /data/sanyo/pub/mail_module.php
ช่วยดู code ให้หน่อยค่ะ มันขึ้นว่า Warning: fread(): supplied argument is not a valid stream resource in /data/sanyo/pub/mail_module.php
<? include 'head.php'; ?>
<? include "config.php"; ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
body,td,th {
font-family: Tahoma, Microsoft Sans Serif, Arial;
font-size: 13px;
}
a {
font-family: Tahoma, Microsoft Sans Serif, Arial;
font-size: 13px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style><p align=center class=title><strong>Send Mail for Application</strong></p>
<?
//----------------------------------------------
function checkfileatt($fname,$fsize){
global $max_size;
global $banned_ext;
$err="No file attached";
//Checking file type in or out of banned file extensions list
$pos1=strrchr($fname,".");
$ftype=str_replace(".","",$pos1);
$blist=explode("|",$banned_ext);
for($i=0;$i<sizeof($blist)-1;$i++){
if($ftype==$blist[$i]) $err="ERROR: Your file extension (<b>*.$ftype</b>) is not be accepted.";
}
//Check file size
if(round($fsize/1024)>$max_size) $err="ERROR: Your file size (<b>" .round($fsize/1024) ."</b> KB) is too large. We only accept <b>$max_size</b> KB.";
//Return the value
return $err;
}
function formathtml($text){
$text=stripslashes($text);
$text=str_replace("\r\n","<BR>",$text);
$text=str_replace("\n","<BR>",$text);
return $text;
}
if($kt==1) print("<p>ERROR: Email address (From email or To email) is not correct</p>");
else if($kt==2) print("<p>ERROR: Your email Subject is blank</p>");
//END mode 3 and 0//----------------------------------------------
//Print the email result
if($sending_ok){
print("<title>Sending successful to $email_to</title><div align=center><p><b>Email sending successful<b></p>");
}
else print("<title>Sending failed to $email_to</title><div align=center><p><b>ERROR in mail server</b> Your email could not been sent</p>");
print("
<p><table border=0 width=80% cellspacing=1 bgcolor=#AED0F2><tr><td bgcolor=#F0F0F0>
<p><u><b>Sent to email</b></u><br>
$email_to
<p><u><b>From email</b></u><br>
$email_from
<p><u><b>Email subject</b></u><br>
$email_subject
<p><u><b>Message</b></u><p>
<table border=0 width=100% cellspacing=1 style=\"border: 1 dotted #AED0F2;\"><tr><td>");
print(formathtml($real_email_message));
print("</td></tr></table><p><br></p>
<p align=center><a href=$my_url title=\"Come back to my site\">Thank you, back to my site</a> or <a href=application.php title=\"Application For Employment site\">Send me another email</a></p>
<p><br></p>
</td></tr></table>
<p><b>Attachment status</b>
<p><table border=0 width=80% cellspacing=1 bgcolor=#AED0F2><tr><td bgcolor=#CAE4FF>");
if($mail_mode==0 || $mail_mode==1) {
if($chked==0) print("<p><b>$upfile_name</b><br>Filesize : " .round($upfile_size/1024) ." KB | Filetype : $upfile_type");
else print("<p>" .checkfileatt($upfile_name,$upfile_size) ."</p>");
}
}
?>
</td></tr></table>
<p><br></p>
<? include 'footer.php'; ?>