From d3da0fecce06b48b0ef05f07b01c6ca944d42c55 Mon Sep 17 00:00:00 2001 From: andryeyev Date: Thu, 24 Dec 2015 14:31:50 +0200 Subject: [PATCH] + реанимация купона --- account/auto_registration.php | 4 ++++ account/registration.php | 11 +++++++++-- libs/Tools.class.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 libs/Tools.class.php diff --git a/account/auto_registration.php b/account/auto_registration.php index bcae8b5..c9ba73b 100644 --- a/account/auto_registration.php +++ b/account/auto_registration.php @@ -4,6 +4,7 @@ include_once($_SERVER['DOCUMENT_ROOT']."/config/config.php"); include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.php"); include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.eMailing.php"); + include_once($_SERVER['DOCUMENT_ROOT']."/libs/Tools.class.php"); // ============================== // ======== =========== @@ -50,6 +51,9 @@ GetSQLValueString($_POST['form']['group'], "text")); $result = mysql_query($sql) or die(mysql_error()); + // + Tools::addUserCoupon (mysql_insert_id()); + // ID $sql="SELECT id FROM zlo_users WHERE email='".htmlspecialchars($_POST['order_email'],ENT_QUOTES)."' AND `pass`='".$pass."' LIMIT 1"; diff --git a/account/registration.php b/account/registration.php index f403f41..6ca8a53 100644 --- a/account/registration.php +++ b/account/registration.php @@ -3,8 +3,12 @@ include_once($_SERVER['DOCUMENT_ROOT']."/config/config.php"); include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.php"); include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.eMailing.php"); + include_once($_SERVER['DOCUMENT_ROOT']."/libs/Tools.class.php"); + global $lang; - function GoodBuy() { + + function GoodBuy() + { echo (""); echo ""; } @@ -89,9 +93,12 @@ $group); $result = mysql_query($sql) or die(mysql_error()); + // + Tools::addUserCoupon (mysql_insert_id()); + // eMailing('reg'); - + // // 100 , + $_POST['form']['login']=$_POST['form']['email']; diff --git a/libs/Tools.class.php b/libs/Tools.class.php new file mode 100644 index 0000000..9818a9e --- /dev/null +++ b/libs/Tools.class.php @@ -0,0 +1,42 @@ + $value) + { + if (is_int ($key)) + { + $exist[$value] = ''; + unset ($exist[$key]); + } + } + + foreach ($exist as $key => $value) + { + if (! isset ($mass[$key]) + || (isset ($mass[$key]) && $mass[$key] === '')) + { + $mass[$key] = $value; + } + } + } + + static function addUserCoupon ($user_id) + { + mysql_query(' + INSERT INTO `card` (`card`, `user_id`) + SELECT (max(`card`) + 1) as max, '.$user_id.' + FROM `card` + '); + + return mysql_insert_id(); + } + +} \ No newline at end of file -- libgit2 0.21.4