more php 8 fixes

This commit is contained in:
Xkeeper
2025-03-29 12:32:35 -07:00
parent da9ad61cab
commit 30260b7530
8 changed files with 175 additions and 163 deletions

View File

@@ -6,7 +6,7 @@
if($loguser['profile_locked'] == 1) { if($loguser['profile_locked'] == 1) {
errorpage("You are not allowed to edit your profile."); errorpage("You are not allowed to edit your profile.");
} }
if($loguser['posts']>=500 or ($loguser[posts]>=250 && (ctime()-$loguser[regdate])>=100*86400)) $postreq=1; if($loguser['posts']>=500 or ($loguser['posts']>=250 && (ctime()-$loguser['regdate'])>=100*86400)) $postreq=1;
if($loguser['titleoption']==0 || $banned) $titleopt=0; if($loguser['titleoption']==0 || $banned) $titleopt=0;
if($loguser['titleoption']==1 && ($postreq or $power>0 or $loguser[title])) $titleopt=1; if($loguser['titleoption']==1 && ($postreq or $power>0 or $loguser[title])) $titleopt=1;
if($loguser['titleoption']==2) $titleopt=1; if($loguser['titleoption']==2) $titleopt=1;
@@ -233,7 +233,7 @@
$title=preg_replace("'(face|style|class|size|id)=([^ ].*?)'si", '', $title); $title=preg_replace("'(face|style|class|size|id)=([^ ].*?)'si", '', $title);
} }
$title = addslashes($title); $title = addslashes($title);
$bio=preg_replace("'<iframe'si", '&lt;iframe', $bio); $bio=preg_replace("'<iframe'si", '&lt;iframe', $bio);
$bio=preg_replace("'<script'si", '&lt;script', $bio); $bio=preg_replace("'<script'si", '&lt;script', $bio);
$bio=preg_replace("'onload'si", 'o<z>nload', $bio); $bio=preg_replace("'onload'si", 'o<z>nload', $bio);

View File

