0
 829   42   2
  View Articles

Name  
   ¹Ú ¼±  (2007-12-04 23:59:05, Hit : 26422, Vote : 2397)
Subject  
   [re] PHP °Ô½ÃÆÇ ¸¸µé±â ÇÁ·ÎÁ§Æ®
Áú¹®À» ¿Ã¸° µÚ °è¼Ó È¥ÀÚ °í¹ÎÇÏ´Ù°¡, È£½ºÆÃ ȸ»ç¿¡ ¹®ÀÇÇØ º» °á°ú
ÇØ°áÇÒ ¼ö ÀÖ¾ú½À´Ï´Ù.

Áú¹® ±ÛÀ» Áö¿ï·Á´Ù°¡, Àúó·³ °í¹ÎÇϽô ºÐµéÀ» À§ÇØ ´äÀ» ¿Ã¸®±â·Î Çß½À´Ï´Ù. (ÀÌ¹Ì ´Ù ¾Æ½Ã´Â °É ¾µµ¥¾ø´Â ÁþÀ» ÇÏ´Â Áöµµ ¸ð¸£°Ú³×¿ë^^;)

ÀúÀÇ °æ¿ì µ¥ÀÌŸº£À̽º¿Í DB Å×À̺íÀ» ¸¸µé·Á¸é ´õ ºñ½Ñ ÆÐŰÁö¸¦ ±¸ÀÔÇØ¾ß ÇÑ´Ù°í ÇÏ´õ±º¿ä. ÇÏÁö¸¸ °£´ÜÇϰÔ, php¸¸ Áö¿øµÈ´Ù¸é Æû¸ÞÀÏphpÆäÀÌÁö¸¦ °èÁ¤¿¡ ¿Ã·Á ÀÚ½ÅÀÇ À̸ÞÀÏ·Î µé¾î¿À°Ô ÇÒ ¼ö ÀÖ´Ù´Â.. ÀÌ·± ³Ê¹«µµ °£´ÜÇÑ ¹æ¹ýÀÌ ÀÖ¾ú´ø °Ì´Ï´Ù ¤Ñ ¤Ñ;;

¸ÕÀú form ÀÛ¼ºÇÏ´Â °ÍÀº ´©±¸³ª ¾Æ½Ã°ÚÁÒ action µÚ¿¡ FormToEmail.php¶ó°í ÁöÁ¤ÇØÁֽðí¿ä, ¾Æ·¡ÀÇ ¼Ò½º¸¦ º¹»çÇØ¼­ phpÆÄÀÏÀ» ¸¸µå¼¼¿ä (¸Þ¸ðÀå¿¡ ºÙ¿©³Ö±â ÇÑ µÚ È®Àå¸íÀ» txt´ë½Å php·Î ÇÏ¸é µË´Ï´Ù)

<?php

/*

Thank you for choosing FormToEmail

Version 2.2 July 1st 2007

COPYRIGHT freezone.co.uk 2003 - 2007

You are not permitted to sell this script, but you can use it, copy it or distribute it, providing that you do not delete this copyright notice, and you do not remove any reference to FormToEmail.com

---------------------------------------------------------------------------------------------------

FormToEmail-Pro (Pro version) Features:

Check for required fields.
Attach file uploads.
Photo CAPTCHA system.
Check for a set cookie.
HTML output option.
CSV output to attachment or file.
Show sender's IP address.
Block IP addresses.
Block web addresses or rude words.
Block gobbledegook characters (???etc).
Auto redirect to "Thank You" page.
No branding.
Use on multiple sites.

---------------------------------------------------------------------------------------------------

FormToEmail DESCRIPTION

FormToEmail is a contact-form processing script written in PHP. It allows you to place a form on your website which your visitors can fill out and send to you.  The contents of the form are sent to the email address (or addresses) which you specify below.  The form allows your visitors to enter their name, email address and comments.  The script will not allow a blank form to be sent.

Your visitors (and nasty spambots!) cannot see your email address.  The script cannot be hijacked by spammers.

When the form is sent, your visitor will get a confirmation of this on the screen, and will be given a link to continue to your homepage, or other page if you specify it.

Should you need the facility, you can add additional fields to your form, which this script will also process without making any additional changes to the script.  You can also use it to process other forms.  The script will handle the "POST" or "GET" methods.  It will also handle multiple select inputs and multiple check box inputs.  If using these, you must name the field as an array using square brackets, like so: <select name="fruit[]" multiple>.  The same goes for check boxes if you are using more than one with the same name, like so: <input type="checkbox" name="fruit[]" value="apple">Apple<input type="checkbox" name="fruit[]" value="orange">Orange<input type="checkbox" name="fruit[]" value="banana">Banana

** PLEASE NOTE **  If you are using the script to process your own forms (or older FormToEmail forms) you must ensure that the email field is named correctly in your form, thus: <input type="text" name="email" etc>.  Note the lower case "email".  If you don't do this, you won't be able to see who the email is from and the script won't be able to check the validity of the email.  If you are using the form code below, you don't need to check for this.

This is a PHP script.  In order for it to run, you must have PHP (version 4.1.0 or later) on your webhosting account, and have the PHP mail() function enabled and working.  If you are not sure about this, please ask your webhost about it.

SETUP INSTRUCTIONS

Step 1: Put the form on your webpage
Step 2: Enter your email address and (optional) continue link below
Step 3: Upload the files to your webspace

Step 1:

To put the form on your webpage, copy the code below as it is, and paste it into your webpage:

<form action="FormToEmail.php" method="post">
<table border="0" bgcolor="#ececec" cellspacing="5">
<tr><td>Name</td><td><input type="text" size="30" name="name"></td></tr>
<tr><td>Email address</td><td><input type="text" size="30" name="email"></td></tr>
<tr><td valign="top">Comments</td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr>
<tr><td> </td><td><input type="submit" value="Send"><font face="arial" size="1">  <a href="http://FormToEmail.com">Form Processor</a> by FormToEmail.com</font></td></tr>
</table>
</form>

Step 2:

Enter your email address.

Enter the email address below to send the contents of the form to.  You can enter more than one email address separated by commas, like so: $my_email = "bob@example.com,sales@example.co.uk,jane@example.com";

*/

