Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] WebEngine 1.0.9

Don't be afraid to ask!
Loyal Member
Joined
Jun 2, 2012
Messages
1,454
Reaction score
252
Hi Guys,

My server use IGCN.
Registration is working fine, on Admin panel all working fine, but the number of account on server do not working, what is cron job? on admin panel the last execution were never executed.

Could you please help to identify it?

Check the sql script in the php file.... try to run it with your ssms and than you will see whats wrong.

Maybe a different column name,.
 
Newbie Spellweaver
Joined
Jul 22, 2015
Messages
8
Reaction score
1
Ranking not showing my characters and then not showing accounts on server:

CkU0Uex - [Release] WebEngine 1.0.9 - RaGEZONE Forums
Lautaro - [Release] WebEngine 1.0.9 - RaGEZONE Forums
Lautaro - [Release] WebEngine 1.0.9 - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Nov 14, 2017
Messages
93
Reaction score
3
Anyone can help me to configure VipSystem for IGCN (AccountExpireDate column), the website use another method for VipSystem.
thanks!
 
Newbie Spellweaver
Joined
Apr 6, 2015
Messages
5
Reaction score
0
Guys, im need help to activate Cronjob on my cPanel.
 
Newbie Spellweaver
Joined
Apr 6, 2015
Messages
5
Reaction score
0
@Lautaro

Hello Lautaro, the registration page has an incompatibility with version 0.97 + 99, it does not insert the data in the VI_CURR_INFO table.

I tried adding the query into the class.account.php file and set the necessary tables in the custom.tables.php file.
But the error persists, can you help me?

Query:
$query = "INSERT INTO ".VI_CURR_INFO." (".ends_days.", ".chek_code.", ".used_time.", "._CLMN_USERNM_.", "._CLMN_MEMBNAME_.", "._CLMN_MEMBID_.", "._CLMN_SNONUMBER_.", ".Bill_Section.", ".Bill_Value.", ".Bill_Hour.", ".Surplus_Point.", ".Surplus_Minute.", ".Increase_Days.") VALUES (2005, 1, 1234, :username, :name, 1, :serial, 6, 3, 6, 6, 1905-06-26 00:00:00.000, 0)";



sn3oGXk - [Release] WebEngine 1.0.9 - RaGEZONE Forums



jrVw6KR - [Release] WebEngine 1.0.9 - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Apr 6, 2015
Messages
5
Reaction score
0
@Lautaro
I leave here the files with the added compatibility.

CUSTOM TABLES:
PHP:
<?php
/**
 * WebEngine CMS
 * https://webenginecms.org/
 * 
 * [USER=316612]Version[/USER] 1.0.9.6
 * @author Lautaro Angelico <http://lautaroangelico.com/>
 * [USER=822345]Copyright[/USER] (c) 2013-2017 Lautaro Angelico, All Rights Reserved
 * 
 * Licensed under the MIT license
 * [url=http://opensource.org/licenses/MIT]The MIT License | Open Source Initiative[/url]
 */

define('_TBL_MI_', 'MEMB_INFO');
    define('_CLMN_USERNM_', 'memb___id');
    define('_CLMN_PASSWD_', 'memb__pwd');
    define('_CLMN_MEMBID_', 'memb_guid');
    define('_CLMN_EMAIL_', 'mail_addr');
    define('_CLMN_BLOCCODE_', 'bloc_code');
    define('_CLMN_SNONUMBER_', 'sno__numb');
    define('_CLMN_MEMBNAME_', 'memb_name');
    define('_CLMN_CTLCODE_', 'ctl1_code');

define('VI_CURR_INFO');
    define('ends_days');
    define('chek_code');
    define('used_time');
    define('_CLMN_USERNM_', 'memb___id');
    define('_CLMN_MEMBNAME_', 'memb_name');
    define('_CLMN_MEMBID_', 'memb_guid');
    define('_CLMN_SNONUMBER_', 'sno__numb');
    define('Bill_Section');
    define('Bill_Value');
    define('Bill_Hour');
    define('Surplus_Point');
    define('Surplus_Minute');
    define('Increase_Days');

define('_TBL_MS_', 'MEMB_STAT');
    define('_CLMN_CONNSTAT_', 'ConnectStat');
    define('_CLMN_MS_MEMBID_', 'memb___id');
    define('_CLMN_MS_GS_', 'ServerName');
    define('_CLMN_MS_IP_', 'IP');
    
define('_TBL_AC_', 'AccountCharacter');
    define('_CLMN_AC_ID_', 'Id');
    define('_CLMN_GAMEID_1_', 'GameID1');
    define('_CLMN_GAMEID_2_', 'GameID2');
    define('_CLMN_GAMEID_3_', 'GameID3');
    define('_CLMN_GAMEID_4_', 'GameID4');
    define('_CLMN_GAMEID_5_', 'GameID5');
    define('_CLMN_GAMEIDC_', 'GameIDC');
    
