-BRAIDZ- Posted December 6, 2015 Share Posted December 6, 2015 Okay so I have this at the moment, and you have to refresh the page while in hospital/jail or whatever to see how long you have left, what I want is to make it so it's a live count down, so the player doesn't have to refresh the page to see how long they have left. Any help what so ever would be greatly appreciated function getgmt() { return date("Y-m-d H:i:s"); } function gmtime() { return strtotime(getgmt()); } function sqltounix($s) { return mktime(substr($s, 11, 2), substr($s, 14, 2), substr($s, 17, 2), substr($s, 5, 2), substr($s, 8, 2), substr($s, 0, 4)); } function gettimeleft($tl) { if($tl <= time()) { $release = "0 Seconds"; } else { $mins = floor(($tl - time()) / 60); $hours = floor($mins / 60); $mins -= $hours * 60; $days = floor($hours / 24); $hours -= $days * 24; $months = floor($days / 31); $days -= $months * 31; $weeks = floor($days / 7); $days -= $weeks * 7; $timeleft = ($tl - time()); $secs = round($timeleft%60); if ($months > 0)//MONTHS { $release .= " $months Month" . ($months > 1 ? "s" : ""); } if ($weeks > 0)//WEEKS { if ($months > 0) { $release .= ","; } $release .= " $weeks Week" . ($weeks > 1 ? "s" : ""); } if ($days > 0)//DAYS { if ($months > 0 ||$weeks > 0) { $release .= ","; } $release .= " $days Day" . ($days > 1 ? "s" : ""); } if ($hours > 0)//HOURS { if ($months > 0 ||$weeks > 0 || $days > 0) { $release .= ","; } $release .= " $hours Hour" . ($hours > 1 ? "s" : ""); } if ($mins > 0)//MINUTES { if ($months > 0 ||$weeks > 0 || $days > 0 || $hours > 0) { $release .= ","; } $release .= " $mins Minute" . ($mins > 1 ? "s" : ""); } if($secs > 0)//SECONDS { if($release != "") { $release .= " and"; } $release .= " $secs Second" . ($secs > 1 ? "s" : ""); } } return $release; } Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted December 6, 2015 Share Posted December 6, 2015 Where it says var count = <?=$time['timeleft']?>; you need to change the $time['timeleft'] with users jail or hosp time. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> var count = <?=$time['timeleft']?>; var counter = setInterval(timer, 1000); //1000 will run it every 1 second function timer() { count = count - 1; if (count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); minutes %= 60; hours %= 60; document.getElementById("clock").innerHTML = hours + "hours " + minutes + "minutes and " + seconds + " seconds left"; } </script> then to show it just <span id='clock'></span> you can see a js fiddle here https://jsfiddle.net/hm2rz6a0/ Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 6, 2015 Author Share Posted December 6, 2015 Where it says var count = <?=$time['timeleft']?>; you need to change the $time['timeleft'] with users jail or hosp time. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> var count = <?=$time['timeleft']?>; var counter = setInterval(timer, 1000); //1000 will run it every 1 second function timer() { count = count - 1; if (count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); minutes %= 60; hours %= 60; document.getElementById("clock").innerHTML = hours + "hours " + minutes + "minutes and " + seconds + " seconds left"; } </script> then to show it just <span id='clock'></span> you can see a js fiddle here https://jsfiddle.net/hm2rz6a0/ Thank you, I'd kind of like go keep the $gettimeleft method as there's a few things that I need to change that in aha! Just want the jquery live count down lol Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 6, 2015 Author Share Posted December 6, 2015 (edited) Where it says var count = <?=$time['timeleft']?>; you need to change the $time['timeleft'] with users jail or hosp time. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> var count = <?=$time['timeleft']?>; var counter = setInterval(timer, 1000); //1000 will run it every 1 second function timer() { count = count - 1; if (count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); minutes %= 60; hours %= 60; document.getElementById("clock").innerHTML = hours + "hours " + minutes + "minutes and " + seconds + " seconds left"; } </script> then to show it just <span id='clock'></span> you can see a js fiddle here https://jsfiddle.net/hm2rz6a0/ Do it like this? <?php /*------------includes--------------*/ include('./includes/connections.php'); include('./includes/brain_file.php'); include('./includes/style_top.php'); /*------------includes--------------*/ echo "<center><main>City Bank</main><hr width = '80%'>"; $q_ry = array(); $q_ry = "SELECT * FROM `bank_accounts` WHERE `a_playerid` = '" . mysql_real_escape_string($_SESSION['playerid']) . "'"; $myacc = array(); $myacc = mysql_query($q_ry); if (mysql_num_rows($myacc)) { $ma = array(); $ma = mysql_fetch_array($myacc); if (($ma['a_time'] - time()) <= '0') { if (!$_GET['step']) { echo "Your investment time is now over, You have " . money_alter($ma['a_ammount']) . " to withdraw.<br/> Would you like to withdraw it now?<br/> ><a href='bank.php?step=1'>Yes</a>"; } else { $q_ry = array(); $q_ry = "UPDATE `members` SET `wallet` = `wallet` + '" . mysql_real_escape_string($ma['a_ammount']) . "' WHERE `playerid` = '" . mysql_real_escape_string($_SESSION['playerid']) . "'"; mysql_query($q_ry); stock_remove(2, 1); $q_ry = array(); $q_ry = "DELETE FROM `bank_accounts` WHERE `a_playerid` = '" . mysql_real_escape_string($_SESSION['playerid']) . "'"; mysql_query($q_ry); echo "You have withdrawn " . money_alter($ma['a_ammount']) . " from the bank, You may now start a new investment!"; echo "<script language=javascript>var origm = " . $pl['wallet'] . "; var newm = origm + " . $ma['a_ammount'] . "; timer = setInterval('addCash();', 100);</script>"; } } else { echo "<b>You have an investment running for another <span id='clock'></span></b><br/><br/> At the end of this investment you will recieve " . money_alter($ma['a_ammount']) . "<br/> You will then be able to start a new investment, Interest rates may vary each time you invest."; echo "<hr width = '80%'>><a href='city.php'>Back</a><hr width = '80%'>"; exit(); } } else { $q_ry = array(); $q_ry = "SELECT `my_interest` FROM `members_extra` WHERE `playerid` = '" . mysql_real_escape_string($_SESSION['playerid']) . "'"; $extra = array(); $extra = mysql_fetch_array(mysql_query($q_ry)); if (!$_POST['submit']) { echo "<b>Please choose from a investment period that best suits you.</b> <br/><b><u>NOTE:</u></b> The longer you invest for the more you will gain at the end of the period.<br/> The maximum investment is 2 billion!<br/><br/> <table width = '80%' class='rounded'><tr><td align = 'center'> <table width = '80%' border='0'><tr><td align='center' width='50%'> <table width = '100%' class='rounded'><tr><td align = 'left'> <form action='bank.php' method='post'> <select name = 'period'> <option value='1wk'>One Week(" . (0.96 + ($extra['my_interest'] * 0.1)) . "% Profit)</option> <option value='2wk'>Two Weeks(" . (2.21 + ($extra['my_interest'] * 0.3)) . "% Profit)</option> <option value='1mt'>One Month(" . (4.08 + ($extra['my_interest'] * 0.9)) . "% Profit)</option> <option value='2mt'>Two Months(" . (10.56 + ($extra['my_interest'] * 0.20)) . "% Profit)</option> <option value='3mt'>Three Months(" . (15.36 + ($extra['my_interest'] * 0.35)) . "% Profit)</option> </select> </td></tr></table></td> <td align='center'> <table width = '100%' class='rounded'><tr><td align = 'left' width='50%'> <input type='text' name='amount' value='" . $pl['wallet'] . "'> </td></tr></table> </td></tr></table><br/> <input type='submit' name='submit' value='Invest'> </form> </td></tr></table><br/>"; } else { $_POST['amount'] = abs(@intval($_POST['amount'])); if (!in_array($_POST['period'], array( '1wk', '2wk', '1mt', '2mt', '3mt' ))) { echo "Error, Invalid time period!<br/> <hr width = '80%'>><a href='city.php'>Back</a><hr width = '80%'>"; include('./includes/style_bottom.php'); exit(); } else if (!$_POST['amount'] || $_POST['amount'] > 2000000000) { echo "Error, Either you dfidnt select an amount to invest or you entered more than 2 billion!<br/> <hr width = '80%'>><a href='city.php'>Back</a><hr width = '80%'>"; include('./includes/style_bottom.php'); exit(); } else { $q_ry = array(); $q_ry = "SELECT * FROM `bank_accounts` WHERE `a_playerid` = '" . mysql_real_escape_string($_SESSION['playerid']) . "'"; $myacc = array(); $myacc = mysql_query($q_ry); if (mysql_num_rows($myacc)) { echo "Error, You already have an investment running!<br/> <hr width = '80%'>><a href='city.php'>Back</a><hr width = '80%'>"; include('./includes/style_bottom.php'); exit(); } else { if ($_POST['amount'] > $pl['wallet']) { echo "Sorry, You dont have enough money for this investment!<br/> <hr width = '80%'>><a href='city.php'>Back</a><hr width = '80%'>"; include('./includes/style_bottom.php'); exit(); } else { $week = 86400 * 7; $month = 86400 * 31; if ($_POST['period'] == "1wk") { $newbal = $_POST['amount'] + ($_POST['amount'] / 100 * (0.96 + ($extra['my_interest'] * 0.1))); $newtime = time() + $week; } if ($_POST['period'] == "2wk") { $newbal = $_POST['amount'] + ($_POST['amount'] / 100 * (2.21 + ($extra['my_interest'] * 0.3))); $newtime = time() + ($week * 2); } if ($_POST['period'] == "1mt") { $newbal = $_POST['amount'] + ($_POST['amount'] / 100 * (4.08 + ($extra['my_interest'] * 0.9))); $newtime = time() + $month; } if ($_POST['period'] == "2mt") { $newbal = $_POST['amount'] + ($_POST['amount'] / 100 * (10.56 + ($extra['my_interest'] * 0.20))); $newtime = time() + ($month * 2); } if ($_POST['period'] == "3mt") { $newbal = $_POST['amount'] + ($_POST['amount'] / 100 * (15.36 + ($extra['my_interest'] * 0.35))); $newtime = time() + ($month * 3); } if (!$_POST['confirm']) { $intime = array( '1wk' => '1 week', '2wk' => '2 weeks', '1mt' => '1 month', '2mt' => '2 months', '3mt' => '3 months' ); echo "<form action = 'bank.php' method = 'post'> Are you sure you wish to invest " . money_alter($_POST['amount']) . " for " . $intime[$_POST['period']] . ". At the end of this investment you will get " . money_alter($newbal) . "?<br/> <input type = 'hidden' name = 'amount' value = '" . $_POST['amount'] . "'> <input type = 'hidden' name = 'period' value = '" . $_POST['period'] . "'> <input type = 'hidden' name = 'submit' value = 'Invest'> <input type = 'submit' name = 'confirm' value = 'Invest'></form>"; } else { $q_ry = array(); $q_ry = "INSERT INTO `bank_accounts` VALUES ('NULL', '" . mysql_real_escape_string($_SESSION['playerid']) . "', '" . mysql_real_escape_string($newbal) . "', '" . mysql_real_escape_string($newtime) . "')"; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE `members` SET `wallet` = `wallet` - '" . mysql_real_escape_string($_POST['amount']) . "' WHERE `playerid` = '" . mysql_real_escape_string($_SESSION['playerid']) . "'"; mysql_query($q_ry); $profit = $newbal - $_POST['amount']; p_stats_add('tot_invest', $_POST['amount'], $_SESSION['playerid']); p_stats_add('tot_profit', $profit, $_SESSION['playerid']); echo "You have started an investment.<br/> It will take another " . gettimeleft($newtime) . " before you can withdraw it.<br/> At the end of this time you will recieve " . money_alter($newbal) . "<br/> You will then be able to start a new investment."; echo "<script language=javascript>var origm = " . $pl['wallet'] . "; var newm = origm - " . $_POST['amount'] . "; timer = setInterval('minCash();', 100);</script>"; stock_credit(2, 1); } } } } } } echo "<hr width = '80%'>><a href='city.php'>Back</a><hr width = '80%'>"; /*------------includes--------------*/ include('./includes/style_bottom.php'); /*------------includes--------------*/ ?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> var count = <?= $time['a_time'] ?>; var counter = setInterval(timer, 1000); //1000 will* run it every 1 second function timer() { count = count - 1; if (count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); minutes %= 60; hours %= 60; document.getElementById("clock").innerHTML = hours + "hours " + minutes + "minutes and " + seconds + " seconds left"; } </script> Edited December 6, 2015 by -BRAIDZ- Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 6, 2015 Author Share Posted December 6, 2015 [MENTION=70347]NonStopCoding[/MENTION] ?? Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 6, 2015 Author Share Posted December 6, 2015 This is all I'm getting from that [ATTACH]2241[/ATTACH] Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted December 6, 2015 Share Posted December 6, 2015 [MENTION=68406]-BRAIDZ-[/MENTION] try this http://pastebin.com/fQjyRFXw Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 6, 2015 Author Share Posted December 6, 2015 [MENTION=68406]-BRAIDZ-[/MENTION] try this http://pastebin.com/fQjyRFXw Thank you it worked, But just wondering if there is anyway I could get rid of the white background?[ATTACH]2242[/ATTACH] Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted December 7, 2015 Share Posted December 7, 2015 Thank you it worked, But just wondering if there is anyway I could get rid of the white background?[ATTACH]2242[/ATTACH] must be something in your css file that affects the span tag i would of said use a div but that would break the text into a new line <span id='clock' style='background:#ececec;'></span> Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 7, 2015 Author Share Posted December 7, 2015 must be something in your css file that affects the span tag i would of said use a div but that would break the text into a new line <span id='clock' style='background:#ececec;'></span> Thank you, now time to add days/months :) Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 7, 2015 Author Share Posted December 7, 2015 [MENTION=70347]NonStopCoding[/MENTION] This is what I'm talking about in Pm [ATTACH]2243[/ATTACH] Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 9, 2015 Author Share Posted December 9, 2015 Anyone else able to help me here please? Quote Link to comment Share on other sites More sharing options...
~Rob0t Posted December 9, 2015 Share Posted December 9, 2015 Anyone else able to help me here please? Re-explain the problems/issues you're having in detail. What do you need? What have you done? What doesn't work? Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 9, 2015 Author Share Posted December 9, 2015 (edited) Re-explain the problems/issues you're having in detail. What do you need? What have you done? What doesn't work? Check this here, https://jsfiddle.net/4hcLtn7s/ it's counting down, but it's saying 26 hours instead of 1 day 1 hour. It will be set from a database entry (unix_timestamp)I'm pretty sure Edited December 9, 2015 by -BRAIDZ- Quote Link to comment Share on other sites More sharing options...
~Rob0t Posted December 9, 2015 Share Posted December 9, 2015 Pretty simple concept. My version supports multiple timers on a single page, also. Probably not the nicest way, as it's writing to the DOM in 2 places (to update the data attribute and to display the time left), but hey. Free code is free code. Grab the timestamp Format the data attributes (the date difference as a string) Create the div Javascript calculations <?php $intCurrentTime = time(); $arrTimes = array( 1449652661, //45 seconds ago 1449652106, //10 minutes ago 1449649106 //1 hour ago ); $objCurrentTime = new \DateTime(null, new \DateTimeZone("Europe/London")); $objCurrentTime->setTimestamp($intCurrentTime); foreach($arrTimes as $intTimestamp) { $objOldTime = new \DateTime(null, new \DateTimeZone("Europe/London")); $objOldTime->setTimestamp($intTimestamp); $objDifference = $objCurrentTime->diff($objOldTime); echo "<div class=\"time_diff\" data-timestamp=\"". $intTimestamp ."\" data-time_str=\"". $objDifference->format("%yy %mm %dd %hh %im %ss") . "\"></div> <br />"; } ?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready( function() { setInterval( function() { $(".time_diff").each( function() { var strTime = $(this).data('time_str'); var intTimestamp = $(this).data('timestamp'); var arrLabel = []; var arrDateDiff = strTime.match(/^(\d{1,2})\w\s(\d{1,2})\w\s(\d{1,2})\w\s(\d{1,2})\w\s(\d{1,2})\w\s(\d{1,2})\w$/); var intYear = arrDateDiff[1]; var intMonth = arrDateDiff[2]; var intDays = arrDateDiff[3]; var intHours = arrDateDiff[4] var intMinutes = arrDateDiff[5]; var intSeconds = arrDateDiff[6]; intSeconds = intSeconds - 1; if( intSeconds <= 0 ) { intSeconds = 0; if( intMinutes > 0) { intSeconds = 60; --intMinutes; } } if( intMinutes <= 0 ) { intMinutes = 0; if( intHours > 0 ) { intMinutes = 59; --intHours; } } if( intHours <= 0 ) { intHours = 0; if( intDays > 0 ) { intHours = 60; --intDays; } } if( intDays <= 0 ) { intDays = 0; if( intMonth > 0 ) { intDays = 30; //roughly. shhhh --intMonth; } } if( intMonth <= 0 ) { intMonth = 0; if( intYear > 0 ) { intYear = 1; } } if( intSeconds > 0 ) { arrLabel.push(intSeconds + " seconds "); } if( intMinutes > 0 ) { arrLabel.push(intMinutes + " minutes"); } if( intHours > 0 ) { arrLabel.push(intHours + " hours"); } if( intDays > 0 ) { arrLabel.push(intDays + " days"); } if( intMonth > 0 ) { arrLabel.push(intMonth + " months"); } if( intYear > 0 ) { arrLabel.push(intYear + " years"); } arrLabel.reverse(); $(this).html(arrLabel.join(" ")); $(this).data("time_str", intYear + 'y ' + intMonth + 'm ' + intDays + 'd ' + intHours + 'h ' + intMinutes + 'm ' + intSeconds + 's'); }) }, 1000); }); </script> Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 9, 2015 Author Share Posted December 9, 2015 Pretty simple concept. My version supports multiple timers on a single page, also. Probably not the nicest way, as it's writing to the DOM in 2 places (to update the data attribute and to display the time left), but hey. Free code is free code. Grab the timestamp Format the data attributes (the date difference as a string) Create the div Javascript calculations <?php $intCurrentTime = time(); $arrTimes = array( 1449652661, //45 seconds ago 1449652106, //10 minutes ago 1449649106 //1 hour ago ); $objCurrentTime = new \DateTime(null, new \DateTimeZone("Europe/London")); $objCurrentTime->setTimestamp($intCurrentTime); foreach($arrTimes as $intTimestamp) { $objOldTime = new \DateTime(null, new \DateTimeZone("Europe/London")); $objOldTime->setTimestamp($intTimestamp); $objDifference = $objCurrentTime->diff($objOldTime); echo "<div class=\"time_diff\" data-timestamp=\"". $intTimestamp ."\" data-time_str=\"". $objDifference->format("%yy %mm %dd %hh %im %ss") . "\"></div> <br />"; } ?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready( function() { setInterval( function() { $(".time_diff").each( function() { var strTime = $(this).data('time_str'); var intTimestamp = $(this).data('timestamp'); var arrLabel = []; var arrDateDiff = strTime.match(/^(\d{1,2})\w\s(\d{1,2})\w\s(\d{1,2})\w\s(\d{1,2})\w\s(\d{1,2})\w\s(\d{1,2})\w$/); var intYear = arrDateDiff[1]; var intMonth = arrDateDiff[2]; var intDays = arrDateDiff[3]; var intHours = arrDateDiff[4] var intMinutes = arrDateDiff[5]; var intSeconds = arrDateDiff[6]; intSeconds = intSeconds - 1; if( intSeconds <= 0 ) { intSeconds = 0; if( intMinutes > 0) { intSeconds = 60; --intMinutes; } } if( intMinutes <= 0 ) { intMinutes = 0; if( intHours > 0 ) { intMinutes = 59; --intHours; } } if( intHours <= 0 ) { intHours = 0; if( intDays > 0 ) { intHours = 60; --intDays; } } if( intDays <= 0 ) { intDays = 0; if( intMonth > 0 ) { intDays = 30; //roughly. shhhh --intMonth; } } if( intMonth <= 0 ) { intMonth = 0; if( intYear > 0 ) { intYear = 1; } } if( intSeconds > 0 ) { arrLabel.push(intSeconds + " seconds "); } if( intMinutes > 0 ) { arrLabel.push(intMinutes + " minutes"); } if( intHours > 0 ) { arrLabel.push(intHours + " hours"); } if( intDays > 0 ) { arrLabel.push(intDays + " days"); } if( intMonth > 0 ) { arrLabel.push(intMonth + " months"); } if( intYear > 0 ) { arrLabel.push(intYear + " years"); } arrLabel.reverse(); $(this).html(arrLabel.join(" ")); $(this).data("time_str", intYear + 'y ' + intMonth + 'm ' + intDays + 'd ' + intHours + 'h ' + intMinutes + 'm ' + intSeconds + 's'); }) }, 1000); }); </script> Thanks, still doesn't explain what the problem is with my code I already have posted here. Maybe just a few problems within the maths side of things? Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 11, 2015 Author Share Posted December 11, 2015 Figured it out var count = <?= $time['a_time'] ?>; var now = Math.floor(new Date().getTime() / 1000); count = count - now; var counter = setInterval(timer, 1000); //1000 will* run it every 1 second function timer() { count = count - 1; if(count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); minutes %= 60; hours %= 24; document.getElementById("clock").innerHTML = days + "days " + hours + "hours " + minutes + "minutes and " + seconds + " seconds left"; } Quote Link to comment Share on other sites More sharing options...
sniko Posted December 11, 2015 Share Posted December 11, 2015 Figured it out var count = <?= $time['a_time'] ?>; var now = Math.floor(new Date().getTime() / 1000); count = count - now; var counter = setInterval(timer, 1000); //1000 will* run it every 1 second function timer() { count = count - 1; if(count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); minutes %= 60; hours %= 24; document.getElementById("clock").innerHTML = days + "days " + hours + "hours " + minutes + "minutes and " + seconds + " seconds left"; } This won't allow for multiple clocks on the same page. But nice! Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 15, 2015 Author Share Posted December 15, 2015 This won't allow for multiple clocks on the same page. But nice! I am looking at doing one that will run multiple timers on the one Page. Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 16, 2015 Author Share Posted December 16, 2015 (edited) Okay now I'm having trouble getting the live counter to work on profile.php for federal jail time, thought I'd try that first to see if it work. Here's the code. Line 295 onwards I believe you're looking at.. <?php /*------------includes--------------*/ include('./includes/connections.php'); include('./includes/brain_file.php'); include('./includes/style_top.php'); include('./includes/bbcode_parser.php'); include('./includes/post_bbcode.php'); /*------------includes--------------*/ $_GET['XID'] = abs(intval($_GET['XID'])); if (!$_GET['XID']) { echo "<center>Error, Invalid ID! <hr width = '75%'> ><a href='javascript:history.back()'>Back</a> <hr width = '75%'>"; } else { $q_ry = "SELECT m.playerid,m.playername,m.am_i_staff,m.my_duties,m.my_level,m.my_rank,m.my_property, m.my_gender,m.my_country,m.my_jail,m.my_hosp,m.my_dondays,m.vipday,m.my_forumscore,m.my_forumposts,m.laston,m.jail_reason, m.hosp_reason,m.my_partner,m.my_partner_days,m.my_life,m.my_maxlife,m.my_faction, m.signup_time,m.last_login_time,m.my_traveltime,m.my_city, m.my_mailban,m.mban_reason,m.my_forumban,m.fban_reason, me.my_daysold,me.my_sig_nature,me.my_job,me.my_job_rank,me.my_comp,me.my_married_times,me.shop_status,me.display_case, mp.my_timesbusted,mp.my_timesjailed,mp.my_crimesdone FROM members m INNER JOIN members_extra AS me ON m.playerid = me.playerid INNER JOIN members_personal AS mp ON m.playerid = mp.playerid WHERE m.playerid = " . $_GET['XID'] . " "; $who = mysql_query($q_ry); if (!mysql_num_rows($who)) { echo "<center>Error, Invalid ID! <hr width = '75%'> ><a href='javascript:history.back()'>Back</a> <hr width = '75%'>"; } else { $me = mysql_fetch_array($who); echo "<center> <br> <font size='4' face='Arial, Helvetica, sans-serif'> <main> Profile for " . htmlentities($me['playername']) . " </main> </font> <br> <hr width='750px'>"; $q_ry = "SELECT * FROM profile_skins WHERE ps_playerid = " . $_GET['XID'] . " "; $pros = mysql_query($q_ry); if (mysql_num_rows($pros)) { $ps = mysql_fetch_array($pros); if ($ps['ps_bgimage'] || $ps['ps_bgcolor']) { $style = "style = 'background: "; if ($ps['ps_bgcolor']) { $style .= $ps['ps_bgcolor']; if (!$ps['ps_bgimage']) { $style .= ";"; } } if ($ps['ps_bgimage']) { $bgimagecheck = array(); $bgimagecheck = $ps['ps_bgimage']; $bgimage = array(); $bgimage = getimagesize($bgimagecheck); if ($bgimage) { $style .= " url(\"" . $bgimagecheck . "\") no-repeat center top;"; } else { $style .= ";"; } } $style .= "'"; } if ($ps['ps_sigbgcolor'] != '') { $sigcolor = "bgcolor = '" . $ps['ps_sigbgcolor'] . "'"; } else { $sigcolor = ""; } $table = $style; $font = $ps['ps_fontcolor']; } else { $sigcolor = "bgcolor = '#DFDFDF'"; $table = ""; $font = "black"; } echo "<table width = '750px' " . $table . "> <tr> <td align = 'left' valign = 'top'> <font color = 'white'><b><u>Information</b></u></font> <br>"; if ($me['laston'] >= time() - 15 * 60) { $onstatus = "online"; } else { $onstatus = "offline"; } echo "<img src='images/" . $onstatus . ".png' title='" . $onstatus . "'/> "; echo "<img src='images/" . $me['my_gender'] . ".gif'> "; if ($me['my_dondays']) { echo "<img src='images/donator.gif' alt = 'Donator: " . $me['my_dondays'] . " days' title = 'Donator: " . $me['my_dondays'] . " days'> "; } if ($me['vipday']) { echo "<img src='images/vip.jpg' alt = 'VIP: " . $me['vipday'] . " days' title = 'VIP: " . $me['vipday'] . " days'> "; } if ($me['am_i_staff'] > '1') { echo "<img src='images/staff.png'> "; } echo " <br><font color = '" . $font . "'><b>Name:</b> " . user_name($_GET['XID']) . " "; echo "<br><b>Online:</b> "; if ($onstatus == 'online') { echo "<font color=#009900>Online</font>"; } else { echo "Offline"; } $sttus = array( 'NPC', 'Civilian', '<b><font color=#660099>Helper</font></b>', '<b><font color=#0085A3>Moderator</font></b>', '<b><font color=#006633>Secretary</font></b>', '<b><font color=#AA0000>Admin</font></b>' ); $ranks = array( 'Absolute beginner', 'Beginner', 'Inexperienced', 'Rookie', 'Novice', 'Below Average', 'Average', 'Reasonable', 'Above Average', 'Competent', 'Highly competent', 'Veteran', 'Distinguished', 'Highly distinguished', 'Professional', 'Star', 'Master', 'Outstanding', 'Celebrity', 'Supreme', 'Idol', 'Champion' ); echo "<br><b>Status:</b> " . $sttus[$me['am_i_staff']] . " <br><b>Duties:</b> " . $me['my_duties'] . " <br><b>Gender:</b> "; if ($me['my_gender'] == 'Male') { echo "Male"; } else { echo "Female"; } echo "<br><b>Age:</b> " . $me['my_daysold'] . " days <br><b>Level:</b> <a href='newspaper.php?page=hof&type=level'><font color = '" . $font . "'>" . $me['my_level'] . "</font></a> <br><b>Rank:</b> <a href='newspaper.php?page=hof&type=rank'><font color = '" . $font . "'>#" . $me['my_rank'] . " " . $ranks[($me['my_rank'] - 1)] . "</font></a> <br><b>Faction:</b> "; if ($me['my_faction']) { $q_ry = "SELECT fac_id,fac_name FROM faction_s WHERE fac_id = " . $me['my_faction'] . " "; $fname = mysql_query($q_ry); $fn = mysql_fetch_array($fname); echo "<a href='view_faction.php?XID=" . $fn['fac_id'] . "'><font color = '" . $font . "'>" . htmlentities($fn['fac_name']) . "</font></a>"; } else { echo "N/A"; } echo "<br><b>Property:</b> "; $q_ry = "SELECT p_id,house_name FROM members_properties LEFT JOIN properties p ON mp.p_property = p.house_id WHERE mp.p_id = " . $me['my_property'] . " "; $myhouse = mysql_query($q_ry); $h = mysql_fetch_array($myhouse); echo "<a href='viewproperties.php?XID=" . $_GET['XID'] . "'><font color = '" . $font . "'>" . htmlentities($h['house_name']) . "</font></a> [<a href='viewproperties.php?XID=" . $_GET['XID'] . "'><font color = '" . $font . "'>View all</font></a>] <br><b>Job:</b> "; if ($me['my_job']) { $q_ry = "SELECT job_NAME FROM system_jobs WHERE job_ID = " . $me['my_job'] . " "; $myjob = mysql_query($q_ry); $myj = mysql_fetch_array($myjob); echo "<a href='job.php'><font color = '" . $font . "'>" . htmlentities($myj['job_NAME']) . "</font></a>"; } else if ($me['my_comp']) { $q_ry = "SELECT c_owner,c_name FROM members_companies WHERE c_id = " . $me['my_comp'] . " "; $myjob = mysql_query($q_ry); $myj = mysql_fetch_array($myjob); if ($_GET['XID'] == $myj['c_owner']) { echo "Director"; } else { echo "Employee"; } echo " (<a href='companies.php?action=view&XID=" . $me['my_comp'] . "'><font color = '" . $font . "'>" . htmlentities($myj['c_name']) . "</font></a>)"; } else { echo "None"; } echo "<br><b>Life:</b> " . $me['my_life'] . " / " . $me['my_maxlife'] . " <br><b>Marital Status: </b>"; if (!$me['my_partner']) { echo "Single"; } else { $q_ry = "SELECT playername FROM members WHERE playerid = " . $me['my_partner'] . " "; $partner = mysql_query($q_ry); $pnr = mysql_fetch_array($partner); echo " Married to <a href='profile.php?XID=" . $me['my_partner'] . "'><font color = '" . $font . "'>" . htmlentities($pnr['playername']) . "</font></a> (" . number_format($me['my_partner_days']) . " days)"; } echo "<br><b>Married:</b> " . $me['my_married_times'] . " times <br><b>Friends:</b> "; $q_ry = "SELECT mf_id FROM members_friends WHERE mf_playerid = " . $_GET['XID'] . " "; echo mysql_num_rows(mysql_query($q_ry)); echo "<br><b>Enemies:</b> "; $q_ry = "SELECT me_id FROM members_enemies WHERE me_enemy = " . $_GET['XID'] . " "; echo mysql_num_rows(mysql_query($q_ry)); echo "<br><b>Posts:</b> " . $me['my_forumposts'] . " (" . $me['my_forumscore'] . " score) <br><b>Last action:</b> "; if ($me['laston'] != '0') { $la = (time() - $me['laston']); $unit = "Seconds"; if ($la >= 60) { $la = (int) ($la / 60); $unit = "Minutes"; } if ($la >= 60) { $la = (int) ($la / 60); $unit = "Hours"; if ($la >= 24) { $la = (int) ($la / 24); $unit = "Days"; } } echo "<b>$la $unit ago</b>"; } else { echo "<b>Never</b>"; } echo "<br><b>Signed Up:</b> " . date('F j Y', $me['signup_time']) . " at " . date('g:i:s a', $me['signup_time']) . " <br><b>Last Login:</b> " . date('F j Y', $me['last_login_time']) . " at " . date('g:i:s a', $me['last_login_time']) . " <br><b>Referrals:</b> "; $q_ry = array(); $q_ry = "SELECT ref_id FROM referals_accepted WHERE ref_referer = " . $_GET['XID'] . " "; echo mysql_num_rows(mysql_query($q_ry)); echo "<br><br>"; if ($me['my_jail'] > time()) { echo "<font color = 'red'><b>In jail for " . gettimeleft($me['my_jail']) . "<br/>Reason: " . $me['jail_reason'] . "</b></font><br/><br/>"; } if ($me['my_hosp'] > time()) { echo "<font color = 'red'><b>In hospital for " . gettimeleft($me['my_hosp']) . "<br/>Reason: " . $me['hosp_reason'] . "</b></font><br/><br/>"; } if ($me['my_traveltime'] > time() || $me['my_city'] > '0') { if ($me['my_city'] > '0') { $q_ry = "SELECT city_name FROM other_cities WHERE city_id = " . $me['my_city'] . " "; $citname = mysql_fetch_array(mysql_query($q_ry)); $citname['city_name'] = explode(":", $citname['city_name']); $citname['city_name'] = $citname['city_name'][0]; } else { $citname['city_name'] = "Mafia Town"; } if ($me['my_traveltime'] > time()) { echo "<font color = 'green'><b>Currently traveling to " . $citname['city_name'] . "</b></font><br/><br/>"; } else { echo "<font color = 'green'><b>Currently in " . $citname['city_name'] . "</b></font><br/><br/>"; } } if ($me['my_mailban']) { echo "<font color = 'red'><b>Mail banned for " . $me['my_mailban'] . " day(s).<br/>Reason: " . $me['mban_reason'] . "</b></font><br/><br/>"; } if ($me['my_forumban']) { echo "<font color = 'red'><b>Forum banned for " . $me['my_forumban'] . " day(s).<br/>Reason: " . $me['fban_reason'] . "</b></font><br/><br/>"; } $q_ry = "SELECT * FROM fed_jailed WHERE fj_playerid = " . $_GET['XID'] . " "; $infed = mysql_query($q_ry); if (mysql_num_rows($infed)) { ?> <script type="text/javascript"> var count = <?= $time['fj_time'] ?>; var now = Math.floor(new Date().getTime() / 1000); count = count - now; var counter = setInterval(timer, 1000); //1000 will* run it every 1 second function timer() { count = count - 1; if(count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); minutes %= 60; hours %= 24; document.getElementById("clock").innerHTML = days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds"; } </script> <?php $if = mysql_fetch_array($infed); echo "<font color = 'red'><b><small>In federal jail for <span id='clock' style='background:#adadad;'></span> <br/> Reason: " . $if['fj_reason'] . "</small></b></font><br/><br/>"; } echo "</font> <font color = 'white'><b><u>Criminal Statistics</b></u></font> <font color = '" . $font . "'> <br> <b>Offences:</b> <a href='newspaper.php?page=hof&type=offences'>"; echo "<font color = '" . $font . "'>" . number_format($me['my_crimesdone']) . "</font></a> <br><b>Busted:</b> <a href='newspaper.php?page=hof&type=busts'><font color = '" . $font . "'>" . number_format($me['my_timesbusted']) . " people</font></a> <br><b>Jailed:</b> " . number_format($me['my_timesjailed']) . " times <br> <br> </font> <font color = 'white'><b><u>Personal Information</b></u></font> <font color = '" . $font . "'>"; $q_ry = "SELECT * FROM members_profile_info WHERE mp_playerid = " . $_GET['XID'] . " "; $persi = mysql_query($q_ry); if (!mysql_num_rows($persi)) { echo "<br><b>" . htmlentities($me['playername']) . " does not wish to share this information.</b>"; } else { $pi = mysql_fetch_array($persi); echo "<br><b>Real name:</b> " . htmlentities($pi['mp_name']) . " <br><b>Country:</b> " . htmlentities($pi['mp_country']) . " <br><b>City:</b> " . htmlentities($pi['mp_city']) . " <br><b>Age:</b> " . ($pi['mp_age']) . " <br><b>MSN:</b> " . stripslashes($pi['mp_msn']) . " <br><b>AIM:</b> " . stripslashes($pi['mp_aim']) . " <br><b>ICQ:</b> " . stripslashes($pi['mp_icq']) . " <br><b>Yahoo:</b> " . stripslashes($pi['mp_yahoo']) . ""; } echo "</td> <td align=left valign=top> <font color = 'white'><b><u>Profile Image:</u></b></font><br/> <img src='images/flags/bigflags/" . $me['my_country'] . ".png' title = 'This Player Citizens Of " . $me['my_country'] . "'> "; $q_ry = "SELECT t_team FROM member_turfs WHERE t_playerid = " . $_GET['XID'] . " LIMIT 1"; $inteam = mysql_query($q_ry); if (mysql_num_rows($inteam)) { $myc = array(); $myc = mysql_fetch_array($inteam); $myc = $myc['t_team']; echo "<br/><a href = 'turfwars.php'><img src = 'images/team-" . $myc . ".png' border = '0'></a>"; } $q_ry = "SELECT i_image FROM member_images WHERE i_playerid = " . $_GET['XID'] . " AND i_profile = 1"; $im = mysql_query($q_ry); if (!mysql_num_rows($im)) { echo "<br/> <img src='images/blank_man.jpg' alt = 'No images' title = 'No images' width = '200px' border = '0'>"; } else { $mi = mysql_fetch_array($im); $imgcheck = "images/uploads/id" . $_GET['XID'] . "/" . $mi['i_image'] . ""; $size = getimagesize($imgcheck); if ($size) { echo "<br/> <a href=userimages.php?XID=" . $_GET['XID'] . "><img src = '" . $imgcheck . "' width = '200px' height = '200' border = '0' onmouseover=\"zxcZoom(this,'" . $imgcheck . "',400,'',3,'C');\" onmouseout=\"javascript:zxcZoom(this);\"></a>"; } else { // error echo "<br/> <font color = 'red'><br/><b>Error while loading image</b></font>."; } } $q_ry = "SELECT i_id FROM member_images WHERE i_playerid = " . $_GET['XID'] . " "; $cnt = mysql_query($q_ry); $no = mysql_num_rows($cnt); ?> <style type="text/css"> #alt_text { background: url('images/profiles/alt_text_bg.png') no-repeat center top; width: 205px; height: 25px; line-height: 25px; margin: 0 0 5px 0; color: black; text-align: center; font-weight: bold; margin: 0 0 5px 0; } .drop_into_page { display: none; } </style> <img src = '/images/profiles/attack-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/mail-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/cash-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/trade-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/bounty-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/stall-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/display-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/stats-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/player-report-h.gif' class = 'drop_into_page'> <?php echo "<br/> <br/> <br/> <font color = '" . $font . "'>[</font><a href='userimages.php?XID=" . $_GET['XID'] . "'><font color = '" . $font . "'>" . $no . " uploaded images</font></a><font color = '" . $font . "'>]</font> <br> <br> <div id='alt_text'>Choose an option.</div> <table width = '220px'> <tr> <td align = 'left'> <a href='attack.php?PID=" . $_GET['XID'] . "' onmouseover=\"document.attack.src='images/profiles/attack-h.gif';altText('Attack " . htmlentities($me['playername']) . "');\" onmouseout=\"document.attack.src='images/profiles/attack.gif';altText('');\"> <img src='images/profiles/attack.gif' name = 'attack' border='0'> </a>"; echo "<span class = 'openPopup1' rel = 'popup' id = '1' onmouseover=\"document.mail.src='images/profiles/mail-h.gif';this.style.cursor='pointer';altText('Message " . htmlentities($me['playername']) . "');\" onmouseout=\"document.mail.src='images/profiles/mail.gif';altText('');\"> <img src='images/profiles/mail.gif' name = 'mail' border='0'> </span>"; echo "<a href='sendcash.php?XID=" . $me['playerid'] . "' onmouseover=\"document.cash.src='images/profiles/cash-h.gif';altText('Send " . htmlentities($me['playername']) . " cash');\" onmouseout=\"document.cash.src='images/profiles/cash.gif';altText('');\"> <img src='images/profiles/cash.gif' name = 'cash' border='0'> </a> <a href='trade.php?XID=" . $me['playerid'] . "' onmouseover=\"document.trade.src='images/profiles/trade-h.gif';altText('Initiate a trade with " . htmlentities($me['playername']) . "');\" onmouseout=\"document.trade.src='images/profiles/trade.gif';altText('');\"> <img src='images/profiles/trade.gif' name = 'trade' border='0'> </a> <a href='newspaper.php?page=place&XID=" . $me['playerid'] . "' onmouseover=\"document.bounty.src='images/profiles/bounty-h.gif';altText('Place a bounty on " . htmlentities($me['playername']) . "');\" onmouseout=\"document.bounty.src='images/profiles/bounty.gif';altText('');\"> <img src='images/profiles/bounty.gif' name = 'bounty' border='0'> </a> <a href='stats.php?XID=" . $_GET['XID'] . "' onmouseover=\"document.stats.src='images/profiles/stats-h.gif';altText('View the stats of " . htmlentities($me['playername']) . "');\" onmouseout=\"document.stats.src='images/profiles/stats.gif';altText('');\"> <img src='images/profiles/stats.gif' name = 'stats' border='0'> </a> <a href='player_report.php' onmouseover=\"document.reports.src='images/profiles/player-report-h.gif';altText('Report " . htmlentities($me['playername']) . " To Staff');\" onmouseout=\"document.reports.src='images/profiles/player-report.gif';altText('');\"> <img src='images/profiles/player-report.gif' name = 'reports' border='0'> </a>"; if ($me['display_case'] == 'yes') { echo "<a href='display.php?XID=" . $me['playerid'] . "' onmouseover=\"document.display.src='images/profiles/display-h.gif';altText('View " . htmlentities($me['playername']) . "\'s display case');\" onmouseout=\"document.display.src='images/profiles/display.gif';altText('');\"> <img src='images/profiles/display.gif' name = 'display' border='0'> </a>"; } if ($me['shop_status'] == 'open' || $_GET['XID'] == $_SESSION['playerid'] && $me['shop_status'] != 'none') { echo "<a href='stall.php?XID=" . $me['playerid'] . "' onmouseover=\"document.stall.src='images/profiles/stall-h.gif';altText('View " . htmlentities($me['playername']) . "\'s stall');\" onmouseout=\"document.stall.src='images/profiles/stall.gif';altText('');\"> <img src='images/profiles/stall.gif' name = 'stall' border='0'> </a>"; } if ($pl['am_i_staff'] >= '3') { echo "<br/> <br/> <font color = '" . $font . "'>[</font><a href='s-t_a-f_f-_-o-n_l-y/mail_bans.php?action=manage&XID=" . $me['playerid'] . "'><font color = '" . $font . "'>Mail ban</font></a><font color = '" . $font . "'>]</font> <br/> <br/> <font color = '" . $font . "'>[</font><a href='s-t_a-f_f-_-o-n_l-y/forum_bans.php?action=manage&XID=" . $me['playerid'] . "'><font color = '" . $font . "'>Forum ban</font></a><font color = '" . $font . "'>]</font>"; } { $cl = 0; while ($fd = mysql_fetch_array($frnd)) { echo "<tr> <td align = 'left' width = '20%'> <div id = 'down" . $fd['pc_id'] . "'> <table cellspacing = '3' border = '0'> <tr> <td align = 'center' valign = 'top' rowspan = '2'> <a href = 'profile.php?XID=" . $fd['pc_playerid'] . "'>" . profile_image($fd['pc_playerid'], 40) . "</a> </td> <td align = 'left' valign = 'top'> <a href = 'profile.php?XID=" . $fd['pc_playerid'] . "'><font color = '$font'>" . user_name($fd['pc_playerid']) . "</font></a> </td> </tr> <tr> <td align = 'left' valign = 'top'> <font color = '" . $font . "'>" . stripslashes($pbbc->post_bbcode_parse(htmlentities($fd['pc_message']))) . "<br/> " . date('F j Y', $fd['pc_time']) . " - " . date('g:i:s a', $fd['pc_time']) . "</font>"; if ($fd['pc_playerid'] == $_SESSION['playerid'] || $fd['pc_to'] == $_SESSION['playerid']) { echo "<font color = '" . $font . "'> - <a onClick = 'deleteRow(\"c\", " . $fd['pc_id'] . ",\"\")' style = 'cursor:pointer;'><font color = '" . $font . "'>Delete</font></a></font>"; } echo "</td> </tr> </table> </div> </td> </tr> <tr> <td align = 'left' valign = 'top'>"; $q_ry = "SELECT * FROM profile_replies WHERE pr_comment = " . $fd['pc_id'] . " ORDER BY pr_time ASC"; $reps = mysql_query($q_ry); if (!mysql_num_rows($reps)) { echo "<div id = 'c" . $fd['pc_id'] . "'>"; if (mysql_num_rows($friendofmine) || $_SESSION['playerid'] == $_GET['XID']) { echo "<table> <tr> <td> <form name = 'com" . $fd['pc_id'] . "' method = 'post'> <textarea name = 'comment" . $fd['pc_id'] . "' id = 'comment" . $fd['pc_id'] . "' style = 'width:300px;height:18px;' onKeyUp = 'EnterSub(event, " . $fd['pc_id'] . ")' onClick = 'this.value=\"\"'>Write a comment...</textarea><br/> <input type = 'button' name = 'sub" . $fd['pc_id'] . "' id = 'sub" . $fd['pc_id'] . "' value = 'Reply' onClick = 'PostReply(" . $fd['pc_id'] . ")'> </form> </td> </tr> </table>"; } echo "<hr></div>"; } else { echo "<div id = 'c" . $fd['pc_id'] . "'><table border = 0' width = '100%'>"; $i = 0; while ($rs = mysql_fetch_array($reps)) { $i++; if ($i % 2) { $color = "#e3e3e3"; } else { $color = "#D8D8D8"; } echo "<tr> <td width = '40px'> </td> <td align = 'left' valign = 'top' bgcolor = $color> <table> <tr> <td align = 'center' width = '40px'> <a href = 'profile.php?XID=" . $rs['pr_playerid'] . "'>" . profile_image($rs['pr_playerid'], 30) . "</a> </td> <td align = 'left' valign = 'top'> <a href = 'profile.php?XID=" . $rs['pr_playerid'] . "'>" . user_name($rs['pr_playerid']) . "</a>: " . stripslashes($pbbc->post_bbcode_parse(htmlentities($rs['pr_reply']))) . "<br/> " . date('F j Y', $fd['pc_time']) . " - " . date('g:i:s a', $rs['pr_time']); if ($rs['pr_playerid'] == $_SESSION['playerid'] || $fd['pc_to'] == $_SESSION['playerid']) { echo " - <a onClick = 'deleteRow(\"r\", " . $fd['pc_id'] . ", " . $rs['pr_id'] . ")' style = 'cursor:pointer;'>Delete</a>"; } echo "</td> </tr> </table> </td> </tr>"; } if (mysql_num_rows($friendofmine) || $_SESSION['playerid'] == $_GET['XID']) { echo "<tr> <td> </td> <td> <form name = 'com" . $fd['pc_id'] . "' method = 'post'> <textarea name = 'comment" . $fd['pc_id'] . "' id = 'comment" . $fd['pc_id'] . "' style = 'width:300px;height:18px;' onKeyUp = 'EnterSub(event, " . $fd['pc_id'] . ")' onClick = 'this.value=\"\"'>Write a comment...</textarea><br/> <input type = 'button' name = 'sub" . $fd['pc_id'] . "' id = 'sub" . $fd['pc_id'] . "' value = 'Reply' onClick = 'PostReply(" . $fd['pc_id'] . ")'> </form> </td> </tr>"; } echo "</table><hr></div>"; } echo "</td> </tr>"; } } echo "</table> </td> </tr> <tr> <td colspan = '2'> <br> <hr width = '100%'> <br> <table width = '100%'> <tr align = 'center' bgcolor = '#999999'> <td align = 'center'> <b>Profile signature</b> </td> </tr> <tr " . $sigcolor . "> <td align=center>"; $sig = array(); $sig = !$me['my_sig_nature'] ? "None" : stripslashes($bbc->bbcode_parse(htmlentities($me['my_sig_nature']))); echo $sig; echo "</td> </tr> </table> <br> <hr width = '100%'> <br> <table width = '100%'> <tr align = 'center' bgcolor = '#999999'> <td align = 'center'> <b>Awards</b> </td> </tr> <tr bgcolor = '#DFDFDF'> <td align = 'center'>"; $q_ry = "SELECT ma.*,a.* FROM members_awards ma LEFT JOIN awards a ON ma.ma_award = a.a_id WHERE ma.ma_playerid = " . $_GET['XID'] . " ORDER BY a.a_id ASC"; $myaws = mysql_query($q_ry); if (!mysql_num_rows($myaws)) { echo "<b>This user has no awards.</b>"; } else { while ($aw = mysql_fetch_array($myaws)) { $q_ry = "SELECT ac_alt FROM award_checks WHERE ac_number = " . $aw['ma_tier'] . " AND ac_award_id = " . $aw['a_id'] . " "; $alt = mysql_fetch_array(mysql_query($q_ry)); echo "<img src = 'awards-png.php?XID=" . $aw['a_id'] . "&tier=" . $aw['ma_tier'] . "' border = '1' alt = '" . $aw['a_name'] . ": " . $alt['ac_alt'] . "' title = '" . $aw['a_name'] . ": " . $alt['ac_alt'] . "'> "; } } echo "</td> </tr> </table> </td> </tr> </table> <br> <hr width = '750px'>"; } } include('./includes/style_bottom.php'); ?> <script type="text/javascript" language="JavaScript"> function GetXmlHttpObject() { var xmlhttp=null; try { // Opera 8.0+, Firefox, Safari xmlhttp=new XMLHttpRequest(); } catch (e) { try { //IE xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlhttp; } function postFormPopup(formname, url, did) { var xmlhttp=GetXmlHttpObject(); if(xmlhttp==null) { alert("Sorry, Your browser doesnt support HTTP Requests"); return; } if(xmlhttp) { var fields = new Array(); if(formname) { var ajax = formname; } for(var x = 0; x < eval("document."+ajax+".elements.length"); x++) { eval("fields.push(document."+ajax+".elements[x].name+'='+document."+ajax+".elements[x].value)"); } var sendf = fields.join('&'); xmlhttp.open("POST", url, true); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.getElementById(did).innerHTML = xmlhttp.responseText; } } } xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(sendf); } } function EnterSub(e, id) { var key = (e.keyCode ? e.keyCode : e.which); if(key == 13) { if(id != '') { var clicker = 'sub' + id; var empty = 'comment' + id; } else { var clicker = 'submit'; var empty = 'post'; } document.getElementById(clicker).click(); document.getElementById(empty).value = 'Write a comment...'; } } function PostReply(id) { var xmlhttp=GetXmlHttpObject(); if(xmlhttp==null) { alert("Sorry, Your browser doesnt support HTTP Requests"); return; } if(xmlhttp) { var fields = new Array(); if(id != '') { var ajax = 'com' + id; } else { var ajax = 'postnew'; } for(var x = 0; x < eval("document."+ajax+".elements.length"); x++) { eval("fields.push(document."+ajax+".elements[x].name+'='+document."+ajax+".elements[x].value)"); } if(id != '') { var load = 'profile_comms.php?action=reply&XID=' + id; var refresh = 'c' + id; } else { var load = 'profile_comms.php?action=comment'; var refresh = 'postn'; } var sendf = fields.join('&'); xmlhttp.open("POST", load, true); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.getElementById(refresh).innerHTML = xmlhttp.responseText; } } } xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(sendf); } } function deleteRow(type, comm, reply) { var xmlhttp=GetXmlHttpObject(); if(xmlhttp==null) { alert("Sorry, Your browser doesnt support HTTP Requests"); return; } if(type == 'r') { var load = 'profile_comms.php?action=deleter&XID=' + reply + '&comm=' + comm; var elem = 'c' + comm; } else { var load = 'profile_comms.php?action=deletec&XID=' + comm; var elem = 'down' + comm; var elem2 = 'c' + comm; } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { document.getElementById(elem).innerHTML = xmlhttp.responseText; if(elem2) { document.getElementById(elem2).innerHTML = ''; } } } xmlhttp.open("GET", load, true); xmlhttp.send(null); } function altText(text) { if(text == '') { jQuery('#alt_text').html('Choose an option.'); } else { jQuery('#alt_text').html(text); } } function addwithEase(smileToAdd) { document.reply.message.value += smileToAdd;document.reply.message.focus(); } </script> <div class = 'popUp' id = 'popup1'> <?php echo round_table('450'); ?> <table width = '430px' border = '0' cellspacing = '0'> <tr bgcolor = '#999999'><td colspan=2 align = 'right'><span id = '1' rel = 'closepopup'>X</span><center><b>Send a message</b></center></td></tr> <form name = 'popform1' method = 'post' id = 'popform1'><tr> <input type = 'hidden' name = 'action' id = 'action' value = 'sendmsg'> <input type = 'hidden' name = 'to' id = 'to' size = '5' maxlength = '10' value = '<?= $_GET['XID'] ?>'> <td width=25% bgcolor=#E3E3E3><b>Subject:</b></td> <td bgcolor=#E3E3E3 align = 'left'><input type = 'text' name = 'subject' id = 'subject' size = '50' maxlength = '50' value=''> <i><font size=2>(Example. Hello)</font></i></td> </tr><tr><td bgcolor = '#E3E3E3' colspan = '2' align = 'center'> </td></tr> <tr> <td bgcolor = '#E3E3E3'><b>Message:</b></td> <td width = '90%' bgcolor = '#E3E3E3'> <textarea name = 'message' id = 'message' rows = '10' cols = '50'></textarea></td> </tr><tr bgcolor = '#E3E3E3'> <td colspan = '2'><center><input type = 'button' value = 'Send' name = 'popsub' id = '1'></center></td> </tr></form></table> <?php echo end_round(); ?> </div> Edited December 16, 2015 by -BRAIDZ- Quote Link to comment Share on other sites More sharing options...
AdamHull Posted December 16, 2015 Share Posted December 16, 2015 Where are you querying $time['fj_time'] as this does not seem to be in your code Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted December 16, 2015 Share Posted December 16, 2015 Okay now I'm having trouble getting the live counter to work on profile.php for federal jail time, thought I'd try that first to see if it work. Here's the code. Line 295 onwards I believe you're looking at.. <?php /*------------includes--------------*/ include('./includes/connections.php'); include('./includes/brain_file.php'); include('./includes/style_top.php'); include('./includes/bbcode_parser.php'); include('./includes/post_bbcode.php'); /*------------includes--------------*/ $_GET['XID'] = abs(intval($_GET['XID'])); if (!$_GET['XID']) { echo "<center>Error, Invalid ID! <hr width = '75%'> ><a href='javascript:history.back()'>Back</a> <hr width = '75%'>"; } else { $q_ry = "SELECT m.playerid,m.playername,m.am_i_staff,m.my_duties,m.my_level,m.my_rank,m.my_property, m.my_gender,m.my_country,m.my_jail,m.my_hosp,m.my_dondays,m.vipday,m.my_forumscore,m.my_forumposts,m.laston,m.jail_reason, m.hosp_reason,m.my_partner,m.my_partner_days,m.my_life,m.my_maxlife,m.my_faction, m.signup_time,m.last_login_time,m.my_traveltime,m.my_city, m.my_mailban,m.mban_reason,m.my_forumban,m.fban_reason, me.my_daysold,me.my_sig_nature,me.my_job,me.my_job_rank,me.my_comp,me.my_married_times,me.shop_status,me.display_case, mp.my_timesbusted,mp.my_timesjailed,mp.my_crimesdone FROM members m INNER JOIN members_extra AS me ON m.playerid = me.playerid INNER JOIN members_personal AS mp ON m.playerid = mp.playerid WHERE m.playerid = " . $_GET['XID'] . " "; $who = mysql_query($q_ry); if (!mysql_num_rows($who)) { echo "<center>Error, Invalid ID! <hr width = '75%'> ><a href='javascript:history.back()'>Back</a> <hr width = '75%'>"; } else { $me = mysql_fetch_array($who); echo "<center> <br> <font size='4' face='Arial, Helvetica, sans-serif'> <main> Profile for " . htmlentities($me['playername']) . " </main> </font> <br> <hr width='750px'>"; $q_ry = "SELECT * FROM profile_skins WHERE ps_playerid = " . $_GET['XID'] . " "; $pros = mysql_query($q_ry); if (mysql_num_rows($pros)) { $ps = mysql_fetch_array($pros); if ($ps['ps_bgimage'] || $ps['ps_bgcolor']) { $style = "style = 'background: "; if ($ps['ps_bgcolor']) { $style .= $ps['ps_bgcolor']; if (!$ps['ps_bgimage']) { $style .= ";"; } } if ($ps['ps_bgimage']) { $bgimagecheck = array(); $bgimagecheck = $ps['ps_bgimage']; $bgimage = array(); $bgimage = getimagesize($bgimagecheck); if ($bgimage) { $style .= " url(\"" . $bgimagecheck . "\") no-repeat center top;"; } else { $style .= ";"; } } $style .= "'"; } if ($ps['ps_sigbgcolor'] != '') { $sigcolor = "bgcolor = '" . $ps['ps_sigbgcolor'] . "'"; } else { $sigcolor = ""; } $table = $style; $font = $ps['ps_fontcolor']; } else { $sigcolor = "bgcolor = '#DFDFDF'"; $table = ""; $font = "black"; } echo "<table width = '750px' " . $table . "> <tr> <td align = 'left' valign = 'top'> <font color = 'white'><b><u>Information</b></u></font> <br>"; if ($me['laston'] >= time() - 15 * 60) { $onstatus = "online"; } else { $onstatus = "offline"; } echo "<img src='images/" . $onstatus . ".png' title='" . $onstatus . "'/> "; echo "<img src='images/" . $me['my_gender'] . ".gif'> "; if ($me['my_dondays']) { echo "<img src='images/donator.gif' alt = 'Donator: " . $me['my_dondays'] . " days' title = 'Donator: " . $me['my_dondays'] . " days'> "; } if ($me['vipday']) { echo "<img src='images/vip.jpg' alt = 'VIP: " . $me['vipday'] . " days' title = 'VIP: " . $me['vipday'] . " days'> "; } if ($me['am_i_staff'] > '1') { echo "<img src='images/staff.png'> "; } echo " <br><font color = '" . $font . "'><b>Name:</b> " . user_name($_GET['XID']) . " "; echo "<br><b>Online:</b> "; if ($onstatus == 'online') { echo "<font color=#009900>Online</font>"; } else { echo "Offline"; } $sttus = array( 'NPC', 'Civilian', '<b><font color=#660099>Helper</font></b>', '<b><font color=#0085A3>Moderator</font></b>', '<b><font color=#006633>Secretary</font></b>', '<b><font color=#AA0000>Admin</font></b>' ); $ranks = array( 'Absolute beginner', 'Beginner', 'Inexperienced', 'Rookie', 'Novice', 'Below Average', 'Average', 'Reasonable', 'Above Average', 'Competent', 'Highly competent', 'Veteran', 'Distinguished', 'Highly distinguished', 'Professional', 'Star', 'Master', 'Outstanding', 'Celebrity', 'Supreme', 'Idol', 'Champion' ); echo "<br><b>Status:</b> " . $sttus[$me['am_i_staff']] . " <br><b>Duties:</b> " . $me['my_duties'] . " <br><b>Gender:</b> "; if ($me['my_gender'] == 'Male') { echo "Male"; } else { echo "Female"; } echo "<br><b>Age:</b> " . $me['my_daysold'] . " days <br><b>Level:</b> <a href='newspaper.php?page=hof&type=level'><font color = '" . $font . "'>" . $me['my_level'] . "</font></a> <br><b>Rank:</b> <a href='newspaper.php?page=hof&type=rank'><font color = '" . $font . "'>#" . $me['my_rank'] . " " . $ranks[($me['my_rank'] - 1)] . "</font></a> <br><b>Faction:</b> "; if ($me['my_faction']) { $q_ry = "SELECT fac_id,fac_name FROM faction_s WHERE fac_id = " . $me['my_faction'] . " "; $fname = mysql_query($q_ry); $fn = mysql_fetch_array($fname); echo "<a href='view_faction.php?XID=" . $fn['fac_id'] . "'><font color = '" . $font . "'>" . htmlentities($fn['fac_name']) . "</font></a>"; } else { echo "N/A"; } echo "<br><b>Property:</b> "; $q_ry = "SELECT p_id,house_name FROM members_properties LEFT JOIN properties p ON mp.p_property = p.house_id WHERE mp.p_id = " . $me['my_property'] . " "; $myhouse = mysql_query($q_ry); $h = mysql_fetch_array($myhouse); echo "<a href='viewproperties.php?XID=" . $_GET['XID'] . "'><font color = '" . $font . "'>" . htmlentities($h['house_name']) . "</font></a> [<a href='viewproperties.php?XID=" . $_GET['XID'] . "'><font color = '" . $font . "'>View all</font></a>] <br><b>Job:</b> "; if ($me['my_job']) { $q_ry = "SELECT job_NAME FROM system_jobs WHERE job_ID = " . $me['my_job'] . " "; $myjob = mysql_query($q_ry); $myj = mysql_fetch_array($myjob); echo "<a href='job.php'><font color = '" . $font . "'>" . htmlentities($myj['job_NAME']) . "</font></a>"; } else if ($me['my_comp']) { $q_ry = "SELECT c_owner,c_name FROM members_companies WHERE c_id = " . $me['my_comp'] . " "; $myjob = mysql_query($q_ry); $myj = mysql_fetch_array($myjob); if ($_GET['XID'] == $myj['c_owner']) { echo "Director"; } else { echo "Employee"; } echo " (<a href='companies.php?action=view&XID=" . $me['my_comp'] . "'><font color = '" . $font . "'>" . htmlentities($myj['c_name']) . "</font></a>)"; } else { echo "None"; } echo "<br><b>Life:</b> " . $me['my_life'] . " / " . $me['my_maxlife'] . " <br><b>Marital Status: </b>"; if (!$me['my_partner']) { echo "Single"; } else { $q_ry = "SELECT playername FROM members WHERE playerid = " . $me['my_partner'] . " "; $partner = mysql_query($q_ry); $pnr = mysql_fetch_array($partner); echo " Married to <a href='profile.php?XID=" . $me['my_partner'] . "'><font color = '" . $font . "'>" . htmlentities($pnr['playername']) . "</font></a> (" . number_format($me['my_partner_days']) . " days)"; } echo "<br><b>Married:</b> " . $me['my_married_times'] . " times <br><b>Friends:</b> "; $q_ry = "SELECT mf_id FROM members_friends WHERE mf_playerid = " . $_GET['XID'] . " "; echo mysql_num_rows(mysql_query($q_ry)); echo "<br><b>Enemies:</b> "; $q_ry = "SELECT me_id FROM members_enemies WHERE me_enemy = " . $_GET['XID'] . " "; echo mysql_num_rows(mysql_query($q_ry)); echo "<br><b>Posts:</b> " . $me['my_forumposts'] . " (" . $me['my_forumscore'] . " score) <br><b>Last action:</b> "; if ($me['laston'] != '0') { $la = (time() - $me['laston']); $unit = "Seconds"; if ($la >= 60) { $la = (int) ($la / 60); $unit = "Minutes"; } if ($la >= 60) { $la = (int) ($la / 60); $unit = "Hours"; if ($la >= 24) { $la = (int) ($la / 24); $unit = "Days"; } } echo "<b>$la $unit ago</b>"; } else { echo "<b>Never</b>"; } echo "<br><b>Signed Up:</b> " . date('F j Y', $me['signup_time']) . " at " . date('g:i:s a', $me['signup_time']) . " <br><b>Last Login:</b> " . date('F j Y', $me['last_login_time']) . " at " . date('g:i:s a', $me['last_login_time']) . " <br><b>Referrals:</b> "; $q_ry = array(); $q_ry = "SELECT ref_id FROM referals_accepted WHERE ref_referer = " . $_GET['XID'] . " "; echo mysql_num_rows(mysql_query($q_ry)); echo "<br><br>"; if ($me['my_jail'] > time()) { echo "<font color = 'red'><b>In jail for " . gettimeleft($me['my_jail']) . "<br/>Reason: " . $me['jail_reason'] . "</b></font><br/><br/>"; } if ($me['my_hosp'] > time()) { echo "<font color = 'red'><b>In hospital for " . gettimeleft($me['my_hosp']) . "<br/>Reason: " . $me['hosp_reason'] . "</b></font><br/><br/>"; } if ($me['my_traveltime'] > time() || $me['my_city'] > '0') { if ($me['my_city'] > '0') { $q_ry = "SELECT city_name FROM other_cities WHERE city_id = " . $me['my_city'] . " "; $citname = mysql_fetch_array(mysql_query($q_ry)); $citname['city_name'] = explode(":", $citname['city_name']); $citname['city_name'] = $citname['city_name'][0]; } else { $citname['city_name'] = "Mafia Town"; } if ($me['my_traveltime'] > time()) { echo "<font color = 'green'><b>Currently traveling to " . $citname['city_name'] . "</b></font><br/><br/>"; } else { echo "<font color = 'green'><b>Currently in " . $citname['city_name'] . "</b></font><br/><br/>"; } } if ($me['my_mailban']) { echo "<font color = 'red'><b>Mail banned for " . $me['my_mailban'] . " day(s).<br/>Reason: " . $me['mban_reason'] . "</b></font><br/><br/>"; } if ($me['my_forumban']) { echo "<font color = 'red'><b>Forum banned for " . $me['my_forumban'] . " day(s).<br/>Reason: " . $me['fban_reason'] . "</b></font><br/><br/>"; } $q_ry = "SELECT * FROM fed_jailed WHERE fj_playerid = " . $_GET['XID'] . " "; $infed = mysql_query($q_ry); if (mysql_num_rows($infed)) { ?> <script type="text/javascript"> var count = <?= $time['fj_time'] ?>; var now = Math.floor(new Date().getTime() / 1000); count = count - now; var counter = setInterval(timer, 1000); //1000 will* run it every 1 second function timer() { count = count - 1; if(count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); minutes %= 60; hours %= 24; document.getElementById("clock").innerHTML = days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds"; } </script> <?php $if = mysql_fetch_array($infed); echo "<font color = 'red'><b><small>In federal jail for <span id='clock' style='background:#adadad;'></span> <br/> Reason: " . $if['fj_reason'] . "</small></b></font><br/><br/>"; } echo "</font> <font color = 'white'><b><u>Criminal Statistics</b></u></font> <font color = '" . $font . "'> <br> <b>Offences:</b> <a href='newspaper.php?page=hof&type=offences'>"; echo "<font color = '" . $font . "'>" . number_format($me['my_crimesdone']) . "</font></a> <br><b>Busted:</b> <a href='newspaper.php?page=hof&type=busts'><font color = '" . $font . "'>" . number_format($me['my_timesbusted']) . " people</font></a> <br><b>Jailed:</b> " . number_format($me['my_timesjailed']) . " times <br> <br> </font> <font color = 'white'><b><u>Personal Information</b></u></font> <font color = '" . $font . "'>"; $q_ry = "SELECT * FROM members_profile_info WHERE mp_playerid = " . $_GET['XID'] . " "; $persi = mysql_query($q_ry); if (!mysql_num_rows($persi)) { echo "<br><b>" . htmlentities($me['playername']) . " does not wish to share this information.</b>"; } else { $pi = mysql_fetch_array($persi); echo "<br><b>Real name:</b> " . htmlentities($pi['mp_name']) . " <br><b>Country:</b> " . htmlentities($pi['mp_country']) . " <br><b>City:</b> " . htmlentities($pi['mp_city']) . " <br><b>Age:</b> " . ($pi['mp_age']) . " <br><b>MSN:</b> " . stripslashes($pi['mp_msn']) . " <br><b>AIM:</b> " . stripslashes($pi['mp_aim']) . " <br><b>ICQ:</b> " . stripslashes($pi['mp_icq']) . " <br><b>Yahoo:</b> " . stripslashes($pi['mp_yahoo']) . ""; } echo "</td> <td align=left valign=top> <font color = 'white'><b><u>Profile Image:</u></b></font><br/> <img src='images/flags/bigflags/" . $me['my_country'] . ".png' title = 'This Player Citizens Of " . $me['my_country'] . "'> "; $q_ry = "SELECT t_team FROM member_turfs WHERE t_playerid = " . $_GET['XID'] . " LIMIT 1"; $inteam = mysql_query($q_ry); if (mysql_num_rows($inteam)) { $myc = array(); $myc = mysql_fetch_array($inteam); $myc = $myc['t_team']; echo "<br/><a href = 'turfwars.php'><img src = 'images/team-" . $myc . ".png' border = '0'></a>"; } $q_ry = "SELECT i_image FROM member_images WHERE i_playerid = " . $_GET['XID'] . " AND i_profile = 1"; $im = mysql_query($q_ry); if (!mysql_num_rows($im)) { echo "<br/> <img src='images/blank_man.jpg' alt = 'No images' title = 'No images' width = '200px' border = '0'>"; } else { $mi = mysql_fetch_array($im); $imgcheck = "images/uploads/id" . $_GET['XID'] . "/" . $mi['i_image'] . ""; $size = getimagesize($imgcheck); if ($size) { echo "<br/> <a href=userimages.php?XID=" . $_GET['XID'] . "><img src = '" . $imgcheck . "' width = '200px' height = '200' border = '0' onmouseover=\"zxcZoom(this,'" . $imgcheck . "',400,'',3,'C');\" onmouseout=\"javascript:zxcZoom(this);\"></a>"; } else { // error echo "<br/> <font color = 'red'><br/><b>Error while loading image</b></font>."; } } $q_ry = "SELECT i_id FROM member_images WHERE i_playerid = " . $_GET['XID'] . " "; $cnt = mysql_query($q_ry); $no = mysql_num_rows($cnt); ?> <style type="text/css"> #alt_text { background: url('images/profiles/alt_text_bg.png') no-repeat center top; width: 205px; height: 25px; line-height: 25px; margin: 0 0 5px 0; color: black; text-align: center; font-weight: bold; margin: 0 0 5px 0; } .drop_into_page { display: none; } </style> <img src = '/images/profiles/attack-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/mail-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/cash-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/trade-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/bounty-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/stall-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/display-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/stats-h.gif' class = 'drop_into_page'> <img src = '/images/profiles/player-report-h.gif' class = 'drop_into_page'> <?php echo "<br/> <br/> <br/> <font color = '" . $font . "'>[</font><a href='userimages.php?XID=" . $_GET['XID'] . "'><font color = '" . $font . "'>" . $no . " uploaded images</font></a><font color = '" . $font . "'>]</font> <br> <br> <div id='alt_text'>Choose an option.</div> <table width = '220px'> <tr> <td align = 'left'> <a href='attack.php?PID=" . $_GET['XID'] . "' onmouseover=\"document.attack.src='images/profiles/attack-h.gif';altText('Attack " . htmlentities($me['playername']) . "');\" onmouseout=\"document.attack.src='images/profiles/attack.gif';altText('');\"> <img src='images/profiles/attack.gif' name = 'attack' border='0'> </a>"; echo "<span class = 'openPopup1' rel = 'popup' id = '1' onmouseover=\"document.mail.src='images/profiles/mail-h.gif';this.style.cursor='pointer';altText('Message " . htmlentities($me['playername']) . "');\" onmouseout=\"document.mail.src='images/profiles/mail.gif';altText('');\"> <img src='images/profiles/mail.gif' name = 'mail' border='0'> </span>"; echo "<a href='sendcash.php?XID=" . $me['playerid'] . "' onmouseover=\"document.cash.src='images/profiles/cash-h.gif';altText('Send " . htmlentities($me['playername']) . " cash');\" onmouseout=\"document.cash.src='images/profiles/cash.gif';altText('');\"> <img src='images/profiles/cash.gif' name = 'cash' border='0'> </a> <a href='trade.php?XID=" . $me['playerid'] . "' onmouseover=\"document.trade.src='images/profiles/trade-h.gif';altText('Initiate a trade with " . htmlentities($me['playername']) . "');\" onmouseout=\"document.trade.src='images/profiles/trade.gif';altText('');\"> <img src='images/profiles/trade.gif' name = 'trade' border='0'> </a> <a href='newspaper.php?page=place&XID=" . $me['playerid'] . "' onmouseover=\"document.bounty.src='images/profiles/bounty-h.gif';altText('Place a bounty on " . htmlentities($me['playername']) . "');\" onmouseout=\"document.bounty.src='images/profiles/bounty.gif';altText('');\"> <img src='images/profiles/bounty.gif' name = 'bounty' border='0'> </a> <a href='stats.php?XID=" . $_GET['XID'] . "' onmouseover=\"document.stats.src='images/profiles/stats-h.gif';altText('View the stats of " . htmlentities($me['playername']) . "');\" onmouseout=\"document.stats.src='images/profiles/stats.gif';altText('');\"> <img src='images/profiles/stats.gif' name = 'stats' border='0'> </a> <a href='player_report.php' onmouseover=\"document.reports.src='images/profiles/player-report-h.gif';altText('Report " . htmlentities($me['playername']) . " To Staff');\" onmouseout=\"document.reports.src='images/profiles/player-report.gif';altText('');\"> <img src='images/profiles/player-report.gif' name = 'reports' border='0'> </a>"; if ($me['display_case'] == 'yes') { echo "<a href='display.php?XID=" . $me['playerid'] . "' onmouseover=\"document.display.src='images/profiles/display-h.gif';altText('View " . htmlentities($me['playername']) . "\'s display case');\" onmouseout=\"document.display.src='images/profiles/display.gif';altText('');\"> <img src='images/profiles/display.gif' name = 'display' border='0'> </a>"; } if ($me['shop_status'] == 'open' || $_GET['XID'] == $_SESSION['playerid'] && $me['shop_status'] != 'none') { echo "<a href='stall.php?XID=" . $me['playerid'] . "' onmouseover=\"document.stall.src='images/profiles/stall-h.gif';altText('View " . htmlentities($me['playername']) . "\'s stall');\" onmouseout=\"document.stall.src='images/profiles/stall.gif';altText('');\"> <img src='images/profiles/stall.gif' name = 'stall' border='0'> </a>"; } if ($pl['am_i_staff'] >= '3') { echo "<br/> <br/> <font color = '" . $font . "'>[</font><a href='s-t_a-f_f-_-o-n_l-y/mail_bans.php?action=manage&XID=" . $me['playerid'] . "'><font color = '" . $font . "'>Mail ban</font></a><font color = '" . $font . "'>]</font> <br/> <br/> <font color = '" . $font . "'>[</font><a href='s-t_a-f_f-_-o-n_l-y/forum_bans.php?action=manage&XID=" . $me['playerid'] . "'><font color = '" . $font . "'>Forum ban</font></a><font color = '" . $font . "'>]</font>"; } { $cl = 0; while ($fd = mysql_fetch_array($frnd)) { echo "<tr> <td align = 'left' width = '20%'> <div id = 'down" . $fd['pc_id'] . "'> <table cellspacing = '3' border = '0'> <tr> <td align = 'center' valign = 'top' rowspan = '2'> <a href = 'profile.php?XID=" . $fd['pc_playerid'] . "'>" . profile_image($fd['pc_playerid'], 40) . "</a> </td> <td align = 'left' valign = 'top'> <a href = 'profile.php?XID=" . $fd['pc_playerid'] . "'><font color = '$font'>" . user_name($fd['pc_playerid']) . "</font></a> </td> </tr> <tr> <td align = 'left' valign = 'top'> <font color = '" . $font . "'>" . stripslashes($pbbc->post_bbcode_parse(htmlentities($fd['pc_message']))) . "<br/> " . date('F j Y', $fd['pc_time']) . " - " . date('g:i:s a', $fd['pc_time']) . "</font>"; if ($fd['pc_playerid'] == $_SESSION['playerid'] || $fd['pc_to'] == $_SESSION['playerid']) { echo "<font color = '" . $font . "'> - <a onClick = 'deleteRow(\"c\", " . $fd['pc_id'] . ",\"\")' style = 'cursor:pointer;'><font color = '" . $font . "'>Delete</font></a></font>"; } echo "</td> </tr> </table> </div> </td> </tr> <tr> <td align = 'left' valign = 'top'>"; $q_ry = "SELECT * FROM profile_replies WHERE pr_comment = " . $fd['pc_id'] . " ORDER BY pr_time ASC"; $reps = mysql_query($q_ry); if (!mysql_num_rows($reps)) { echo "<div id = 'c" . $fd['pc_id'] . "'>"; if (mysql_num_rows($friendofmine) || $_SESSION['playerid'] == $_GET['XID']) { echo "<table> <tr> <td> <form name = 'com" . $fd['pc_id'] . "' method = 'post'> <textarea name = 'comment" . $fd['pc_id'] . "' id = 'comment" . $fd['pc_id'] . "' style = 'width:300px;height:18px;' onKeyUp = 'EnterSub(event, " . $fd['pc_id'] . ")' onClick = 'this.value=\"\"'>Write a comment...</textarea><br/> <input type = 'button' name = 'sub" . $fd['pc_id'] . "' id = 'sub" . $fd['pc_id'] . "' value = 'Reply' onClick = 'PostReply(" . $fd['pc_id'] . ")'> </form> </td> </tr> </table>"; } echo "<hr></div>"; } else { echo "<div id = 'c" . $fd['pc_id'] . "'><table border = 0' width = '100%'>"; $i = 0; while ($rs = mysql_fetch_array($reps)) { $i++; if ($i % 2) { $color = "#e3e3e3"; } else { $color = "#D8D8D8"; } echo "<tr> <td width = '40px'> </td> <td align = 'left' valign = 'top' bgcolor = $color> <table> <tr> <td align = 'center' width = '40px'> <a href = 'profile.php?XID=" . $rs['pr_playerid'] . "'>" . profile_image($rs['pr_playerid'], 30) . "</a> </td> <td align = 'left' valign = 'top'> <a href = 'profile.php?XID=" . $rs['pr_playerid'] . "'>" . user_name($rs['pr_playerid']) . "</a>: " . stripslashes($pbbc->post_bbcode_parse(htmlentities($rs['pr_reply']))) . "<br/> " . date('F j Y', $fd['pc_time']) . " - " . date('g:i:s a', $rs['pr_time']); if ($rs['pr_playerid'] == $_SESSION['playerid'] || $fd['pc_to'] == $_SESSION['playerid']) { echo " - <a onClick = 'deleteRow(\"r\", " . $fd['pc_id'] . ", " . $rs['pr_id'] . ")' style = 'cursor:pointer;'>Delete</a>"; } echo "</td> </tr> </table> </td> </tr>"; } if (mysql_num_rows($friendofmine) || $_SESSION['playerid'] == $_GET['XID']) { echo "<tr> <td> </td> <td> <form name = 'com" . $fd['pc_id'] . "' method = 'post'> <textarea name = 'comment" . $fd['pc_id'] . "' id = 'comment" . $fd['pc_id'] . "' style = 'width:300px;height:18px;' onKeyUp = 'EnterSub(event, " . $fd['pc_id'] . ")' onClick = 'this.value=\"\"'>Write a comment...</textarea><br/> <input type = 'button' name = 'sub" . $fd['pc_id'] . "' id = 'sub" . $fd['pc_id'] . "' value = 'Reply' onClick = 'PostReply(" . $fd['pc_id'] . ")'> </form> </td> </tr>"; } echo "</table><hr></div>"; } echo "</td> </tr>"; } } echo "</table> </td> </tr> <tr> <td colspan = '2'> <br> <hr width = '100%'> <br> <table width = '100%'> <tr align = 'center' bgcolor = '#999999'> <td align = 'center'> <b>Profile signature</b> </td> </tr> <tr " . $sigcolor . "> <td align=center>"; $sig = array(); $sig = !$me['my_sig_nature'] ? "None" : stripslashes($bbc->bbcode_parse(htmlentities($me['my_sig_nature']))); echo $sig; echo "</td> </tr> </table> <br> <hr width = '100%'> <br> <table width = '100%'> <tr align = 'center' bgcolor = '#999999'> <td align = 'center'> <b>Awards</b> </td> </tr> <tr bgcolor = '#DFDFDF'> <td align = 'center'>"; $q_ry = "SELECT ma.*,a.* FROM members_awards ma LEFT JOIN awards a ON ma.ma_award = a.a_id WHERE ma.ma_playerid = " . $_GET['XID'] . " ORDER BY a.a_id ASC"; $myaws = mysql_query($q_ry); if (!mysql_num_rows($myaws)) { echo "<b>This user has no awards.</b>"; } else { while ($aw = mysql_fetch_array($myaws)) { $q_ry = "SELECT ac_alt FROM award_checks WHERE ac_number = " . $aw['ma_tier'] . " AND ac_award_id = " . $aw['a_id'] . " "; $alt = mysql_fetch_array(mysql_query($q_ry)); echo "<img src = 'awards-png.php?XID=" . $aw['a_id'] . "&tier=" . $aw['ma_tier'] . "' border = '1' alt = '" . $aw['a_name'] . ": " . $alt['ac_alt'] . "' title = '" . $aw['a_name'] . ": " . $alt['ac_alt'] . "'> "; } } echo "</td> </tr> </table> </td> </tr> </table> <br> <hr width = '750px'>"; } } include('./includes/style_bottom.php'); ?> <script type="text/javascript" language="JavaScript"> function GetXmlHttpObject() { var xmlhttp=null; try { // Opera 8.0+, Firefox, Safari xmlhttp=new XMLHttpRequest(); } catch (e) { try { //IE xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlhttp; } function postFormPopup(formname, url, did) { var xmlhttp=GetXmlHttpObject(); if(xmlhttp==null) { alert("Sorry, Your browser doesnt support HTTP Requests"); return; } if(xmlhttp) { var fields = new Array(); if(formname) { var ajax = formname; } for(var x = 0; x < eval("document."+ajax+".elements.length"); x++) { eval("fields.push(document."+ajax+".elements[x].name+'='+document."+ajax+".elements[x].value)"); } var sendf = fields.join('&'); xmlhttp.open("POST", url, true); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.getElementById(did).innerHTML = xmlhttp.responseText; } } } xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(sendf); } } function EnterSub(e, id) { var key = (e.keyCode ? e.keyCode : e.which); if(key == 13) { if(id != '') { var clicker = 'sub' + id; var empty = 'comment' + id; } else { var clicker = 'submit'; var empty = 'post'; } document.getElementById(clicker).click(); document.getElementById(empty).value = 'Write a comment...'; } } function PostReply(id) { var xmlhttp=GetXmlHttpObject(); if(xmlhttp==null) { alert("Sorry, Your browser doesnt support HTTP Requests"); return; } if(xmlhttp) { var fields = new Array(); if(id != '') { var ajax = 'com' + id; } else { var ajax = 'postnew'; } for(var x = 0; x < eval("document."+ajax+".elements.length"); x++) { eval("fields.push(document."+ajax+".elements[x].name+'='+document."+ajax+".elements[x].value)"); } if(id != '') { var load = 'profile_comms.php?action=reply&XID=' + id; var refresh = 'c' + id; } else { var load = 'profile_comms.php?action=comment'; var refresh = 'postn'; } var sendf = fields.join('&'); xmlhttp.open("POST", load, true); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.getElementById(refresh).innerHTML = xmlhttp.responseText; } } } xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(sendf); } } function deleteRow(type, comm, reply) { var xmlhttp=GetXmlHttpObject(); if(xmlhttp==null) { alert("Sorry, Your browser doesnt support HTTP Requests"); return; } if(type == 'r') { var load = 'profile_comms.php?action=deleter&XID=' + reply + '&comm=' + comm; var elem = 'c' + comm; } else { var load = 'profile_comms.php?action=deletec&XID=' + comm; var elem = 'down' + comm; var elem2 = 'c' + comm; } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { document.getElementById(elem).innerHTML = xmlhttp.responseText; if(elem2) { document.getElementById(elem2).innerHTML = ''; } } } xmlhttp.open("GET", load, true); xmlhttp.send(null); } function altText(text) { if(text == '') { jQuery('#alt_text').html('Choose an option.'); } else { jQuery('#alt_text').html(text); } } function addwithEase(smileToAdd) { document.reply.message.value += smileToAdd;document.reply.message.focus(); } </script> <div class = 'popUp' id = 'popup1'> <?php echo round_table('450'); ?> <table width = '430px' border = '0' cellspacing = '0'> <tr bgcolor = '#999999'><td colspan=2 align = 'right'><span id = '1' rel = 'closepopup'>X</span><center><b>Send a message</b></center></td></tr> <form name = 'popform1' method = 'post' id = 'popform1'><tr> <input type = 'hidden' name = 'action' id = 'action' value = 'sendmsg'> <input type = 'hidden' name = 'to' id = 'to' size = '5' maxlength = '10' value = '<?= $_GET['XID'] ?>'> <td width=25% bgcolor=#E3E3E3><b>Subject:</b></td> <td bgcolor=#E3E3E3 align = 'left'><input type = 'text' name = 'subject' id = 'subject' size = '50' maxlength = '50' value=''> <i><font size=2>(Example. Hello)</font></i></td> </tr><tr><td bgcolor = '#E3E3E3' colspan = '2' align = 'center'> </td></tr> <tr> <td bgcolor = '#E3E3E3'><b>Message:</b></td> <td width = '90%' bgcolor = '#E3E3E3'> <textarea name = 'message' id = 'message' rows = '10' cols = '50'></textarea></td> </tr><tr bgcolor = '#E3E3E3'> <td colspan = '2'><center><input type = 'button' value = 'Send' name = 'popsub' id = '1'></center></td> </tr></form></table> <?php echo end_round(); ?> </div> <script type="text/javascript"> var count = <?= $infed['fj_time'] ?>; var now = Math.floor(new Date().getTime() / 1000); count = count - now; var counter = setInterval(timer, 1000); //1000 will* run it every 1 second function timer() { count = count - 1; if(count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); minutes %= 60; hours %= 24; document.getElementById("clock").innerHTML = days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds"; } </script> ?? Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 17, 2015 Author Share Posted December 17, 2015 <script type="text/javascript"> var count = <?= $infed['fj_time'] ?>; var now = Math.floor(new Date().getTime() / 1000); count = count - now; var counter = setInterval(timer, 1000); //1000 will* run it every 1 second function timer() { count = count - 1; if(count == -1) { clearInterval(counter); return; } var seconds = count % 60; var minutes = Math.floor(count / 60); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); minutes %= 60; hours %= 24; document.getElementById("clock").innerHTML = days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds"; } </script> ?? Nope nothing I'll have to put the original code in a pastebin and post it might be easier there, I want to change all my timers like this.. Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 17, 2015 Author Share Posted December 17, 2015 Where are you querying $time['fj_time'] as this does not seem to be in your code Original code here http://pastebin.com/kw1SLJGZ Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted December 19, 2015 Author Share Posted December 19, 2015 Anyone figured this one out yet? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.