관리-도구
편집 파일: destinationAdd.php
<?php include("../connect.php"); if ($_POST['Submit']) { $dotpos = strpos($_POST['txtpagename'],".",0); $filename = substr($_POST['txtpagename'],0,$dotpos); $destname = addslashes($_POST['txtdestinationname']); if ($_POST['fileyesno'] == 'YES') { $dotposX = strpos($_FILES["file"]["name"],".",0); $filenameX = substr($_FILES["file"]["name"],0,$dotposX); $extension = substr($_FILES["file"]["name"],$dotposX,strlen($_FILES["file"]["name"])-$dotposX); move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $filename . $extension); $sql = "insert into destination_email values ('','" . $_POST['txtpagename'] . "','" . $destname . "','" . addslashes($_POST['txtsubject']) . "','" . addslashes($_POST['editor1']) . "','" . $_POST['txtemailaddress'] . "','" . $filename . $extension . "','" . $_POST['addtarget'] . "')"; mysql_query($sql); } else { $sql = "insert into destination_email values ('','" . $_POST['txtpagename'] . "','" . $destname . "','" . addslashes($_POST['txtsubject']) . "','" . addslashes($_POST['editor1']) . "','" . $_POST['txtemailaddress'] . "','','" . $_POST['addtarget'] . "')"; echo $sql; mysql_query($sql); } $to = 'lisa@mungias.com'; $subject = 'Auto-Reply Enabled for ' . $_GET['addtarget'] . ' - ' . $destname; $from = 'no-reply@finestweddingsites.com'; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'Cc: anshulbhaigupta@yahoo.co.in' . "\r\n"; $headers .= "From: $from"; $message = 'Auto-Reply Email has been Enabled for ' . $_GET['addtarget'] . ' - ' . $destname; //$mail_sent = @mail($to,$subject,$message,$headers); //header("location:destinationDone.php?action=Add&addtarget=" . $_POST['addtarget']); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>New Destination</title> <style type="text/css"> <!-- .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } .style3 {font-size: 24px; font-family: Georgia, "Times New Roman", Times, serif;} body { background-image: url(../images/back.jpg); margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; }--> </style> <script language="javascript"> function validateForm() { if (document.getElementById('txtpagename').value == '') { alert("Please enter the name of the HTML or PHP page."); document.getElementById('txtpagename').focus(); return false; } if (document.getElementById('txtdestinationname').value == '') { alert("Please enter Destination Name."); document.getElementById('txtdestinationname').focus(); return false; } if (document.getElementById('file').value == '') document.getElementById('fileyesno').value = 'NO'; else document.getElementById('fileyesno').value = 'YES'; if (document.getElementById('txtsubject').value == '') { alert("Please enter the Subject of Email."); document.getElementById('txtsubject').focus(); return false; } if (document.getElementById('txtemailaddress').value == '') { alert("Email Address can not be left blank."); document.getElementById('txtemailaddress').focus(); return false; } if (echeck(document.getElementById('txtemailaddress').value)==false) { document.getElementById('txtemailaddress').focus() return false; } } function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1) { alert("Invalid E-mail ID") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { alert("Invalid E-mail ID") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) { alert("Invalid E-mail ID") return false } // if (str.indexOf(at,(lat+1))!=-1) // { // alert("Invalid E-mail ID") // return false // } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) { alert("Invalid E-mail ID") return false } if (str.indexOf(dot,(lat+2))==-1) { alert("Invalid E-mail ID") return false } // if (str.indexOf(" ")!=-1) // { // alert("Invalid E-mail ID") // return false // } return true } </script> <script type="text/javascript" src="ckeditor/ckeditor.js"></script> <script src="ckeditor/_samples/sample.js" type="text/javascript"></script> <link href="ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .style4 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; } .style5 { font-family: Georgia, "Times New Roman", Times, serif; font-size: 14px; font-weight: bold; } --> </style> </head> <body> <form action="destinationAdd.php" method="post" enctype="multipart/form-data" name="frmnewDestination" id="frmnewDestination" onsubmit="return validateForm()"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff"> <tr> <td><table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td height="50" colspan="2" align="center" valign="middle"><table width="95%" border="0" cellspacing="5" cellpadding="5"> <tr> <td align="left"><span class="style5">Fill out this form and save to enable the email auto-reply option.</span></td> </tr> </table></td> </tr> <tr> <td width="23%" align="right" valign="top"><span class="style1">HTML/PHP Page Name : </span></td> <td width="77%" align="left" valign="top" bgcolor="#FFFFFF"><input name="txtpagename" type="text" id="txtpagename" size="40" /> <input name="addtarget" type="hidden" id="addtarget" value="<?php echo $_GET['addtarget']; ?>" /> <span class="style4">(Ex: az_destination_agave.php)</span></td> </tr> <tr> <td align="right" valign="top" class="style1"><?php echo $_GET['addtarget']; ?> Name : </td> <td align="left" valign="top" bgcolor="#FFFFFF"><input name="txtdestinationname" type="text" id="txtdestinationname" size="40" /> <span class="style4">(Ex: Agave Of Sedona)</span></td> </tr> <tr> <td align="right" valign="top" class="style1">Upload PDF File : </td> <td align="left" valign="top" bgcolor="#FFFFFF"><input name="file" id="file" type="file" size="40" /><input name="fileyesno" id="fileyesno" type="hidden" size="2" value="" /></td> </tr> <tr> <td align="right" valign="top" class="style1" nowrap="nowrap">From Email Address : </td> <td align="left" valign="top" bgcolor="#FFFFFF"><input name="txtemailaddress" type="text" id="txtemailaddress" size="25" /></td> </tr> <tr> <td align="right" valign="top" class="style1">Email Subject : </td> <td align="left" valign="top" bgcolor="#FFFFFF"><input name="txtsubject" type="text" id="txtsubject" size="40" /></td> </tr> <tr> <td colspan="2" align="left" valign="top" class="style1">Email body content : </td> </tr> <tr> <td colspan="2" align="left" valign="top" bgcolor="#FFFFFF"><textarea cols="60" id="editor1" name="editor1" rows="6"></textarea></td> </tr> <script type="text/javascript"> CKEDITOR.replace( 'editor1', { fullPage : true }); </script> <tr> <td height="41" colspan="2" align="center" valign="middle" bgcolor="#F0F0F0"><input type="submit" name="Submit" id="Submit" value=" Save Auto-Email " /></td> </tr> </table></td> </tr> </table> </form> </body> </html>