diff --git a/WebInterface/game-site/account.php b/WebInterface/game-site/account.php index 52d8b3e..f1f5a39 100755 --- a/WebInterface/game-site/account.php +++ b/WebInterface/game-site/account.php @@ -71,16 +71,31 @@ if(!is_logged_in()) // Get account data -$money = getUserMoney($dbname, $_SESSION['PLAYER_ID']); -$bankMoney = getUserBankMoney($dbname, $_SESSION['PLAYER_ID']); -$loginDate = getUserLoginDate($dbname, $_SESSION['PLAYER_ID']); -$questPoints = getUserQuestPoints($dbname, $_SESSION['PLAYER_ID']); -$totalLogins = getUserTotalLogins($dbname, $_SESSION['PLAYER_ID']); +$newUser = getUserExistInExt($dbname, $_SESSION['PLAYER_ID']); -$subbed = getUserSubbed($dbname, $_SESSION['PLAYER_ID']); -$subTime = getUserSubTimeRemaining($dbname, $_SESSION['PLAYER_ID']); -$playtime = getUserPlaytime($dbname, $_SESSION['PLAYER_ID']); +if(!$newUser){ + $money = getUserMoney($dbname, $_SESSION['PLAYER_ID']); + $bankMoney = getUserBankMoney($dbname, $_SESSION['PLAYER_ID']); + $loginDate = getUserLoginDate($dbname, $_SESSION['PLAYER_ID']); + $questPoints = getUserQuestPoints($dbname, $_SESSION['PLAYER_ID']); + $totalLogins = getUserTotalLogins($dbname, $_SESSION['PLAYER_ID']); + + $subbed = getUserSubbed($dbname, $_SESSION['PLAYER_ID']); + $subTime = getUserSubTimeRemaining($dbname, $_SESSION['PLAYER_ID']); + $playtime = getUserPlaytime($dbname, $_SESSION['PLAYER_ID']); +} +else +{ + $money = 0; + $bankMoney = 0; + $loginDate = time(); + $questPoints = 0; + $totalLogins = 0; + $subbed = false; + $subTime = 0; + $playtime = 0; +} if($all_users_subbed) $subbed = true; @@ -183,8 +198,13 @@ h+=60;//h += 96; $difference = $current_time - $loginDate; $lastOn = $difference/3600; - - echo('It has been: '.number_format((float)$lastOn, 2, '.', '').' hours since you were last online. You have logged in '.$totalLoginsStr.' times.
You have $'.$moneyStr.' in Horse Isle money on hand and $'.$bankmoneyStr.' in the bank.
You have earned '.(string)$questPoints.' of 63005 total quest points ('.(string)floor(($questPoints / 63005) * 100.0).'% Complete)
'); + if($newUser){ + echo('
You have a new account and have not yet logged in!
'); + } + else{ + echo('It has been: '.number_format((float)$lastOn, 2, '.', '').' hours since you were last online. You have logged in '.$totalLoginsStr.' times.
'); + } + echo('You have $'.$moneyStr.' in Horse Isle money on hand and $'.$bankmoneyStr.' in the bank.
You have earned '.(string)$questPoints.' of 63005 total quest points ('.(string)floor(($questPoints / 63005) * 100.0).'% Complete)
'); if(!$subbed) { echo('You have '.(string)$playtime.' minutes of playtime available. As a non-subscriber you get 1 additional minute every 8 minutes. (subject to change based on load) (why limited?)
'); diff --git a/WebInterface/game-site/web/crosserver.php b/WebInterface/game-site/web/crosserver.php index 444a7e8..984a444 100644 --- a/WebInterface/game-site/web/crosserver.php +++ b/WebInterface/game-site/web/crosserver.php @@ -122,6 +122,20 @@ function getUserQuestPoints($database, $id) } +function getUserExistInExt($database, $id) +{ + include('config.php'); + $dbname = $database; + $connect = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname) or die("Unable to connect to '$dbhost'"); + $stmt = $connect->prepare("SELECT COUNT(*) FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]) <= 0; + +} + function getUserTotalLogins($database, $id) { include('config.php'); diff --git a/WebInterface/game-site/web/header.php b/WebInterface/game-site/web/header.php index b9c1d34..42a275b 100644 --- a/WebInterface/game-site/web/header.php +++ b/WebInterface/game-site/web/header.php @@ -8,8 +8,7 @@ if(session_status() !== PHP_SESSION_ACTIVE) if(!function_exists('is_logged_in')) include('common.php'); -$host_names = explode(".", $host); -$host = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1]; +$host = $_SERVER['HTTP_HOST']; ?> diff --git a/WebInterface/master-site/crosserver.php b/WebInterface/master-site/crosserver.php index 444a7e8..984a444 100644 --- a/WebInterface/master-site/crosserver.php +++ b/WebInterface/master-site/crosserver.php @@ -122,6 +122,20 @@ function getUserQuestPoints($database, $id) } +function getUserExistInExt($database, $id) +{ + include('config.php'); + $dbname = $database; + $connect = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname) or die("Unable to connect to '$dbhost'"); + $stmt = $connect->prepare("SELECT COUNT(*) FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]) <= 0; + +} + function getUserTotalLogins($database, $id) { include('config.php'); diff --git a/WebInterface/master-site/web/header.php b/WebInterface/master-site/web/header.php index 8c4f3a2..c0091d5 100644 --- a/WebInterface/master-site/web/header.php +++ b/WebInterface/master-site/web/header.php @@ -5,8 +5,8 @@ if(session_status() !== PHP_SESSION_ACTIVE) if(!function_exists('is_logged_in')) include('../common.php'); -$info = parse_url($_SERVER['HTTP_HOST']); -$host = $info['host']; + +$host = $_SERVER['HTTP_HOST']; ?>