本文整理汇总了PHP中prefixed函数的典型用法代码示例。如果您正苦于以下问题:PHP prefixed函数的具体用法?PHP prefixed怎么用?PHP prefixed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prefixed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bjtable
function bjtable($res, $frame_caption)
{
begin_frame($frame_caption, true);
begin_table();
?>
<tr>
<td class="colhead">Rank</td>
<td align="left" class="colhead">User</td>
<td align="right" class="colhead">Wins</td>
<td align="right" class="colhead">Losses</td>
<td align="right" class="colhead">Games</td>
<td align="right" class="colhead">Percentage</td>
<td align="right" class="colhead">Win/Loss</td>
</tr>
<?php
$num = 0;
while ($a = mysql_fetch_assoc($res)) {
++$num;
//Calculate Win %
$win_perc = number_format($a[wins] / $a[games] * 100, 1);
// Add a user's +/- statistic
$plus_minus = $a[wins] - $a[losses];
if ($plus_minus >= 0) {
$plus_minus = prefixed(($a[wins] - $a[losses]) * 100 * 1024 * 1024);
} else {
$plus_minus = "-";
$plus_minus .= prefixed(($a[losses] - $a[wins]) * 100 * 1024 * 1024);
}
print "<tr><td>{$num}</td><td align=left><table border=0 class=main cellspacing=0 cellpadding=0><tr><td class=embedded>" . "<b><a href=userdetails.php?id=" . $a[id] . ">" . $a[username] . "</a></b></td>" . "</tr></table></td><td align=right>" . number_format($a[wins], 0) . "</td>" . "</td><td align=right>" . number_format($a[losses], 0) . "</td>" . "</td><td align=right>" . number_format($a[games], 0) . "</td>" . "</td><td align=right>{$win_perc}</td>" . "</td><td align=right>{$plus_minus}</td>" . "</tr>\n";
}
end_table();
end_frame();
}
示例2: peer_list
function peer_list($array)
{
?>
<table width="100%" border="1" cellpadding="5" style="border-collapse:collapse">
<tr>
<td align="center" class="colhead">User</td>
<td align="center" class="colhead">Port&Ip</td>
<td align="center" class="colhead">Ratio</td>
<td align="center" class="colhead">Downloaded</td>
<td align="center" class="colhead">Uploaded</td>
<td align="center" class="colhead">Started</td>
<td align="center" class="colhead">Finished</td>
</tr>
<?php
foreach ($array as $p) {
$time = max(1, time() - $p["started"] - (time() - $p["last_action"]));
?>
<tr>
<td align="center"><a href="userdetails.php?id=<?php
echo $p["p_uid"];
?>
" ><?php
echo $p["p_user"];
?>
</a></td>
<td align="center"><?php
echo get_user_class() >= UC_MODERATOR ? $p["ip"] . ":" . $p["port"] : "xx.xx.xx.xx:xxxx";
?>
</td>
<td align="center"><?php
echo $p["downloaded"] > 0 ? number_format($p["uploaded"] / $p["downloaded"], 2) : ($p["uploaded"] > 0 ? "∞" : "---");
?>
</td>
<td align="center"><?php
echo $p["downloaded"] > 0 ? prefixed($p["downloaded"]) . " @" . prefixed(($p["downloaded"] - $p["downloadoffset"]) / $time) . "s" : "0kb";
?>
</td>
<td align="center"><?php
echo $p["uploaded"] > 0 ? prefixed($p["uploaded"]) . " @" . prefixed(($p["uploaded"] - $p["uploadoffset"]) / $time) . "s" : "0kb";
?>
</td>
<td align="center"><?php
echo date("d-M/Y H:i", $p["started"]);
?>
</td>
<td align="center"><?php
echo date("d-M/Y H:i", $p["finishedat"]);
?>
</td>
</tr>
<?php
}
print "</table>";
}
示例3: maketable
function maketable($res)
{
global $CURUSER;
$ret = "<table class=main border=1 cellspacing=0 cellpadding=5>" . "<tr><td class=colhead align=center>Type</td><td class=colhead>Name</td><td class=colhead align=center>Size</td><td class=colhead align=right>Se.</td><td class=colhead align=right>Le.</td><td class=colhead align=center>Upl.</td>\n" . "<td class=colhead align=center>Downl.</td><td class=colhead align=center>Ratio</td></tr>\n";
while ($arr = mysql_fetch_assoc($res)) {
$ratio = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 0;
$ratio = number_format($ratio, 3);
$color = get_ratio_color($ratio);
if ($color) {
$ratio = "<font color={$color}>{$ratio}</font>";
}
$catimage = safeChar($arr["image"]);
$catname = safeChar($arr["catname"]);
$size = str_replace(" ", "<br>", prefixed($arr["size"]));
$uploaded = str_replace(" ", "<br>", prefixed($arr["uploaded"]));
$downloaded = str_replace(" ", "<br>", prefixed($arr["downloaded"]));
$seeders = number_format($arr["seeders"]);
$leechers = number_format($arr["leechers"]);
$ret .= "<tr><td style='padding: 0px'><img src=\"pic/{$catimage}\" alt=\"{$catname}\" width=42 height=42></td>\n" . "<td><a href=details.php?id={$arr['torrent']}&hit=1><b>" . safeChar($arr["torrentname"]) . "</b></a></td><td align=center>{$size}</td><td align=right>{$seeders}</td><td align=right>{$leechers}</td><td align=center>{$uploaded}</td>\n" . "<td align=center>{$downloaded}</td><td align=center>{$ratio}</td></tr>\n";
}
$ret .= "</table>\n";
return $ret;
}
示例4: insert_compose_frame
//.........这里部分代码省略.........
exit;
}
$res = sql_query("SELECT posts.*, users.username FROM posts JOIN users ON posts.userid = users.id WHERE posts.id = {$postid}") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0) {
stdmsg("Error", "No post with this ID");
end_table();
end_main_frame();
stdfoot();
exit;
}
$arr = mysql_fetch_assoc($res);
}
?>
<tr>
<td class='rowhead' width="10%">Body</td>
<td><?php
$qbody = $quote ? "[quote=" . safeChar($arr["username"]) . "]" . safeChar(unesc($arr["body"])) . "[/quote]" : '';
if (function_exists('textbbcode')) {
textbbcode("compose", "body", $qbody);
} else {
?>
<textarea name="body" style="width:99%" rows="7"><?php
echo $qbody;
?>
</textarea><?php
}
if ($use_attachment_mod && $attachment) {
?>
<tr>
<td colspan='2'><fieldset class="fieldset"><legend>Add attachment</legend>
<input type='checkbox' name='uploadattachment' value='yes' />
<input type="file" name="file" size="60" />
<div class='error'>Allowed files: rar, zip<br />Max file size: <?php
echo prefixed($maxfilesize);
?>
</div></fieldset>
</td>
</tr><?php
}
?>
<tr>
<td align=center colspan=2>
<?php
echo post_icons();
?>
</td>
</tr>
<tr>
<td colspan='2' align='center'>
<input type='submit' value='Submit' />
</td>
</tr>
</td>
</tr><?php
end_table();
?>
</form><?php
end_frame();
// ------ Get 10 last posts if this is a reply
if (!$newtopic) {
$postres = sql_query("SELECT p.id, p.added, p.body, u.id AS uid, u.username, u.avatar " . "FROM posts AS p " . "LEFT JOIN users AS u ON u.id = p.userid " . "WHERE p.topicid = " . sqlesc($id) . " " . "ORDER BY p.id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($postres) > 0) {
?>
<br /><?php
begin_frame("Last 10 post's in reverse order");
示例5: doslowcleanup
function doslowcleanup()
{
global $SITENAME, $DEFAULTBASEURL, $torrent_dir, $autoslowclean_interval, $READPOST_EXPIRY, $CACHE, $queries, $query_stat, $torrent_dir, $tdeadtime, $delaccounts, $oldtorrents, $slotduration, $max_dead_torrent_time, $max_dead_topic_time, $max_dead_user_time, $ad_ratio, $ap_time, $ap_limit, $ap_ratio, $torrent_ttl;
set_time_limit(1200);
$result = mysql_query("show processlist") or sqlerr(__FILE__, __LINE__);
while ($row = mysql_fetch_array($result)) {
if ($row["Time"] > 100 || $row["Command"] == "Sleep") {
$sql = "kill " . $row["Id"] . "";
mysql_query($sql) or sqlerr(__FILE__, __LINE__);
}
}
ignore_user_abort(1);
if ($delaccounts) {
// delete inactive user accounts
$dt = sqlesc(get_date_time(gmtime() - $max_dead_user_time));
$maximumclass = UC_POWER_USER;
sql_query("DELETE FROM users WHERE status='confirmed' AND parked='no' AND class <= {$maximumclass} AND last_access < {$dt}");
}
// == Updated promote power users
$limit = 25 * 1024 * 1024 * 1024;
$res = sql_query("SELECT id, uploaded, downloaded FROM users WHERE class = 0 AND uploaded >= {$limit} AND uploaded / downloaded >= {$ap_ratio} AND enabled='yes' and added < DATE_SUB(NOW(), INTERVAL 28 DAY)") or sqlerr(__FILE__, __LINE__);
$msgs_buffer = $users_buffer = array();
if (mysql_num_rows($res) > 0) {
$msg = "Congratulations, you have been Auto-Promoted to [b]Power User[/b]. :)\n You can enter the casino your account wont get deleted automatically and you get one extra invite :).\n";
while ($arr = mysql_fetch_assoc($res)) {
$ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
$modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Promoted to Power User by System (UL=" . prefixed($arr['uploaded']) . ", DL=" . prefixed($arr['downloaded']) . ", R=" . $ratio . ") \n");
$msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Promotion\')';
$users_buffer[] = '(' . $arr['id'] . ',1,1,' . $modcomment . ')';
}
if (sizeof($msgs_buffer) > 0) {
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
sql_query("INSERT INTO users (id, class, invites, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class), invites = invites+values(invites), modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
$count = mysql_affected_rows();
write_log("promotion", "Delayed Cleanup: Promoted " . $count / 2 . " member(s) from User to Power User");
}
unset($users_buffer);
unset($msgs_buffer);
status_change($arr['id']);
}
// == Updated demote power users
$res = sql_query("SELECT id, uploaded, downloaded FROM users WHERE class = 1 AND uploaded / downloaded < {$ad_ratio}") or sqlerr(__FILE__, __LINE__);
$msgs_buffer = $users_buffer = array();
if (mysql_num_rows($res) > 0) {
$msg = "You have been auto-demoted from [b]Power User[/b] to [b]User[/b] because your share ratio has dropped below < {$ad_ratio}.\n";
while ($arr = mysql_fetch_assoc($res)) {
$ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
$modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Demoted To User by System (UL=" . prefixed($arr['uploaded']) . ", DL=" . prefixed($arr['downloaded']) . ", R=" . $ratio . ") \n");
$msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Demotion\')';
$users_buffer[] = '(' . $arr['id'] . ',0,' . $modcomment . ')';
}
if (sizeof($msgs_buffer) > 0) {
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
sql_query("INSERT INTO users (id, class, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class),\nmodcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
$count = mysql_affected_rows();
write_log("demotion", "Delayed Cleanup: Demoted " . $count / 2 . " member(s) from Power User to User");
status_change($arr['id']);
}
unset($users_buffer);
unset($msgs_buffer);
}
// ////////////////////end//
// ///////////////////////happyhour////
$f = "{$CACHE}/happyhour.txt";
//$f = "C://AppServ/www/happyhour.txt";
$happy = unserialize(file_get_contents($f));
$happyHour = strtotime($happy["time"]);
$curDate = time();
$happyEnd = $happyHour + 3600;
if ($happy["status"] == 0) {
write_log("happyhour", "Happy hour was @ " . date("Y-m-d H:i", $happyHour) . " and Catid " . $happy["catid"] . " ");
happyFile("set");
} elseif ($curDate > $happyEnd && $happy["status"] == 1) {
happyFile("reset");
}
// ////////////end///////
// Remove userprofile views
$days = 7;
$dt = sqlesc(get_date_time(gmtime() - $days * 68400));
mysql_query("DELETE FROM userhits WHERE added < {$dt}");
// //////////////////reset ips/////
$secs = 24 * 60 * 60;
// 24Hours * 60 minutes * 60 seconds...
$dt = sqlesc(get_date_time(gmtime() - $secs));
mysql_query("UPDATE users SET ip = '' WHERE last_access < {$dt}");
// Remove expired readposts...
$dt = sqlesc(get_date_time(gmtime() - $READPOST_EXPIRY));
sql_query("DELETE readposts FROM readposts " . "LEFT JOIN posts ON readposts.lastpostread = posts.id " . "R .added < {$dt}");
write_log("slowautoclean", " -------------------- Delayed cleanup Complete using {$queries} queries --------------------");
}
示例6: mysql_query
// ////////End poster mod
// ////////////recommeded torrents///////////////
if ($CURUSER['rohp'] == "yes") {
echo "<table width=754><tr><td class=\"colhead\" colspan=\"4\"><h2>" . $language['rtor'] . "</h2></td></tr>";
$res1 = mysql_query("SELECT torrents.id AS torrentid, torrents.size, torrents.name, torrents.filename, torrents.leechers, torrents.seeders, torrents.times_completed, torrents.poster, torrents.countstats, torrents.owner, users.username AS username, users.class AS class FROM torrents INNER JOIN users ON torrents.owner = users.id WHERE torrents.recommended='yes' ORDER BY torrents.times_completed DESC LIMIT 4");
if (mysql_num_rows($res1) > 0) {
echo "<tr>";
while ($arr1 = mysql_fetch_assoc($res1)) {
$dispname = trim($arr1["name"]);
if (strlen($dispname) > 30) {
$torlinkalt = " title=\"{$dispname}\"";
$dispname = substr($dispname, 0, 30) . "...";
} else {
$torlinkalt = " title=\"{$dispname}\"";
}
echo "<td width=\"188px\" align=\"center\"" . ($arr1['countstats'] == "no" ? " style='background-color:green'" : ($arr1['countstats'] == "yes" ? " style='background-color:orange'" : "")) . ">\n<br />\n<strong><a href=\"./details.php?id={$arr1['torrentid']}&hit=1\"{$torlinkalt}><img src=\"" . safeChar($arr1['poster']) . "\" border=\"0\" width=\"100\" height=\"120\"></a></strong>\n<br />\n<strong><a href=\"./details.php?id={$arr1['torrentid']}&hit=1\"{$torlinkalt}>" . safeChar($dispname) . "</a></strong><br /><br />\n<strong><a href=\"./details.php?id={$arr1['torrentid']}&dllist=1#seeders\"><font color=yellow>Seeders " . safeChar($arr1['seeders']) . "</font> <font color=red>Leechers " . safeChar($arr1['leechers']) . "</font></a></strong><br />\n<strong><em>Size:</em></strong> " . safeChar(prefixed($arr1['size'])) . "<br />\n</td>";
}
}
echo "</tr></table><br />";
mysql_free_result($res1);
unset($arr1);
}
// ////////////////////////////////////////
// /////////////Birthday cache///////////////////////////////////
$file2 = "{$CACHE}/birthday.txt";
$expire = 21600;
// 6 hours
if (file_exists($file2) && filemtime($file2) > time() - $expire) {
$res3 = unserialize(file_get_contents($file2));
} else {
$today = date("'%'-m-d");
示例7: sql_query
$res1 = sql_query("INSERT INTO messages (sender, poster, receiver, subject, msg, added) VALUES (0, 0, {$CURUSER['id']}, " . sqlesc($subject) . ", " . sqlesc($msg) . ", '" . get_date_time() . "')") or sqlerr(__FILE__, __LINE__);
if (!$res) {
stderr("Error", "It appears that something went wrong while trying to add 10% to your upload amount.");
} else {
stderr("10% Added", "Your total upload amount has been increased by 10% from <b>" . prefixed($uploaded) . "</b> to <b>" . prefixed($newuploaded) . "</b>, which brings your ratio to <b>{$newratio}</b>.");
}
}
stdhead("");
echo "<h1>10%</h1>\n";
if ($CURUSER["tenpercent"] == "yes") {
echo "<h2>It appears that you have already used your 10% addition</h2>\n";
}
echo "<p><table width=700 border=0 cellspacing=0 cellpadding=5><tr><td\n";
echo "<table width=700 border=0 cellspacing=0 cellpadding=10><tr><td style='padding-bottom: 0px'>\n";
echo "<p><b>How it works:</b></p>";
echo "<p class=sub>From this page you can <b>add 10%</b> of your current upload amount to your upload amount bringing it it to <b>110%</b> of its current amount. More details about how this would work out for you can be found in the tables below.</p>";
echo "<br><p><b>However, there are some things you should know first:</b></p>";
echo "<li>This can only be done <b>once</b>, so chose your moment wisely.";
echo "<li>The staff will <b>not</b> reset your 10% addition for any reason.";
echo "</td></tr></table>\n";
echo "</td></tr></table></p>\n";
echo "<p><table width=630 class=main align=center border=0 cellspacing=0 cellpadding=5>\n";
echo "<tr><td class=normalrowhead>Current upload amount:</td><td class=normal>" . str_replace(" ", " ", prefixed($uploaded)) . "</td><td class=embedded width=5%></td><td class=normalrowhead>Increase:</td><td class=normal>" . str_replace(" ", " ", prefixed($newuploaded - $uploaded)) . "</td><td class=embedded width=5%></td><td class=normalrowhead>New upload amount:</td><td class=normal>" . str_replace(" ", " ", prefixed($newuploaded)) . "</td></tr>\n";
echo "<tr><td class=normalrowhead>Current download amount:</td><td class=normal>" . str_replace(" ", " ", prefixed($downloaded)) . "</td><td class=embedded width=5%></td><td class=normalrowhead>Increase:</td><td class=normal>" . str_replace(" ", " ", prefixed(0)) . "</td><td class=embedded width=5%></td><td class=normalrowhead>New download amount:</td><td class=normal>" . str_replace(" ", " ", prefixed($downloaded)) . "</td></tr>\n";
echo "<tr><td class=normalrowhead>Current ratio:</td><td class=normal>{$ratio}</td><td class=embedded width=5%></td><td class=normalrowhead>Increase:</td><td class=normal>{$ratiochange}</td><td class=embedded width=5%></td><td class=normalrowhead>New ratio:</td><td class=normal>{$newratio}</td></tr>\n";
echo "</table></p>\n";
echo "<p><table align=center border=0 cellspacing=0 cellpadding=5><form name=tenpercent method=post action=tenpercent.php>\n";
echo "<tr><td align=center><b>Yes please </b><input type=checkbox name=sure value=yes onclick='if (this.checked) enablesubmit(); else disablesubmit();'></td></tr>\n";
echo "<tr><td align=center><input type=submit name=submit value='Add 10%' class=btn disabled></td></tr>\n";
echo "</form></table></p>\n";
stdfoot();
示例8: mysql_result
echo "<table cellpadding=4 align=center border=1>";
echo "<tr>";
echo "<td class=colhead>Num</td>";
echo "<td class=colhead>Username</td>";
echo "<td class=colhead>Upped / Downed</td>";
echo "<td class=colhead>Ratio</td>";
echo "<td class=colhead>Num torrents</td>";
echo "<td class=colhead>Last upload</td>";
echo "<td class=colhead>Send PM</td>";
echo "</tr>";
for ($i = 0; $i <= $zerofix; $i++) {
$id = mysql_result($result, $i, "id");
$username = mysql_result($result, $i, "username");
$added = mysql_result($result, $i, "added");
$uploaded = prefixed(mysql_result($result, $i, "uploaded"));
$downloaded = prefixed(mysql_result($result, $i, "downloaded"));
$uploadedratio = mysql_result($result, $i, "uploaded");
$downloadedratio = mysql_result($result, $i, "downloaded");
$donor = mysql_result($result, $i, "donor");
$warned = mysql_result($result, $i, "warned");
// get uploader torrents activity
$upperquery = "SELECT added FROM torrents WHERE owner = {$id}";
$upperresult = mysql_query($upperquery);
$torrentinfo = mysql_fetch_array($upperresult);
$numtorrents = mysql_num_rows($upperresult);
if ($downloaded > 0) {
$ratio = $uploadedratio / $downloadedratio;
$ratio = number_format($ratio, 3);
$color = get_ratio_color($ratio);
if ($color) {
$ratio = "<font color={$color}>{$ratio}</font>";
示例9: header
<?php
// CyBerFuN.Ro
// By CyBerNe7
// //
// http://cyberfun.ro/
// http://xlist.ro/
header("Content-Type: text/html; charset=iso-8859-1");
require_once "include/bittorrent.php";
dbconn();
if (!logged_in()) {
header("HTTP/1.0 404 Not Found");
// moddifed logginorreturn by retro//Remember to change the following line to match your server
print "<html><h1>Not Found</h1><p>The requested URL /{$_SERVER['PHP_SELF']} was not found on this server.</p><hr /><address>Apache/1.1.11 " . $SITENAME . " Server at " . $_SERVER['SERVER_NAME'] . " Port 80</address></body></html>\n";
die;
}
$id = 0 + $_GET["id"];
$s = "<table width=500 class=colorss class=main border=\"1\" cellspacing=0 cellpadding=\"5\">\n";
$subres = sql_query("SELECT * FROM files WHERE torrent = {$id} ORDER BY id");
$s .= "<tr><td width=500 class=colhead>Type</td><td class=colhead>Path</td><td class=colhead align=right>Size</td></tr>\n";
while ($subrow = mysql_fetch_array($subres)) {
preg_match('/\\.([A-Za-z0-9]+)$/', $subrow["filename"], $ext);
$ext = strtolower($ext[1]);
if (!file_exists("pic/icons/" . $ext . ".png")) {
$ext = "Unknown";
}
$s .= "<tr><td align\"center\"><img align=center src=\"pic/icons/" . $ext . ".png\" alt=\"{$ext} file\"></td><td class=tableb2 width=700>" . safeChar($subrow["filename"]) . "</td><td align=\"right\">" . prefixed($subrow["size"]) . "</td></tr>\n";
}
$s .= "</table>\n";
echo $s;
示例10: number_format
if ($arr['downloaded'] > 0) {
$ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
$ratio = '<font color=" . get_ratio_color($ratio) . ">' . $ratio . '</font>';
} else {
if ($arr['uploaded'] > 0) {
$ratio = 'Inf.';
} else {
$ratio = '---';
}
}
if ($arr["status"] == 'confirmed') {
$status = "<font color=#1f7309>Confirmed</font>";
} else {
$status = "<font color=#ca0226>Pending</font>";
}
echo '<tr class=tableb>' . $user . '<td align=center>' . prefixed($arr['uploaded']) . '</td><td align=center>' . prefixed($arr['downloaded']) . '</td><td align=center>' . $ratio . '</td><td align=center>' . $status . '</td>';
if ($arr['status'] == 'pending') {
echo '<td align=center><a href=?do=confirm_account&userid=' . (int) $arr['id'] . '&sender=' . (int) $CURUSER['id'] . '><img src=pic/confirm.png border=0 /></a></td>';
} else {
echo '<td align=center>---</td>';
}
}
}
echo '</table><br>';
$select = sql_query("SELECT * FROM invite_codes WHERE sender = " . sqlesc($CURUSER['id']) . " AND status = 'Pending'") or sqlerr();
$num_row = mysql_num_rows($select);
print "<table border=1 width=750 cellspacing=0 cellpadding=5>" . "<tr class=tabletitle><td colspan=6 class=colhead><b>Created Invite Codes</b></td></tr>";
if (!$num_row) {
echo '<tr class=tableb><td colspan=6>You have not created invite codes at the moment!</tr>';
} else {
echo '<tr class=tableb><td><b>Invite Code</b></td><td><b>Created Date</b></td><td><b>Delete</b></td><td><b>Status</b></tr>';
示例11: getStats
function getStats($user, $forced = false)
{
global $_settings, $countries;
if (!file_exists($_settings . $user . ".set") || !is_array($var = unserialize(file_get_contents($_settings . $user . ".set")))) {
return false;
}
$q = mysql_query("SELECT u.id,u.last_login, u.reputation,u.uploaded,u.downloaded,u.country,u.agent,u.hits,u.uptime, count(p.id) as posts ,count(c.id) as comments FROM users as u LEFT JOIN posts as p ON u.id = p.userid LEFT JOIN comments as c ON c.user = u.id WHERE u.username = " . sqlesc($user) . " GROUP BY u.id") or die('Error Error Error!');
if (mysql_num_rows($q) != 1) {
die('Error Error Error!');
}
$a = mysql_fetch_assoc($q);
$ops = array($var['line1']['value'], $var['line2']['value'], $var['line3']['value']);
$i = 1;
foreach ($ops as $op) {
switch ($op) {
case 1:
$var['line' . $i]['value_p'] = $a['posts'] . " post" . ($a['posts'] > 1 ? "s" : "");
break;
case 2:
#$var['line'.$i]['value_p'] = mksize($a['downloaded']) . " - " . mksize($a['uploaded']);
$var['line' . $i]['value_p'] = prefixed($a['downloaded']) . " - " . prefixed($a['uploaded']);
break;
case 3:
#list($days,$hours,$mins) = explode(",",calctime($a['onirct']));
#$var['line'.$i]['value_p'] = "$days days - $hours hours";
$var['line' . $i]['value_p'] = "not yet";
break;
case 4:
$var['line' . $i]['value_p'] = $a['reputation'] . " point" . ($a['reputation'] > 1 ? "s" : "");
break;
case 5:
foreach ($countries as $c) {
if ($c['id'] == $a['country']) {
$var['line' . $i]['value_p'] = $c;
}
}
break;
case 6:
$var['line' . $i]['value_p'] = $a['comments'] . " comment" . ($a['comments'] > 1 ? "s" : "");
break;
case 7:
$var['line' . $i]['value_p'] = $a['agent'];
break;
case 8:
$var['line' . $i]['value_p'] = $a['hits'] . " hit" . ($a['hits'] > 1 ? "s" : "");
break;
case 9:
$lapsetime = ($lapsetime = time() - sql_timestamp_to_unix_timestamp($a["last_login"])) / 3600 % 24 . ' h ' . $lapsetime / 60 % 60 . ' min ' . $lapsetime % 60 . ' s';
$var['line' . $i]['value_p'] = $lapsetime;
break;
}
$i++;
}
if (is_writable($_settings . $user . ".set")) {
file_put_contents($_settings . $user . ".set", serialize($var));
} else {
exit("Can't write user setting");
}
if (file_exists($_settings . $user . ".png")) {
unlink($_settings . $user . ".png");
}
return $var;
}
示例12: date
}
?>
]
Half Download [
<?php
if ($hdown_enabled) {
echo "<font color=\"darkgreen\"><strong>ON </strong></font>" . date("d/m", $hdown_start_time) . " - " . date("d/m", $hdown_end_time);
} else {
echo "<font color=\"" . $hcolor . "\"><strong>" . $hstatus . "</strong></font>";
}
?>
]
<?php
begin_frame();
$uploaded = $CURUSER['uploaded'];
echo '<table align=center width=756 border=1 cellspacing=0 cellpadding=5><tr><td class=colhead2 colspan=4>' . '<h1>' . $SITENAME . ' Karma Bonus Point system:</h1></td></tr><tr><td align=center colspan=4 class=clearalt6>' . 'Exchange your <a class=altlink href=mybonus.php>Karma/Upload Bonus Points</a> [ current ' . $bonus . '/' . prefixed($uploaded) . ' ] for goodies!' . '<br><br>[ If no buttons appear, you have not earned enough bonus points to trade. ]<br><br><tr>' . '<td class=colhead2 align=left>Description</td>' . '<td class=colhead2 align=center>Points</td><td class=colhead2 align=center>Trade</td></tr>';
$res = sql_query("SELECT * FROM bonus WHERE enabled = 'yes' ORDER BY id ASC");
while ($gets = mysql_fetch_assoc($res)) {
//=======change colors
$count1 = ++$count1 % 2;
$class = 'clearalt' . ($count1 == 0 ? '6' : '7');
$otheroption = "<table width=100%><tr><td class={$class}><b>Username:</b><input type=text name=username size=20 maxlength=24></td><td class={$class}> <b>to be given: </b><select name=bonusgift> <option value=100.0> 100.0</option> <option value=200.0> 200.0</option> <option value=300.0> 300.0</option> <option value=400.0> 400.0</option><option value=500.0> 500.0</option><option value=1000.0> 1000.0</option></select> Karma points!</td></tr></table>";
$otheroption2 = "<table width=100%><tr><td class={$class}><b>Username:</b><input type=text name=username size=20 maxlength=24></td><td class={$class}> <b>Amount:</b><input type=text name=amnt size=8 maxlength=24><select name=unit> <option value=2> GB</option></select></td></tr></table>";
$otheroption_title = "<input type=text name=title size=30 maxlength=30>";
$otheroption_donate = "<input type=text name=donate size=10 maxlength=10>";
echo '<form action=mybonus.php?exchange=1 method=post>';
switch (true) {
case $gets['id'] == 5:
echo '<tr><td align=left class=' . $class . '><h1><font color="#CECFF3">' . $gets['bonusname'] . '</font></h1>' . $gets['description'] . '<br><br>Enter the <b>Special Title</b> you would like to have ' . $otheroption_title . ' click Exchange! </td><td align=center class=' . $class . '>' . $gets['points'] . '</td>';
break;
case $gets['id'] == 7:
示例13: elseif
if ($_GET["done"] == "yes") {
$add = "AND addbookmark='ratio'";
} elseif ($_GET["done"] == "no") {
$add = "AND addbookmark='no'";
} else {
$add = "AND addbookmark='no'";
}
$res = mysql_query("SELECT * FROM users WHERE uploaded / downloaded <= 0.70 AND enabled = 'yes' AND immun='no' AND added < {$wdt} {$add} ORDER BY (uploaded/downloaded) ASC") or sqlerr(__FILE__, __LINE__);
echo "<table><tr><h1>" . ($_GET["done"] == "yes" ? "already bookmarked" : "not yet bookmarked") . " Bad Ratio User:</h1></tr>";
echo "" . ($_GET["done"] == "yes" ? "<table><tr style=\"border:none;\"><td style=\"border:none;\"><a href=\"" . $_SERVER['PHP_SELF'] . "?done=no\">show non bookmarked users</a></td></tr></table><br />" : "<table><tr style=\"border:none;\"><td style=\"border:none;\"><a href=\"" . $_SERVER['PHP_SELF'] . "?done=yes\">show bookmarked</a></td></tr></table><br />") . "";
if (mysql_num_rows($res) == 0) {
echo "<table><tr><td class=colhead><font size=3>Cant believe the list is empty!</font></td></tr></table>";
} else {
echo "<table width=550><tr><td class=colhead>Member</td><td class=colhead>Time until incl.</td><td class=colhead>Upload</td><td class=colhead>Download</td><td class=colhead>Ratio</td><td class=colhead>last activity</td></tr>";
while ($row = mysql_fetch_assoc($res)) {
if ($row["downloaded"] > 0) {
$ratio = number_format($row["uploaded"] / $row["downloaded"], 3);
$ratio = "<font color=" . get_ratio_color($ratio) . ">{$ratio}</font>";
} else {
if ($row["uploaded"] > 0) {
$ratio = "Inf.";
} else {
$ratio = "---";
}
}
echo "<tr><td><a href=\"javascript:ajaxpage('inpagebadratio.php?id=" . $row["id"] . "', 'badratio');\">" . $row["username"] . "</a></td><td>" . ($row["addbookmark"] == "ratio" ? "" . substr($row["bookmcomment"], -10, 10) . "" : "not bookmarked") . "</td><td>" . prefixed($row["uploaded"]) . "</td><td>" . prefixed($row["downloaded"]) . "</td><td>" . $ratio . "</td><td>" . date("d.m.Y - H:i:s", strtotime($row["last_access"])) . "</td></tr>";
}
echo "</table>";
echo "<div id=\"badratio\"></div>";
}
stdfoot();
示例14: mysql_query
// ===use this line if you DO NOT HAVE subject in your PM system
// mysql_query("INSERT INTO messages (poster, sender, receiver, added, msg) VALUES(0, 0, $row[userid], '" . get_date_time() . "', " . sqlesc($pn_msg) . ")") or sqlerr(__FILE__, __LINE__);
}
// === delete all offer stuff
@mysql_query("DELETE FROM `offers` WHERE `id` = " . ($_POST['offer'] + 0));
@mysql_query("DELETE FROM `offervotes` WHERE `offerid` = " . ($_POST['offer'] + 0));
@mysql_query("DELETE FROM `comments` WHERE `offer` = " . ($_POST['offer'] + 0) . "");
}
}
// === end notify people who voted on offer
$res = mysql_query("SELECT name FROM categories WHERE id={$catid}") or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res);
$cat = $arr["name"];
$res = mysql_query("SELECT email FROM users WHERE enabled='yes' AND notifs LIKE '%[cat{$catid}]%' AND notifs LIKE '%[email]%'") or sqlerr(__FILE__, __LINE__);
$uploader = $CURUSER['username'];
$size = prefixed($totallen);
$description = $html ? strip_tags($descr) : $descr;
$body = <<<EOD
A new torrent has been uploaded.
Name: {$torrent}
Size: {$size}
Category: {$cat}
Description
-------------------------------------------------------------------------------
{$description}
-------------------------------------------------------------------------------
示例15: mysql_query
}
// leechers ?
if ($leechers != 1) {
$l = "s";
$aktivl = "{$leechers} leecher{$l}";
} else {
$aktivl = "no leecher";
}
if (isset($_GET["feed"])) {
$feed = $_GET["feed"];
} else {
$feed = " ";
}
// ddl or detail ?
if ($feed == "dl") {
$link = "{$BASEURL}/rssdownload.php/{$id}/" . ($passkey ? "{$passkey}/" : "") . "{$filename}";
} else {
$link = "{$BASEURL}/details.php?id={$id}&hit=1";
}
// measure the totalspeed
if ($seeders >= 1 && $leechers >= 1) {
$spd = mysql_query("SELECT (t.size * t.times_completed + SUM(p.downloaded)) / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS totalspeed FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND p.torrent = '{$id}' GROUP BY t.id ORDER BY added ASC") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_assoc($spd);
$totalspeed = prefixed($a["totalspeed"]) . "/s";
} else {
$totalspeed = "no traffic";
}
// output of all data
echo "<item><title>" . htmlspecialchars($name) . "</title>\n<link>" . $link . "</link>\n<category>\nCategory: " . $category[$cat] . " </category>\n<size> Size: " . prefixed($size) . "</size>\n<status> Status: " . $aktivs . " and " . $aktivl . "</status>\n<speed> Speed: " . $totalspeed . "</speed>\n<added> Added: " . $added . "</added>\n<description> Description:\n " . htmlspecialchars($descr) . "\n</description>\n</item>\n";
}
echo "</channel>\n</rss>\n";