how can i make limit to stay 10 hour online after user can send mms.
online time limit
Collapse
X
-
u could get the time that a users logs in, and then get the time they log out (or their session is deleted), calculate the amount of time they were logged in for n save that figure in the database, keep adding that figure everytime they log in/out.. and av some code to prevent access to mms if the figure is below 10 hours
-
Originally posted by bigboss View PostI have done this code in my site.
And u know to ask for help from others for every little thing and just expect the finished code.
No one should help u any more.<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
Comment
-
Working Total time Online Below.
Add in Core.php
PHP Code:function addonline($uid,$place,$plclink)
{
/////delete inactive users
$tm = time();
$timeout = $tm - 18000; //time out = 5 minutes
$deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");
$cloak = mysql_fetch_array(mysql_query("SELECT hidden FROM ibwf_users WHERE id = '".$uid."'"));
if($cloak[0]==1){
mysql_query("UPDATE ibwf_online SET hidden = 1 WHERE userid = $uid");
}else if($cloak[0]==0){
mysql_query("UPDATE ibwf_online SET hidden = 0 WHERE userid = $uid");
}
///now try to add user to online list
$lastactive2 = mysql_fetch_array(mysql_query("SELECT resetime FROM ibwf_users WHERE id='".$uid."'"));
$tolsla2 = time() - $lastactive2[0];
$totaltimeonline2 = mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
$totaltimeonline2 = $totaltimeonline2[0] + $tolsla2;
$res = mysql_query("UPDATE ibwf_users SET onlinetime='".$totaltimeonline2."' WHERE id='".$uid."'");
$onlinetime = mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
$num = $onlinetime[0]/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
if(!onlinetime($uid))
{
if($hours==1)
{
$kano ="50";
$text = "Congratulation! You have been awarded with 50 plusses for staying online for 1 hour.[br/][small][b]Note:[/b] Stay more earn more.[br/][i]P.S: This is an automated PM.[/i][/small]";
mysql_query("INSERT INTO ibwf_private SET text='".$text."', byuid='2', touid='".$uid."', timesent='".time()."'");
$res = mysql_query("UPDATE ibwf_users SET pnts=pnts+'$kano' WHERE id='".$uid."'");
$res = mysql_query("UPDATE ibwf_users SET onlinedone='1' WHERE id='".$uid."'");
$res = mysql_query("UPDATE ibwf_users SET onlinedone='0' WHERE id='".$uid."'");
$res = mysql_query("UPDATE ibwf_users SET onlinetime='0' WHERE id='".$uid."'");
}
}
$lastactive = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$uid."'"));
$tolsla = time() - $lastactive[0];
$totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id='".$uid."'"));
$totaltimeonline = $totaltimeonline[0] + $tolsla;
$res = mysql_query("UPDATE ibwf_users SET tottimeonl='".$totaltimeonline."' WHERE id='".$uid."'");
$ttime = time();
$res = mysql_query("UPDATE ibwf_users SET resetime='".$ttime."' WHERE id='".$uid."'");
$res = mysql_query("UPDATE ibwf_users SET lastact='".$ttime."' WHERE id='".$uid."'");
$res = mysql_query("UPDATE ibwf_users SET lastseen='".$place."' WHERE id='".$uid."'");
$res = mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$ttime."', place='".$place."', placedet='".$plclink."'");
///////////////////////////////she's always online
mysql_query("UPDATE ibwf_users SET tottimeonl='".$totaltimeonline."' WHERE id='2'");
mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='2'");
mysql_query("INSERT INTO ibwf_online SET userid='2', place='".$place."', actvtime='".$tm."'");
if(!$res)
{
//most probably userid already in the online list
//so just update the place and time
$res = mysql_query("UPDATE ibwf_online SET actvtime='".$ttime."', place='".$place."', placedet='".$plclink."' WHERE userid='".$uid."'");
}
$maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'"));
$result = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));
if($result[0]>=$maxmem[0])
{
$tnow = date("D d M Y - H:i", time());
mysql_query("UPDATE ibwf_settings set name='".$tnow."', value='".$result[0]."' WHERE id='2'");
}
$maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
if($maxtoday[0]==0||$maxtoday=="")
{
mysql_query("INSERT INTO ibwf_mpot SET ddt='".date("d m y")."', ppl='1', dtm='".date("H:i:s")."'");
$maxtoday[0]=1;
}
if($result[0]>=$maxtoday[0])
{
mysql_query("UPDATE ibwf_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'");
}
}
function onlinetime($uid)
{
$not = mysql_fetch_array(mysql_query("SELECT onlinedone FROM ibwf_users WHERE id='".$uid."'"));
if($not[0]=='1')
{ return true;
}else{
return false;
}
}
PHP Code:else if($action=="sendmms"){
addonline(getuid_sid($sid),"Composing a multimedia message","");
$whonick = getnick_uid($who);
boxstart("Send MMS");
$uid = getuid_sid($sid);
$totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id='".$uid."'"));
$limit = 18000 - $totaltimeonline[0];
if(getonline(getuid_sid($sid))<18000)
{
echo "<br/><img src=\"../images/notok.gif\" alt=\"X\"/>You need at least stay 5 hour total time online to send mms!<br/>Your Total Time Online: <b>".gettimemsg($totaltimeonline[0])."</b><br/>Remaining Total time Online: <b>".gettimemsg($limit)."</b>";
}else{
echo "<p><u>Compose your multimedia message:</u><br/>";
echo "Recipient:<br/><form enctype=\"multipart/form-data\" action=\"inbxproc.php?action=sendmms&sid=$sid\" method=\"post\"><input id=\"inputText\" type=\"text\" name=\"pmtou\" value=\"$whonick\" maxlength=\"30\"/><br/>";
echo "Text:<br/><textarea id=\"inputText\" name=\"pmtext\"></textarea><br/>";
echo "Image(JPG or JPEG or GIF or PNG or BMP)/Audio(MIDI or AMR or WAV or MP3 or RM)/Video(3GP or MP4 or RM or AVI)/Others(ZIP or RAR or EXE or SIS or JAR or PDF):<br/>Size limit(2MB) ";
echo "<input id=\"inputText\" type=\"file\" name=\"attach\"/><br/>";
echo "<input id=\"inputButton\" type=\"submit\" name=\"submit\" value=\"Send\"/></form></p>";
}
boxend();
getfooter($sid);
}
Comment
Comment