Let's see the code of the module you use. But ... :
SQL:
ALTER TABLE [MEMB_STAT] ADD [OnlineTime] int NOT NULL DEFAULT(0)
GO
SQL:
/****** Object: StoredProcedure [dbo].[WZ_DISCONNECT_MEMB] Script Date: 07/25/2019 14:19:08 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]
@uid varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET DisConnectTM = (getdate()), connectstat = 0, OnlineTime = OnlineTime+(DATEDIFF(hh,ConnectTM,getdate())) WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,DisConnectTM,connectstat, OnlineTime) valueS (@uid,(getdate()),0, 0)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
Thank you!
This is the Module Code
<article class="rankingWrap">
<ul class="shadowz" style="width:200px;">
<li class="du">Exchange System</li></ul>
<table width="100%" class="rankTable" align="center">
<thead>
<tr>
<th width="40%"><b>Online Hours</b></th>
<th width="40%"><b>Credits</b></th>
<th width="20%"> </th>
</tr>
</thead>
<tbody>
<?
if(!isset($_SESSION['user_auth_id'])) { die("You need to be logged in."); }$name = $_SESSION['user_auth_id'];
$query = mssql_query("Select OnlineMinutes from MEMB_STAT where memb___id='$name'");
$hour = mssql_fetch_row($query);
$hours = $hour[0];
if(!isset($_POST['agree']))
{
?><form action="" method="post" name="module">
<tr align="center">
<td><? if($hours == "") { $hours = "0"; } echo($hours); ?></td>
<td><? $k = $hours*10; echo($k); ?> </td>
<td align="right">
<input type="submit" class="btnStylec" value="Exchange" name="agree" id="agree"></td>
</tr>
</form>
<?
}
else
{
$name = $_SESSION['user_auth_id'];
$queryy = mssql_query("Select OnlineMinutes from MEMB_STAT where memb___id='$name'");
$hr = mssql_fetch_row($queryy);
$hh = $hr[0];
$mm = mssql_query("Select connectstat from MEMB_STAT where Memb___id='$name'");
$fmm = mssql_fetch_row($mm);
if($fmm[0] == "1")
{
die("<strong>You need to be <font color=red>OFFLINE</font> before you trade your hours.</strong>");
}
$credit = mssql_query("Select Credits from MEMB_CREDITS where memb___id='$name'");
$cr = mssql_fetch_row($credit);
$k = $hh * 10 + $cr[0];
mssql_query("Update MEMB_CREDITS set Credits='$k' where memb___id='$name'");
mssql_query("Delete from MEMB_STAT where memb___id='$name'");
$queryyy = mssql_query("Select OnlineMinutes from MEMB_STAT where memb___id='$name'");
$hrr = mssql_fetch_row($queryyy);
$hhh = $hrr[0];
echo('<td colspan="4" align="center">Succefuly added '.$k.' Credits</td>');
}
?>
</tbody></table></article>