mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
add sub check
This commit is contained in:
parent
7c987d8d35
commit
7c6414e752
4 changed files with 103 additions and 3 deletions
|
@ -77,6 +77,13 @@ $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']);
|
||||
|
||||
if($all_users_subbed)
|
||||
$subbed = true;
|
||||
|
||||
$hasIntl = function_exists('numfmt_create');
|
||||
|
||||
if($hasIntl)
|
||||
|
@ -176,8 +183,14 @@ h+=60;//h += 96;
|
|||
$difference = $current_time - $loginDate;
|
||||
$lastOn = $difference/60;
|
||||
|
||||
echo('It has been: '.$lastOn.' hours since you were last online. You have logged in '.$totalLoginsStr.' times.<BR>You have <B><FONT COLOR=005500>$'.$moneyStr.'</FONT></B> in Horse Isle money on hand and <B><FONT COLOR=005500>$'.$bankmoneyStr.'</FONT></B> in the bank.<BR>You have earned <B>'.(string)$questPoints.'</B> of <B>63005</B> total quest points (<B>'.(string)floor(($questPoints / 63005) * 100.0).'%</B> Complete)<BR></TD></TR></TABLE><BR><HR>');
|
||||
?>
|
||||
|
||||
echo('It has been: '.$lastOn.' hours since you were last online. You have logged in '.$totalLoginsStr.' times.<BR>You have <B><FONT COLOR=005500>$'.$moneyStr.'</FONT></B> in Horse Isle money on hand and <B><FONT COLOR=005500>$'.$bankmoneyStr.'</FONT></B> in the bank.<BR>You have earned <B>'.(string)$questPoints.'</B> of <B>63005</B> total quest points (<B>'.(string)floor(($questPoints / 63005) * 100.0).'%</B> Complete)<BR>');
|
||||
if(!$subbed)
|
||||
{
|
||||
echo('You have <B>'.(string)$playtime.'</B> minutes of playtime available. As a non-subscriber you get 1 additional minute every 8 minutes. <I>(subject to change based on load)</I> (<A HREF=/web/whylimited.php>why limited?</A>) <BR>');
|
||||
}
|
||||
|
||||
?></TD></TR></TABLE><BR><HR>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ $dbuser = 'root';
|
|||
$dbpass = 'test123';
|
||||
$dbhost = '127.0.0.1';
|
||||
|
||||
$all_users_subbed = false;
|
||||
$server_id = "beta";
|
||||
|
||||
# == hmac_secret ==
|
||||
|
@ -15,7 +16,7 @@ $server_id = "beta";
|
|||
# NOTE: if someone knows this secret they can login to ANYONES account
|
||||
# Ideally, this would be a random string of numbers, letters and symbols like 20 characters long T-T
|
||||
$hmac_secret = "!!NOTSET!!";
|
||||
$master_site = "//server.islehorse.com";
|
||||
$master_site = "//localhost";
|
||||
# Password for /web/admin
|
||||
$admin_portal_password = "!!NOTSET!!";
|
||||
?>
|
||||
|
|
|
@ -100,6 +100,49 @@ function getUserTotalLogins($database, $id)
|
|||
|
||||
}
|
||||
|
||||
function getUserPlaytime($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 FreeMinutes FROM UserExt WHERE Id=?");
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
return intval($result->fetch_row()[0]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getUserSubTimeRemaining($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 SubscribedUntil FROM UserExt WHERE Id=?");
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
return intval($result->fetch_row()[0]);
|
||||
|
||||
}
|
||||
|
||||
function getUserSubbed($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 Subscriber FROM UserExt WHERE Id=?");
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
return $result->fetch_row()[0] == "YES";
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getNoModPlayersOnlineInServer($database)
|
||||
{
|
||||
|
|
|
@ -100,6 +100,49 @@ function getUserTotalLogins($database, $id)
|
|||
|
||||
}
|
||||
|
||||
function getUserPlaytime($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 FreeMinutes FROM UserExt WHERE Id=?");
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
return intval($result->fetch_row()[0]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getUserSubTimeRemaining($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 SubscribedUntil FROM UserExt WHERE Id=?");
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
return intval($result->fetch_row()[0]);
|
||||
|
||||
}
|
||||
|
||||
function getUserSubbed($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 Subscriber FROM UserExt WHERE Id=?");
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
return $result->fetch_row()[0] == "YES";
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getNoModPlayersOnlineInServer($database)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue