Understanding a script need help

hello, not sure if its the right place and sorry if its not but i need help with this script
the formula behind this script is that an online person on my website gets 1 point per 1 hour being online
i need to change it to days (24 hours) = 1 point
thank you for your help :slight_smile:

ONLINE TIME TO CREDITS EXCHANGER
<?

$exchange_time_settings = simplexml_load_file(‘engine/config_mods/exchange_online_time.xml’);
$reward = $exchange_time_settings->reward;

if(!isset($_SESSION[‘user_auth_id’])) { die(“You need to be logged in.”); }$name = $_SESSION[‘user_auth_id’];
$query = mssql_query(“Select OnlineTime from MEMB_STAT where memb___id=’$name’”);
$hour = mssql_fetch_row($query);
$hours = floor($hour[0] / 60);

$credit = mssql_query(“Select WCoinC from T_InGameShop_Point where AccountID=’$name’”);
$cr = mssql_fetch_row($credit);

if(!isset($_POST[‘agree’]))
{

?>

Your WCoinC : <? echo($cr[0]); ?>
Your Online Hours : <? if($hours == "") { $hours = "0"; } echo($hours); ?>
You Will Get : <? $k = $hours*$reward; echo($k); ?> WCoinC
<? } else { $name = $_SESSION['user_auth_id']; $queryy = mssql_query("Select OnlineTime from MEMB_STAT where memb___id='$name'"); $hr = mssql_fetch_row($queryy); $hh = floor($hr[0] / 60);

$mm = mssql_query(“Select connectstat from MEMB_STAT where Memb___id=’$name’”);
$fmm = mssql_fetch_row($mm);
if($fmm[0] == “1”)
{
die(“You need to be OFFLINE before you trade your hours.”);
}
$k = $hh * $reward + $cr[0];
mssql_query(“Update T_InGameShop_Point set WCoinC=’$k’ where AccountID=’$name’”);
mssql_query(“Update MEMB_STAT set OnlineTime = 0 where memb___id=’$name’”);
$queryyy = mssql_query(“Select OnlineTime from MEMB_STAT where memb___id=’$name’”);
$hrr = mssql_fetch_row($queryyy);
$hhh = $hrr[0];
echo(“You have now “.$k.” WCoinC and 0 Online Hours”);
}
?>

Not exactly sure what you are asking. But, this code:
$hour = mssql_fetch_row($query);
$hours = floor($hour[0] / 60);

Looks like it takes minutes online, divides by 60 to get the hours. Therefore…
$days = floor($hour[0]/1440); should give you minutes divided by 60 divided by 24… (24 hours * 60 minutes=1440)

I think that is what you are looking for…

Sponsor our Newsletter | Privacy Policy | Terms of Service