define('_TBL_CHR_', 'Character');
    define('_CLMN_CHR_NAME_', 'Name');
    define('_CLMN_CHR_ACCID_', 'AccountID');
    define('_CLMN_CHR_CLASS_', 'Class');
    define('_CLMN_CHR_ZEN_', 'Money');
    define('_CLMN_CHR_LVL_', 'cLevel');
    define('_CLMN_CHR_RSTS_', 'RESETS');
    define('_CLMN_CHR_LVLUP_POINT_', 'LevelUpPoint');
    define('_CLMN_CHR_STAT_STR_', 'Strength');
    define('_CLMN_CHR_STAT_AGI_', 'Dexterity');
    define('_CLMN_CHR_STAT_VIT_', 'Vitality');
    define('_CLMN_CHR_STAT_ENE_', 'Energy');
    define('_CLMN_CHR_STAT_CMD_', 'Leadership');
    define('_CLMN_CHR_PK_KILLS_', 'PkCount');
    define('_CLMN_CHR_PK_LEVEL_', 'PkLevel');
    define('_CLMN_CHR_PK_TIME_', 'PkTime');
    define('_CLMN_CHR_MAP_', 'MapNumber');
    define('_CLMN_CHR_MAP_X_', 'MapPosX');
    define('_CLMN_CHR_MAP_Y_', 'MapPosY');
    define('_CLMN_CHR_MAGIC_L_', 'MagicList');
    define('_CLMN_CHR_MLVL_', 'mLevel');
    define('_CLMN_CHR_MLPOINT_', 'mlPoint');
    define('_CLMN_CHR_MLEXP_', 'mlExperience');

define('_TBL_MASTERLVL_', 'Character');
    define('_CLMN_ML_NAME_', 'Name');
    define('_CLMN_ML_LVL_', 'mLevel');
    define('_CLMN_ML_EXP_', 'mlExperience');
    define('_CLMN_ML_NEXP_', 'mlNextExp');
    define('_CLMN_ML_POINT_', 'mlPoint');
    
define('_TBL_MC_', 'MEMB_CREDITS');
    define('_CLMN_MC_ID_', 'memb___id');
    define('_CLMN_MC_CREDITS_', 'credits');
    define('_CLMN_MC_USED_', 'used');

define('_TBL_MUCASTLE_DATA_', 'MuCastle_DATA');
    define('_CLMN_MCD_GUILD_OWNER_', 'OWNER_GUILD');
    define('_CLMN_MCD_MONEY_', 'MONEY');
    define('_CLMN_MCD_TRC_', 'TAX_RATE_CHAOS');
    define('_CLMN_MCD_TRS_', 'TAX_RATE_STORE');
    define('_CLMN_MCD_THZ_', 'TAX_HUNT_ZONE');
    
define('_TBL_GUILD_', 'Guild');
    define('_CLMN_GUILD_NAME_', 'G_Name');
    define('_CLMN_GUILD_LOGO_', 'G_Mark');
    define('_CLMN_GUILD_SCORE_', 'G_Score');
    define('_CLMN_GUILD_MASTER_', 'G_Master');
    define('_CLMN_GUILD_NOTICE_', 'G_Notice');
    define('_CLMN_GUILD_UNION_', 'G_Union');
    
define('_TBL_GUILDMEMB_', 'GuildMember');
    define('_CLMN_GUILDMEMB_CHAR_', 'Name');
    define('_CLMN_GUILDMEMB_NAME_', 'G_Name');
    define('_CLMN_GUILDMEMB_LEVEL_', 'G_Level');
    define('_CLMN_GUILDMEMB_STATUS_', 'G_Status');
    
define('_TBL_MUCASTLE_RS_', 'MuCastle_REG_SIEGE');
    define('_CLMN_MCRS_GUILD_', 'REG_SIEGE_GUILD');
    
define('_TBL_GENS_', 'IGC_Gens');
    define('_CLMN_GENS_NAME_', 'Name');
    define('_CLMN_GENS_TYPE_', 'Influence');
    define('_CLMN_GENS_RANK_', 'Class');
    define('_CLMN_GENS_POINT_', 'Points');
    
define('_TBL_VIP_', 'T_VIPList');
    define('_CLMN_VIP_ID_', 'AccountID');
    define('_CLMN_VIP_DATE_', 'Date');
    define('_CLMN_VIP_TYPE_', 'Type');

    
/*
 * custom: character_class
 */
$custom['character_class'] = array(
    0 => array('Dark Wizard', 'DW', 'dw.jpg', 'base_stats' => array('str' => 18, 'agi' => 18, 'vit' => 15, 'ene' => 30, 'cmd' => 0)),
    1 => array('Soul Master', 'SM', 'dw.jpg', 'base_stats' => array('str' => 18, 'agi' => 18, 'vit' => 15, 'ene' => 30, 'cmd' => 0)),
    2 => array('Grand Master', 'GM', 'dw.jpg', 'base_stats' => array('str' => 18, 'agi' => 18, 'vit' => 15, 'ene' => 30, 'cmd' => 0)),
    16 => array('Dark Knight', 'DK', 'dk.jpg', 'base_stats' => array('str' => 28, 'agi' => 20, 'vit' => 25, 'ene' => 10, 'cmd' => 0)),
    17 => array('Blade Knight', 'BK', 'dk.jpg', 'base_stats' => array('str' => 28, 'agi' => 20, 'vit' => 25, 'ene' => 10, 'cmd' => 0)),
    18 => array('Blade Master', 'BM', 'dk.jpg', 'base_stats' => array('str' => 28, 'agi' => 20, 'vit' => 25, 'ene' => 10, 'cmd' => 0)),
    32 => array('Elf', 'ELF', 'elf.jpg', 'base_stats' => array('str' => 22, 'agi' => 25, 'vit' => 15, 'ene' => 20, 'cmd' => 0)),
    33 => array('Muse Elf', 'ELF', 'elf.jpg', 'base_stats' => array('str' => 22, 'agi' => 25, 'vit' => 15, 'ene' => 20, 'cmd' => 0)),
    34 => array('High Elf', 'ELF', 'elf.jpg', 'base_stats' => array('str' => 22, 'agi' => 25, 'vit' => 15, 'ene' => 20, 'cmd' => 0)),
    48 => array('Magic Gladiator', 'MG', 'mg.jpg', 'base_stats' => array('str' => 26, 'agi' => 26, 'vit' => 26, 'ene' => 16, 'cmd' => 0)),
    50 => array('Duel Master', 'DM', 'mg.jpg', 'base_stats' => array('str' => 26, 'agi' => 26, 'vit' => 26, 'ene' => 16, 'cmd' => 0)),
    64 => array('Dark Lord', 'DL', 'dl.jpg', 'base_stats' => array('str' => 26, 'agi' => 20, 'vit' => 20, 'ene' => 15, 'cmd' => 25)),
    66 => array('Lord Emperor', 'LE', 'dl.jpg', 'base_stats' => array('str' => 26, 'agi' => 20, 'vit' => 20, 'ene' => 15, 'cmd' => 25)),
    80 => array('Summoner', 'SUM', 'sum.jpg', 'base_stats' => array('str' => 21, 'agi' => 21, 'vit' => 18, 'ene' => 23, 'cmd' => 0)),
    81 => array('Bloody Summoner', 'SUM', 'sum.jpg', 'base_stats' => array('str' => 21, 'agi' => 21, 'vit' => 18, 'ene' => 23, 'cmd' => 0)),
    82 => array('Dimension Master', 'SUM', 'sum.jpg', 'base_stats' => array('str' => 21, 'agi' => 21, 'vit' => 18, 'ene' => 23, 'cmd' => 0)),
    96 => array('Rage Fighter', 'RF', 'rf.jpg', 'base_stats' => array('str' => 32, 'agi' => 27, 'vit' => 25, 'ene' => 20, 'cmd' => 0)),
    98 => array('Fist Master', 'FM', 'rf.jpg', 'base_stats' => array('str' => 32, 'agi' => 27, 'vit' => 25, 'ene' => 20, 'cmd' => 0)),
    112 => array('Grow Lancer', 'GL', 'gl.jpg', 'base_stats' => array('str' => 30, 'agi' => 30, 'vit' => 25, 'ene' => 24, 'cmd' => 0)),
    114 => array('Mirage Lancer', 'ML', 'gl.jpg', 'base_stats' => array('str' => 30, 'agi' => 30, 'vit' => 25, 'ene' => 24, 'cmd' => 0)),
);

/*
 * custom: character_cmd
 * classes who use cmd stat
 */
$custom['character_cmd'] = array(64, 66);

/*
 * custom: gens_ranks
 */
$custom['gens_ranks'] = array(
    0 => 'None',
    1 => 'Grand Duke',
    2 => 'Duke',
    3 => 'Marquis',
    4 => 'Count',
    5 => 'Viscount',
    6 => 'Summoner',
    7 => 'Baron',
    8 => 'Knight Commander',
    9 => 'Superior Knight',
    10 => 'Knight',
    11 => 'Officer',
    12 => 'Lieutenant',
    13 => 'Sergeant',
    14 => 'Private',
);

CLASS.ACCOUNT
PHP:
<?php
/**
 * WebEngine CMS
 * https://webenginecms.org/
 * 
 * [USER=316612]Version[/USER] 1.0.9.8
 * @author Lautaro Angelico <http://lautaroangelico.com/>
 * [USER=822345]Copyright[/USER] (c) 2013-2017 Lautaro Angelico, All Rights Reserved
 * 
 * Licensed under the MIT license
 * [url=http://opensource.org/licenses/MIT]The MIT License | Open Source Initiative[/url]
 */

class Account extends common {
    
    private $_defaultAccountSerial = '1111111111111';
    
