Results 1 to 10 of 10
Thread: PHP mail form ;(
Hybrid View
-
22nd June 2012 15:22 #1Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 20
PHP mail form ;(
. . . " Online Form: � �" , subject , " Защото аз съм човекът с бойната глава
хахахах"
, ;( . index.php
Code:<!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 charset="utf-8" /> <title>Contact Us</title> <script type="text/JavaScript"> <!-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } //--> </script> </head> <body> <form action="mailer.php" method="post" name="form1" id="form1" style="margin:0px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px; width:300px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue"> e-mail:<br /> <input name="from" type="text" id="from" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:17px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:14px; background-image: url(20x10.png); " value="<?php echo $_GET['from'];?>"/> <br /> <br /> :<br /> <input name="subject" type="text" id="subject" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:17px;font-family:Verdana, Arial, Helvetica, sans-serif; background-image: url(20x10.png); font-size:14px;" value="<?php echo $_GET['subject'];?>"/> <br /> <br /> :<br /> <input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:17px;font-family:Verdana, Arial, Helvetica, sans-serif; background-image: url(20x10.png); font-size:14px;"/> <img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br /> <br /> <!-- if the variable "wrong_code" is sent from previous page then display the error field --> <?php if(isset($_GET['wrong_code'])){?> <div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div><br /> <?php ;}?> :<br /> <textarea name="message" cols="6" rows="5" id="message" style="padding:2px; border:1px solid #CCCCCC; width:300px; height:120px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"><?php echo $_GET['message'];?></textarea> <input name="Submit" type="submit" style="margin-top:10px; display:block; border:1px solid #000000; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; background-image: url(20x10.png);font-size:11px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;" value=""/> </form> </body> </html>
: mailer.php
Code:<?php // ----------------------------------------- // The Web Help .com // ----------------------------------------- // remember to replace you@email.com with your own email address lower in this code. // load the variables form address bar $subject = $_POST["subject"]; $message = $_POST["message"]; $from = $_POST["from"]; $verif_box = $_POST["verif_box"]; // remove the backslashes that normally appears when entering " or ' $message = stripslashes($message); $subject = stripslashes($subject); $from = stripslashes($from); // check to see if verificaton code was correct if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ // if verification code was correct send the message and show this page mail("moi_email@abv.bg", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from"); // delete the cookie so it cannot sent again by refreshing this page setcookie('tntcon',''); } else if(isset($message) and $message!=""){ // if verification code was incorrect then return to contact page and show error header("Location: index.php?subject=$subject&from=$from&message=".urlencode($message)."&wrong_code=true"); exit; } else { echo "no variables received, this page cannot be accessed directly"; exit; } ?> <!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 charset="utf-8" /> <title>E-Mail Sent</title> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style></head> <body> . - .<br /> <br /> <a href="/">e-mail</a> ? </body> </html>
. " ....." .
-
22nd June 2012 16:16 #2
:
, . ,Code:$pname = mb_convert_encoding($_POST['name'], 'cp1251', 'utf-8'); $headers = "Content-type: text/plain; charset=utf-8\n"; $headers .= "From: " . $pname . " <" . $_POST['email'] . ">\n"; $subject = "..."; $to = "..."; if (mail($to, $subject, $_POST['msg'], $headers)) { ...
, UTF-8 without BOM, .Lenovo Y720; Samsung 850 Evo 1TB; Logitech G604; DELL U2410; Wacom Intuos 4L
-
26th June 2012 13:06 #3Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 20
,
. .
:$subject = $_POST["subject"];
? , ? .$subject = mb_convert_encoding($_POST['subject'], 'cp1251', 'utf-8');
--------- 13:06 --------- : 13:27 ---------
: ������� V-Brake ������ convert : ��� V-Brake ��� .... ?
-
26th June 2012 16:12 #4
, , mailer.php :
Code:$subject = $_POST['subject']; $message = $_POST['message']; $from = $_POST['from']; $headers = "Content-type: text/plain; charset=utf-8\n"; $headers .= "From: " . $from . "\n"; $verif_box = $_POST["verif_box"];
2 $headers , . Notepad++ , UTF-8 without BOM. , . , special characters. .Code:mail("moi_email@abv.bg", 'Online Form: '.$subject, $message, $headers);Lenovo Y720; Samsung 850 Evo 1TB; Logitech G604; DELL U2410; Wacom Intuos 4L
-
27th June 2012 11:02 #5Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 20
July666 ,
, 2 . header subject subjecta ::Online Form: �� �Online Form: �� � /
encoding-a . Cut- UTF-8 without BOM. . . .
-
27th June 2012 15:57 #6
, - . , ,
Lenovo Y720; Samsung 850 Evo 1TB; Logitech G604; DELL U2410; Wacom Intuos 4L




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in