Revision: 35072
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 2, 2010 02:51 by nuwak
Initial Code
<?php session_start(); if($_GET[er]){ if($_SESSION[num_order]>2){$_SESSION[two]='<h2 id="er">Ð’Ñ‹ уже отправили 2 заÑвки</h2>';} if($_SESSION[error]){ echo iconv("UTF-8", "cp1251", $_SESSION[error]);} elseif($_SESSION[two]){echo iconv("UTF-8", "cp1251", $_SESSION[two]);} elseif($_SESSION[ok]){echo iconv("UTF-8", "cp1251", $_SESSION[ok]); exit();} exit(); } 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'; print_r($work_ar); if(!is_array($work_ar)){$_SESSION[error]='<h2 id="er">Укажите работы.</h2>';exit();} $bdlink=mysql_connect('host.ru','user','pass'); mysql_select_db('bd_name',$bdlink); 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++;} mysql_close($bdlink); foreach($_POST as $key => $line){$mes.=($line)?"$key: $line <br> ":'';} $headers = "Content-type: text/html; charset=utf-8 "; $headers .= "From: www <[email protected]> "; $headers .= "Bcc: [email protected] "; mail('[email protected]','Заказ Ñ Ñайта',$mes,$headers); $_SESSION[ok]='<h2>Ваша заÑвка принÑта. Стартуем!</h2>'; $_SESSION[error]=''; $_SESSION[num_order]=($_SESSION[num_order])?$_SESSION[num_order]+1:1; } ?>
Initial URL
Initial Description
Initial Title
СобÑтвенный Ñкрипт запиÑи пиÑем в webform
Initial Tags
mail, drupal
Initial Language
PHP