    public function registerAccount($username, $password, $cpassword, $email) {
        
        if(!check_value($username)) throw new Exception(lang('error_4',true));
        if(!check_value($password)) throw new Exception(lang('error_4',true));
        if(!check_value($cpassword)) throw new Exception(lang('error_4',true));
        if(!check_value($email)) throw new Exception(lang('error_4',true));

        // Filters
        if(!Validator::UsernameLength($username)) throw new Exception(lang('error_5',true));
        if(!Validator::AlphaNumeric($username)) throw new Exception(lang('error_6',true));
        if(!Validator::PasswordLength($password)) throw new Exception(lang('error_7',true));
        if($password != $cpassword) throw new Exception(lang('error_8',true));
        if(!Validator::Email($email)) throw new Exception(lang('error_9',true));
        
        # load registration configs
        $regCfg = loadConfigurations('register');
        
        # check if username / email exists
        if($this->userExists($username)) throw new Exception(lang('error_10',true));
        if($this->emailExists($email)) throw new Exception(lang('error_11',true));
        
        # WebEngine Email Verification System (EVS)
        if($regCfg['verify_email']) {
            # check if username / email exists
            if($this->checkUsernameEVS($username)) throw new Exception(lang('error_10',true));
            if($this->checkEmailEVS($email)) throw new Exception(lang('error_11',true));
            
            # generate verification key
            $verificationKey = $this->createRegistrationVerification($username,$password,$email);
            if(!check_value($verificationKey)) throw new Exception(lang('error_23',true));
            
            # send verification email
            $this->sendRegistrationVerificationEmail($username,$email,$verificationKey);
            message('success', lang('success_18',true));
            return;
        }
        
        # insert data
        $data = array(
            'username' => $username,
            'password' => $password,
            'name' => $username,
            'serial' => $this->_defaultAccountSerial,
            'email' => $email
        );
        
        # query
        if($this->_md5Enabled) {
            $query = "INSERT INTO "._TBL_MI_." ("._CLMN_USERNM_.", "._CLMN_PASSWD_.", "._CLMN_MEMBNAME_.", "._CLMN_SNONUMBER_.", "._CLMN_EMAIL_.", "._CLMN_BLOCCODE_.", "._CLMN_CTLCODE_.") VALUES (:username, [dbo].[fn_md5](:password, :username), :name, :serial, :email, 0, 0)";
        } else {
            $query = "INSERT INTO "._TBL_MI_." ("._CLMN_USERNM_.", "._CLMN_PASSWD_.", "._CLMN_MEMBNAME_.", "._CLMN_SNONUMBER_.", "._CLMN_EMAIL_.", "._CLMN_BLOCCODE_.", "._CLMN_CTLCODE_.") VALUES (:username, :password, :name, :serial, :email, 0, 0)";
        }
        # query for VI_CURR_INFO (Compatible with ********* 97d+99i MuServer)
        $data2 = array(
            'username' => $username,
            'name' => $username,
            'serial' => $this->_defaultAccountSerial,
        );
        $query2 = "INSERT INTO VI_CURR_INFO (ends_days, chek_code, used_time, "._CLMN_USERNM_.", "._CLMN_MEMBNAME_.", "._CLMN_MEMBID_.", "._CLMN_SNONUMBER_.", Bill_Section, Bill_Value, Bill_Hour, Surplus_Point, Surplus_Minute, Increase_Days) VALUES (2005, 1, 1234, :username, :name, 1, :serial, 6, 3, 6, 6,'1905-06-26 00:00:00.000', 0)";
        
        # register account
        $result = $this->db->query($query, $data);
        if(!$result) throw new Exception(lang('error_22',true));
        $result2 = $this->db->query($query2, $data2);
        if(!$result2) throw new Exception('error_22',true);
        
        # send welcome email
        if($regCfg['send_welcome_email']) {
            $this->sendWelcomeEmail($username, $email);
        }
        
        # free vip days
        if($regCfg['freevip_enable']) {
            switch($this->_serverFiles) {
                case 'MUE':
                    $vip = new Vip();
                    $this->updateVipTimeStamp($this->db->lastInsertId(), $vip->CalculateTimestamp($regCfg['freevip_days']));
                    break;
                default:
                    break;
            }
        }
        
        # success message
        message('success', lang('success_1',true));
        
        # redirect to login (5 seconds)
        redirect(2,'login/',5);
    }
    
    public function changePasswordProcess($userid, $username, $password, $new_password, $confirm_new_password) {
        if(!check_value($userid)) throw new Exception(lang('error_4',true));
        if(!check_value($username)) throw new Exception(lang('error_4',true));
        if(!check_value($password)) throw new Exception(lang('error_4',true));
        if(!check_value($new_password)) throw new Exception(lang('error_4',true));
        if(!check_value($confirm_new_password)) throw new Exception(lang('error_4',true));
        if(!Validator::PasswordLength($new_password)) throw new Exception(lang('error_7',true));
        if($new_password != $confirm_new_password) throw new Exception(lang('error_8',true));
        
        # check user credentials
        if(!$this->validateUser($username, $password)) throw new Exception(lang('error_13',true));
        
        # check online status
        if($this->accountOnline($username)) throw new Exception(lang('error_14',true));
        
        # change password
        if(!$this->changePassword($userid, $username, $new_password)) throw new Exception(lang('error_23',true));
        
        # send email with new password
        $accountData = $this->accountInformation($userid);
        try {
            $email = new Email();
            $email->setTemplate('CHANGE_PASSWORD');
            $email->addVariable('{USERNAME}', $username);
            $email->addVariable('{NEW_PASSWORD}', $new_password);
            $email->addAddress($accountData[_CLMN_EMAIL_]);
            $email->send();
        } catch (Exception $ex) {}
        
        # success message
        message('success', lang('success_2',true));
    }
    
