use pdo_sqlsvr instead of pdo_odbc much better
check this here's mine muwarzonesea.com
Printable View
@aspire219 how did you make that working in your template? or it will need cs module?
http://i60.tinypic.com/rblcgj.png
Thank you mate :)
Works here :)
http://i60.tinypic.com/rblcgj.png[/QUOTE]
bro ENABLED Module @adminCP
in Xampp 1.7.1 Work 100%, you dont need to upgrade or download new version.
http://i58.tinypic.com/vfhqs.png
its hard to setup mates
why dont you make video tutorial guys?
I use 1.7.3 with ODBC
here are the guides.
Im not using MD5 on this :D
1st:
2ND:Code:// SQL DATA$config['SQL_DB_HOST'] = '127.0.0.1';
$config['SQL_DB_NAME'] = 'MuOnline';
$config['SQL_DB_2_NAME'] = 'Me_MuOnline';
$config['SQL_DB_USER'] = 'sa';
$config['SQL_DB_PASS'] = 'password';
$config['SQL_DB_PORT'] = '1433';
$config['SQL_USE_2_DB'] = false; $config['SQL_PDO_DRIVER'] = 3; // 1= dblib (default) || 2= sqlsrv || 3= odbc
3RD:Code:1. Download latest xampp if you are windows user.
2. Enable ODBC ($config['SQL_PDO_DRIVER'] = 3;)
3. Enable extension=php_pdo_odbc.dll by removing ";" at php/php.ini
4. Restart WebServer.
5. Configure config.php (if you use MSSSQL Express use for host NAME\SQLEXPRESS ex ROOTHOME\SQLEXPRESS)
else you can use host ip
Open includes/classes/class.common.php
FIND
REPLACED ON THISCode:$query = "SELECT * FROM "._TBL_MI_." WHERE "._CLMN_USERNM_." = '$username' AND "._CLMN_PASSWD_." = [dbo].[fn_md5]('$password','$username')";
A guide from @4FUNer :)Code:$query = "SELECT * FROM "._TBL_MI_." WHERE "._CLMN_USERNM_." = '$username' AND "._CLMN_PASSWD_." = '$password'";
Hope some of you guys "master of web files" can make this web compatible on z-team database., thank you!
can anyone kindly attached your class.common.php file so I could compare mine, this might be the answer to my problem.
Only this I change mate :)
Code:public function validateUser($username,$password) { global $dB,$dB2;
if(!Validator::UsernameLength($username)) { $error = true; }
if(!Validator::AlphaNumeric($username)) { $error = true; }
if(!Validator::PasswordLength($password)) { $error = true; }
if(!$error) {
$query = "SELECT * FROM "._TBL_MI_." WHERE "._CLMN_USERNM_." = '$username' AND "._CLMN_PASSWD_." = '$password'";
if(config('SQL_USE_2_DB',true)) {
$check = $dB2->query_fetch_single($query);
} else {
$check = $dB->query_fetch_single($query);
}
if(is_array($check)) {
do you have screenshot mate?
Someone asked me for non-md5 register/change pwd/verify & login
Here it is
https://www.sendspace.com/file/um7uyv
bro @DooMDesigN check your SQL password or ODBC connection ...
- - - Updated - - -
bro share your template with us .. mine not working header :(
Everything sets fine, MuCore is working on my pc, I just really want to try this and make a nice new theme, I'm kinda lost with this web engine idk why.
I think his header also not worked :)Quote:
Originally Posted by
[COLOR=silver
how to enable module? when i go to AdminCP i click Modules Manager but theres no Enable bla bla ...
http://i.imgur.com/oEuOd3a.png
Share the Template please. the Header
http://i58.tinypic.com/69f7mg.jpg
@4FUNer
how to add the name of GuildMaster between castle owner and castle siege battle starts in
PHP Code:function template_displayCastleSiegeBanner() {
loadModuleConfigs('castlesiege');
if(mconfig('active') && mconfig('enable_banner')) {
$ranking_data = LoadCacheData('castle_siege.cache');
$Rankings = new Rankings();
$cs = cs_CalculateTimeLeft();
if(!is_null($cs)) {
$timeleft = sec_to_hms($cs);
echo '
<div id="castle-siege">
<table cellspacing="0" cellpadding="0">
<tr>
<td class="cs-logo"><img src="'.__BASE_URL__.'helper.php?req='.$ranking_data[1][1].'&s=112" width="112" height="112"></td>
<td class="cs-guild-info">
<td class="guild-master"> </td>
<span class="cs-guild-title">'.$ranking_data[1][0].'</span><br />
<span>'.lang('csbanner_txt_1',true).'</span>
</td>
<td>
'.lang('csbanner_txt_2',true).'<br />
<span class="cs-timeleft">
'.$timeleft[0].'<span>h</span>
'.$timeleft[1].'<span>m</span>
'.$timeleft[2].'<span>s</span>
</span>
</td>
</tr>
</table>
</div>';
like this?
http://i.imgur.com/EeKJ9q5.png
cron/castle_siege.php
find
addCode:, t2."._CLMN_GUILD_LOGO_." FROM "._TBL_MUCASTLE_DATA_."
Run cron & you access guild master at template.functions likeCode:, t2."._CLMN_GUILD_LOGO_.", t2."._CLMN_GUILD_MASTER_." FROM "._TBL_MUCASTLE_DATA_."
Restyle box to looks as you wishPHP Code:<td>' . $ranking_data[1][2] . '</td>
for example
templates/default/css/style.css
find #castle-siege .cs-guild-info & change width to 180px
templates/default/inc/template.functions.php
add gm entry between guild name & time space
Code:<td class="cs-guild-info">
<span class="cs-guild-title">'.$ranking_data[1][2].'</span><br />
<span>Guild Master</span>
</td>
HF :P
DELETED.... thanks
Stop this longs quotes ...
Anyway sorry i use 1.0.6, didn't check 1.0.5
use
addCode:, t2."._CLMN_GUILD_LOGO_." FROM "._TBL_MUCASTLE_DATA_."
& access by $ranking_data[1][2]Code:, t2."._CLMN_GUILD_LOGO_.", t2."._CLMN_GUILD_MASTER_." FROM "._TBL_MUCASTLE_DATA_."
Hi i have a problem in Castle Siege Module.
i update in database
http://i.imgur.com/ySSEFp4.png
but theres no in site :3
http://i.imgur.com/ovXHigw.pngsorry for my bad English :)
Thanks 4FUNer :)
http://i.imgur.com/b7j4jAo.png
4FUNer Release Free Modules or template Please? :)
- - - Updated - - -
Share your Header Please :)
- - - Updated - - -
Hey 4FUNer Share Blank Header please?
My problems.
ERROR: The Administrator has disabled new registrations. ( ANY PAGES)
OTHER:
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\modules\news.php on line 84
@mustt
try enable the registrations in admincp modulemanager and post news
@daeron91 I can not access the admin panel, I go to the link "localhost/admincp" and it redirects me to "localhost/admincp/page=admincp!
with 404 not found.
anyone can share ,,,header for premium template :( please thanks a lot godbless
@Wayne Sniper
When I type the link of the admin panel, I am redirected to "localhost/admincp/page=admincp!
I can not even enter login and password, it simply generates 404 NOT FOUND page.
Is there any way to disable the MD5?
there's already a solution posted earlier, please read more.
New Error.
(On Register)
[SQL 22007] [odbc 242]> [Microsoft] [ODBC SQL Server Driver] [SQL Server] The talk of a varchar data type to a datetime data type resulted in an out of range value. (SQLExecute [242] at ext \ pdo_odbc \ odbc_stmt.c: 254)
- - - Updated - - -
New Error.
(On Register)
[SQL 22007] [odbc 242]> [Microsoft] [ODBC SQL Server Driver] [SQL Server] The talk of a varchar data type to a datetime data type resulted in an out of range value. (SQLExecute [242] at ext \ pdo_odbc \ odbc_stmt.c: 254)
try this bro copy and replace to includes>classes>classlogin.php
Code:<?php
class login {
function isLoggedIN() {
global $_SESSION,$dB;
if($_SESSION['valid'] == true) {
if(check_value($_SESSION['userid']) && check_value($_SESSION['username'])) {
if($this->checkActiveSession($_SESSION['userid'],session_id())) {
$this->updateActiveSessionTime($_SESSION['userid']);
} else {
$this->logout();
return;
}
if(mconfig('enable_session_timeout')) {
if($this->isSessionActive($_SESSION['timeout'])) {
$_SESSION['timeout'] = time();
return true;
} else {
$this->logout();
return;
}
} else {
return true;
}
}
}
}
function validateLogin($username,$password) {
global $common,$_SERVER;
if(check_value($username) && check_value($password)) {
//if($this->canLogin($_SERVER['REMOTE_ADDR'])) {
if($common->userExists($username)) {
if($common->validateUser($username,$password)) {
$this->removeFailedLogins($_SERVER['REMOTE_ADDR']);
session_regenerate_id();
$_SESSION['valid'] = true;
$_SESSION['timeout'] = time();
$_SESSION['userid'] = $common->retrieveUserID($username);
$_SESSION['username'] = $username;
// ACTIVE SESSIONS
$this->deleteActiveSession($_SESSION['userid']);
$this->addActiveSession($_SESSION['userid'],$_SERVER['REMOTE_ADDR']);
if(check_value($_SESSION['login_last_location'])) {
redirect(1,$_SESSION['login_last_location']);
} else {
redirect(1,'usercp/');
}
} else {
// invalid password
$this->addFailedLogin($username,$_SERVER['REMOTE_ADDR']);
message('error', lang('error_1',true));
message('warning', $this->checkFailedLogins($_SERVER['REMOTE_ADDR']) . lang('warning_1b',true) . mconfig('max_login_attempts'), lang('warning_1a',true));
}
} else {
// invalid username
message('error', lang('error_2',true));
}
//} else {
// // user is timed out
//message('error', lang('error_3',true));
//}
} else {
// user didn't complete a field
message('error', lang('error_4',true));
}
}
function canLogin($ipaddress) {
global $dB,$common;
if(Validator::Ip($ipaddress)) {
$fl = $this->checkFailedLogins($ipaddress);
if($fl >= mconfig('max_login_attempts')) {
$result = $dB->query_fetch_single("SELECT * FROM "._TBL_FLA_." WHERE ip_address = '$ipaddress' ORDER BY id DESC");
if(is_array($result)) {
if(time() > $result['unlock_timestamp']) {
$this->removeFailedLogins($ipaddress);
return true;
} else {
return false;
}
} else {
return true;
}
} else {
return true;
}
} else {
return false;
}
}
function checkFailedLogins($ipaddress) {
global $dB;
if(Validator::Ip($ipaddress)) {
$result = $dB->query_fetch_single("SELECT * FROM "._TBL_FLA_." WHERE ip_address = '$ipaddress' ORDER BY id DESC");
if(is_array($result)) {
return $result['failed_attempts'];
} else {
return false;
}
} else {
return false;
}
}
function addFailedLogin($username,$ipaddress) {
global $dB,$common,$config;
if(!Validator::UsernameLength($username)) { $error = true; }
if(!Validator::AlphaNumeric($username)) { $error = true; }
if(!Validator::Ip($ipaddress)) { $error = true; }
if(!$common->userExists($username)) { $error = true; }
if(!$error) {
$n = $this->checkFailedLogins($ipaddress);
$timeout = time() + mconfig('failed_login_timeout') * 60;
if(!$n) {
$data = array($username, $ipaddress, 0, 1, time());
$dB->query("INSERT INTO "._TBL_FLA_." (username, ip_address, unlock_timestamp, failed_attempts, timestamp) VALUES (?, ?, ?, ?, ?)", $data);
} else {
$new_n = $n + 1;
if($new_n >= mconfig('max_login_attempts')) {
$dB->query("UPDATE "._TBL_FLA_." SET username = '$username', ip_address = '$ipaddress', failed_attempts = '$new_n', unlock_timestamp = '$timeout', timestamp = '".time()."' WHERE ip_address = '$ipaddress'");
} else {
$dB->query("UPDATE "._TBL_FLA_." SET username = '$username', ip_address = '$ipaddress', failed_attempts = '$new_n', timestamp = '".time()."' WHERE ip_address = '$ipaddress'");
}
}
}
}
function removeFailedLogins($ipaddress) {
global $dB;
if(Validator::Ip($ipaddress)) {
$dB->query("DELETE FROM "._TBL_FLA_." WHERE ip_address = '$ipaddress'");
}
}
function isSessionActive($session_timeout) {
if(check_value($session_timeout)) {
$offset = time() - $session_timeout;
if($offset < mconfig('session_timeout')) {
return true;
} else {
return false;
}
} else {
return false;
}
}
function logout() {
$_SESSION = array();
session_destroy();
redirect();
}
private function deleteActiveSession($userid) {
global $dB;
$delete = $dB->query("DELETE FROM WEBENGINE_ACTIVE_SESSIONS WHERE session_user_id = ?", array($userid));
}
private function addActiveSession($userid,$ipaddress) {
global $dB;
$add = $dB->query("INSERT INTO WEBENGINE_ACTIVE_SESSIONS (session_user_id,session_id,session_ip,session_time) VALUES (?,?,?,?) ", array($userid,session_id(),$ipaddress,time()));
if($add) {
return true;
}
}
private function checkActiveSession($userid,$session_id) {
global $dB;
$check = $dB->query_fetch_single("SELECT * FROM WEBENGINE_ACTIVE_SESSIONS WHERE session_user_id = ? AND session_id = ?", array($userid,$session_id));
if($check && is_array($check)) {
return true;
}
}
private function updateActiveSessionTime($userid) {
global $dB;
$update = $dB->query("UPDATE WEBENGINE_ACTIVE_SESSIONS SET session_time = ? WHERE session_user_id = ?", array(time(),$userid));
if($update) {
return true;
}
}
}
?>
@clerigz
your modification only disabled the ip blocking and session timeout :thumbdown:
his problem is clearly in registration, the code you give him has nothing to do with his problem lol!
mustt problem is because in his MEMB_INFO table the date tables are type datetime and this web register query as that as text (type varchar).... so he need to update the register query
This is the solution for your problem :)
MD5 Disable
class.common.php
Code:<?php
class common {
public function registerAccount($username,$password,$cpassword,$email) {
global $dB,$dB2;
if(check_value($username) && check_value($password) && check_value($cpassword) && check_value($email)) {
// Filters
if(!Validator::UsernameLength($username)) {
message('error', lang('error_5',true));
return;
}
if(!Validator::AlphaNumeric($username)) {
message('error', lang('error_6',true));
return;
}
if(!Validator::PasswordLength($password)) {
message('error', lang('error_7',true));
return;
}
if($password != $cpassword) {
message('error', lang('error_8',true));
return;
}
if(!Validator::Email($email)) {
message('error', lang('error_9',true));
return;
}
loadModuleConfigs('register');
if(!$this->userExists($username)) {
if(!$this->emailExists($email)) {
if(mconfig('verify_email')) {
if($this->checkUsernameEVS($username)) {
message('error', lang('error_10',true));
return;
}
if($this->checkEmailEVS($email)) {
message('error', lang('error_11',true));
return;
}
$verificationKey = $this->createRegistrationVerification($username,$password,$email);
if(check_value($verificationKey)) {
$register_account = true;
}
} else {
$info = array($username, $password, 'test', '111111111111', '0', '0', '1', $email, date('m/d/Y'), date('m/d/Y'), '2005-01-03', '2005-01-03', '1', md5($username));
$query = "INSERT INTO "._TBL_MI_." (memb___id, memb__pwd, memb_name, sno__numb, bloc_code, ctl1_code, mail_chek, mail_addr, appl_days, modi_days, out__days, true_days) VALUES ('".$info[0]."', '".$info[1]."', '".$info[2]."', '".$info[3]."', '".$info[4]."', '".$info[5]."', '".$info[6]."', '".$info[7]."', '".$info[8]."', '".$info[9]."', '".$info[10]."', '".$info[11]."')";
if(config('SQL_USE_2_DB',true)) {
$register_account = $dB2->query($query);
} else {
$register_account = $dB->query($query);
}
}
if($register_account) {
if(mconfig('verify_email')) {
$this->sendRegistrationVerificationEmail($username,$email,$verificationKey);
message('success', lang('success_18',true));
} else {
if(mconfig('send_welcome_email')) {
$this->sendWelcomeEmail($username,$email);
}
message('success', lang('success_1',true));
}
redirect(2,'login/',5);
} else {
message('error', lang('error_22',true));
}
} else {
message('error', lang('error_11',true));
}
} else {
message('error', lang('error_10',true));
}
} else {
message('error', lang('error_4',true));
}
}
public function changePasswordProcess($id,$username,$password,$new_password,$confirm_new_password) {
if(check_value($password) && check_value($new_password) && check_value($confirm_new_password)) {
if($this->validateUser($username,$password)) {
if(Validator::PasswordLength($new_password)) {
if($new_password == $confirm_new_password) {
if(!$this->accountOnline($username)) {
// Update Password
if($this->changePassword($id,$username,$new_password)) {
/* success message */
message('success', lang('success_2',true));
/* send email with new password */
if(config('email_system_active',true)) {
$accountData = $this->accountInformation($id);
$email_titles = config('email_titles',true);
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array('{USERNAME}','{NEW_PASSWORD}');
$email_replace = array($username,$new_password);
$email_template = emailTemplate('CHANGE_PASSWORD');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$address = $accountData[_CLMN_EMAIL_];
$mail->AddAddress($address);
$mail->Subject = $email_titles['CHANGE_PASSWORD'];
$mail->MsgHTML($body);
if($mail->Send()) {
/* success message */
message('',lang('success_4',true),'NOTE:');
}
}
}
} else {
message('error', lang('error_23',true));
}
} else {
message('error', lang('error_14',true));
}
} else {
message('error', lang('error_8',true));
}
} else {
message('error', lang('error_7',true));
}
} else {
message('error', lang('error_13',true));
}
} else {
message('error', lang('error_4',true));
}
}
public function changePasswordProcess_verifyEmail($id,$username,$password,$new_password,$confirm_new_password,$ip_address) {
if(check_value($password) && check_value($new_password) && check_value($confirm_new_password)) {
if($this->validateUser($username,$password)) {
if(Validator::PasswordLength($new_password)) {
if($new_password == $confirm_new_password) {
if(!$this->accountOnline($username)) {
if(!$this->hasActivePasswordChangeRequest($id)) {
/* account data */
$auth_code = rand(111111,999999);
$accountData = $this->accountInformation($id);
$link = $this->generatePasswordChangeVerificationURL($id,$auth_code);
if(is_array($accountData)) {
/* add request to database */
$add_request = $this->addPasswordChangeRequest($id,$new_password,$auth_code);
if($add_request) {
/* send email with new password */
$email_titles = config('email_titles',true);
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array('{USERNAME}','{DATE}','{IP_ADDRESS}','{LINK}','{EXPIRATION_TIME}');
$email_replace = array($username,date("m/d/Y @ j:i a"),$ip_address,$link,mconfig('change_password_request_timeout'));
$email_template = emailTemplate('CHANGE_PASSWORD_EMAIL_VERIFICATION');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$address = $accountData[_CLMN_EMAIL_];
$mail->AddAddress($address);
$mail->Subject = $email_titles['CHANGE_PASSWORD_EMAIL_VERIFICATION'];
$mail->MsgHTML($body);
}
if($mail->Send()) {
// success message
message('success', lang('success_3',true));
} else {
message('error', lang('error_20',true));
}
} else {
message('error', lang('error_21',true));
}
} else {
message('error', lang('error_21',true));
}
} else {
message('error', lang('error_19',true));
}
} else {
message('error', lang('error_14',true));
}
} else {
message('error', lang('error_8',true));
}
} else {
message('error', lang('error_7',true));
}
} else {
message('error', lang('error_13',true));
}
} else {
message('error', lang('error_4',true));
}
}
public function changePasswordVerificationProcess($user_id,$auth_code) {
global $dB,$dB2;
if(check_value($user_id) && check_value($auth_code)) {
$userid = Decode_id($user_id);
$authcode = Decode_id($auth_code);
$check = $dB->query_fetch_single("SELECT * FROM "._TBL_CHANGEPASSWORD_REQUEST_." WHERE user_id = '$userid'");
if(is_array($check)) {
loadModuleConfigs('usercp.mypassword');
$request_timeout = mconfig('change_password_request_timeout') * 3600;
$request_date = $check['request_date'] + $request_timeout;
if($request_date > time()) {
if($check['auth_code'] == $authcode) {
$accountData = $this->accountInformation($userid);
$username = $accountData[_CLMN_USERNM_];
$new_password = Decode($check['new_password']);
if(!$this->accountOnline($username)) {
// Update Password
$change_password = $this->changePassword($userid,$username,$new_password);
if($change_password) {
/* send email with new password */
$email_titles = config('email_titles',true);
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array('{USERNAME}','{NEW_PASSWORD}');
$email_replace = array($username,$new_password);
$email_template = emailTemplate('CHANGE_PASSWORD');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$address = $accountData[_CLMN_EMAIL_];
$mail->AddAddress($address);
$mail->Subject = $email_titles['CHANGE_PASSWORD'];
$mail->MsgHTML($body);
$mail->Send();
}
// Clear Password Change Request
$this->removePasswordChangeRequest($userid);
// Success Message
message('success', lang('success_5',true));
} else {
// unknown error
message('error', lang('error_29',true));
}
} else {
// account online
message('error', lang('error_28',true));
}
} else {
// bad auth code
message('error', lang('error_27',true));
}
} else {
// expired
message('error', lang('error_26',true));
}
} else {
// doesnt exist
message('error', lang('error_25',true));
}
} else {
// invalid data
message('error', lang('error_24',true));
}
}
public function passwordRecoveryProcess($email,$ip_address) {
if($this->emailExists($email)) {
$user_id = $this->retrieveUserIDbyEmail($email);
if(Validator::Number($user_id)) {
$accountData = $this->accountInformation($user_id);
if(is_array($accountData)) {
/* 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 to user */
$email_titles = config('email_titles',true);
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array(
'{USERNAME}',
'{DATE}',
'{IP_ADDRESS}',
'{LINK}'
);
$email_replace = array(
$accountData[_CLMN_USERNM_],
date("m/d/Y @ j:i a"),
$ip_address,
$aru
);
$email_template = emailTemplate('PASSWORD_RECOVERY_REQUEST');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$address = $accountData[_CLMN_EMAIL_];
$mail->AddAddress($address);
$mail->Subject = $email_titles['PASSWORD_RECOVERY_REQUEST'];
$mail->MsgHTML($body);
if(!$mail->Send()) {
// could not send email (unknown error)
message('error', lang('error_23',true));
} else {
/* success message */
message('success', lang('success_6',true));
}
} else {
// bad email template, cannot send email (unknown error)
message('error', lang('error_23',true));
}
} else {
// could not retrieve account data (unknown error)
message('error', lang('error_23',true));
}
} else {
// could not retrieve user id (unknown error)
message('error', lang('error_23',true));
}
} else {
// no email or invalid email
message('error', lang('error_30',true));
}
}
public function passwordRecoveryVerificationProcess($ui,$ue,$key) {
if(check_value($ui) && check_value($ue) && check_value($key)) {
$user_id = Decode($ui); // decoded user id
$user_email = Decode($ue); // decoded email address
if(Validator::Number($user_id)) {
if($this->emailExists($user_email)) {
$accountData = $this->accountInformation($user_id);
if(is_array($accountData)) {
$username = $accountData[_CLMN_USERNM_];
$gen_key = $this->generateAccountRecoveryCode($user_id,$username);
/* compare keys */
if($key == $gen_key) {
/* update user password */
$new_password = rand(11111111,99999999);
$update_pass = $this->changePassword($user_id,$username,$new_password);
if($update_pass) {
/* send email with new password */
$email_titles = config('email_titles',true);
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array(
'{USERNAME}',
'{NEW_PASSWORD}'
);
$email_replace = array(
$username,
$new_password
);
$email_template = emailTemplate('PASSWORD_RECOVERY_COMPLETED');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$address = $accountData[_CLMN_EMAIL_];
$mail->AddAddress($address);
$mail->Subject = $email_titles['PASSWORD_RECOVERY_COMPLETED'];
$mail->MsgHTML($body);
if(!$mail->Send()) {
// could not send email (unknown error)
message('error', lang('error_23',true));
} else {
/* success message */
message('success', lang('success_7',true));
}
} else {
// bad email template, cannot send email (unknown error)
message('error', lang('error_23',true));
}
} else {
message('error', lang('error_23',true));
}
} else {
message('error', lang('error_31',true));
}
} else {
message('error', lang('error_31',true));
}
} else {
message('error', lang('error_31',true));
}
} else {
message('error', lang('error_31',true));
}
} else {
message('error', lang('error_31',true));
}
}
public function masterKeyRecoveryProcess($user_id) {
global $dB,$dB2,$_COOKIE;
if(check_value($user_id)) {
if(!check_value($_COOKIE['webengine_masterkey'])) {
$accountData = $this->accountInformation($user_id);
if(check_value($accountData[_CLMN_MASTER_KEY_])) {
if(!$this->accountOnline($accountData[_CLMN_USERNM_])) {
/* send email with new password */
$username = $accountData[_CLMN_USERNM_];
$email_titles = config('email_titles',true);
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array('{USERNAME}','{CURRENT_MASTERKEY}');
$email_replace = array($username,$accountData[_CLMN_MASTER_KEY_]);
$email_template = emailTemplate('MASTER_KEY_RECOVERY');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$address = $accountData[_CLMN_EMAIL_];
$mail->AddAddress($address);
$mail->Subject = $email_titles['MASTER_KEY_RECOVERY'];
$mail->MsgHTML($body);
if(!$mail->Send()) {
// could not send email (unknown error)
message('error', lang('error_23',true));
} else {
/* success message */
message('success', lang('success_16',true));
/* set cookie for request limit */
setcookie("webengine_masterkey", $username, time()+3600); /* expire in 1 hour */
}
} else {
// bad email template, cannot send email (unknown error)
message('error', lang('error_23',true));
}
} else {
message('error', lang('error_14',true));
}
} else {
message('error', lang('error_49',true));
}
} else {
message('error', lang('error_50',true));
}
} else {
message('error', lang('error_23',true));
}
}
public function emailExists($email) {
global $dB,$dB2;
if(!Validator::Email($email)) { $error = true; }
if(!$error) {
$query = "SELECT * FROM "._TBL_MI_." WHERE "._CLMN_EMAIL_." = '$email'";
if(config('SQL_USE_2_DB',true)) {
$check = $dB2->query_fetch_single($query);
} else {
$check = $dB->query_fetch_single($query);
}
if(is_array($check)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public function userExists($username) {
global $dB,$dB2;
if(!Validator::UsernameLength($username)) { $error = true; }
if(!Validator::AlphaNumeric($username)) { $error = true; }
if(!$error) {
$query = "SELECT * FROM "._TBL_MI_." WHERE "._CLMN_USERNM_." = '$username'";
if(config('SQL_USE_2_DB',true)) {
$check = $dB2->query_fetch_single($query);
} else {
$check = $dB->query_fetch_single($query);
}
if(is_array($check)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public function validateUser($username,$password) {
global $dB,$dB2;
if(!Validator::UsernameLength($username)) { $error = true; }
if(!Validator::AlphaNumeric($username)) { $error = true; }
if(!Validator::PasswordLength($password)) { $error = true; }
if(!$error) {
$query = "SELECT * FROM "._TBL_MI_." WHERE "._CLMN_USERNM_." = '$username' AND "._CLMN_PASSWD_." ='$password'";
if(config('SQL_USE_2_DB',true)) {
$check = $dB2->query_fetch_single($query);
} else {
$check = $dB->query_fetch_single($query);
}
if(is_array($check)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public function retrieveUserID($username) {
global $dB,$dB2;
if(!Validator::UsernameLength($username)) { $error = true; }
if(!Validator::AlphaNumeric($username)) { $error = true; }
if(!$error) {
$query = "SELECT "._CLMN_MEMBID_." FROM "._TBL_MI_." WHERE "._CLMN_USERNM_." = '$username'";
if(config('SQL_USE_2_DB',true)) {
$data = $dB2->query_fetch_single($query);
} else {
$data = $dB->query_fetch_single($query);
}
if(is_array($data)) {
return $data[_CLMN_MEMBID_];
} else {
return null;
}
} else {
return null;
}
}
public function retrieveUserIDbyEmail($email) {
global $dB,$dB2;
if($this->emailExists($email)) {
$query = "SELECT "._CLMN_MEMBID_." FROM "._TBL_MI_." WHERE "._CLMN_EMAIL_." = '$email'";
if(config('SQL_USE_2_DB',true)) {
$data = $dB2->query_fetch_single($query);
} else {
$data = $dB->query_fetch_single($query);
}
if(is_array($data)) {
return $data[_CLMN_MEMBID_];
} else {
return null;
}
} else {
return null;
}
}
public function accountInformation($id) {
global $dB,$dB2;
if(!Validator::Number($id)) { $error = true; }
if(!$error) {
$query = "SELECT * FROM "._TBL_MI_." WHERE "._CLMN_MEMBID_." = '$id'";
if(config('SQL_USE_2_DB',true)) {
$data = $dB2->query_fetch_single($query);
} else {
$data = $dB->query_fetch_single($query);
}
if(is_array($data)) {
return $data;
} else {
return false;
}
} else {
return false;
}
}
public function accountOnline($username) {
global $dB,$dB2;
if(!Validator::UsernameLength($username)) { $error = true; }
if(!Validator::AlphaNumeric($username)) { $error = true; }
if(!$error) {
$query = "SELECT "._CLMN_CONNSTAT_." FROM "._TBL_MS_." WHERE "._CLMN_USERNM_." = '$username'";
if(config('SQL_USE_2_DB',true)) {
$data = $dB2->query_fetch_single($query);
} else {
$data = $dB->query_fetch_single($query);
}
if(is_array($data)) {
if($data[_CLMN_CONNSTAT_] == 1) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
public function changePassword($id,$username,$new_password) {
global $dB,$dB2;
if(!Validator::Number($id)) { $error = true; }
if(!Validator::UsernameLength($username)) { $error = true; }
if(!Validator::AlphaNumeric($username)) { $error = true; }
if(!Validator::PasswordLength($new_password)) { $error = true; }
if(!$error) {
$query = "UPDATE "._TBL_MI_." SET "._CLMN_PASSWD_." ='$new_password' WHERE "._CLMN_MEMBID_." = '$id'";
if(config('SQL_USE_2_DB',true)) {
$change_password = $dB2->query($query);
} else {
$change_password = $dB->query($query);
}
if($change_password) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public function addPasswordChangeRequest($user_id,$new_password,$auth_code) {
global $dB;
if(check_value($user_id) && check_value($new_password)) {
if(Validator::PasswordLength($new_password)) {
$data = array(
$user_id,
Encode($new_password),
$auth_code,
time()
);
$add_request = $dB->query("INSERT INTO "._TBL_CHANGEPASSWORD_REQUEST_." (user_id,new_password,auth_code,request_date) VALUES (?, ?, ?, ?)", $data);
if($add_request) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
public function hasActivePasswordChangeRequest($user_id) {
global $dB;
$check = $dB->query_fetch_single("SELECT * FROM "._TBL_CHANGEPASSWORD_REQUEST_." WHERE user_id = '$user_id'");
if(is_array($check)) {
$request_timeout = mconfig('change_password_request_timeout') * 3600;
$request_date = $check['request_date'] + $request_timeout;
if(time() > $request_date) {
$this->removePasswordChangeRequest($user_id);
return false;
} else {
return true;
}
} else {
return false;
}
}
public function removePasswordChangeRequest($user_id) {
global $dB;
$query = $dB->query("DELETE FROM "._TBL_CHANGEPASSWORD_REQUEST_." WHERE user_id = '$user_id'");
if($query) {
return true;
} else {
return false;
}
}
public function generatePasswordChangeVerificationURL($user_id,$auth_code) {
$build_url = __BASE_URL__;
$build_url .= 'verifyemail/';
$build_url .= '?op='; // operation
$build_url .= Encode_id(1);
$build_url .= '&uid=';
$build_url .= Encode_id($user_id);
$build_url .= '&ac=';
$build_url .= Encode_id($auth_code);
return $build_url;
}
public function addCredits($userid,$amount,$check_online=true,$custom=false,$custom_database="MuOnline",$custom_table="MEMB_INFO",$custom_column="cspoints",$column_user="memb___id",$custom_user_identifier=1) {
global $dB,$dB2;
// Filters
if(!check_value($userid)) { return; }
if(!check_value($amount)) { return; }
if(!Validator::Number($amount)) { return; }
if(!Validator::Number($userid)) { return; }
// retrieve account data
$accountData = $this->accountInformation($userid);
if(!is_array($accountData)) { return; }
// Online Check
if($check_online) {
if($this->accountOnline($accountData[_CLMN_USERNM_])) {
return;
}
}
if(!$custom) {
// REGULAR CREDITS SEND
if(config('add_credits_to_temp',true)) {
$query = "UPDATE "._TBL_MI_." SET "._CLMN_CREDITS_TEMP_." = "._CLMN_CREDITS_TEMP_." + $amount WHERE "._CLMN_MEMBID_." = '$userid'";
} else {
$query = "UPDATE "._TBL_MI_." SET "._CLMN_CREDITS_." = "._CLMN_CREDITS_." + $amount WHERE "._CLMN_MEMBID_." = '$userid'";
}
if(config('SQL_USE_2_DB',true)) {
$reward = $dB2->query($query);
} else {
$reward = $dB->query($query);
}
if($reward) {
return true;
}
} else {
// CUSTOM CREDITS SEND
// custom database
switch($custom_database) {
case "MuOnline":
$dataBase = $dB;
break;
case "Me_MuOnline":
$dataBase = $dB2;
break;
default:
$dataBase = $dB;
break;
}
// build query
$query = "UPDATE $custom_table SET $custom_column = $custom_column + ? WHERE $column_user = ?";
// user identifier
if($custom_user_identifier == 1) {
$userIdentifier = $accountData[_CLMN_USERNM_];
} else {
$userIdentifier = $userid;
}
// run query
$reward = $dataBase->query($query, array($amount, $userIdentifier));
if($reward) {
return true;
}
}
}
public function substractCredits($userid,$amount) {
global $dB,$dB2;
if(check_value($userid) && check_value($amount) && Validator::Number($amount) && Validator::Number($userid)) {
$userData = $this->accountInformation($userid);
if(is_array($userData)) {
$accountCredits = $userData[_CLMN_CREDITS_];
if($accountCredits >= $amount) {
$query = "UPDATE "._TBL_MI_." SET "._CLMN_CREDITS_." = "._CLMN_CREDITS_." - $amount WHERE "._CLMN_MEMBID_." = $userid";
if(config('SQL_USE_2_DB',true)) {
$deduct = $dB2->query($query);
} else {
$deduct = $dB->query($query);
}
if($deduct) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
} else {
// unknown error (incomplete data) or reward amount is not number
return false;
}
}
public function blockAccount($userid) {
global $dB,$dB2;
if(check_value($userid) && Validator::Number($userid)) {
$query = "UPDATE "._TBL_MI_." SET "._CLMN_BLOCCODE_." = 1 WHERE "._CLMN_MEMBID_." = '$userid'";
if(config('SQL_USE_2_DB',true)) {
$block = $dB2->query($query);
} else {
$block = $dB->query($query);
}
if($block) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public function paypal_transaction($transaction_id,$user_id,$payment_amount,$paypal_email,$order_id) {
global $dB;
if(check_value($transaction_id) && check_value($user_id) && check_value($payment_amount) && check_value($paypal_email) && check_value($order_id)) {
if(Validator::Number($user_id)) {
$data = array(
$transaction_id,
$user_id,
$payment_amount,
$paypal_email,
time(),
1,
$order_id
);
$add = $dB->query("INSERT INTO "._TBL_PAYPAL_." (transaction_id, user_id, payment_amount, paypal_email, transaction_date, transaction_status, order_id) VALUES (?, ?, ?, ?, ?, ?, ?)", $data);
if($add) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
public function paypal_transaction_reversed_updatestatus($order_id) {
global $dB;
if(check_value($order_id)) {
$update = $dB->query("UPDATE "._TBL_PAYPAL_." SET transaction_status = 0 WHERE order_id = '$order_id'");
if($update) {
return true;
} else {
return false;
}
} else {
return false;
}
}
function addRewardItem($character_name,$item_data_array) {
global $dB;
if(check_value($character_name) && check_value($item_data_array) && is_array($item_data_array)) {
$data = array(
$character_name,
$item_data_array[0],
$item_data_array[1],
$item_data_array[2],
$item_data_array[3],
$item_data_array[4],
$item_data_array[5],
$item_data_array[6],
$item_data_array[7],
$item_data_array[8],
$item_data_array[9]
);
$addItems = $dB->query("INSERT INTO "._TBL_REWARD_ITEM_." (name,iGroup,iIndex,iLevel,iDur,iLuck,iSkill,iExc,iSet,iSock,iOpt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", $data);
if($addItems) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public function retrieveAccountIPs($username) {
global $dB;
if(check_value($username)) {
if($this->userExists($username)) {
$query = $dB->query_fetch("SELECT IP FROM "._TBL_LOGEX_." WHERE AccountId = '$username' GROUP BY IP");
if(is_array($query)) {
return $query;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
public function generateAccountRecoveryCode($user_id,$username) {
if(check_value($user_id) && check_value($username)) {
return md5($user_id . $username . config('encryption_hash',true) . date("m-d-Y"));
} else {
return null;
}
}
public function generateAccountRecoveryLink($user_id,$email,$recovery_code) {
if(check_value($user_id) && check_value($recovery_code)) {
$user_id_encoded = Encode($user_id);
$email_encoded = Encode($email);
$build_url = __BASE_URL__;
$build_url .= 'forgotpassword/';
$build_url .= '?ui=';
$build_url .= $user_id_encoded;
$build_url .= '&ue=';
$build_url .= $email_encoded;
$build_url .= '&key=';
$build_url .= $recovery_code;
return $build_url;
} else {
return false;
}
}
public function updateVipTimeStamp($userid,$new_timestamp) {
global $dB,$dB2;
$query = "UPDATE "._TBL_MI_." SET "._CLMN_VIP_STAMP_." = '$new_timestamp' WHERE "._CLMN_MEMBID_." = '$userid'";
if(config('SQL_USE_2_DB',true)) {
$update = $dB2->query($query);
} else {
$update = $dB->query($query);
}
if($update) {
return true;
} else {
return false;
}
}
private function sendWelcomeEmail($username,$email) {
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array('{USERNAME}');
$email_replace = array($username);
$email_template = emailTemplate('WELCOME_EMAIL');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$mail->AddAddress($email);
$email_titles = config('email_titles',true);
$mail->Subject = $email_titles['WELCOME_EMAIL'];
$mail->MsgHTML($body);
$mail->Send();
}
}
private function createRegistrationVerification($username,$password,$email) {
global $dB;
$key = uniqid();
$query = $dB->query("INSERT INTO WEBENGINE_REGISTER_ACCOUNT (registration_account,registration_password,registration_email,registration_date,registration_ip,registration_key) VALUES (?,?,?,?,?,?)", array($username, Encode($password), $email, time(), $_SERVER['REMOTE_ADDR'], $key));
if($query) {
return $key;
}
}
private function sendRegistrationVerificationEmail($username,$email,$key) {
$verificationLink = __BASE_URL__.'verifyemail/?op='.Encode_id(2).'&user='.Encode($username).'&key='.$key;
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array('{USERNAME}','{LINK}');
$email_replace = array($username,$verificationLink);
$email_template = emailTemplate('WELCOME_EMAIL_VERIFICATION');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$mail->AddAddress($email);
$email_titles = config('email_titles',true);
$mail->Subject = $email_titles['WELCOME_EMAIL_VERIFICATION'];
$mail->MsgHTML($body);
$mail->Send();
}
}
public function verifyRegistrationProcess($username,$key) {
global $dB,$dB2;
$verifyKey = $dB->query_fetch_single("SELECT * FROM WEBENGINE_REGISTER_ACCOUNT WHERE registration_account = ? AND registration_key = ?", array($username,$key));
if($verifyKey && is_array($verifyKey)) {
// create account
$info = array($verifyKey['registration_account'], Decode($verifyKey['registration_password']), 'test', '111111111111', '0', '0', '1', $verifyKey['registration_email'], date('m/d/Y'), date('m/d/Y'), '2005-01-03', '2005-01-03', '1', md5($verifyKey['registration_account']));
$query = "INSERT INTO "._TBL_MI_." (memb___id, memb__pwd, memb_name, sno__numb, bloc_code, ctl1_code, mail_chek, mail_addr, appl_days, modi_days, out__days, true_days, confirmed, activation_id) VALUES ('".$info[0]."', [dbo].[fn_md5]('".$info[1]."','".$info[0]."'), '".$info[2]."', '".$info[3]."', '".$info[4]."', '".$info[5]."', '".$info[6]."', '".$info[7]."', '".$info[8]."', '".$info[9]."', '".$info[10]."', '".$info[11]."', '".$info[12]."', '".$info[13]."')";
if(config('SQL_USE_2_DB',true)) {
$register_account = $dB2->query($query);
} else {
$register_account = $dB->query($query);
}
if($register_account) {
// delete verification
$this->deleteRegistrationVerification($username);
// send welcome email
$this->sendWelcomeEmail($verifyKey['registration_account'],$verifyKey['registration_email']);
// success message
message('success', 'welcome!');
redirect(2,'login/',5);
} else {
message('error', 'some error');
}
} else {
redirect();
}
}
private function deleteRegistrationVerification($username) {
global $dB;
$delete = $dB->query("DELETE FROM WEBENGINE_REGISTER_ACCOUNT WHERE registration_account = ?", array($username));
if($delete) {
return true;
}
}
// Check if an username exists in the email verification system
private function checkUsernameEVS($username) {
global $dB;
$result = $dB->query_fetch_single("SELECT * FROM WEBENGINE_REGISTER_ACCOUNT WHERE registration_account = ?", array($username));
if($result && is_array($result)) {
loadModuleConfigs('register');
$timelimit = $result['registration_date']+mconfig('verification_timelimit')*60*60;
if($timelimit < time()) {
$this->deleteRegistrationVerification($username);
return false;
} else {
return true;
}
}
}
// Check if an email exists in the email verification system
private function checkEmailEVS($email) {
global $dB;
$result = $dB->query_fetch_single("SELECT * FROM WEBENGINE_REGISTER_ACCOUNT WHERE registration_email = ?", array($email));
if($result && is_array($result)) {
loadModuleConfigs('register');
$timelimit = $result['registration_date']+mconfig('verification_timelimit')*60*60;
if($timelimit < time()) {
$this->deleteRegistrationVerification($result['registration_account']);
return false;
} else {
return true;
}
}
}
public function isIpBlocked($ip) {
global $dB;
if(Validator::Ip($ip)) {
$check = $dB->query_fetch_single("SELECT * FROM WEBENGINE_BLOCKED_IP WHERE block_ip = ?", array($ip));
if($check && is_array($check)) {
return true;
}
}
}
public function blockIpAddress($ip,$user) {
global $dB;
if(!check_value($user)) { return; }
if(!$this->isIpBlocked($ip)) {
$block = $dB->query("INSERT INTO WEBENGINE_BLOCKED_IP (block_ip,block_by,block_date) VALUES (?,?,?)", array($ip,$user,time()));
if($block) {
return true;
}
}
}
public function retrieveBlockedIPs() {
global $dB;
return $dB->query_fetch("SELECT * FROM WEBENGINE_BLOCKED_IP ORDER BY id DESC");
}
public function unblockIpAddress($id) {
global $dB;
$unblock = $dB->query("DELETE FROM WEBENGINE_BLOCKED_IP WHERE id = ?", array($id));
if($unblock) {
return 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));
$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));
}
private function changeEmailVerificationMail($userName, $emailAddress, $newEmail, $verificationLink, $ipAddress) {
$mail = new PHPMailer();
$smtpCONF = gconfig('smtp',true);
if($smtpCONF['active']) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $smtpCONF['smtp_host'];
$mail->Port = $smtpCONF['smtp_port'];
$mail->Username = $smtpCONF['smtp_user'];
$mail->Password = $smtpCONF['smtp_pass'];
}
$email_strings = array('{USERNAME}', '{IP_ADDRESS}', '{NEW_EMAIL}', '{LINK}');
$email_replace = array($userName, $ipAddress, $newEmail, $verificationLink);
$email_template = emailTemplate('CHANGE_EMAIL_VERIFICATION');
if($email_template) {
$build_template = replaceMultiTextStrings($email_template,$email_strings,$email_replace);
$body = $build_template;
$mail->SetFrom(config('email_send_from',true), config('email_send_from_name',true));
$mail->AddAddress($emailAddress);
$email_titles = config('email_titles',true);
$mail->Subject = $email_titles['CHANGE_EMAIL_VERIFICATION'];
$mail->MsgHTML($body);
if($mail->Send()) {
return 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));
}
private function updateEmail($userId, $newEmail) {
global $dB,$dB2;
if(!Validator::UnsignedNumber($userId)) return;
if(!Validator::Email($newEmail)) return;
$query = "UPDATE "._TBL_MI_." SET "._CLMN_EMAIL_." = ? WHERE "._CLMN_MEMBID_." = ?";
if(config('SQL_USE_2_DB',true)) {
$run = $dB2->query($query, array($newEmail, $userId));
} else {
$run = $dB->query($query, array($newEmail, $userId));
}
if(!$run) return;
return true;
}
}
?>
hello guys, thanks, system work perfectly ! :)
what table and column for PK Rank?
thanks.
Please release php.ini from xampp!!! Server offline :(
SOMEONE CAN HELM ME ?? :( HOW TO EDIT INFORMATION ON SERVER STATS? #premium templates
http://s28.postimg.org/vgdev66r1/serverstats.jpg
how to fix Online Ranking?? because there are no ranking online in site but there was a online ingame
and how to fix the server time in site because i can't see any time it will see 00:00:00
http://i60.tinypic.com/160t2d4.png
http://i59.tinypic.com/2rnknkx.png
http://i58.tinypic.com/2q21wzl.png
- - - Updated - - -
and also how to make the CS banner will updated every seconds???
ERROR: The Administrator has disabled new registrations.
how enable>?
on website Online Hours what formula did website because in SQL its not Hours count i thin its minutes?....
Hello, please help is problem in ranking
Warning: Invalid argument supplied for foreach() in C:\misitio\www\modules\rankings\level.php on line 33
Thx.
can we use Mucore module for this?
after trying this webfile why my xamp has too slow to load the webpage..even i already change the file back to mucore. same result 1minute more or less to load T_T any idea?
Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\index.php on line 85
bro mine is not working .. take a look .. :( help
http://s14.postimg.org/llyuzyff5/1212.jpg
Hello 4FUNer, the possibility of adding system reset, ie number of points x amount of resets ???
From already thank you for the help.
Hello 4FUNer, there any requirement to display the logo of castle mow such as having alliance or simply run cron.
From already thank you for the help.
Hi, the only thing that fails me is the logo of the clan does not leave me anything any suggestions par ???
can we use Mucore module for this?
exist the ability to add libraries mssql
how to set the cron job in every seconds?
Attachment 147989
Can't run SQL query on mysql server 2000 ? how to running sql ? , please help me
no support sql 2000 bro try sql 2005
Warning: Invalid argument supplied for foreach() in H:\xampp\htdocs\modules\news.php on line 84
H:\lampp\htdocs\cron>H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\cron.php
MIB search path: c:/usr/share/snmp/mibs
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)
When I try to execute "cro.bat" I got this:
"php.exe entry point not found"
"The procedure entry point _object_and_propreties_int could not be located in the dynamic link library php4ts.dll"
http://i.imgur.com/dBLU1Qu.png
"cant find the procedure"
http://i.imgur.com/xHRpk9t.png
What I have to do? O.o
http://i.imgur.com/En9nGtL.png
ERROR: Could not load requested rankings.
How do i fix?
Win7
SQL2008r2
Now, with no erros the cro.bat pops this mensage and closesQuote:
Originally Posted by Jake023;8226091
comment
;extension=php_mssql.dll
.
uncomment
extension=php_pdo_odbc.dll
config.php
$config['SQL_PDO_DRIVER'
http://i.imgur.com/Mf3jfWB.png
Still cant login:
http://i.imgur.com/HA8VivM.png
I'm using SQL2000, any problem? Its REALLY necessary use thoses SQL files on my DB? Most of them return erros and not complet the action.
I'll can enter on the adincp if I run them? :(
Thanks in advance bro!
MD5 problem
yes LOL you should run
I'll install SQL2008 and come back with more info soon
kkkkkkk
Hello ScriptKid,
I alredy installed the SQL2008 and still getting the same error on website.
http://i.imgur.com/dmG8vgE.png
As you can see, my server is running perfectly, and all SQL scripts was run.
http://i.imgur.com/nyFlJvk.png
What I supposed to do now? I have no more ideas.
Thanks again!
Well peers that have the same error 404 when trying to access the admincp anyone knows the solution?, I've been trying to figure out days and seen a lot about speakers would help me solve my problem, I would be very grateful
PD: Sorry for my bad English
Why dont you use Template Posted at the First post..
admin panel should work perfect mate .
- - - Updated - - -
and now im finally get rid of cron thankyou mate for the info
my cron.php is not run correctly so i manage to add it all to cron.bat then execute ranking work perfect
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\cron.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\gens_ranking.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\castle_siege.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\grandresets_ranking.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\guilds_ranking.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\killers_ranking.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\levels_ranking.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\masterlevel_ranking.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\online_ranking.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\pvplaststand_ranking.php
H:\xampp\php\php.exe -f H:\xampp\htdocs\cron\resets_ranking.php
Still waiting for solution about a login error, guys. :/: