Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > PHP > PHP Forum > ช่วยดู code ให้หน่อยค่ะ 1.ไฟล์ attach_mail.php (อันนี้ไม่มีปัญหาค่ะ) No such file or directory in /data/ddd/pub/mail_module.php on line 96 ต้องแก้ยังไงให้หายไปค่ะ ขอบคุณอีกครั้งนะค่ะ



 

ช่วยดู code ให้หน่อยค่ะ 1.ไฟล์ attach_mail.php (อันนี้ไม่มีปัญหาค่ะ) No such file or directory in /data/ddd/pub/mail_module.php on line 96 ต้องแก้ยังไงให้หายไปค่ะ ขอบคุณอีกครั้งนะค่ะ

 



Topic : 007846

Guest




1.ไฟล์ attach_mail.php (อันนี้ไม่มีปัญหาค่ะ)

<? include 'head.php' ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<script>
function createCaret(textEl) {
if (textEl.createTextRange)
textEl.caretPos = document.selection.createRange().duplicate();
}

function insertCode(openTag, tagData, closeTag) {
if (document.all.real_email_message.createTextRange && document.all.real_email_message.caretPos) {
var caretPos = document.all.real_email_message.caretPos;
caretPos.text = openTag+caretPos.text+closeTag;
} else {
document.all.real_email_message.value += openTag+tagData+closeTag;
document.all.real_email_message.focus();
}
}

function putButton(toolTip, textdis, openTag, tagData, closeTag) {
document.write("<input class=fb type=button value=\"" +textdis+ "\" onClick=\"javascript:insertCode(\'"+openTag+"\', \'"+tagData+"\', \'"+closeTag+"\');\" onmouseover=\"document.all.tooltip.innerHTML='"+toolTip+"';\" onmouseover=\"document.all.tooltip.innerHTML='';\" onfocus=\"document.all.real_email_message.focus();\">");
}

function preview(){
prewin=window.open('about:Please wait','prewin','width=500,height=440,top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
prewin.document.write("<title>Preview window</title><body bgcolor=#CAE4FF><br>");
prewin.document.write("<table border=0 width=100% cellspacing=0 cellpadding=8 bgcolor=gray style=\"border: 1 dotted gray;\"><tr><td bgcolor=#FFFFFF width=100%><font face=Verdana size=1>");
prewin.document.write(document.all.real_email_message.value);
prewin.document.write("</td></tr></table>");
}
//putButton("Bold", "B", "<b>", "", "</b>");

function pop(url,w,h,scroll){
if(scroll==1) bars='yes';
else bars='no';
popwindow= open(url, "popwin","width=" + w + "px,height==" + h + "px,top=0,left=0;fullscreen=no,scrollbars==" + bars + ",location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes");
}
</script>
<?
include "config.php";
?>
<title>Email to <?=$my_email;?></title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style8 {font-family: Tahoma, "Microsoft Sans Serif", Arial; font-weight: bold; font-size: 13px; }
.style12 {
font-size: 13px;
font-weight: bold;
}
.style13 {
font-family: Tahoma, "Microsoft Sans Serif", Arial;
font-size: 13px;
}
body,td,th {
font-family: Tahoma, Microsoft Sans Serif, Arial;
font-size: 13px;
}
-->
</style>
<div align=center>
<p class=title><strong>Send Mail for Application</strong></p>
<form action="mail_module.php" method="post" ENCTYPE="multipart/form-data">
<p><table border=0 width=80% cellspacing=0 cellpadding=8 bgcolor=gray>
<!--DWLayoutTable-->
<tr><td width=316 height="35" valign="top" bgcolor="#F0F0F0"><div align="right"><span class="style8">YOUR EMAIL</span></div></td>
<td width=634 valign="top" bgcolor="#F0F0F0"><input class=fi type=text size=40 name=email_from value=<? if($mail_mode==0) echo " ";?>>
<br><i>Please type your real email address</i></td>
</tr>
<tr><td height="35" valign="top" bgcolor="#F0F0F0"><div align="right"><span class="style8">TO EMAIL</span></div></td>
<td valign="top" bgcolor="#F0F0F0"><input class=fi type=text size=40 name=email_to_anonymous value=<? if($mail_mode==1) echo "$my_email";?>></td>
</tr>
<tr><td height="35" valign="top" bgcolor="#F0F0F0"><div align="right" class="style8">SUBJECT</div></td>
<td valign="top" bgcolor="#F0F0F0"><input class=fi type=text size=40 name=email_subject value="<? if($mail_mode==1) echo "Send File Picture and Transcript";?>"></td>
</tr>
<td bgcolor="#F0F0F0"></td><td bgcolor="#F0F0F0"></tr></table>
<table border=0 width=80% cellspacing=1 cellpadding=8 bgcolor="#AED0F2">
<tr><td bgcolor="#F0F0F0">
<p><span class="style12">MESSAGE</span><br>
<br>
<script>putButton("Bold", " B ", "<b>", "", "</b>");</script>
<script>putButton("Italic", " I ", "<i>", "", "</i>");</script>
<script>putButton("Underline", " U ", "<u>", "", "</u>");</script>
<script>putButton("Font color to RED", " Red ", "<font color=red>", "", "</font>");</script>
<script>putButton("Font color to GREEN", " Green ", "<font color=green>", "", "</font>");</script>
<script>putButton("Font color to BLUE", " Blue ", "<font color=blue>", "", "</font>");</script>
<script>putButton("Heading 2", " H2 ", "<h2>", "", "</h2>");</script>
<script>putButton("Heading 4", " H4 ", "<h4>", "", "</h4>");</script>
<br><div class="style13" id=tooltip>Layer for tooltips</div><br>
<textarea class=fi name=real_email_message cols=86 rows=14 onclick=createCaret(this); onselect=createCaret(this);>
<? if($mail_mode==1) echo "<Text English only>

Name :
Tel :

";?>
</textarea></p>
<?
print("
<p><b>ATTACHMENT FILE</b> <input class=fi type=\"file\" size=40 name=\"upfile\"><br>
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$max_size\">
<br><u>NOTE</u> We DO NOT accept these files' type: ");
print(str_replace("|",",",$banned_ext));
print(". And the attachment file size must lower than <b>$max_size</b> KB");
?>
<p><input class=fb type="submit" value=">> Send email"> <input class=fb type=reset>
<font size=1 color=gray>[MODE :
<?
if($mail_mode==0) echo "Anonymous HTML form mail with attachment file";
else if($mail_mode==1) echo "HTML form mail with attachment file";
?>
]</font>
</td>
</tr></table>
</form>
<? include 'footer.php'; ?>

2.ไฟล์ mail_module.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;
}
-->
</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;
}