    public function changePasswordProcess_verifyEmail($userid, $username, $password, $new_password, $confirm_new_password, $ip_address) {
        if(!check_value($userid)) throw new Exception(lang('error_4',true));
        if(!check_value($username)) throw new Exception(lang('error_4',true));
        if(!check_value($password)) throw new Exception(lang('error_4',true));
        if(!check_value($new_password)) throw new Exception(lang('error_4',true));
        if(!check_value($confirm_new_password)) throw new Exception(lang('error_4',true));
        if(!Validator::PasswordLength($new_password)) throw new Exception(lang('error_7',true));
        if($new_password != $confirm_new_password) throw new Exception(lang('error_8',true));
        
        # load changepw configs
        $mypassCfg = loadConfigurations('usercp.mypassword');
        
        # check user credentials
        if(!$this->validateUser($username, $password)) throw new Exception(lang('error_13',true));
        
        # check online status
        if($this->accountOnline($username)) throw new Exception(lang('error_14',true));
        
        # check if user has an active password change request
        if($this->hasActivePasswordChangeRequest($userid)) throw new Exception(lang('error_19',true));
        
        # load account data
        $accountData = $this->accountInformation($userid);
        if(!is_array($accountData)) throw new Exception(lang('error_21',true));
        
        # request data
        $auth_code = mt_rand(111111,999999);
        $link = $this->generatePasswordChangeVerificationURL($userid, $auth_code);
        
        # add request to database
        $addRequest = $this->addPasswordChangeRequest($userid, $new_password, $auth_code);
        if(!$addRequest) throw new Exception(lang('error_21',true));
        
        # send verification email
        try {
            $email = new Email();
            $email->setTemplate('CHANGE_PASSWORD_EMAIL_VERIFICATION');
            $email->addVariable('{USERNAME}', $username);
            $email->addVariable('{DATE}', date("m/d/Y @ h:i a"));
            $email->addVariable('{IP_ADDRESS}', $ip_address);
            $email->addVariable('{LINK}', $link);
            $email->addVariable('{EXPIRATION_TIME}', $mypassCfg['change_password_request_timeout']);
            $email->addAddress($accountData[_CLMN_EMAIL_]);
            $email->send();
            
            message('success', lang('success_3',true));
        } catch (Exception $ex) {
            message('error', lang('error_20',true));
        }
        
    }
    
    public function changePasswordVerificationProcess($user_id, $auth_code) {
        if(!check_value($user_id)) throw new Exception(lang('error_24',true));
        if(!check_value($auth_code)) throw new Exception(lang('error_24',true));
        
        $userid = Decode_id($user_id);
        $authcode = Decode_id($auth_code);
        
        if(!Validator::UnsignedNumber($userid)) throw new Exception(lang('error_25',true));
        if(!Validator::UnsignedNumber($authcode)) throw new Exception(lang('error_25',true));
        
        $result = $this->db->query_fetch_single("SELECT * FROM WEBENGINE_PASSCHANGE_REQUEST WHERE user_id = ?", array($userid));
        if(!is_array($result)) throw new Exception(lang('error_25',true));
        
        # load changepw configs
        $mypassCfg = loadConfigurations('usercp.mypassword');
        $request_timeout = $mypassCfg['change_password_request_timeout'] * 3600;
        $request_date = $result['request_date'] + $request_timeout;
        
        # check request data
        if($request_date < time()) throw new Exception(lang('error_26',true));
        if($result['auth_code'] != $authcode) throw new Exception(lang('error_27',true));
        
        # account data
        $accountData = $this->accountInformation($userid);
        $username = $accountData[_CLMN_USERNM_];
        $new_password = Decode($result['new_password']);
        
        # check online status
        if($this->accountOnline($username)) throw new Exception(lang('error_14',true));
        
        # update password
        if(!$this->changePassword($userid, $username, $new_password)) throw new Exception(lang('error_29',true));
        
        # send email
        try {
            $email = new Email();
            $email->setTemplate('CHANGE_PASSWORD');
            $email->addVariable('{USERNAME}', $username);
            $email->addVariable('{NEW_PASSWORD}', $new_password);
            $email->addAddress($accountData[_CLMN_EMAIL_]);
            $email->send();
        } catch (Exception $ex) {}
        
        # clear password change request
        $this->removePasswordChangeRequest($userid);
        
        # success message
        message('success', lang('success_5',true));
        
    }
    
