diff --git a/Horse Isle Server/HorseIsleServer/Server/Database.cs b/Horse Isle Server/HorseIsleServer/Server/Database.cs index a03a483..3de2797 100755 --- a/Horse Isle Server/HorseIsleServer/Server/Database.cs +++ b/Horse Isle Server/HorseIsleServer/Server/Database.cs @@ -23,7 +23,7 @@ namespace HISP.Server { db.Open(); string UserTable = "CREATE TABLE IF NOT EXISTS Users(Id INT, Username TEXT(16), PassHash TEXT(128), Salt TEXT(128), Gender TEXT(16), Admin TEXT(3), Moderator TEXT(3))"; - string ExtTable = "CREATE TABLE IF NOT EXISTS UserExt(Id INT, X INT, Y INT, LastLogin INT, Money INT, QuestPoints INT, BankBalance DOUBLE, BankInterest DOUBLE, ProfilePage Text(4000),IpAddress TEXT(1028),PrivateNotes Text(65535), CharId INT, ChatViolations INT,Subscriber TEXT(3), SubscribedUntil INT, Experience INT, Tiredness INT, Hunger INT, Thirst INT, FreeMinutes INT)"; + string ExtTable = "CREATE TABLE IF NOT EXISTS UserExt(Id INT, X INT, Y INT, LastLogin INT, Money INT, QuestPoints INT, BankBalance DOUBLE, BankInterest DOUBLE, ProfilePage Text(4000),IpAddress TEXT(1028),PrivateNotes Text(65535), CharId INT, ChatViolations INT,Subscriber TEXT(3), SubscribedUntil INT, Experience INT, Tiredness INT, Hunger INT, Thirst INT, FreeMinutes INT, TotalLogins INT)"; string MailTable = "CREATE TABLE IF NOT EXISTS Mailbox(RandomId INT, IdTo INT, IdFrom INT, Subject TEXT(100), Message Text(65535), TimeSent INT, BeenRead TEXT(3))"; string BuddyTable = "CREATE TABLE IF NOT EXISTS BuddyList(Id INT, IdFriend INT)"; string MessageQueue = "CREATE TABLE IF NOT EXISTS MessageQueue(Id INT, Message TEXT(1028))"; @@ -3792,6 +3792,37 @@ namespace HISP.Server return gender; } } + public static int GetLoginCount(int playerId) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + + sqlCommand.CommandText = "SELECT TotalLogins FROM UserExt WHERE Id=@playerId"; + sqlCommand.Parameters.AddWithValue("@playerId", playerId); + sqlCommand.Prepare(); + int count = Convert.ToInt32(sqlCommand.ExecuteScalar()); + sqlCommand.Dispose(); + + return count; + } + } + public static void SetLoginCount(int playerId, int count) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + + sqlCommand.CommandText = "UPDATE UserExt SET TotalLogins=@count WHERE Id=@playerId"; + sqlCommand.Parameters.AddWithValue("@playerId", playerId); + sqlCommand.Parameters.AddWithValue("@count", count); + sqlCommand.Prepare(); + sqlCommand.ExecuteNonQuery(); + sqlCommand.Dispose(); + } + } public static int GetExperience(int playerId) { using (MySqlConnection db = new MySqlConnection(ConnectionString)) diff --git a/Horse Isle Server/HorseIsleServer/Server/GameClient.cs b/Horse Isle Server/HorseIsleServer/Server/GameClient.cs index 3535357..03a85f2 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameClient.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameClient.cs @@ -256,6 +256,7 @@ namespace HISP.Server LoggedIn = true; Database.SetIpAddress(id, RemoteIp); + Database.SetLoginCount(id, Database.GetLoginCount(id) + 1); inactivityTimer = new Timer(new TimerCallback(keepAliveTimerTick), null, keepAliveInterval, keepAliveInterval); } diff --git a/WebInterface/game-site/account.php b/WebInterface/game-site/account.php index 3eda1e8..ba918c8 100755 --- a/WebInterface/game-site/account.php +++ b/WebInterface/game-site/account.php @@ -69,6 +69,19 @@ if(!is_logged_in()) exit(); } + +// 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']); + +$hasIntl = function_exists('numfmt_create'); + +if($hasIntl) + $fmt = numfmt_create( 'en_US', NumberFormatter::DECIMAL ); + include("web/header.php"); ?> @@ -138,13 +151,39 @@ h+=60;//h += 96; // --> -
When Ready, Enter the World



(bigger borders version)
(same window version)
Welcome back SilicaAndPina, Here is your account info and Horse Isle server status: (refresh)

It has been: 0.2 hours since you were last online. You have logged in 2 times.
You have $5,910 in Horse Isle money on hand and $0 in the bank.
You have earned 25 of 63005 total quest points (0% Complete)


+
When Ready, ' target=popup onClick="wopen('/horseisle.php?USER=', 'popup', 790, 522); return false;">Enter the World



