Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] MuCore Exchange Online Time Module

Newbie Spellweaver
Joined
Aug 15, 2012
Messages
37
Reaction score
3
MuCore Exchange Online Time Into Credits Module , working 100% ,
may need some additional querys in database to count hours , minutes online



Enjoy
 
Last edited:
Junior Spellweaver
Joined
Jun 24, 2012
Messages
135
Reaction score
16
Here the querys:
CREATE PROCEDURE WZ_DISCONNECT_MEMB
@memb___id varchar(10)
AS
Begin
set nocount on
Declare @find_id varchar(10)
Declare @ConnectStat tinyint
Set @ConnectStat = 0
Set @find_id = 'NOT'
select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id
where I.memb___id = @memb___id
if( @find_id <> 'NOT' )
begin
update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), TotalTime = TotalTime+(DATEDIFF(mi,ConnectTM,getdate()))
where memb___id = @memb___id
-- TIMEONLINE MOD by john_d
end
end

GO

Just change the "TotalTime" column if you have different column name
also change "(DATEDIFF(mi,ConnectTM,getdate()))" to "(DATEDIFF(hh,ConnectTM,getdate()))" if you want record by hour.

Good luck

Credits - john_d
 
Experienced Elementalist
Joined
Feb 6, 2011
Messages
225
Reaction score
57
good job.
However you may want to consider rewrite the script so it use ODBC connection or SQLSRV instead of MSSQL(since later versions of PHP/IIS won't support it)
 
Newbie Spellweaver
Joined
Jan 6, 2013
Messages
47
Reaction score
4
credits to my class mate of university Víctor Gutierrez.
 
Newbie Spellweaver
Joined
Jan 6, 2013
Messages
47
Reaction score
4
[aporte] Exchange Online hours mucore por UND3R look te date of the post :junglejane:

the post is in spanish but you can use google translator.
 
Last edited by a moderator:
Experienced Elementalist
Joined
May 16, 2009
Messages
205
Reaction score
101
this code can create vulnerabilities in the mu core, not worked in adodb which is the characteristic of the core system

Try this (is the same code but work on adodb) - I have not tested it yet

PHP:
echo "<fieldset>
<legend> ONLINE TO CREDITS EXCHANGER </legend>
<table align=\"center\" border=\"0\" width=\"500\"><tr><td align=\"center\">";

if(!isset($_SESSION['user_auth_id'])) { die("You need to be logged in."); }
$hour = $core_db2->Execute("Select OnlineHours from MEMB_STAT where memb___id=?",array($_SESSION['user_auth_id']));
$hours = $hour->fields[0];
if(!isset($_POST['agree']))
{
echo "<form action=\"\" method=\"post\" name=\"module\">
<table style=\"padding-left: 10px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"4\" width=\"100%\">
<tbody><tr>
<td align=\"left\">Your Online Hours : <b><font color=\"#2e9e1b\">";
echo ($hours == "") ? $hours = "0" : $hours;
echo "</font></b></td>
</tr>
<tr>
<td align=\"left\">You Will Get : <b><em>";
$k = $hours*10;
echo $k;
echo "<font color=\"red\">Credits</font></em></b></td>
</tr>
<tr>
  <td align=\"left\"><div align=\"right\"><strong>
    <input name=\"agree\" type=\"submit\" id=\"agree\" value=\"Exchange\">
  </strong></div></td>
</tr>
</tbody></table>
</form>";
}
else
{
$hr = $core_db2->Execute("Select OnlineHours from MEMB_STAT where memb___id=?",array($_SESSION['user_auth_id']));
$hh = $hr->fields[0];

$mm = $core_db2->Execute("Select connectstat from MEMB_STAT where Memb___id=?",array($_SESSION['user_auth_id']));
if($mm->fields[0] == "1")
{
die("<strong>You need to be <font color=red>OFFLINE</font> before you trade your hours.</strong>");
}
$credit = $core_db2->Execute("Select Credits from MEMB_CREDITS where memb___id=?",array($_SESSION['user_auth_id']));
$k = $hh * 10 + $credit->fields[0];
$core_db->Execute("Update MEMB_CREDITS set Credits=? where memb___id=?",array($k,$_SESSION['user_auth_id']));
$core_db2->Execute("Delete from MEMB_STAT where memb___id=?",array($_SESSION['user_auth_id']));
$hrr = $core_db2->Execute("Select OnlineHours from MEMB_STAT where memb___id=?",array($_SESSION['user_auth_id']));
$hhh = $hrr->fields[0];
echo "<strong>You have now <font color=\"red>\"".$k." Credits</font> and <font color=\"red\">0</font> Online Hours</strong>";
}
echo "</td></tr></table></fieldset>";
 
Last edited:
Newbie Spellweaver
Joined
Mar 3, 2013
Messages
20
Reaction score
5
If im right tha per 1 hour you can get 10 credits ? By useing first post script!
 
Banned
Banned
Joined
Aug 17, 2008
Messages
16
Reaction score
4
Too old thread, but i think, i should say : Don't use this..., because the author don't know anythink about global variables and syntaxis of SQL... For example :

mssql_query("Update MEMB_CREDITS set Credits='$k' where memb___id='$name'");

or for AdoDB

("Update MEMB_CREDITS set Credits=? where memb___id=?",array($k,$_SESSION['user_auth_id']))

...) This thread don't add credits for Online hours, he just SET credits with overwriting olds... It should be :

credits = credits + $k

I know, what it's an old thread, but my reply for all, who think about use this...*script*
 
Custom Title Activated
Loyal Member
Joined
Dec 5, 2009
Messages
2,657
Reaction score
1,178
This thread don't add credits for Online hours, he just SET credits with overwriting olds...

You sure? recheck code... or test next time...

$cr[0] = old credits
$hh = hours
new credits = $k

$k =
Code:
$k = $hh * 10 + $cr[0];

It should be :
credits = credits + $k

so ur code would add 2x old + for online time ^^
 
Banned
Banned
Joined
Aug 17, 2008
Messages
16
Reaction score
4
Sorry, now i see this var, but for what use 2 diff. queryes?=), when you can add old credits in update query? But, how i see,this topic created a long ago, an a think, what at that moment the creator knew the php so bad. Then, i think, there is no point in continuing the discussion. But, again, i dont recommend use it in public, it should be recoded=)
 
Custom Title Activated
Loyal Member
Joined
Apr 6, 2007
Messages
1,806
Reaction score
483
Works on MuWeb 0.9 ?

If you actually read the code, and change a few lines, it should work.
For example: mucore uses $core_db variable for SQL querys, while muweb uses a different one (you should find it on your muweb files.)...changing those kind of things will make the code work on muweb....but hey, dont ask me to do it for you....it means reading php files to understand completely how the code works, and then moving it to fit your web.
But it's always possible ;).

Best Luck.
Ian
 
Back
Top