function checkemail($email){
if(!eregi("^[A-za-z0-9\_\.-]+@[A-za-z0-9\_\.-]+.[A-za-z0-9\_-]+.*",$email) || empty($email))
return FALSE;
else return TRUE;
}
//----------------------------------------------

if($mail_mode==0) $email_to=$email_to_anonymous;
else $email_to=$my_email;

if($version=="1.0") {
$email_from=" ";
$real_email_message.=" ";
}

$kt=0;
//Checking valid email address
if(!checkemail($email_to)) $kt=1;
if(!checkemail($email_from)) $kt=1;
if(empty($email_subject)) $kt=2;

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>");

if($kt==0){

//BEGIN //----------------------------------------------
$email_message=formathtml($real_email_message);
$chked=0;
if ($upfile == "none" || $upfile_size==0) $chked=1;
if (checkfileatt($upfile_name,$upfile_size)!="No file attached") $chked=1;
if($chked==0) {
copy($upfile, $upfile_name);
$fileatt=$upfile_name;
$fileatt_type=$upfile_type;
$fileatt_name=$upfile_name;
$file = fopen($fileatt,'pic');
$data = fread($file,filesize($fileatt));
fclose($file);
}
$headers = "From: ".$email_from;

$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
$email_message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n";

$data = chunk_split(base64_encode($data));

$email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" ."--{$mime_boundary}--\n";
$sending_ok = @mail($email_to, $email_subject, $email_message, $headers);

if($chked==0) unlink($upfile_name);

//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>

3.ไฟล์ config.php (อันนี้ไว้ติดต่อ)

<?
$mail_mode = 1;

//------------------Max file size: Maximum size of attchment file, in (KB)

$max_size = 50;

//------------------My email: Your own email address

$my_email="[email protected]";

//------------------My URL: Your own website address

$my_url="http://www.ddd.com";

$banned_ext="php| phtml| cgi| pl| asp| jsp| c| cfm| shtml| exe| bat| com|";

//------------------Script version

$version="Version 1.0";
?>

จะสอบถามค่ะว่าทำไมเวลา attachment ไปแล้วพอเปิดดูในเมล์มันเปิดไม่ได้ค่ะ คือตอนจาก code กำหนด ขนาดไม่เกิน 50 KB โดยไฟล์ที่ attach เข้าไปเป็นไฟล์รูป .jpg ซึ่งมีขนาด 28 KB แต่พอไปเปิดในเมล์ attachment ที่ส่งมากลับมีขนาดแค่ 99 B ซึ่งเปิดไม่ได้ค่ะไม่ทราบว่าทำไมถึงเป็นอย่างนี้ใครทราบช่วยอธิบายหน่อยนะค่ะขอบคุณค่ะ

อ่อลืมไปตอนส่งที่หน้าจะมันขึ้นว่า
Warning: copy(Blue hills.jpg): failed to open stream: Permission denied in /data/ddd/pub/mail_module.php on line 75

Warning: fopen(Blue hills.jpg): failed to open stream: Permission denied in /data/ddd/pub/mail_module.php on line 79

Warning: filesize(): Stat failed for Blue hills.jpg (errno=2 - No such file or directory) in /data/ddd/pub/mail_module.php on line 80

Warning: fread(): supplied argument is not a valid stream resource in /data/ddd/pub/mail_module.php on line 80

Warning: fclose(): supplied argument is not a valid stream resource in /data/ddd/pub/mail_module.php on line 81

Warning: unlink(Blue hills.jpg): No such file or directory in /data/ddd/pub/mail_module.php on line 96
ต้องแก้ยังไงให้หายไปค่ะ ขอบคุณอีกครั้งนะค่ะ


Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 7 เม.ย. 2549 14:22:22 By : vava View : 2221 Reply : 0
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดู code ให้หน่อยค่ะ 1.ไฟล์ attach_mail.php (อันนี้ไม่มีปัญหาค่ะ) No such file or directory in /data/ddd/pub/mail_module.php on line 96 ต้องแก้ยังไงให้หายไปค่ะ ขอบคุณอีกครั้งนะค่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่