博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

注册就发红包 ecshop

Posted on 2011-06-22 13:21  阳光-浪漫  阅读(1072)  评论(0编辑  收藏  举报

1.首先在后台添加红包。如图:



2.修改文件。user.php

找到:228 行左右

 if (register($username, $password, $email, $other) !== false)

        {

                        /* 用户注册就发红包 */

                $bonus = $db->getRow('SELECT * FROM ' . $ecs->table("bonus_type") . ' WHERE send_type = 0', true);

                        if($bonus){

                                if(time()<($bonus['send_end_date']+28800)){

                                        $sql = "INSERT INTO " . $ecs->table('user_bonus') .

                                                        "(bonus_type_id, bonus_sn, user_id, used_time, order_id, emailed) " .

                                                        "VALUES ('$bonus[type_id]', 0, '$_SESSION[user_id]', 0, 0, 0)";

                                        $db->query($sql);

                                }

                        }