Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- __ ___ ___ ___ __ ___ __ __ ___ __ __ ___ __
- /__` |__ | |__ |__ |__) \_/ | | | | | |__ |__) /__` |__ |__) \ / | / ` |__ /__`
- .__/ |___ | | |___ | \ / \ | | | |/\| |___ |__) .__/ |___ | \ \/ | \__, |___ .__/
- */
- class GlobalSettings{
- /*
- Lord, Maraming salamat po palagi sa inyong Wisdom na inyong ipinapahiram sa amin ^_^.
- Nawa po ay patuloy nyo pa po kaming mas pag-palain pa po, sa proyekto pong ito,
- akin pong ipapaubaya na po sa inyo kung ano po ang maging kakahantungan po nito.
- Nawa'y ilayo nyo po kami sa masasamang loob at nagtatangkang mang-gulo po sa aming buhay.
- Sa mga nagkasala po sa amin ay amin po silang patatawarin gaya ng pagpapatawad nyo po sa amin.
- Maraming salamat po!
- Glory to God in the Highest!
- In Jesus name, I give you thanks, praise and worship,
- Amen.
- Eliezer S. Rabadon (SeiferXIII)
- Signed: 01/15/16
- */
- /* BEGIN DATABASE SETTINGS */
- protected $blazedex_sql = array(
- 'dbaddress' => 'RAN-PC\SQLEXPRESS', // db host //done this
- 'dbuser' => 'sa', // database username //done this
- 'dbpass' => '123' // database password //done this
- );
- public $bd_sql = array(
- 'db1' => 'SeiferCP', //done this
- 'db2' => 'RanGame1', //done this
- 'db3' => 'RanShop', //done this
- 'db4' => 'RanUser' //done this
- );
- /* END DATABASE SETTINGS */
- /* BEGIN DEFINITIONS */
- public $def = array(
- 'admin_username' => array('test123','test123'),//admin username and admin password //done this
- 'server_name' => 'Server Name', // servername
- 'server_website' => 'localhost/index.php', // website link
- 'server_motto' => '',
- 'EPoints_Name' => 'E-Points',
- 'GameTime_Column' => 'GameTime2',
- 'Kills_Columns' => 'P.ChaPkWin+P.ChaKills',
- 'Death_Columns' => 'P.ChaPkLoss',
- 'Referral_Advertisement' => '
- ',
- 'about_html' => '
- ',
- 'footer' => '© 2018 Ran Online Ph.',
- 'maintenance_page' => 'Website is currently not available, please stand2by.',
- 'avatar_type' => 'identicon', //identicon , wavatar, mm, monesterid, 404, retro, blank - powered by gravatar
- );
- /* END DEFINITIONS */
- /* BEGIN OPTIONS */
- public $options = array(
- /******* BEGIN TEARHEAR CP INTEGRATION *******/
- 'is_tearhear18_migrate' => array(
- 'activated' => false,
- 'webSite' => 'webSite'
- ),
- /******* END TEARHEAR CP INTEGRATION *******/
- /* BEGIN CORE OPTIONS */
- 'is_md5' => true, //Enable/Disable MD5 Encryption on password
- 'display_onlinecount' => false, //Display Online Count?
- 'maintenance_mode' => false, //Is Website Online?
- 'serverinfo_newsid' => 6, //News ID of the Server Information Page
- 'howtodonate_newsid' => 4, //News ID of How to Donation Page
- 'enable_logs' => true, //Log actions of the user (buy,topup,change credentials, etc.)
- /* END CORE OPTIONS */
- /* BEGIN RAN Web Core Functions */
- 'enable_changepass' => true, //Is password change enabled?
- 'enable_chadelete' => true, //Web based Character Deletion
- 'enable_changepin' => true, //Is pincode change enabled?
- 'enable_changeemail' => true, //Is email change enabled?
- 'enable_topup' => true, //Is topup system enabled?
- 'enable_connectedfix' => false, //Is connectedfix system enabled?
- 'enable_webmarket' => true, //Is webmarket system enabled?
- /* END RAN Web Core Functions */
- /* BEGIN Referral System */
- 'referral' => array(
- 'activated' => false, //Is referral system enabled?
- 'comission' => 0.05 //5% Referral Bonus once the reffered user has topped up.
- ),
- 'shopbonus' => array(
- 'activated' => false, //Is icafe shop bonus system enabled?
- 'comission' => 0.02 //2% Referral Bonus to the shop owner and the player who topped up once the player has input the icafe code when they topped up.
- ),
- 'enable_shopbonus' => true, //Is iCafe Shop Bonus enabled?
- /* END Referral System */
- /* BEGIN Points Conversion */
- 'ep2vp' => array(
- 'activated' => true, //Is EP to VP system enabled?
- 'ep2vp_minimum' => 20,
- 'ep2vp_rate' => 1
- /* 1 EP = 1 VP */
- ),
- 'vp2ep' => array(
- 'activated' => true, //Is VP to EP system enabled?
- 'vp2ep_minimum' => 20,
- 'vp2ep_rate' => 1
- /* 1 VP = 1 EP */
- ),
- 'gt2vp' => array(
- 'activated' => true, //Is GameTime to VP system enabled?
- 'gt2vp_minimum' => 60, //Minimum Minutes that can be converted
- 'gt2vp_rate' => 2,
- /* 90 Minutes = 1VP */
- ),
- /* END Points Conversion */
- /* BEGIN Private Server Core Functions */
- 'changeschool_system' => array(
- 'activated' => true, //Is Change School system enabled?
- 'cooldown' => 5, //How many days?
- 'fee' => 0, //how much?
- 'currency' => 'ep' //vp or ep or gold
- ),
- 'resetstats_system' => array(
- 'activated' => true, //Is Reset Stats system enabled?
- 'fee' => 0, //how much?
- 'currency' => 'ep' //vp or ep or gold
- ),
- 'is_reborn_server' => false, //Enable/Disable Reborn Rankings
- 'reborn' => array (
- 'activated' => false, //Does your server has reborn system?
- 'rb1' => array(
- 'activated' => false,
- 'level_req' => 170,
- 'fee' => 1000000,
- 'from' => 0,
- 'to' => 20,
- 'stats_reward' => 100
- ),
- 'rb2' => array(
- 'activated' => false,
- 'level_req' => 180,
- 'fee' => 2000000,
- 'from' => 21,
- 'to' => 30,
- 'stats_reward' => 120
- ),
- 'rb3' => array(
- 'activated' => false,
- 'level_req' => 190,
- 'fee' => 3000000,
- 'from' => 31,
- 'to' => 40,
- 'stats_reward' => 130
- ),
- 'rb4' => array(
- 'activated' => false,
- 'level_req' => 200,
- 'fee' => 4000000,
- 'from' => 41,
- 'to' => 50,
- 'stats_reward' => 150
- ),
- ),
- 'vote' => array(
- 'activated' => true,
- 'vote_level_req' => 200, //Level Requirement - Voting System
- 'ip_filter' => false,
- 'vote_every' => 12, //12 hours
- 'reward' => 2,
- 'portal_1' => array(
- 'activated' => false,
- 'topsite_name' => 'GTop 100',
- 'image' => 'http://l2deathland.com/display/images/vote/gtop100.jpg',
- 'link' => "http://www.gtop100.com/topsites/Ran-Online/sitedetails/Strife-Ran-Online-89904?vote=1",
- ),
- 'portal_2' => array(
- 'activated' => true,
- 'topsite_name' => 'ArenaTop 100',
- 'image' => 'http://www.arena-top100.com/images/arena-top100.png',
- 'link' => "http://www.arena-top100.com/index.php?a=in&u=antediluvian2016",
- ),
- 'portal_3' => array(
- 'activated' => true,
- 'topsite_name' => 'GameSama',
- 'image' => 'http://topsite.gamesama.com/votebutton.png',
- 'link' => "http://topsite.gamesama.com/profile/161",
- ),
- 'portal_4' => array(
- 'activated' => true,
- 'topsite_name' => 'XtremeTop 100',
- 'image' => 'http://www.xtremetop100.com/votenew.jpg',
- 'link' => "http://www.xtremetop100.com/in.php?site=1132358737",
- ),
- 'portal_5' => array(
- 'activated' => true,
- 'topsite_name' => 'TopOfGames',
- 'image' => 'http://ic.pics.livejournal.com/samaritanyn/10860637/47879/47879_original.gif',
- 'link' => "http://gamesama.com",
- ),
- )
- /* END Private Server Core Functions */
- );
- /* END OPTIONS */
- /* BEGIN ACTIVE SHOP */
- public $activeshop = array(
- 'voteshop' => true,
- 'premiumshop' => true
- );
- /* END ACTIVE SHOP */
- /* BEGIN SHOP CATEGORIES */
- public $shop_ctg = array(
- 'Weapons',
- 'Accessories',
- 'Costumes',
- 'Pet System',
- 'EXP',
- 'Cards',
- 'Enhancements'
- );
- /* BEGIN MAX VALUES */
- public $maxvalue = array(
- 'max_topnews' => 5, //Maximum Top News
- 'max_toprank' => 5, //Maximum Top Rank
- 'max_rankall' => 50, //Maximum Top Rank All
- );
- /* END MAX VALUES */
- /* BEGIN ACTIVE CLASS */
- public $activeclass = array(
- 'brawler' => true,
- 'swordsman' => true,
- 'archer' => true,
- 'shaman' => true,
- 'extreme' => false,
- 'gunner' => false,
- 'assassin' => false,
- 'magician' => false
- );
- /* END ACTIVE CLASS */
- /* BEGIN SOCIAL MEDIA */
- public $social = array(
- 'display_social' => true,
- 'facebook' => 'http://facebook.com/',
- 'twitter' => '',
- 'youtube' => '',
- 'twitch' => '',
- 'steam' => '',
- 'fbgroup' => ''
- );
- /* END SOCIAL MEDIA */
- function setOpenGraph(){
- echo '
- <meta property="og:type" content="article">
- <meta property="og:title" content="content">
- <meta property="og:description" content="content">
- <meta name="author" content="">
- <meta property="article:author" content="" />
- ';
- }
- /***********************************************************************************************************************************************************
- ***********************************************************************************************************************************************************
- -----------------------------------------------------------------------------------------------------------------------------------------------------------
- Editing the source code below may cause major disturbance on your website. Please DO NOT Modify things beyond this line.
- -----------------------------------------------------------------------------------------------------------------------------------------------------------
- .______ ___________ ____ ______ .__ __. _______ .___________. __ __ __ _______. __ __ .__ __. _______
- | _ \ | ____\ \ / / / __ \ | \ | | | \ | || | | | | | / | | | | | | \ | | | ____|
- | |_) | | |__ \ \/ / | | | | | \| | | .--. | `---| |----`| |__| | | | | (----` | | | | | \| | | |__
- | _ < | __| \_ _/ | | | | | . ` | | | | | | | | __ | | | \ \ | | | | | . ` | | __|
- | |_) | | |____ | | | `--' | | |\ | | '--' | | | | | | | | | .----) | | `----.| | | |\ | | |____ __
- |______/ |_______| |__| \______/ |__| \__| |_______/ |__| |__| |__| |__| |_______/ |_______||__| |__| \__| |_______(_ )
- |/
- _______ ______ .__ __. ______ .___________. .___ ___. ______ _______ __ ___________ ____
- | \ / __ \ | \ | | / __ \ | | | \/ | / __ \ | \ | | | ____\ \ / /
- | .--. | | | | | \| | | | | | `---| |----` | \ / | | | | | | .--. || | | |__ \ \/ /
- | | | | | | | | . ` | | | | | | | | |\/| | | | | | | | | || | | __| \_ _/
- | '--' | `--' | | |\ | | `--' | | | | | | | | `--' | | '--' || | | | | |
- |_______/ \______/ |__| \__| \______/ |__| |__| |__| \______/ |_______/ |__| |__| |__|
- -----------------------------------------------------------------------------------------------------------------------------------------------------------
- Editing the source code below may cause major disturbance on your website. Please DO NOT Modify things beyond this line.
- -----------------------------------------------------------------------------------------------------------------------------------------------------------
- YOU HAVE BEEN WARNED.
- ***********************************************************************************************************************************************************
- ***********************************************************************************************************************************************************/
- /* BEGIN SITE PAGES - DO NOT MODIFY! */
- public $SitePages = array(
- 'login',
- 'download',
- 'info',
- 'voteshop',
- 'premiumshop',
- 'rank',
- 'contact',
- 'shop',
- 'resetpass',
- 'register',
- 'news',
- 'donate',
- 'webmarket',
- 'userpanel',
- 'adminpanel'
- );
- /* END SITE PAGES - DO NOT MODIFY! */
- public function getPageName($p)
- {
- if (in_array($p,$this->SitePages))
- {
- switch($p)
- {
- case "login":
- return "Login";
- break;
- case "register":
- return "Register";
- break;
- case "resetpass":
- return "Reset Password";
- break;
- case "rank":
- return "Rankings";
- break;
- case "shop":
- return "ItemShop";
- break;
- case "news":
- return "News";
- break;
- case "userpanel":
- return "User Panel";
- break;
- case "download":
- return "Download";
- break;
- case "info":
- return "Server Info";
- break;
- case "donate":
- return "Donate";
- break;
- case "adminpanel":
- return "Admin Panel";
- break;
- default:
- include "404";
- }
- }
- }
- //Connecting to MsSQL
- public function doSQLConnect(){
- $link = mssql_connect(
- $this->blazedex_sql['dbaddress'],
- $this->blazedex_sql['dbuser'],
- $this->blazedex_sql['dbpass']
- );
- $tx = time();
- $check['updateVoteTime'] = mssql_query("delete from ".$this->bd_sql['db1'].".dbo.VotePanel where lastVoteDate <= '".date('Y-m-d H:i:s', $tx)."'");
- if(!$link) return FALSE;
- else return TRUE;
- }
- public function doLogout(){
- session_start();
- session_destroy(); // ?? Session ???????
- session_start();
- }
- function isLoggedIn(){
- session_start();
- if($_SESSION["___user_"] != NULL && $_SESSION["___pass_"] != NULL) return true;
- else return false;
- }
- function doCheckCaptchaResult($captcha,$ip){
- $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LdhaxITAAAAAOUWL2P9eNMVjGqdgZd0TJF5yFgc&response=".$captcha."&remoteip=".$ip);
- return $response.success;
- }
- public function doRandom($length=11){
- $key = '';
- $pattern = "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5q6r7s8t9u0v1w2x3y4z5";
- for($i=0;$i<$length;$i++){
- $key .= $pattern{rand(5,35)};
- }
- return strtoupper($key);
- }
- public function doLogAction($username,$desc){
- mssql_query("INSERT INTO ".$this->bd_sql[db1].".dbo.LogActionCP (username,description) VALUES ('".$username."','".$desc."') ");
- }
- public function doLogVote($accName, $lastVoteDate, $voteLink, $ip){
- //mssql_query("INSERT INTO ".$this->bd_sql[db1].".dbo.VotePanel (accName, lastVoteDate, voteLink, ip) VALUES ('$accName', DATEADD(hour, + ".$this->options[vote]['vote_every'].", GETDATE())) , '$voteLink', '$ip') ");
- mssql_query("insert into ".$this->bd_sql['db1'].".dbo.VotePanel(accName, lastVoteDate, voteLink, ip) values('".$accName."','".$lastVoteDate."', '".$voteLink."','".$ip."')");
- }
- public function doDeduct($currency,$amount,$chanum=0){
- session_start();
- $currency = (int)$currency;
- $amount = (int)$amount;
- $chanum = (int)$chanum;
- switch($currency)
- {
- case 1: //ep
- $exec = mssql_query(sprintf("UPDATE ".$this->bd_sql[db1].".dbo.Points SET Points = Points - $amount WHERE UserName = '".$_SESSION[___user_]."'"));
- return true;
- break;
- case 2: //vp
- $exec = mssql_query(sprintf("UPDATE ".$this->bd_sql[db1].".dbo.Points SET VPoints = VPoints - $amount WHERE UserName = '".$_SESSION[___user_]."'"));
- return true;
- break;
- case 3: //gold
- if($chanum!=0) $exec = mssql_query(sprintf("UPDATE ".$this->bd_sql[db2].".dbo.ChaInfo SET ChaMoney = ChaMoney - $amount WHERE ChaNum=$chanum and UserNum='".$this->getUserNum_from_username($_SESSION[___user_])."'"));
- return true;
- break;
- case 4: //reborn
- if($chanum!=0) $exec = mssql_query(sprintf("UPDATE ".$this->bd_sql[db2].".dbo.ChaInfo SET ChaReborn = ChaReborn - $amount WHERE ChaNum=$chanum and UserNum='".$this->getUserNum_from_username($_SESSION[___user_])."'"));
- return true;
- break;
- case 5: //gametime
- if($chanum!=0) $exec = mssql_query(sprintf("UPDATE ".$this->bd_sql[db4].".dbo.UserInfo SET ".$this->def['GameTime_Column']." = ".$this->def['GameTime_Column']." - $amount WHERE UserNum='".$this->getUserNum_from_username($_SESSION[___user_])."'"));
- return true;
- break;
- default:
- return false;
- }
- }
- public function getDownload ($quantity=0){
- $i = 0;
- if($quantity==0)$download = mssql_query("SELECT id,date,title,text FROM ".$this->bd_sql['db1'].".dbo.download ORDER BY date DESC");
- else $download = mssql_query("SELECT TOP $quantity id,date,title,text FROM ".$this->bd_sql['db1'].".dbo.download ORDER BY date DESC");
- $downloadlist['count'] =0;
- $downloadlist = array();
- while($download_info = mssql_fetch_array($download)){
- $downloadlist[$i] = array(
- 'id' => $download_info['id'],
- 'dates' => $download_info['date'],
- 'text' => $download_info['text'],
- 'title' => $download_info['title'],
- 'datewhole' => date('m.j.Y', strtotime($download_info['date']))
- );
- $downloadlist['count']++;
- $i++;
- }
- return $downloadlist;
- }
- public function getTopNews ($quantity=0){
- $i = 0;
- if($quantity==0)$news = mssql_query("SELECT id,date,type,title,pin FROM ".$this->bd_sql['db1'].".dbo.news ORDER BY date DESC");
- else $news = mssql_query("SELECT TOP $quantity id,date,type,title,pin FROM ".$this->bd_sql['db1'].".dbo.news ORDER BY date DESC");
- $newslist['count'] =0;
- $newslist = array();
- while($news_info = mssql_fetch_array($news)){
- $newslist[$i] = array(
- 'id' => $news_info['id'],
- 'dates' => $news_info['date'],
- 'type' => $news_info['type'],
- 'title' => $news_info['title'],
- 'date' => strtotime($news_info['date']),
- 'datewhole' => date('m.j.Y', strtotime($news_info['date'])),
- 'newsmonth' => date('m', strtotime($news_info['date'])),
- 'newsday' => date('j', strtotime($news_info['date'])),
- 'pin' => $news_info['pin']
- );
- $newslist['count']++;
- $i++;
- }
- return $newslist;
- }
- public function getLogActionCP ( $count,$username=NULL )
- {
- $loginfo = array();
- $i = 0;
- if($username!=NULL)$get_logaction = mssql_query("SELECT TOP $count username,description,logdate FROM ".$this->bd_sql['db1'].".dbo.LogActionCP WHERE username='$username' ORDER BY logdate desc");
- else $get_logaction = mssql_query("SELECT TOP $count username,description,logdate FROM ".$this->bd_sql['db1'].".dbo.LogActionCP ORDER BY logdate desc");
- if(mssql_num_rows($get_logaction)==0) return false;
- while ( $logact = mssql_fetch_array($get_logaction)){
- $loginfo[$i] = array(
- 'username' => $logact['username'],
- 'description' => $logact['description'],
- 'logdate' => $logact['logdate']
- );
- $loginfo['count']++;
- $i++;
- }
- return $loginfo;
- }
- public function getNewsInfo( $id ){
- $newsinfo = array();
- $get_news = mssql_query("SELECT id,title,text,date,autor FROM ".$this->bd_sql['db1'].".dbo.news where id = $id");
- if(mssql_num_rows($get_news)==0) return false;
- while ($points = mssql_fetch_array($get_news)) {
- $newsinfo = array(
- 'id' => $points[id],
- 'title' => $points[title],
- 'text' => $points[text],
- 'date' => date('m.j.Y', strtotime($points['date'])),
- 'autor' => $points[autor]
- );
- }
- return $newsinfo;
- }
- public function getShopInfo ($quantity=0){
- $i = 0;
- if($quantity==0)$shopinfo = mssql_query("SELECT * FROM ".$this->bd_sql['db1'].".dbo.ShopInfo");
- else $shopinfo = mssql_query("SELECT TOP $quantity * FROM ".$this->bd_sql['db1'].".dbo.ShopInfo");
- $shopinfolist['count'] =0;
- $shopinfolist = array();
- while($shopinfo_info = mssql_fetch_array($shopinfo)){
- $shopinfolist[$i] = array(
- 'id' => $shopinfo_info['ShopName'],
- 'dates' => $shopinfo_info['Owner'],
- 'type' => $shopinfo_info['ShopID'],
- );
- $shopinfolist['count']++;
- $i++;
- }
- return $shopinfolist;
- }
- function getOnlineCount(){
- $get_points = mssql_query("SELECT SUM(ChaOnline) as Online FROM ".$this->bd_sql['db2'].".dbo.ChaInfo where ChaOnline = 1");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[Online];
- }
- }
- function getCurPeak(){
- $get_points = mssql_query("SELECT onlinepeak as Online FROM ".$this->bd_sql['db1'].".dbo.settings where server1 = 0");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[Online];
- }
- }
- function getOnlinePeak(){
- $ol = $this->getOnlineCount();
- $pik = $this->getCurPeak();
- if($ol > $pik)
- {
- $pik = $online;
- $exec = mssql_query(sprintf("UPDATE ".$this->bd_sql[db1].".dbo.settings SET onlinepeak = $pik WHERE server1=0"));
- }
- return $pik;
- }
- function getEP( $username ){
- $get_points = mssql_query("SELECT Points FROM ".$this->bd_sql['db1'].".dbo.Points where UserName = '".$username."'");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[Points];
- }
- }
- function getreferrer( $username ){
- $get_points = mssql_query("SELECT referrer FROM ".$this->bd_sql['db1'].".dbo.Points where referrer = '".$username."'");
- return mssql_num_rows($get_points);
- }
- function getVP( $username ){
- $get_points = mssql_query("SELECT VPoints FROM ".$this->bd_sql['db1'].".dbo.Points where UserName = '".$username."'");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[VPoints];
- }
- }
- function getEMail( $username ){
- $get_points = mssql_query("SELECT UserEmail FROM ".$this->bd_sql['db4'].".dbo.UserInfo where UserName = '".$username."'");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[UserEmail];
- }
- }
- function getUserInfo_Points( $username ){
- $userinfo = array();
- $userinfo['count'] = 0;
- $i=0;
- $get_points = mssql_query("SELECT UserName,Points,VPoints FROM ".$this->bd_sql['db1'].".dbo.Points where UserName like '%".$username."%'");
- while ($points = mssql_fetch_array($get_points)) {
- $userinfo[$i] = array(
- 'UserName' => $points['UserName'],
- 'Points' => $points['Points'],
- 'VPoints' => $points['VPoints'],
- 'UserEmail' => $this->getEMail($points['UserName'])
- );
- $userinfo['count']++;
- $i++;
- }
- return $userinfo;
- }
- function getUserType( $username ){
- $get_points = mssql_query("SELECT UserType FROM ".$this->bd_sql['db4'].".dbo.UserInfo where UserName = '".$username."'");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[UserType];
- }
- }
- function getUserNum_from_username( $username ){
- $get_points = mssql_query("SELECT UserNum FROM ".$this->bd_sql['db4'].".dbo.UserInfo where UserName = '".$username."'");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[UserNum];
- }
- }
- function getUserNum_from_ChaName( $chaname ){
- $get_points = mssql_query("SELECT UserNum FROM ".$this->bd_sql['db2'].".dbo.ChaInfo where ChaName = '".$chaname."'");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[UserNum];
- }
- }
- function getUserName_from_usernum( $usernum ){
- $get_points = mssql_query("SELECT UserName FROM ".$this->bd_sql['db4'].".dbo.UserInfo where UserNum = $usernum");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[UserName];
- }
- }
- function getChaName_from_username( $username ){
- $getname = mssql_query("SELECT ChaName from ".$this->bd_sql['db2'].".dbo.ChaInfo WHERE UserNum=".$this->getUserNum_from_username($username)." ");
- while ($points = mssql_fetch_array($getname)) {
- return $points[ChaName];
- }
- }
- function doInsert2bank( $username, $productnum, $quantity ){
- for($i=0;$i<$quantity;$i++)
- {
- $insert_user = mssql_query("INSERT INTO ".$this->bd_sql[db3].".dbo.ShopPurchase (UserUID,ProductNum) VALUES ('".$username."','".$productnum."') ");
- }
- }
- function getlastip( $username ){
- $get_points = mssql_query("SELECT TOP 1 LogIpAddress FROM ".$this->bd_sql['db4'].".dbo.LogLogin where UserID = '".$username."' AND LogInOut=1 ORDER BY LogDate DESC");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[LogIpAddress];
- }
- }
- function getGuName ( $guild ){
- $get_points = mssql_query("SELECT GuName FROM ".$this->bd_sql['db2'].".dbo.GuildInfo where GuNum = '".$guild."'");
- if(mssql_num_rows($get_points) == 0 ) return "None";
- while ($points = mssql_fetch_array($get_points)) {
- return $points[GuName];
- }
- }
- public function deleteNews($id){
- $id = (int)$id;
- $get_news = mssql_query("SELECT * FROM ".$this->bd_sql['db1'].".dbo.news where id = '$id'");
- while ($dnews = mssql_fetch_array($get_news)) {
- $strSQL = mssql_query("DELETE FROM ".$this->bd_sql['db1'].".dbo.news where id = '$id'");
- }
- return true;
- }
- public function deleteDownload($id){
- $id = (int)$id;
- $get_news = mssql_query("SELECT * FROM ".$this->bd_sql['db1'].".dbo.download where id = '$id'");
- while ($dnews = mssql_fetch_array($get_news)) {
- $strSQL = mssql_query("DELETE FROM ".$this->bd_sql['db1'].".dbo.download where id = '$id'");
- }
- return true;
- }
- public function deleteShopItemMap($id){
- $id = (int)$id;
- $get_news = mssql_query("SELECT * FROM ".$this->bd_sql['db3'].".dbo.ShopItemMap where ProductNum = '$id'");
- while ($dnews = mssql_fetch_array($get_news)) {
- $strSQL = mssql_query("DELETE FROM ".$this->bd_sql['db3'].".dbo.ShopItemMap where ProductNum = '$id'");
- }
- return true;
- }
- public function deleteTopup($code,$pin){
- $code = htmlspecialchars($code);
- $pin = htmlspecialchars($pin);
- $get_news = mssql_query("SELECT * FROM ".$this->bd_sql['db1'].".dbo.Topup where Code = '$code' and PCode ='$pin'");
- while ($dnews = mssql_fetch_array($get_news)) {
- $strSQL = mssql_query("DELETE FROM ".$this->bd_sql['db1'].".dbo.Topup where Code = '$code' and PCode ='$pin'");
- }
- return true;
- }
- public function deleteiCafe($code){
- $code = htmlspecialchars($code);
- $get_news = mssql_query("SELECT * FROM ".$this->bd_sql['db1'].".dbo.ShopInfo where ShopID = '$code'");
- while ($dnews = mssql_fetch_array($get_news)) {
- $strSQL = mssql_query("DELETE FROM ".$this->bd_sql['db1'].".dbo.ShopInfo where ShopID = '$code'");
- }
- return true;
- }
- public function getCharacterRank($quantity, $class=""){
- $quantity = (int)$quantity;
- if($quantity == 0) $quantity = 100;
- $charlist = array();
- $i = 0;
- if($class=="toprich") $rich = "P.ChaMoney DESC,";
- else $rich = "";
- if($class=="toppk") $pk = "P.ChaPkWin DESC, P.ChaPkLoss ASC,";
- else $pk = "";
- switch($class)
- {
- case "brawler":
- if($this->activeclass[$class]) $class = "AND P.ChaClass IN (1,64)";
- break;
- case "swordsman":
- if($this->activeclass[$class]) $class = "and P.ChaClass IN (2,128)";
- break;
- case "archer":
- if($this->activeclass[$class]) $class = "and P.ChaClass IN (4,256)";
- break;
- case "shaman":
- if($this->activeclass[$class]) $class = "and P.ChaClass IN (8,512)";
- break;
- case "extreme":
- if($this->activeclass[$class]) $class = "and P.ChaClass IN (16,32)";
- break;
- case "gunner":
- if($this->activeclass[$class]) $class = "and P.ChaClass IN (1024,2048)";
- break;
- case "assassin":
- if($this->activeclass[$class]) $class = "and P.ChaClass IN (4096,8192)";
- break;
- case "magician":
- if($this->activeclass[$class]) $class = "and P.ChaClass IN (16384,32768)";
- break;
- case "sg":
- $class = "and P.ChaSchool=0";
- break;
- case "mp":
- $class = "and P.ChaSchool=1";
- break;
- case "phx":
- $class = "and P.ChaSchool=2";
- break;
- default:
- $class = "";
- break;
- }
- if($this->options['is_reborn_server']){ $r = "P.ChaReborn,"; $reborn = "P.ChaReborn DESC,"; }
- else{ $reborn = ""; $r="";}
- $charlist['count'] =0;
- //$get_crank = mssql_query("SELECT TOP $quantity P.ChaExp,P.ChaMoney,P.ChaLastLevelUp,P.ChaName,P.ChaLevel,P.ChaClass,P.ChaExp,P.ChaOnline,P.GuNum, $r (".$this->def['Kills_Columns'].") AS Kills, (".$this->def['Death_Columns'].") AS Deaths FROM ".$this->bd_sql['db4'].".dbo.UserInfo U, ".$this->bd_sql['db2'].".dbo.ChaInfo P WHERE P.UserNum = U.UserNum AND U.UserType < 11 AND U.UserBlockDate < GETDATE() AND P.ChaDeleted != 1 $class ORDER BY $pk $rich $reborn Kills DESC, Deaths ASC,P.ChaLevel DESC, P.ChaLastLevelUp DESC, P.ChaExp DESC");
- $get_crank = mssql_query("SELECT TOP $quantity P.ChaPkWin, P.ChaPkLoss, P.ChaName, P.ChaReborn, P.ChaLevel, P.ChaClass, P.ChaSchool, P.ChaOnline, P.GuNum, P.ChaNum, P.ChaMoney FROM ".$this->bd_sql['db2'].".dbo.ChaInfo P, ".$this->bd_sql['db4'].".dbo.UserInfo U WHERE P.UserNum = U.UserNum AND U.UserType != 32 AND U.UserType != 31 AND U.UserType != 30 AND U.UserType != 10 AND U.UserType != 6969 AND U.UserAvailable != 0 AND P.ChaDeleted != 1 AND P.SGNUM != 1 $class ORDER BY $pk $rich $reborn P.ChaLevel DESC, P.ChaPkWin DESC, P.ChaName ASC");
- //$get_crank = mssql_query("SELECT TOP $quantity P.ChaExp,P.ChaMoney,P.ChaLastLevelUp,P.ChaName,P.ChaLevel,P.ChaClass,P.ChaExp,P.ChaOnline,P.GuNum, $r (".$this->def['Kills_Columns'].") AS Kills, (".$this->def['Death_Columns'].") AS Deaths FROM ".$this->bd_sql['db4'].".dbo.UserInfo U, ".$this->bd_sql['db2'].".dbo.ChaInfo P WHERE P.UserNum = U.UserNum AND U.UserType < 11 AND P.ChaDeleted != 1 $class ORDER BY $rich P.ChaLevel DESC, P.ChaLastLevelUp DESC");
- if(mssql_num_rows($get_crank) == 0 ) return false;
- while ($crank = mssql_fetch_array($get_crank)) {
- $ccount++;
- $get_g = mssql_query("SELECT GuName FROM ".$this->bd_sql['db2'].".dbo.GuildInfo where GuNum = '$crank[GuNum]' ");
- while ($guild = mssql_fetch_array($get_g)) {
- $g = $guild[3];
- }
- $charlist[$i] = array(
- 'ChaName' => $crank[ChaName],
- 'ChaReborn' => $crank[ChaReborn],
- 'ChaClass' => $crank[ChaClass],
- 'ChaLevel' => $crank[ChaLevel],
- 'ChaSchool' => $this->getSchool($crank[ChaSchool]),
- 'ChaOnline' => $this->getOnlineStatus($crank[ChaOnline]),
- 'TotalKills' => $crank[ChaPkWin],
- 'TotalDeath' => $crank[ChaPkLoss],
- 'GuNum' => $crank[GuNum],
- 'ChaMoney' => $crank[ChaMoney]
- );
- $i++;
- $charlist['count']++;
- }
- return $charlist;
- }
- public function getItemShop($type="",$ctg="",$search="",$admincp=0){
- $itemlist = array();
- $itemlist['count'] = 0;
- $type = (int)$type;
- $i = 0;
- if($search!=""){ $search="ItemName LIKE '%$search%'"; }
- if($ctg !=""){ $ctg="AND ItemCtg=$ctg"; }
- if($type!=""){ $itemsec="AND ItemSec=$type"; }
- if($admincp==1) $get_new_item = mssql_query("SELECT ItemCtg,ItemMain,ItemSub,ItemName,ItemBought,ItemPrice,Itemexp,ItemSS,ItemComment,ProductNum,ItemSec,hidden,Itemstock FROM ".$this->bd_sql[db3].".dbo.ShopItemMap WHERE $search order by ItemBought desc");
- else $get_new_item = mssql_query("SELECT ItemCtg,ItemMain,ItemSub,ItemName,ItemBought,ItemPrice,Itemexp,ItemSS,ItemComment,ProductNum,ItemSec,hidden,Itemstock FROM ".$this->bd_sql[db3].".dbo.ShopItemMap where hidden=0 $itemsec $ctg $search order by ItemBought desc");
- while ($new_items = mssql_fetch_array($get_new_item)) {
- $itemlist[$itemlist['count']] = array(
- 'ItemSS' => $new_items[ItemSS],
- 'ItemName' => $new_items[ItemName],
- 'Itemstock' => $new_items[Itemstock],
- 'ItemPrice' => $new_items[ItemPrice],
- 'ItemSec' => $new_items[ItemSec],
- 'ItemComment' => $new_items[ItemComment],
- 'ProductNum' => $new_items[ProductNum],
- 'ItemMain' => $new_items[ItemMain],
- 'ItemSub' => $new_items[ItemSub],
- 'hidden' => $new_items[hidden],
- 'ItemCtg' => $new_items[ItemCtg]
- );
- $itemlist['count']++;
- }
- return $itemlist;
- }
- public function getTopupCodes(){
- $topuplist = array();
- $i=0;
- $get_new_topup = mssql_query("SELECT Code,PCode,Points FROM ".$this->bd_sql[db1].".dbo.TopUp order by date desc");
- while ($new_topup = mssql_fetch_array($get_new_topup)) {
- $topuplist[$i] = array(
- 'Code' => $new_topup['Code'],
- 'PCode' => $new_topup['PCode'],
- 'Points' => $new_topup['Points']
- );
- $topuplist['count']++;
- $i++;
- }
- return $topuplist;
- }
- public function getCharacterStatistics(){
- $fetchstats = mssql_query(" SELECT sum(case when ChaClass IN(1,64) then 1 end) as brawler,
- sum(case when ChaClass IN(2,128) then 1 end) as swordsman,
- sum(case when ChaClass IN(4,256) then 1 end) as archer,
- sum(case when ChaClass IN(8,512) then 1 end) as shaman,
- sum(case when ChaClass IN(16,32) then 1 end) as extreme,
- sum(case when ChaClass IN(1024,2048) then 1 end) as gunner,
- sum(case when ChaClass IN(4096,8192) then 1 end) as assassin,
- sum(case when ChaClass IN(16384,32768) then 1 end) as magician,
- sum(case when ChaDeleted=1 then 1 end) as deleted,
- sum(case when ChaOnline=1 then 1 end) as online,
- sum(1) as overall
- FROM ".$this->bd_sql[db2].".dbo.ChaInfo");
- while ($stats = mssql_fetch_array($fetchstats))
- {
- $mainstats = array(
- 'brawler' => (int)$stats['brawler'],
- 'swordsman' => (int)$stats['swordsman'],
- 'archer' => (int)$stats['archer'],
- 'shaman' => (int)$stats['shaman'],
- 'extreme' => (int)$stats['extreme'],
- 'gunner' => (int)$stats['gunner'],
- 'assassin' => (int)$stats['assassin'],
- 'magician' => (int)$stats['magician'],
- 'online' => (int)$stats['online'],
- 'deleted' => (int)$stats['deleted'],
- 'overall' => (int)$stats['overall']
- );
- }
- return $mainstats;
- }
- public function getiCafe(){
- $topuplist = array();
- $i=0;
- $get_new_topup = mssql_query("SELECT ShopName,ShopID,ShopOwner FROM ".$this->bd_sql[db1].".dbo.ShopInfo");
- while ($new_topup = mssql_fetch_array($get_new_topup)) {
- $topuplist[$i] = array(
- 'branch' => $new_topup['ShopName'],
- 'owner' => $new_topup['ShopOwner'],
- 'code' => $new_topup['ShopID']
- );
- $topuplist['count']++;
- $i++;
- }
- return $topuplist;
- }
- function getGuMarkImage ( $guild ){
- $get_points = mssql_query("SELECT GuMarkImage FROM ".$this->bd_sql['db2'].".dbo.GuildInfo where GuNum = '".$guild."'");
- while ($points = mssql_fetch_array($get_points)) {
- return $points[GuMarkImage];
- }
- }
- function getAvatar ( $xemail ){
- return md5( strtolower( trim( $xemail ) ) );
- }
- function Init() {
- error_reporting(E_ALL ^E_NOTICE ^E_WARNING);
- date_default_timezone_set('Asia/Manila');
- putenv("TZ=Asia/Manila");
- if (!in_array($_SESSION["___user_"], $this->def['admin_username'])) $this->doStartSecurity();
- }
- public function doCheckNumRows ( $stmt ){
- $rows = mssql_num_rows($stmt);
- if($rows > 0) return true;
- else return false;
- }
- public function getClass($class){
- switch($class)
- {
- case 1:
- case 64:
- return "Brawler";
- break;
- case 2:
- case 128:
- return "Swordsman";
- break;
- case 4:
- case 256:
- return "Archer";
- break;
- case 8:
- case 512:
- return "Shaman";
- break;
- case 1024:
- case 2048:
- return "Gunner";
- break;
- case 4096:
- case 8192:
- return "Assassin";
- break;
- case 16384:
- case 32768:
- return "Magician";
- break;
- default:
- return "N/A";
- }
- }
- public function getSchool($school){
- switch ($school){
- case 0:
- return "SG";
- break;
- case 1:
- return "MP";
- break;
- case 2:
- return "PHX";
- break;
- default:
- return "Leonair";
- }
- }
- public function getOnlineStatus($online){
- switch($online)
- {
- case 0:
- return "Offline";
- break;
- case 1:
- return "Online";
- break;
- }
- }
- function shorten_string($oldstring, $wordsreturned){
- $retval = $string;
- $string = preg_replace('/(?<=\S,)(?=\S)/', ' ', $oldstring);
- $string = str_replace("\n", " ", $string);
- $array = explode(" ", $string);
- if (count($array)<=$wordsreturned)
- {
- $retval = $string;
- }
- else
- {
- array_splice($array, $wordsreturned);
- $retval = implode(" ", $array)." ";
- }
- return $retval;
- }
- function mask ( $str, $start = 0, $length = null ) {
- $mask = preg_replace ( "/\S/", "*", $str );
- if ( is_null ( $length )) {
- $mask = substr ( $mask, $start );
- $str = substr_replace ( $str, $mask, $start );
- } else {
- $mask = substr ( $mask, $start, $length );
- $str = substr_replace ( $str, $mask, $start, $length );
- }
- return $str;
- }
- function doStartSecurity(){
- $today = date("Ymd");
- $ip = $_SERVER['REMOTE_ADDR'];
- $time = date("l dS of F Y h:i:s A");
- $script = $_SERVER['SCRIPT_NAME'];
- //$fp = fopen ("logs/errlog_$today.txt", "a+");
- $sql_inject_1 = array(";","'","%",'"'); #Whoth need replace
- $sql_inject_2 = array("", "","","""); #To wont replace
- $GET_KEY = array_keys($_GET); #array keys from $_GET
- $POST_KEY = array_keys($_POST); #array keys from $_POST
- $COOKIE_KEY = array_keys($_COOKIE); #array keys from $_COOKIE
- /*begin clear $_GET */
- for($i=0;$i<count($GET_KEY);$i++)
- {
- $real_get[$i] = $_GET[$GET_KEY[$i]];
- $_GET[$GET_KEY[$i]] = str_replace($sql_inject_1, $sql_inject_2, htmlspecialchars($_GET[$GET_KEY[$i]]));
- if($real_get[$i] != $_GET[$GET_KEY[$i]])
- {
- //fwrite ($fp, "IP: $ip\r\n");
- //fwrite ($fp, "Method: GET\r\n");
- //fwrite ($fp, "Value: $real_get[$i]\r\n");
- //fwrite ($fp, "Script: $script\r\n");
- //fwrite ($fp, "Time: $time\r\n");
- //fwrite ($fp, "==================================\r\n");
- }
- }
- /*end clear $_GET */
- /*begin clear $_POST */
- for($i=0;$i<count($POST_KEY);$i++)
- {
- $real_post[$i] = $_POST[$POST_KEY[$i]];
- $_POST[$POST_KEY[$i]] = str_replace($sql_inject_1, $sql_inject_2, htmlspecialchars($_POST[$POST_KEY[$i]]));
- if($real_post[$i] != $_POST[$POST_KEY[$i]])
- {
- //fwrite ($fp, "IP: $ip\r\n");
- //fwrite ($fp, "Method: POST\r\n");
- //fwrite ($fp, "Value: $real_post[$i]\r\n");
- //fwrite ($fp, "Script: $script\r\n");
- //fwrite ($fp, "Time: $time\r\n");
- //fwrite ($fp, "==================================\r\n");
- }
- }
- /*end clear $_POST */
- /*begin clear $_COOKIE */
- for($i=0;$i<count($COOKIE_KEY);$i++)
- {
- $real_cookie[$i] = $_COOKIE[$COOKIE_KEY[$i]];
- $_COOKIE[$COOKIE_KEY[$i]] = str_replace($sql_inject_1, $sql_inject_2, htmlspecialchars($_COOKIE[$COOKIE_KEY[$i]]));
- if($real_cookie[$i] != $_COOKIE[$COOKIE_KEY[$i]])
- {
- //fwrite ($fp, "IP: $ip\r\n");
- //fwrite ($fp, "Method: COOKIE\r\n");
- //fwrite ($fp, "Value: $real_cookie[$i]\r\n");
- //fwrite ($fp, "Script: $script\r\n");
- //fwrite ($fp, "Time: $time\r\n");
- //fwrite ($fp, "==================================\r\n");
- }
- }
- /*end clear $_COOKIE */
- //fclose ($fp);
- }
- public $seiferxiii = array(
- 'hash' => '17377db57e632b4c6ac6b7bc5717835a',
- 'ze' => 'C9E1074F5B3F9FC8EA1',
- 'bu' => 'C0E190D8267E36708F9'
- );
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement