Modification [XTeam] Add account to CashShopData automatically

Mon

Administrator
Developer
Nov 8, 2018
185
45
28
Hello,

This is a modification for WebEngine 1.2.x that will automatically add accounts to the CashShopData table so your accounts can receive credits through the WebEngine credit system even if they have not logged into the game yet.

Requirements:
- WebEngine 1.2.x
- X-Team Mu FIles (or similar files that use the CashShopData table)

Step 1:
Open /modules/usercp.php

Step 2:
Replace all the code with the following:
PHP:
<?php
/**
 * WebEngine CMS
 * https://webenginecms.org/
 *
 * @version 1.2.0
 * @author Lautaro Angelico <http://lautaroangelico.com/>
 * @copyright (c) 2013-2019 Lautaro Angelico, All Rights Reserved
 *
 * Licensed under the MIT license
 * http://opensource.org/licenses/MIT
 */

if(!isLoggedIn()) redirect(1,'login');

$db = Connection::Database('MuOnline');
$check = $db->query_fetch_single("SELECT * FROM CashShopData WHERE AccountID = ?", array($_SESSION['username']));
if(!is_array($check)) {
    $create = $db->query("INSERT INTO CashShopData (AccountID, WCoinC, WCoinP, GoblinPoint) VALUES (?, 0, 0, 0)", array($_SESSION['username']));
}

# redirect to my account
redirect(1, 'usercp/myaccount');