$sql = "SELECT count(id) FROM orderd WHERE YEAR(data_create)='" . date('Y') . "' AND MONTH(data_create)='" . date('m') . "' AND DAY(data_create)='" . date('d') . "'"; $db->query($sql); $val = $db->getValue(); if ($val + 1 < 10) { $dopol = '00'; } else { if ($val + 1 >= 10 and $val + 1 < 100) { $dopol = '0'; } else { $dopol = ''; } } $uid = date('ymd') . $dopol . $val + 1; $sms = new sms(); $sms->setLogin('lyufari'); $sms->setPass('zayaccool'); $text_sms_manger = 'Бронь '; $text_sms_manger .= $_POST['roomtype'] == "delux" ? '"номер де люкс" ' : '"номер апартаменты" '; $text_sms_manger .= 'на сумму ' . $itogo . ' грн'; if ($sms->auth()) { $phone_who = $_POST['phonecode'] . $_POST['phone']; $sms->sendsms('lyufari', $phone_who, "Спасибо. Бронь #" . $uid . "\nМы свяжемся с вами в ближайшее время."); $sms->sendsms('lyufari', '+380505870147', $text_sms_manger); $sms->sendsms('lyufari', '+380951727272', $text_sms_manger); // $sms->sendsms('lyufari','+380951727272',"Бронь с сайта #".$uid." на сумму ".$itogo); $smsid = $sms->smsresultbynumb(1); //id } $sql = "INSERT INTO orderd (uid,smsid,data_create,date,name,phone,nameevent,peoplecount,comment,address,zakaz,type) VALUES('%s','%s','" . date('Y-m-d H:i:s') . "','','%s','" . $_POST['phonecode'] . $_POST['phone'] . "','','','','','','notrest')"; $query = sprintf($sql, $uid, $smsid, $name); $db->query($query);
$new_idorder_more = $db->getValue() + 1; } else { $new_idorder_more = 1; } $sql_put_to_ids = "UPDATE ids SET idorder_more=" . $new_idorder_more; $db->query($sql_put_to_ids); $sum = $price * $factor_user * $val['k']; $sql = "INSERT INTO compositionoforder (id,idorder,idgoods,count,factor,price,sum,id_ed_iz,`updated`) VALUES ('w" . $new_idorder_more . "','w" . $new_or_id . "','" . $val['id'] . "'," . $val['k'] * $factor_user . "," . $factor . "," . $price . "," . $sum . ",'" . $user_iz . "',1)"; $db->query($sql); } $_SESSION['client']['new'] = 0; } } $sms = new sms(); $sms->setLogin('vsort'); $sms->setPass('43176'); if ($sms->auth()) { $sms->sendsms('VsortComUa', $phone, 'Ваш заказ № ' . $uid . ' принят. Ожидайте звонка менеджера'); $sms->sendsms('VsortComUa', '+380992264778', 'Новый заказ с сайта. № ' . $uid . '.'); } $arrayname = array(); $arrayorder = array(); for ($i = 1; $i <= 20; $i++) { array_push($arrayname, "покупатель(" . $i . ")"); array_push($arrayorder, array()); } $_SESSION['active'] = 0; $active = 0; $_SESSION['arrayname'] = $arrayname; $_SESSION['arrayorder'] = $arrayorder; $arr = array_merge($arr, array('order' => $_SESSION['arrayorder']), array('names' => $_SESSION['arrayname']), array('ord' => $order), array('real_ord' => $real_order), array('fff' => $fff));