Commit d3da0fecce06b48b0ef05f07b01c6ca944d42c55
1 parent
ea42de8b
+ реанимация купона
Showing
3 changed files
with
55 additions
and
2 deletions
Show diff stats
account/auto_registration.php
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | include_once($_SERVER['DOCUMENT_ROOT']."/config/config.php"); |
| 5 | 5 | include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.php"); |
| 6 | 6 | include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.eMailing.php"); |
| 7 | + include_once($_SERVER['DOCUMENT_ROOT']."/libs/Tools.class.php"); | |
| 7 | 8 | |
| 8 | 9 | // ============================== |
| 9 | 10 | // ======== Îáðàáîòêà =========== |
| ... | ... | @@ -50,6 +51,9 @@ |
| 50 | 51 | GetSQLValueString($_POST['form']['group'], "text")); |
| 51 | 52 | $result = mysql_query($sql) or die(mysql_error()); |
| 52 | 53 | |
| 54 | + // ñîçäàåì êóïîí | |
| 55 | + Tools::addUserCoupon (mysql_insert_id()); | |
| 56 | + | |
| 53 | 57 | // Óçíàåì ID |
| 54 | 58 | $sql="SELECT id FROM zlo_users |
| 55 | 59 | WHERE email='".htmlspecialchars($_POST['order_email'],ENT_QUOTES)."' AND `pass`='".$pass."' LIMIT 1"; | ... | ... |
account/registration.php
| ... | ... | @@ -3,8 +3,12 @@ |
| 3 | 3 | include_once($_SERVER['DOCUMENT_ROOT']."/config/config.php"); |
| 4 | 4 | include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.php"); |
| 5 | 5 | include_once($_SERVER['DOCUMENT_ROOT']."/account/func/func.eMailing.php"); |
| 6 | + include_once($_SERVER['DOCUMENT_ROOT']."/libs/Tools.class.php"); | |
| 7 | + | |
| 6 | 8 | global $lang; |
| 7 | - function GoodBuy() { | |
| 9 | + | |
| 10 | + function GoodBuy() | |
| 11 | + { | |
| 8 | 12 | echo ("<script>alert('Âàì îòêàçàíî â ðåãèñòðàöèè çà íàðóøåíèå ïðàâèë')</script>"); |
| 9 | 13 | echo "<script language=\"JavaScript\">{ location.href=\"GoBAck(1)\"; self.focus(); } </script>"; |
| 10 | 14 | } |
| ... | ... | @@ -89,9 +93,12 @@ |
| 89 | 93 | $group); |
| 90 | 94 | $result = mysql_query($sql) or die(mysql_error()); |
| 91 | 95 | |
| 96 | + // ñîçäàåì êóïîí | |
| 97 | + Tools::addUserCoupon (mysql_insert_id()); | |
| 98 | + | |
| 92 | 99 | // Øëåì ïèñüìà |
| 93 | 100 | eMailing('reg'); |
| 94 | - | |
| 101 | + | |
| 95 | 102 | // äëÿ òîãî ÷òîá ïîëüçîâàòåëü áûë çàðåãèñòðèðîâàí |
| 96 | 103 | // êîä ìóñîðíûé ïîòîìó÷òî 100 ðàç çàäà÷à ìåíÿëàñü, + âñå äåëàåòñÿ íà â÷åðà |
| 97 | 104 | $_POST['form']['login']=$_POST['form']['email']; | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +class Tools | |
| 4 | +{ | |
| 5 | + static function ifNotExist (&$mass, $exist) | |
| 6 | + { | |
| 7 | + if (! is_array ($mass)) | |
| 8 | + { | |
| 9 | + $mass = array(); | |
| 10 | + } | |
| 11 | + | |
| 12 | + foreach ($exist as $key => $value) | |
| 13 | + { | |
| 14 | + if (is_int ($key)) | |
| 15 | + { | |
| 16 | + $exist[$value] = ''; | |
| 17 | + unset ($exist[$key]); | |
| 18 | + } | |
| 19 | + } | |
| 20 | + | |
| 21 | + foreach ($exist as $key => $value) | |
| 22 | + { | |
| 23 | + if (! isset ($mass[$key]) | |
| 24 | + || (isset ($mass[$key]) && $mass[$key] === '')) | |
| 25 | + { | |
| 26 | + $mass[$key] = $value; | |
| 27 | + } | |
| 28 | + } | |
| 29 | + } | |
| 30 | + | |
| 31 | + static function addUserCoupon ($user_id) | |
| 32 | + { | |
| 33 | + mysql_query(' | |
| 34 | + INSERT INTO `card` (`card`, `user_id`) | |
| 35 | + SELECT (max(`card`) + 1) as max, '.$user_id.' | |
| 36 | + FROM `card` | |
| 37 | + '); | |
| 38 | + | |
| 39 | + return mysql_insert_id(); | |
| 40 | + } | |
| 41 | + | |
| 42 | +} | |
| 0 | 43 | \ No newline at end of file | ... | ... |