@@ -63,12 +63,13 @@
$blist.= "$userurl ($y)"; $blist.= "$userurl ($y)";
} }
$onlinetime=ctime()-300; $onlinetime = ctime()-300;
$onusers=$sql->query("SELECT id,name,powerlevel,lastactivity,sex,minipic,aka,birthday FROM users WHERE lastactivity>$onlinetime OR lastposttime>$onlinetime ORDER BY name"); $onusers = $sql->query("SELECT id,name,powerlevel,lastactivity,sex,minipic,aka,birthday FROM users WHERE lastactivity > $onlinetime OR lastposttime > $onlinetime ORDER BY name");
$numonline=mysql_num_rows($onusers); $numonline = mysql_num_rows($onusers);
$numguests=$sql->resultq("SELECT count(*) FROM guests WHERE date>$onlinetime",0,0); $numguests = $sql->resultq("SELECT count(*) FROM guests WHERE date>$onlinetime",0,0);
if ($numguests) $guestcount=" | <nobr>$numguests guest".($numguests>1?"s":""); $guestcount = "";
if ($numguests) $guestcount = " | <nobr>$numguests guest".($numguests>1?"s":"");
$onlineusersa = array(); $onlineusersa = array();
for ($numon=0; $onuser = $sql->fetch($onusers);$numon++) { for ($numon=0; $onuser = $sql->fetch($onusers);$numon++) {
@@ -149,7 +150,8 @@
$pms = $sql->getresultsbykey("SELECT msgread, COUNT(*) num FROM pmsgs WHERE userto=$loguserid GROUP BY msgread", 'msgread', 'num'); $pms = $sql->getresultsbykey("SELECT msgread, COUNT(*) num FROM pmsgs WHERE userto=$loguserid GROUP BY msgread", 'msgread', 'num');
$pms[0] = intval($pms[0] ?? 0); // unread $pms[0] = intval($pms[0] ?? 0); // unread
$pms[1] = intval($pms[1] ?? 0); // read $pms[1] = intval($pms[1] ?? 0); // read
$totalpms = $pms[0] + $pms[1]; $totalpms = $pms[0] + $pms[1];
$lastmsg = "";
if ($totalpms) { if ($totalpms) {
if ($pms[0]) $new = $statusicons['new']; if ($pms[0]) $new = $statusicons['new'];
@@ -250,7 +252,7 @@
// Quicker (?) new posts calculation that's hopefully accurate v.v // Quicker (?) new posts calculation that's hopefully accurate v.v
if ($log) { if ($log) {
$qadd = array(); $qadd = array();
foreach ($forums as $forum) $qadd[] = "(lastpostdate > '{$postread[$forum['id']]}' AND forum = '{$forum['id']}')\r\n"; foreach ($forums as $forum) $qadd[] = "(lastpostdate > '". ($postread[$forum['id']] ?? 0) ."' AND forum = '{$forum['id']}')\r\n";
$qadd = implode(' OR ', $qadd); $qadd = implode(' OR ', $qadd);
$forumnew = $sql->getresultsbykey("SELECT forum, COUNT(*) AS unread FROM threads t LEFT JOIN threadsread tr ON (tr.tid = t.id AND tr.uid = $loguser[id]) $forumnew = $sql->getresultsbykey("SELECT forum, COUNT(*) AS unread FROM threads t LEFT JOIN threadsread tr ON (tr.tid = t.id AND tr.uid = $loguser[id])

View File

@@ -20,6 +20,7 @@
require 'lib/config.php'; require 'lib/config.php';
require 'lib/mysql.php'; require 'lib/mysql.php';
require 'lib/reporting.php';
if (isset($board_timezone)) { if (isset($board_timezone)) {
date_default_timezone_set($board_timezone); date_default_timezone_set($board_timezone);
@@ -348,7 +349,7 @@ function timeunits2($sec){
} }
function calcexpgainpost($posts,$days) {return @floor(1.5*@pow($posts*$days,0.5));} function calcexpgainpost($posts,$days) {return @floor(1.5*@pow($posts*$days,0.5));}
function calcexpgaintime($posts,$days) {return sprintf('%01.3f',172800*@(@pow(@($days/$posts),0.5)/$posts));} function calcexpgaintime($posts,$days) {return ($posts == 0 ? 0 : sprintf('%01.3f',172800*@(@pow(@($days/$posts),0.5)/$posts)));}
function calcexpleft($exp) {return calclvlexp(calclvl($exp)+1)-$exp;} function calcexpleft($exp) {return calclvlexp(calclvl($exp)+1)-$exp;}
function totallvlexp($lvl) {return calclvlexp($lvl+1)-calclvlexp($lvl);} function totallvlexp($lvl) {return calclvlexp($lvl+1)-calclvlexp($lvl);}
@@ -407,6 +408,7 @@ function generatenumbergfx($num,$minlen=0,$double=false){
function dotags($msg, $user, &$tags = array()) { function dotags($msg, $user, &$tags = array()) {
global $sql, $dateformat, $tzoff; global $sql, $dateformat, $tzoff;
if (!is_string($msg)) return "";
if (is_string($tags)) { if (is_string($tags)) {
$tags = json_decode($tags, true); $tags = json_decode($tags, true);
} }
@@ -604,8 +606,8 @@ function doforumlist($id){
return $forumlinks; return $forumlinks;
} }
function ctime(){return time(); } // +3*3600;} function ctime(){return time() - 3*3600; } // +3*3600;}
function cmicrotime(){return microtime(true); } // +3*3600;} function cmicrotime(){return microtime(true) - 3*3600; } // +3*3600;}
function getrank($rankset,$title,$posts,$powl){ function getrank($rankset,$title,$posts,$powl){
global $hacks, $sql; global $hacks, $sql;
@@ -787,7 +789,7 @@ function getuserlink(&$u, $substitutions = null, $urlclass = '') {
? " title='Also known as: {$akafield}'" : ''); ? " title='Also known as: {$akafield}'" : '');
} }
$u[$fn['name']] = htmlspecialchars($u[$fn['name']], ENT_QUOTES); $u[$fn['name']] = htmlspecialchars($u[$fn['name']] ?? "", ENT_QUOTES);
global $tzoff; global $tzoff;
$birthday = ($u[$fn['birthday']] ?? null) && (date('m-d', $u[$fn['birthday']]) == date('m-d',ctime() + $tzoff)); $birthday = ($u[$fn['birthday']] ?? null) && (date('m-d', $u[$fn['birthday']]) == date('m-d',ctime() + $tzoff));
@@ -903,7 +905,7 @@ function getnamecolor($sex, $powl, $prefix = true){
case 96: // Kak - Witch case 96: // Kak - Witch
$namecolor .= $nmcol[2][3]; break; // Make it readable in case the user has a light theme $namecolor .= $nmcol[2][3]; break; // Make it readable in case the user has a light theme
default: default:
$namecolor .= $nmcol[$sex][$powl]; $namecolor .= $nmcol[$sex][$powl] ?? $nmcol[0][2];
break; break;
} }
@@ -933,7 +935,7 @@ function fonlineusers($id){
$namelink = getuserlink($onuser); $namelink = getuserlink($onuser);
$onlineusers .='<nobr>'; $onlineusers .='<nobr>';
$onuser['minipic'] =str_replace('>','&gt;',$onuser['minipic']); $onuser['minipic'] =str_replace('>','&gt;',$onuser['minipic'] ?? "");
if($onuser['minipic']) $onlineusers .="<img width=16 height=16 src=$onuser[minipic] align=top> "; if($onuser['minipic']) $onlineusers .="<img width=16 height=16 src=$onuser[minipic] align=top> ";
if($onuser['lastactivity'] <=$onlinetime) $namelink="($namelink)"; if($onuser['lastactivity'] <=$onlinetime) $namelink="($namelink)";
$onlineusers .="$namelink</nobr>"; $onlineusers .="$namelink</nobr>";
@@ -985,6 +987,7 @@ function postradar($userid){
global $sql, $loguser, $loguserid; global $sql, $loguser, $loguserid;
if (!$userid) return ""; if (!$userid) return "";
$race = "";
//$postradar = $sql->query("SELECT posts,id,name,aka,sex,powerlevel,birthday FROM users u RIGHT JOIN postradar p ON u.id=p.comp WHERE p.user={$userid} ORDER BY posts DESC", MYSQL_ASSOC); //$postradar = $sql->query("SELECT posts,id,name,aka,sex,powerlevel,birthday FROM users u RIGHT JOIN postradar p ON u.id=p.comp WHERE p.user={$userid} ORDER BY posts DESC", MYSQL_ASSOC);
$postradar = $sql->query("SELECT posts,id,name,aka,sex,powerlevel,birthday FROM users,postradar WHERE postradar.user={$userid} AND users.id=postradar.comp ORDER BY posts DESC", MYSQL_ASSOC); $postradar = $sql->query("SELECT posts,id,name,aka,sex,powerlevel,birthday FROM users,postradar WHERE postradar.user={$userid} AND users.id=postradar.comp ORDER BY posts DESC", MYSQL_ASSOC);
if (@mysql_num_rows($postradar)>0) { if (@mysql_num_rows($postradar)>0) {
@@ -1344,117 +1347,14 @@ function addslashes_array($data) {
$data[$key] = addslashes_array($value); $data[$key] = addslashes_array($value);
} }
return $data; return $data;
} elseif (is_null($data)) {
return "";
} else { } else {
return addslashes($data); return addslashes($data);
} }
} }
function report($type, $msg) {
if (!function_exists('get_discord_webhook')) return;
$wh_url = get_discord_webhook($type, null);
if (!$wh_url) return;
discord_send($wh_url, $outdiscord);
}
// general purpose report function, now with discord!
function xk_ircout($type, $user, $in) {
// gone
// return;
# and back
$dest = min(1, max(0, $in['pow']));
if ($in['fid'] == 99) {
$dest = 6;
} elseif ($in['fid'] == 98) {
$dest = 7;
}
global $x_hacks;
if ($type == "user") {
if ($in['pmatch']) {
$color = array(8, 7);
if ($in['pmatch'] >= 3) $color = array(7, 4);
elseif ($in['pmatch'] >= 5) $color = array(4, 5);
$extra = " (". xk($color[1]) ."Password matches: ". xk($color[0]) . $in['pmatch'] . xk() .")";
$extradiscord = " (**Password matches**: " . $in['pmatch'] . ")";
}
$out = "1|New user: #". xk(12) . $in['id'] . xk(11) ." $user ". xk() ."(IP: ". xk(12) . $in['ip'] . xk() .")$extra: https://jul.rustedlogic.net/?u=". $in['id'];
$outdiscord = "New user: **#" . $in['id'] . "** ". $user . " (IP: " . $in['ip'] . ")$extra: <https://jul.rustedlogic.net/?u=" . $in['id'] . ">";
} else {
// global $sql;
// $res = $sql -> resultq("SELECT COUNT(`id`) FROM `posts`");
$out = "$dest|New $type by ". xk(11) . $user . xk() ." (". xk(12) . $in['forum'] .": ". xk(11) . $in['thread'] . xk() ."): https://jul.rustedlogic.net/?p=". $in['pid'];
$outdiscord = "New $type by **" . $user . "** (" . $in['forum'] . ": **" . $in['thread'] . "**): <https://jul.rustedlogic.net/?p=". $in['pid'] . ">";
}
xk_ircsend($out);
// discord part
// logic to decide where the message goes based on info provided
if (!function_exists('get_discord_webhook')) return;
$wh_url = get_discord_webhook($type, $in);
if (!$wh_url) return;
discord_send($wh_url, $outdiscord);
}
function xk_ircsend($str) {
$str = str_replace(array("%10", "%13"), array("", ""), rawurlencode($str));
$str = html_entity_decode($str);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://treeki.rustedlogic.net:5000/reporting.php?t=$str");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); // <---- HERE
curl_setopt($ch, CURLOPT_TIMEOUT, 5); // <---- HERE
$file_contents = curl_exec($ch);
curl_close($ch);
return true;
}
function discord_send($url, $msg) {
// stripped down from https://gist.github.com/Mo45/cb0813cb8a6ebcd6524f6a36d4f8862c
$json_data = json_encode([
"content" => $msg
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
// echo $response;
curl_close($ch);
return true;
}
function xk($n = -1) {
if ($n == -1) $k = "";
else $k = str_pad($n, 2, 0, STR_PAD_LEFT);
return "\x03". $k;
}
function formatting_trope($input) { function formatting_trope($input) {
$in = "/[A-Z][^A-Z]/"; $in = "/[A-Z][^A-Z]/";
$out = " \\0"; $out = " \\0";
@@ -1586,42 +1486,3 @@ function printtimedif($timestart){
*/ */
} }
function ircerrors($type, $msg, $file, $line, $context) {
global $loguser;
// They want us to shut up? (@ error control operator) Shut the fuck up then!
if (!error_reporting())
return true;
switch($type) {
case E_USER_ERROR: $typetext = xk(4) . "- Error"; break;
case E_USER_WARNING: $typetext = xk(7) . "- Warning"; break;
case E_USER_NOTICE: $typetext = xk(8) . "- Notice"; break;
default: return false;
}
// Get the ACTUAL location of error for mysql queries
if ($type == E_USER_ERROR && substr($file, -9) === "mysql.php") {
$backtrace = debug_backtrace();
for ($i = 1; isset($backtrace[$i]); ++$i) {
if (substr($backtrace[$i]['file'], -9) !== "mysql.php") {
$file = $backtrace[$i]['file'];
$line = $backtrace[$i]['line'];
break;
}
}
}
// Get the location of error for deprecation
elseif ($type == E_USER_NOTICE && substr($msg, 0, 10) === "Deprecated") {
$backtrace = debug_backtrace();
$file = $backtrace[2]['file'];
$line = $backtrace[2]['line'];
}
$errorlocation = str_replace($_SERVER['DOCUMENT_ROOT'], "", $file) ." #$line";
xk_ircsend("102|".($loguser['id'] ? xk(11) . $loguser['name'] .' ('. xk(10) . $_SERVER['REMOTE_ADDR'] . xk(11) . ')' : xk(10) . $_SERVER['REMOTE_ADDR']) .
" $typetext: ".xk()."($errorlocation) $msg");
return true;
}

View File

@@ -68,7 +68,7 @@ namespace {
return false; return false;
} }
\Dshafik\MySQL::$last_connection = $conn; \Dshafik\MySQL::$last_connection = $conn;
$conn->hash = $hash; @$conn->hash = $hash;
\Dshafik\MySQL::$connections[$hash] = array('refcount' => 1, 'conn' => $conn); \Dshafik\MySQL::$connections[$hash] = array('refcount' => 1, 'conn' => $conn);
return $conn; return $conn;

149
lib/reporting.php Normal file
View File

@@ -0,0 +1,149 @@
<?php
function report($type, $msg) {
if (!function_exists('get_discord_webhook')) return;
$wh_url = get_discord_webhook($type, null);
if (!$wh_url) return;
discord_send($wh_url, $outdiscord);
}
// general purpose report function, now with discord!
function xk_ircout($type, $user, $in) {
// gone
// return;
# and back
$dest = min(1, max(0, $in['pow']));
if ($in['fid'] == 99) {
$dest = 6;
} elseif ($in['fid'] == 98) {
$dest = 7;
}
global $x_hacks;
if ($type == "user") {
if ($in['pmatch']) {
$color = array(8, 7);
if ($in['pmatch'] >= 3) $color = array(7, 4);
elseif ($in['pmatch'] >= 5) $color = array(4, 5);
$extra = " (". xk($color[1]) ."Password matches: ". xk($color[0]) . $in['pmatch'] . xk() .")";
$extradiscord = " (**Password matches**: " . $in['pmatch'] . ")";
}
$out = "1|New user: #". xk(12) . $in['id'] . xk(11) ." $user ". xk() ."(IP: ". xk(12) . $in['ip'] . xk() .")$extra: https://jul.rustedlogic.net/?u=". $in['id'];
$outdiscord = "New user: **#" . $in['id'] . "** ". $user . " (IP: " . $in['ip'] . ")$extra: <https://jul.rustedlogic.net/?u=" . $in['id'] . ">";
} else {
// global $sql;
// $res = $sql -> resultq("SELECT COUNT(`id`) FROM `posts`");
$out = "$dest|New $type by ". xk(11) . $user . xk() ." (". xk(12) . $in['forum'] .": ". xk(11) . $in['thread'] . xk() ."): https://jul.rustedlogic.net/?p=". $in['pid'];
$outdiscord = "New $type by **" . $user . "** (" . $in['forum'] . ": **" . $in['thread'] . "**): <https://jul.rustedlogic.net/?p=". $in['pid'] . ">";
}
xk_ircsend($out);
// discord part
// logic to decide where the message goes based on info provided
if (!function_exists('get_discord_webhook')) return;
$wh_url = get_discord_webhook($type, $in);
if (!$wh_url) return;
discord_send($wh_url, $outdiscord);
}
function xk_ircsend($str) {
$str = str_replace(array("%10", "%13"), array("", ""), rawurlencode($str));
$str = html_entity_decode($str);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://treeki.rustedlogic.net:5000/reporting.php?t=$str");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); // <---- HERE
curl_setopt($ch, CURLOPT_TIMEOUT, 5); // <---- HERE
$file_contents = curl_exec($ch);
curl_close($ch);
return true;
}
function discord_send($url, $msg) {
// stripped down from https://gist.github.com/Mo45/cb0813cb8a6ebcd6524f6a36d4f8862c
$json_data = json_encode([
"content" => $msg
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
// echo $response;
curl_close($ch);
return true;
}
function xk($n = -1) {
if ($n == -1) $k = "";
else $k = str_pad($n, 2, 0, STR_PAD_LEFT);
return "\x03". $k;
}
function ircerrors($type, $msg, $file, $line, $context) {
global $loguser;
// They want us to shut up? (@ error control operator) Shut the fuck up then!
if (!error_reporting())
return true;
switch($type) {
case E_USER_ERROR: $typetext = xk(4) . "- Error"; break;
case E_USER_WARNING: $typetext = xk(7) . "- Warning"; break;
case E_USER_NOTICE: $typetext = xk(8) . "- Notice"; break;
default: return false;
}
// Get the ACTUAL location of error for mysql queries
if ($type == E_USER_ERROR && substr($file, -9) === "mysql.php") {
$backtrace = debug_backtrace();
for ($i = 1; isset($backtrace[$i]); ++$i) {
if (substr($backtrace[$i]['file'], -9) !== "mysql.php") {
$file = $backtrace[$i]['file'];
$line = $backtrace[$i]['line'];
break;
}
}
}
// Get the location of error for deprecation
elseif ($type == E_USER_NOTICE && substr($msg, 0, 10) === "Deprecated") {
$backtrace = debug_backtrace();
$file = $backtrace[2]['file'];
$line = $backtrace[2]['line'];
}
$errorlocation = str_replace($_SERVER['DOCUMENT_ROOT'], "", $file) ." #$line";
xk_ircsend("102|".($loguser['id'] ? xk(11) . $loguser['name'] .' ('. xk(10) . $_SERVER['REMOTE_ADDR'] . xk(11) . ')' : xk(10) . $_SERVER['REMOTE_ADDR']) .
" $typetext: ".xk()."($errorlocation) $msg");
return true;
}

View File

@@ -11,7 +11,7 @@
$userlink = getuserlink($post, array('id'=>'uid'), $linkclass); $userlink = getuserlink($post, array('id'=>'uid'), $linkclass);
unset($postuser); unset($postuser);
$set['userrank'] = getrank($post['useranks'],str_replace("<div", "<<z>idiot", $post['title']),$post['posts'],$post['powerlevel']); $set['userrank'] = getrank($post['useranks'],str_replace("<div", "<<z>idiot", $post['title'] ?? ""),$post['posts'],$post['powerlevel']);
$set['userlink'] = "<a name={$p}></a>{$userlink}"; $set['userlink'] = "<a name={$p}></a>{$userlink}";
$set['date'] = date($dateformat,$post['date']+$tzoff); $set['date'] = date($dateformat,$post['date']+$tzoff);

View File

@@ -107,7 +107,7 @@ MSG;
$tccellh width=40%>&nbsp;</td> $tccellh width=40%>&nbsp;</td>
</tr><tr> </tr><tr>
$tccell1><b>User name:</b></td> $tccell1><b>User name:</b></td>
$tccell2l>$inpt=username maxlength=25 style='width:280px;' ". (!$username ? "autofocus='1' " : "") ."tabindex='1' value=\"". htmlspecialchars($username) ."\"></td> $tccell2l>$inpt=username maxlength=25 style='width:280px;' ". (!$username ? "autofocus='1' " : "") ."tabindex='1' value=\"". htmlspecialchars($username ?? "") ."\"></td>
$tccell1 rowspan=2><b>IP Verification:</b></td> $tccell2l rowspan=2> $tccell1 rowspan=2><b>IP Verification:</b></td> $tccell2l rowspan=2>
<select name='verify' tabindex=4> <select name='verify' tabindex=4>
<option selected value=0>Don't use</option> <option selected value=0>Don't use</option>

View File

@@ -114,7 +114,7 @@
if($user['posts'] > 0) $expstatus.="<br>Gain: ".calcexpgainpost($user['posts'],(ctime()-$user['regdate'])/86400)." EXP per post, ".calcexpgaintime($user['posts'],(ctime()-$user['regdate'])/86400)." seconds to gain 1 EXP when idle"; if($user['posts'] > 0) $expstatus.="<br>Gain: ".calcexpgainpost($user['posts'],(ctime()-$user['regdate'])/86400)." EXP per post, ".calcexpgaintime($user['posts'],(ctime()-$user['regdate'])/86400)." seconds to gain 1 EXP when idle";
$postavg=sprintf("%01.2f",$user['posts']/(ctime()-$user['regdate'])*86400); $postavg=sprintf("%01.2f",$user['posts']/(ctime()-$user['regdate'])*86400);
$totalwidth=116; $totalwidth=116;
$barwidth=@floor(($user['posts']/$maxposts)*$totalwidth); $barwidth=$user['posts'] == 0 ? 0 : @floor(($user['posts']/$maxposts)*$totalwidth);
if($barwidth<0) $barwidth=0; if($barwidth<0) $barwidth=0;
if($barwidth) $baron="<img src=images/$numdir"."bar-on.gif width=$barwidth height=8>"; if($barwidth) $baron="<img src=images/$numdir"."bar-on.gif width=$barwidth height=8>";
if($barwidth<$totalwidth) $baroff="<img src=images/$numdir"."bar-off.gif width=".($totalwidth-$barwidth)." height=8>"; if($barwidth<$totalwidth) $baroff="<img src=images/$numdir"."bar-off.gif width=".($totalwidth-$barwidth)." height=8>";