$my_email = "/";

/*

Enter the continue link to offer the user after the form is sent.  If you do not change this, your visitor will be given a continue link to your homepage.

If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm"

*/

$continue = "/";

/*

Step 3:

Save this file (FormToEmail.php) and upload it together with your webpage containing the form to your webspace.  IMPORTANT - The file name is case sensitive!  You must save it exactly as it is named above!  Do not put this script in your cgi-bin directory (folder) it may not work from there.

THAT'S IT, FINISHED!

You do not need to make any changes below this line.

*/

$errors = array();

// Remove $_COOKIE elements from $_REQUEST.

if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}

// Check all fields for an email header.

function recursive_array_check_header($element_value)
{

global $set;

if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i",$element_value)){$set = 1;}}
else
{

foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}

}

}

recursive_array_check_header($_REQUEST);

if($set){$errors[] = "You cannot send an email header";}

unset($set);

// Validate name field.

if(isset($_REQUEST['name']) && !empty($_REQUEST['name']))
{

if(preg_match("/[^a-z' -]/i",stripslashes($_REQUEST['name']))){$errors[] = "You have entered an invalid character in the name field";}

}

// Validate email field.

if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
{

if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}

$_REQUEST['email'] = trim($_REQUEST['email']);

if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0 || substr_count($exploded_email[1],".") > 3){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $key => $value){if($key == 0){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}elseif(strlen($value) > 6 || !preg_match('/^[a-z0-9]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}

}

// Remove leading whitespace from all values.

function recursive_array_check(&$element_value)
{

if(!is_array($element_value)){$element_value = ltrim($element_value);}
else
{

foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check($value);}

}

return $element_value;

}

recursive_array_check($_REQUEST);

// Check referrer is from same site.

if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}

// Check for a blank form.

function recursive_array_check_blank($element_value)
{

global $set;

if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
{

foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}

}

}

recursive_array_check_blank($_REQUEST);

if(!$set){$errors[] = "You cannot send a blank form";}

unset($set);

// Display any errors and exit if errors exist.

if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}

if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}

// Build message.

function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}

$message = build_message($_REQUEST);

$message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Thank you for using FormToEmail from http://www.freezone.co.uk";

$message = stripslashes($message);

$subject = "FormToEmail Comments";

$headers = "From: " . $_REQUEST['email'];

mail($my_email,$subject,$message,$headers);

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<title>Form To Email PHP script from Freezone.co.uk</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#ffffff" text="#000000">

<div>
<center>
<b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b>
<br>Your message has been sent
<p><a href="<?php print $continue; ?>">Click here to continue</a></p>
<p><b>FormToEmail</b> </p>
</center>
</div>

</body>
</html>



À̰ÍÀº °­Á¿¡¼­ ¹è¿ü´ø, insert.php ´ë½ÅÀÇ ¿ªÇÒÀÔ´Ï´Ù.

¿µ¾î·Î µÇ¾îÀ־ ÈûµéÁö ¸ð¸£Áö¸¸, Áß¿äÇÑ °Ç ÀÚ½ÅÀÇ À̸ÞÀÏÀ» ³Ö¾îÁֽðí,
ÀÛ¼ºÀÚ°¡ ³»¿ëÀ» Àû¾î³ÖÀº µÚ ¾î´À ÆäÀÌÁö·Î µ¹¾Æ°¡´Â Áö¸¦ ²À ³Ö¾îÁà¾ß ÇÕ´Ï´Ù.

Step 2¿¡¼­ ±×°ÍÀ» Çϵµ·Ï µÇ¾îÀֳ׿ä. / ½½·¡½¬ ´ë½Å¿¡ ÁÖ¼Ò¸¦ ³Ö¾îÁÝ´Ï´Ù.

°­Á¿¡¼­ ¹è¿î °Íó·³, ÆäÀÌÁö¸¦ °ÅÄ¡Áö ¾Ê°í 'ÀÛ¼ºµÇ¾ú½À´Ï´Ù' °°Àº ¸Þ½ÃÁö°¡ ¶á µÚ ¹Ù·Î ´Ù½Ã ÆûÀ¸·Î µ¹¾Æ°¡°Ô ÇÏ·Á¸é