    public function passwordRecoveryProcess($user_email, $ip_address) {
        if(!check_value($user_email)) throw new Exception(lang('error_30',true));
        if(!check_value($ip_address)) throw new Exception(lang('error_30',true));
        if(!Validator::Email($user_email)) throw new Exception(lang('error_30',true));
        if(!Validator::Ip($ip_address)) throw new Exception(lang('error_30',true));
        
        if(!$this->emailExists($user_email)) throw new Exception(lang('error_30',true));
        
        $user_id = $this->retrieveUserIDbyEmail($user_email);
        if(!check_value($user_id)) throw new Exception(lang('error_23',true));
        
        $accountData = $this->accountInformation($user_id);
        if(!is_array($accountData)) throw new Exception(lang('error_23',true));
        
        # Account Recovery Code
        $arc = $this->generateAccountRecoveryCode($accountData[_CLMN_MEMBID_], $accountData[_CLMN_USERNM_]);

        # Account Recovery URL
        $aru = $this->generateAccountRecoveryLink($accountData[_CLMN_MEMBID_], $accountData[_CLMN_EMAIL_], $arc);
        
        # send email
        try {
            $email = new Email();
            $email->setTemplate('PASSWORD_RECOVERY_REQUEST');
            $email->addVariable('{USERNAME}', $accountData[_CLMN_USERNM_]);
            $email->addVariable('{DATE}', date("Y-m-d @ h:i a"));
            $email->addVariable('{IP_ADDRESS}', $ip_address);
            $email->addVariable('{LINK}', $aru);
            $email->addAddress($accountData[_CLMN_EMAIL_]);
            $email->send();
            
            message('success', lang('success_6',true));
        } catch (Exception $ex) {
            throw new Exception(lang('error_23',true));
        }
    }
    
    public function passwordRecoveryVerificationProcess($ui, $ue, $key) {
        if(!check_value($ui)) throw new Exception(lang('error_31',true));
        if(!check_value($ue)) throw new Exception(lang('error_31',true));
        if(!check_value($key)) throw new Exception(lang('error_31',true));
        
        $user_id = Decode($ui); // decoded user id
        if(!Validator::UnsignedNumber($user_id)) throw new Exception(lang('error_31',true));
        
        $user_email = Decode($ue); // decoded email address
        if(!$this->emailExists($user_email)) throw new Exception(lang('error_31',true));
        
        $accountData = $this->accountInformation($user_id);
        if(!is_array($accountData)) throw new Exception(lang('error_31',true));
        
        $username = $accountData[_CLMN_USERNM_];
        $gen_key = $this->generateAccountRecoveryCode($user_id, $username);
        
        # compare keys
        if($key != $gen_key) throw new Exception(lang('error_31',true));
        
        # update user password
        $new_password = rand(11111111,99999999);
        $update_pass = $this->changePassword($user_id, $username, $new_password);
        if(!$update_pass) throw new Exception(lang('error_23',true));

        try {
            $email = new Email();
            $email->setTemplate('PASSWORD_RECOVERY_COMPLETED');
            $email->addVariable('{USERNAME}', $username);
            $email->addVariable('{NEW_PASSWORD}', $new_password);
            $email->addAddress($accountData[_CLMN_EMAIL_]);
            $email->send();
            
            message('success', lang('success_7',true));
        } catch (Exception $ex) {
            throw new Exception(lang('error_23',true));
        }
    }
    
    public function masterKeyRecoveryProcess($user_id) {
        if(!check_value($user_id)) throw new Exception(lang('error_23',true));
        if(check_value($_COOKIE['webengine_masterkey'])) throw new Exception(lang('error_50',true));
        
        $accountData = $this->accountInformation($user_id);
        if(!check_value($accountData[_CLMN_MASTER_KEY_])) throw new Exception(lang('error_49',true));
        
        if($this->accountOnline($accountData[_CLMN_USERNM_])) throw new Exception(lang('error_14',true));
        
        try {
            $email = new Email();
            $email->setTemplate('MASTER_KEY_RECOVERY');
            $email->addVariable('{USERNAME}', $accountData[_CLMN_USERNM_]);
            $email->addVariable('{CURRENT_MASTERKEY}', $accountData[_CLMN_MASTER_KEY_]);
            $email->addAddress($accountData[_CLMN_EMAIL_]);
            $email->send();
            
            message('success', lang('success_16',true));
            setcookie("webengine_masterkey", $accountData[_CLMN_USERNM_], time()+3600);  /* expire in 1 hour */
        } catch (Exception $ex) {
            throw new Exception(lang('error_23',true));
        }
    }
    
    public function changeEmailAddress($accountId, $newEmail, $ipAddress) {
        if(!check_value($accountId)) throw new Exception(lang('error_21',true));
        if(!check_value($newEmail)) throw new Exception(lang('error_21',true));
        if(!check_value($ipAddress)) throw new Exception(lang('error_21',true));
        if(!Validator::Ip($ipAddress)) throw new Exception(lang('error_21',true));
        if(!Validator::Email($newEmail)) throw new Exception(lang('error_21',true));
        
        # check if email already in use
        if($this->emailExists($newEmail)) throw new Exception(lang('error_11',true));
        
        # account info
        $accountInfo = $this->accountInformation($accountId);
        if(!is_array($accountInfo)) throw new Exception(lang('error_21',true));
        
        $myemailCfg = loadConfigurations('usercp.myemail');
        if($myemailCfg['require_verification']) {
            # requires verification
            $userName = $accountInfo[_CLMN_USERNM_];
            $userEmail = $accountInfo[_CLMN_EMAIL_];
            $requestDate = strtotime(date("m/d/Y 23:59"));
            $key = md5(md5($userName).md5($userEmail).md5($requestDate).md5($newEmail));
            $verificationLink = __BASE_URL__.'verifyemail/?op='.Encode_id(3).'&uid='.Encode_id($accountId).'&email='.$newEmail.'&key='.$key;
            
            # send verification email
            $sendEmail = $this->changeEmailVerificationMail($userName, $userEmail, $newEmail, $verificationLink, $ipAddress);
            if(!$sendEmail) throw new Exception(lang('error_21',true));
        } else {
            # no verification required
            if(!$this->updateEmail($accountId, $newEmail)) throw new Exception(lang('error_21',true));
        }
    }
    
