/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if($_GET[er]){ if($_SESSION[num_order]>2){$_SESSION[two]='<h2 id="er">Ð’Ñ‹ уже отправили 2 заÑвки</h2>';} } if($_POST && $_SESSION[num_order]<3){ if(!preg_match('#[-a-zA-Z0-9\.]+@[-a-zA-Z0-9]+\.[a-zA-Z]+#',$_POST[email])){$_SESSION[error]='<h2 id="er">Ðе правильно указан E-mail</h2>';exit();} if(strcasecmp($_POST[email],'[email protected]')==0){$_SESSION[error]='<h2 id="er">Ðе правильно указан E-mail</h2>';exit();} if($_POST[seo])$work_ar[]='seo'; if($_POST[create])$work_ar[]='create'; if($_POST[support])$work_ar[]='support'; mysql_query("INSERT INTO `webform_submissions`(nid,uid,submitted,remote_addr) VALUE('3','0','".time()."','{$_SERVER['REMOTE_ADDR']}')",$bdlink); $max_sid=mysql_fetch_array(mysql_query("SELECT MAX(sid) FROM webform_submissions"));$max_sid=$max_sid[0]; mysql_query("INSERT INTO `webform_submitted_data`(nid,sid,cid,no,data) VALUE('3','$max_sid','1','0','{$_POST[email]}')",$bdlink); mysql_query("INSERT INTO `webform_submitted_data`(nid,sid,cid,no,data) VALUE('3','$max_sid','2','0','{$_POST[phone]}')",$bdlink); mysql_query("INSERT INTO `webform_submitted_data`(nid,sid,cid,no,data) VALUE('3','$max_sid','3','0','".iconv('UTF-8', 'cp1251', $_POST[name])."')",$bdlink); mysql_query("INSERT INTO `webform_submitted_data`(nid,sid,cid,no,data) VALUE('3','$max_sid','4','0','{$_POST[sitename]}')",$bdlink); $c=0; if($work_ar[0]){mysql_query("INSERT INTO `webform_submitted_data`(nid,sid,cid,no,data) VALUE('3','$max_sid','5','$c','{$work_ar[0]}')",$bdlink); $c++;} if($work_ar[1]){mysql_query("INSERT INTO `webform_submitted_data`(nid,sid,cid,no,data) VALUE('3','$max_sid','5','$c','{$work_ar[1]}')",$bdlink); $c++;} if($work_ar[2]){mysql_query("INSERT INTO `webform_submitted_data`(nid,sid,cid,no,data) VALUE('3','$max_sid','5','$c','{$work_ar[2]}')",$bdlink); $c++;} foreach($_POST as $key => $line){$mes.=($line)?"$key: $line <br> ":'';} $headers = "Content-type: text/html; charset=utf-8 "; "; "; $_SESSION[ok]='<h2>Ваша заÑвка принÑта. Стартуем!</h2>'; $_SESSION[error]=''; $_SESSION[num_order]=($_SESSION[num_order])?$_SESSION[num_order]+1:1; } ?>