$msg = "Your message has been sent";
echo " <html><head>
                 <script name=javascript>

                 if('$msg' != '') {
                         self.window.alert('$msg');
                 }

                 location.href='form.php';

                 </script>
                 </head>
                 </html> ";

ÀÌ ¼Ò½º¸¦ ?> ¾È¿¡ ³Ö¾îÁÖ¼¼¿ä.

°³ÀÎÀûÀ¸·Î ¼º°øÇÏ°í ³ª´Ï±ñ ³Ê¹« ±âºÐÀÌ ÁÁ³×¿ä^^

±×·³ ´Ùµé ÇÏ°í ½ÍÀº °Å ²À ÀÌ·ç¼¼¿ä~




¼Õº´¸ñ
¤¾¤¾ ½º½º·Î ÇØ°áÇϼ̳׿ä. ´ÙÇàÀÔ´Ï´Ù. ÃàÇÏÇÕ´Ï´Ù!
- ÀÌ·¡Àú·¡ ´äº¯À» ¹Ì·é °ÔÀ¸¸¥ ¿î¿µÀÚ ¿Ã¸²^^
 2007/12/05 04:17:06    


no
subject
name
date
hit
*
809
  ÀÌ·± Á¤¸» ±¦ÂúÀº °÷À̱º¿ä. [1]

ýÙÙÞ-Èæ¹¦
2008/10/02 9715 2111
808
  ÀÌ·±»çÀÌÆ®°¡ ÀÖ¾ú´Ù´Ï....

flyyo
2008/09/30 10353 2161
807
  À̰й®Á¦°¡ ¸ÓÁ®.¤Ð¤Ð

¿À¶óÃʺ¸
2008/07/24 9318 1906
806
 ºñ¹Ð±ÛÀÔ´Ï´Ù µ¥ÀÌÅͺ£À̽º¿¡ º¯¼ö°ªÀÌ µé¾î¿ÀÁö ¾Ê³×...

°­Áö»ê
2008/07/02 1 0
805
  php °­Á ¾ÈÇϽóª¿ä?

Á¤À±Èñ
2008/06/16 9130 1825
804
  °Ô½ÃÆÇ¿¡¼­ ¾÷·Îµå ¿¡·¯°¡ ³ª¿ä [1]

ÀÌ¿¬±¸
2008/06/14 9008 1775
803
  °¨»ç!!!!!!!!!!!!!!¢½ [1]

¿ì¼Û¹è
2008/06/09 8789 1959
802
  JSP °Ô½ÃÆÇÀ» °øºÎÇϰí Àִµ¥...excep... [1]

¾È´ë¿ø
2008/06/04 9376 1949
801
  php°Ô½ÃÆÇ¿¡¼­.. Áú¹®ÀÔ´Ï´Ù.. [2]

±Ã±Ý
2008/02/12 9784 2015
800
  ÀÌÁ¦¼­¾ß ¿Í º¸³×¿ä. [1]

±èâÇö
2008/02/04 8754 1904
799
  ÀÚ·á½Ç ¼Ò½º ´Ù¿îÀÌ ¾ÈµÇ³×¿ä~ [3]

¹Ú°ü¿À
2008/01/29 9561 2048
798
  °Ô½ÃÆÇ ÄÚ¸àÆ®¿¡ ´ëÇØ Àǹ®ÀÌÀÖ½À´Ï´Ù.

ÃÖÇý¸²
2008/01/24 9853 2025
797
  ¿Ö ÆÄÀϾ÷·Îµå°¡ ¾ÈµÉ±î¿ä?

¹ÚÁ¤Àº
2008/01/24 8363 1846
796
  php°Ô½ÃÆÇ 1 delete_ok Áú¹® [1]

ÀÓ¿ë±Ô
2008/01/17 9034 2064
795
  °Ô½ÃÆÇ ÄÚ¸àÆ®¿ä~ [1]

ÃÖÇ츲
2007/12/12 9095 1911
794
  php°Ô½ÃÆÇ Áú¹®ÀÌ¿ä.. [2]

¹Ú¹Ì¿µ
2007/12/12 9801 2077
793
  ÀÚ·á½Ç¼Ò½º ´Ù¿î¸¦ ¾ÈµÇ¿ä!! [2]

¼®¿µÇÐ
2007/12/06 8651 2046
792
  PHP °Ô½ÃÆÇ ¸¸µé±â ÇÁ·ÎÁ§Æ®

¹Ú ¼±
2007/12/01 8947 1983

    [re] PHP °Ô½ÃÆÇ ¸¸µé±â ÇÁ·ÎÁ§Æ® [1]

¹Ú ¼±
2007/12/04 26422 2397
790
  JSP °Ô½ÃÆÇ °ü·Ã Áú¹®µå¸±²²¿ä [1]

sailron
2007/12/01 8762 1789
[1] 2 [3][4][5][6][7][8][9][10]..[42] [next]

Copyright 1999-2025 Zeroboard / skin by Zetyx