    public function changeEmailVerificationProcess($encodedId, $newEmail, $encryptedKey) {
        $userId = Decode_id($encodedId);
        if(!Validator::UnsignedNumber($userId)) throw new Exception(lang('error_21',true));
        if(!Validator::Email($newEmail)) throw new Exception(lang('error_21',true));
        
        # check if email already in use
        if($this->emailExists($newEmail)) throw new Exception(lang('error_11',true));
        
        # account info
        $accountInfo = $this->accountInformation($userId);
        if(!is_array($accountInfo)) throw new Exception(lang('error_21',true));
        
        # check key
        $requestDate = strtotime(date("m/d/Y 23:59"));
        $key = md5(md5($accountInfo[_CLMN_USERNM_]).md5($accountInfo[_CLMN_EMAIL_]).md5($requestDate).md5($newEmail));
        if($key != $encryptedKey) throw new Exception(lang('error_21',true));
        
        # change email
        if(!$this->updateEmail($userId, $newEmail)) throw new Exception(lang('error_21',true));
    }
    
    public function verifyRegistrationProcess($username, $key) {
        $verifyKey = $this->db->query_fetch_single("SELECT * FROM WEBENGINE_REGISTER_ACCOUNT WHERE registration_account = ? AND registration_key = ?", array($username,$key));
        if(!is_array($verifyKey)) throw new Exception(lang('error_25',true));
        
        # load registration configs
        $regCfg = loadConfigurations('register');
        
        # insert data
        $data = array(
            'username' => $verifyKey['registration_account'],
            'password' => Decode($verifyKey['registration_password']),
            'name' => $verifyKey['registration_account'],
            'serial' => $this->_defaultAccountSerial,
            'email' => $verifyKey['registration_email']
        );
        
        # query
        if($this->_md5Enabled) {
            $query = "INSERT INTO "._TBL_MI_." ("._CLMN_USERNM_.", "._CLMN_PASSWD_.", "._CLMN_MEMBNAME_.", "._CLMN_SNONUMBER_.", "._CLMN_EMAIL_.", "._CLMN_BLOCCODE_.", "._CLMN_CTLCODE_.") VALUES (:username, [dbo].[fn_md5](:password, :username), :name, :serial, :email, 0, 0)";
        } else {
            $query = "INSERT INTO "._TBL_MI_." ("._CLMN_USERNM_.", "._CLMN_PASSWD_.", "._CLMN_MEMBNAME_.", "._CLMN_SNONUMBER_.", "._CLMN_EMAIL_.", "._CLMN_BLOCCODE_.", "._CLMN_CTLCODE_.") VALUES (:username, :password, :name, :serial, :email, 0, 0)";
        }
        
        
        # create account
        $result = $this->db->query($query, $data);
        if(!$result) throw new Exception(lang('error_22',true));
        
        # delete verification request
        $this->deleteRegistrationVerification($username);
        
        # send welcome email
        if($regCfg['send_welcome_email']) {
            $this->sendWelcomeEmail($verifyKey['registration_account'],$verifyKey['registration_email']);
        }
        
        # free vip days
        if($regCfg['freevip_enable']) {
            switch($this->_serverFiles) {
                case 'MUE':
                    $vip = new Vip();
                    $this->updateVipTimeStamp($this->db->db->lastInsertId(), $vip->CalculateTimestamp($regCfg['freevip_days']));
                    break;
                default:
                    break;
            }
        }
        
        # success message
        message('success', lang('success_1',true));
        
        # redirect to login (5 seconds)
        redirect(2,'login/',5);
    }
    
    private function sendRegistrationVerificationEmail($username, $account_email, $key) {
        $verificationLink = __BASE_URL__.'verifyemail/?op='.Encode_id(2).'&user='.Encode($username).'&key='.$key;
        try {
            $email = new Email();
            $email->setTemplate('WELCOME_EMAIL_VERIFICATION');
            $email->addVariable('{USERNAME}', $username);
            $email->addVariable('{LINK}', $verificationLink);
            $email->addAddress($account_email);
            $email->send();
        } catch (Exception $ex) {}
    }
    
    private function sendWelcomeEmail($username,$address) {
        try {
            $email = new Email();
            $email->setTemplate('WELCOME_EMAIL');
            $email->addVariable('{USERNAME}', $username);
            $email->addAddress($address);
            $email->send();
        } catch (Exception $ex) {
            // do nuthin u.u
        }
    }
    
    private function createRegistrationVerification($username,$password,$email) {
        if(!check_value($username)) return;
        if(!check_value($password)) return;
        if(!check_value($email)) return;
        
        $key = uniqid();
        $data = array(
            $username,
            Encode($password),
            $email,
            time(),
            $_SERVER['REMOTE_ADDR'],
            $key
        );
        
        $query = "INSERT INTO WEBENGINE_REGISTER_ACCOUNT (registration_account,registration_password,registration_email,registration_date,registration_ip,registration_key) VALUES (?,?,?,?,?,?)";
        
        $result = $this->db->query($query, $data);
        if(!$result) return;
        return $key;
    }
    
    private function deleteRegistrationVerification($username) {
        if(!check_value($username)) return;
        $delete = $this->db->query("DELETE FROM WEBENGINE_REGISTER_ACCOUNT WHERE registration_account = ?", array($username));
        if($delete) return true;
        return;
    }

    private function checkUsernameEVS($username) {
        if(!check_value($username)) return;
        $result = $this->db->query_fetch_single("SELECT * FROM WEBENGINE_REGISTER_ACCOUNT WHERE registration_account = ?", array($username));
        
        $configs = loadConfigurations('register');
        if(!is_array($configs)) return;
        
        $timelimit = $result['registration_date']+$configs['verification_timelimit']*60*60;
        if($timelimit > time()) return true;
        
        $this->deleteRegistrationVerification($username);
        return false;
    }

    private function checkEmailEVS($email) {
        if(!check_value($email)) return;
        $result = $this->db->query_fetch_single("SELECT * FROM WEBENGINE_REGISTER_ACCOUNT WHERE registration_email = ?", array($email));
        
        $configs = loadConfigurations('register');
        if(!is_array($configs)) return;
        
        $timelimit = $result['registration_date']+$configs['verification_timelimit']*60*60;
        if($timelimit > time()) return true;
        
        $this->deleteRegistrationVerification($result['registration_account']);
        return false;
    }
    
    private function changeEmailVerificationMail($userName, $emailAddress, $newEmail, $verificationLink, $ipAddress) {
        try {
            $email = new Email();
            $email->setTemplate('CHANGE_EMAIL_VERIFICATION');
            $email->addVariable('{USERNAME}', $userName);
            $email->addVariable('{IP_ADDRESS}', $ipAddress);
            $email->addVariable('{NEW_EMAIL}', $newEmail);
            $email->addVariable('{LINK}', $verificationLink);
            $email->addAddress($emailAddress);
            $email->send();
            
            return true;
        } catch (Exception $ex) {
            return;
        }
    }
    
    private function generateAccountRecoveryLink($userid,$email,$recovery_code) {
        if(!check_value($userid)) return;
        if(!check_value($recovery_code)) return;
        
        $build_url = __BASE_URL__;
        $build_url .= 'forgotpassword/';
        $build_url .= '?ui=';
        $build_url .= Encode($userid);
        $build_url .= '&ue=';
        $build_url .= Encode($email);
        $build_url .= '&key=';
        $build_url .= $recovery_code;
        return $build_url;
    }
    
}
 
Newbie Spellweaver
Joined
Feb 1, 2012
Messages
14
Reaction score
0
Cron.php not working :/ Warning: Invalid argument supplied for foreach() in /home/tkfmu.com/public/web/includes/cron/cron.php on line 23 Call Stack: 0.0006 245928 1. {main}() /home/tkfmu.com/public/web/includes/cron/cron.php:0 .....
 
Newbie Spellweaver
Joined
Sep 25, 2015
Messages
47
Reaction score
4
who has tried this web 2.0 help establish))



Guys please tell me where can I change this text to what folder to look for and what is the file??

Update...


does anyone know how to add a payment to interkassa???
 
Last edited by a moderator:
Newbie Spellweaver
Joined
Oct 4, 2018
Messages
30
Reaction score
0
, i sure , i made all correctly , but still got question , which files i need , or how to install webshop on this web?
actually i know that for some DmN CMS you need to pay , but which webshop i need if i use zTeam Season Ex802 , and web from webengine?
Appreciated if someone will drop me link with guid <3
 
Joined
Oct 2, 2006
Messages
1,562
Reaction score
372
, i sure , i made all correctly , but still got question , which files i need , or how to install webshop on this web?
actually i know that for some DmN CMS you need to pay , but which webshop i need if i use zTeam Season Ex802 , and web from webengine?
Appreciated if someone will drop me link with guid <3

Webshop is not included in any of webengine's releases



For sure WebEngine 2.0 is better but i cannot testify that. I can only assure you that this one is good.

As pero lautaro, webengine 2.0 is finished but it just needs to put plugin modules



who has tried this web 2.0 help establish))



Guys please tell me where can I change this text to what folder to look for and what is the file??

Update...


does anyone know how to add a payment to interkassa???

check legendary/modules/inc/footer
 
Newbie Spellweaver
Joined
Sep 10, 2018
Messages
11
Reaction score
1
Any decent webshop module to couple with this engine? Preferably one that supports credits and runs on a webhost without IonCube.

Also, getting a 403 forbidden when editing template settings (facebook and youtube video thingy)
 
Back
Top