random gift on register

DDDDec

Tongue Boxing Champion 2023
May 30, 2017
405
248
PHP:
$enable = array(
    "registerGift" => true
);

public function registerGift() {
        global $db, $enable;
        if ($enable['registerGift'] == true) {
            $day = date('l');
            $getGift = $db->prepare('SELECT * FROM cms_register_gift WHERE day = :day');
            $getGift->bindParam(":day", $day);
            $getGift->execute();
            if ($getGift->RowCount() > 0) {
                if ($getGift->RowCount() == 1) {
                    $getGift = $gift->fetch();
                    $giveGift = $db->prepare("INSERT INTO user_furni (furniture) VALUES (?)");
                    $giveGift->execute([$getGift]);
                } else {
                    while ($getGift = $gift->fetch()) {
                        $giveGift = $db->prepare("INSERT INTO user_furni (furniture) VALUES (?)");
                        $giveGift->execute([$getGift]);
                    }
                }
            } else {
                exit();
            }
        }
    }
give a gift to a user when registering or multiple gifts
 

Users who are viewing this thread

Top