(' target=popup onClick="wopen('/horseisle.php?USER=', 'popup', 846, 542); return false;">bigger borders version)
(>same window version)
Welcome back , Here is your account info and Horse Isle server status: (refresh)

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)


'); +?>
-SILICAANDPINA'S PINTO SUBSCRIPTION STATUS:
ACTIVE
(31 days remain in your subscription) (Subscription Benefits) +'S SUBSCRIPTION STATUS:
ACTIVE
(∞ days remain in your subscription) (Subscription Benefits)
diff --git a/WebInterface/game-site/web/crosserver.php b/WebInterface/game-site/web/crosserver.php index e532bf1..2c765e2 100644 --- a/WebInterface/game-site/web/crosserver.php +++ b/WebInterface/game-site/web/crosserver.php @@ -30,6 +30,77 @@ function getNoSubbedPlayersOnlineInServer($database) return $onlineSubscribers->fetch_row()[0]; } +function getUserMoney($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 Money FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + +function getUserBankMoney($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 BankBalance FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + +function getUserLoginDate($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 LastLogin FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + +function getUserQuestPoints($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 QuestPoints FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + +function getUserTotalLogins($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 TotalLogins FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + + function getNoModPlayersOnlineInServer($database) { include('config.php'); diff --git a/WebInterface/game-site/web/header.php b/WebInterface/game-site/web/header.php index 9b6aa3b..8062f90 100644 --- a/WebInterface/game-site/web/header.php +++ b/WebInterface/game-site/web/header.php @@ -110,7 +110,7 @@ color: #440000; if(is_logged_in()) { $username = $_SESSION['USERNAME']; - echo('
BUY 1 Month Membership $5.00usd (adds 31 days membership time to the account that you are currently logged in with.) Non-refundable. @@ -152,13 +191,13 @@ h+=60;//h += 96; - +"> - - +/web/paypalpayment.php"> +/web/paypalgateway.php"> @@ -178,13 +217,13 @@ h+=60;//h += 96; - +"> - - +/web/paypalpayment.php"> +/web/paypalgateway.php"> @@ -246,13 +285,13 @@ Select: - +"> - - +/web/paypalpayment.php"> +/web/paypalgateway.php"> @@ -271,13 +310,13 @@ Select: - +"> - - +/web/paypalpayment.php"> +/web/paypalgateway.php"> @@ -296,13 +335,13 @@ Select: - +"> - - +/web/paypalpayment.php"> +/web/paypalgateway.php"> @@ -322,7 +361,7 @@ Select:

Alternative Payment Methods: Check/Cash via postal mail -

Gift Payments: Pay for a different player +

Gift Payments: /web/giftmembership.php>Pay for a different player

'.strtoupper($_SERVER['HTTP_HOST']).'
Logged in as: '.$username.'





'); + echo('
'.strtoupper($_SERVER['HTTP_HOST']).'
Logged in as: '.htmlspecialchars($username).'





'); } else { diff --git a/WebInterface/master-site/crosserver.php b/WebInterface/master-site/crosserver.php index e532bf1..2c765e2 100644 --- a/WebInterface/master-site/crosserver.php +++ b/WebInterface/master-site/crosserver.php @@ -30,6 +30,77 @@ function getNoSubbedPlayersOnlineInServer($database) return $onlineSubscribers->fetch_row()[0]; } +function getUserMoney($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 Money FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + +function getUserBankMoney($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 BankBalance FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + +function getUserLoginDate($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 LastLogin FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + +function getUserQuestPoints($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 QuestPoints FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + +function getUserTotalLogins($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 TotalLogins FROM UserExt WHERE Id=?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + + return intval($result->fetch_row()[0]); + +} + + function getNoModPlayersOnlineInServer($database) { include('config.php'); diff --git a/WebInterface/master-site/index.php b/WebInterface/master-site/index.php index 3aea459..414c399 100755 --- a/WebInterface/master-site/index.php +++ b/WebInterface/master-site/index.php @@ -61,30 +61,30 @@ HREF=/web/parents.php>Parent's Guide
Players Online Now
Subscribers Online Now
Moderators Online Now
fetch_row()[0]; if($hasIntl) -echo numfmt_format($fmt, $activeUserCount); + echo numfmt_format($fmt, $activeUserCount); else -echo $activeUserCount; + echo $activeUserCount; ?> Active Accounts

ABOUT:
Horse Isle is a vast multi-player horse based world. It allows for many players to diff --git a/WebInterface/master-site/web/header.php b/WebInterface/master-site/web/header.php index abd01a4..8c4f3a2 100644 --- a/WebInterface/master-site/web/header.php +++ b/WebInterface/master-site/web/header.php @@ -111,7 +111,7 @@ color: #440000; if(is_logged_in()) { $username = $_SESSION['USERNAME']; - echo('
Logged in as: '.$username.'






'); + echo('
Logged in as: '.htmlspecialchars($username).'






'); } else {