function draw_user_information($error) { global $_USER, $_CONF, $LANG_ECOM; $res = get_user_row($_USER['uid']); #If it's users first time to enter there information will have to add them to database. if (DB_numRows($res) <= 0) { add_user_row($_USER['uid']); #Create the row to hold ecom_userinfo $res = get_user_row($_USER['uid']); } $user_info = DB_fetchArray($res); #load template for editing user $T = new Template($_CONF['path'] . 'plugins/ecommerce/templates'); $T->set_file('text', 'user_info.thtml'); $T->set_var('site_url', $PHP_SELF); $T->set_var('error', $error); $T->set_var('full_name', $user_info['fullname']); $T->set_var('email', $user_info['email']); $T->set_var('phone_number', $user_info['ecom_phone_number']); $T->set_var('dob_month', $user_info['ecom_dob_month']); $T->set_var('dob_day', $user_info['ecom_dob_day']); $T->set_var('dob_year', $user_info['ecom_dob_year']); $T->set_var('driver_license_number', $user_info['ecom_drivers_license_number']); $T->set_var('driver_license_state', $user_info['ecom_drivers_license_state']); $T->set_var('msg_1', $LANG_ECOM[1]); $T->set_var('msg_12', $LANG_ECOM[12]); $T->set_var('msg_146', $LANG_ECOM[146]); $T->set_var('msg_147', $LANG_ECOM[147]); $T->set_var('msg_148', $LANG_ECOM[148]); $T->set_var('msg_149', $LANG_ECOM[149]); $T->set_var('msg_150', $LANG_ECOM[150]); echo $T->parse('output', 'text'); }
//Get post author $postauthor = get_single_value("posts", "userid", "WHERE topicid=" . sqlesc($topicid) . " ORDER by id"); while ($arr = mysql_fetch_assoc($res)) { if ($pn >= 1) { if ($Advertisement->enable_ad()) { if ($forumpostad[$pn - 1]) { echo "<div align=\"center\" style=\"margin-top: 10px\" id=\"ad_forumpost_" . $pn . "\">" . $forumpostad[$pn - 1] . "</div>"; } } } ++$pn; $postid = $arr["id"]; $posterid = $arr["userid"]; $added = gettime($arr["added"], true, false); //---- Get poster details $arr2 = get_user_row($posterid); $uploaded = mksize($arr2["uploaded"]); $downloaded = mksize($arr2["downloaded"]); $ratio = get_ratio($arr2['id']); if (!($forumposts = $Cache->get_value('user_' . $posterid . '_post_count'))) { $forumposts = get_row_count("posts", "WHERE userid=" . $posterid); $Cache->cache_value('user_' . $posterid . '_post_count', $forumposts, 3600); } $signature = $CURUSER["signatures"] == "yes" ? $arr2["signature"] : ""; $avatar = $CURUSER["avatars"] == "yes" ? htmlspecialchars($arr2["avatar"]) : ""; $uclass = get_user_class_image($arr2["class"]); $by = get_username($posterid, false, true, true, false, false, true); if (!$avatar) { $avatar = "pic/default_avatar.png"; } if ($pn == $pc) {
} </script> <? print("<table border='0' cellspacing='0' cellpadding='2' width='100%' align='left' style='word-break: break-all; word-wrap:break-word;table-layout: fixed;'>\n"); $i = 1; while ($arr = mysql_fetch_assoc($res)) { if (get_user_class() >= $sbmanage_class) { // $del="[<a href=\"shoutbox.php?del=".$arr[id]."\">".$lang_shoutbox['text_del']."</a>]"; $del = <<<EOD [<a onclick="if(confirm('确定要删除吗?')){window.location.href='shoutbox.php?del={$arr['id']}';}" style="cursor:pointer">{$lang_shoutbox['text_del']}</a>] EOD; } if ($arr["userid"]) { $username = get_username($arr["userid"],false,true,true,true,false,false,"",true); $arr2 = get_user_row($arr["userid"]); if ($_GET["type"] != 'helpbox' && $arr["type"] == 'hb') $username .= $lang_shoutbox['text_to_guest']; } else{ $school = strpos($arr["ip"],':')?school_ip_location($arr["ip"],false):''; $userip = str_replace(':','',$arr['ip']); $guestid = substr($userip,strlen($userip) - 8); $username = "******".$school."'>游客".$guestid."</b>"; $arr2["username"] = "******".$guestid; } if ($CURUSER['timetype'] != 'timealive') $time = strftime("%m.%d %H:%M",$arr["date"]); else $time = get_elapsed_time($arr["date"]).$lang_shoutbox['text_ago']; $messtext = $arr["text"];
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3); $ratio = "<font color=" . get_ratio_color($ratio) . ">{$ratio}</font>"; } elseif ($arr["uploaded"] > 0) { $ratio = $lang_viewsnatches['text_inf']; } else { $ratio = "---"; } $uploaded = mksize($arr["uploaded"]); $downloaded = mksize($arr["downloaded"]); $seedtime = mkprettytime($arr["seedtime"]); $leechtime = mkprettytime($arr["leechtime"]); $uprate = $arr["seedtime"] > 0 ? mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0); $downrate = $arr["leechtime"] > 0 ? mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0); //end $highlight = $CURUSER["id"] == $arr["userid"] ? " bgcolor=#00A527" : ""; $userrow = get_user_row($arr['userid']); if ($userrow['privacy'] == 'strong') { $username = $lang_viewsnatches['text_anonymous']; if (get_user_class() >= $viewanonymous_class || $arr["id"] == $CURUSER['id']) { $username .= "<br />(" . get_username($arr[userid]) . ")"; } } else { $username = get_username($arr[userid]); } $reportImage = "<img class=\"f_report\" src=\"pic/trans.gif\" alt=\"Report\" title=\"" . $lang_viewsnatches['title_report'] . "\" />"; print "<tr{$highlight}><td class=rowfollow align=center>" . $username . "</td>" . (get_user_class() >= $userprofile_class ? "<td class=rowfollow align=center>" . $arr[ip] . "</td>" : "") . "<td class=rowfollow align=center>" . $uploaded . "@" . $uprate . $lang_viewsnatches['text_per_second'] . "<br />" . $downloaded . "@" . $downrate . $lang_viewsnatches['text_per_second'] . "</td><td class=rowfollow align=center>{$ratio}</td><td class=rowfollow align=center>{$seedtime}</td><td class=rowfollow align=center>{$leechtime}</td><td class=rowfollow align=center>" . gettime($arr[completedat], true, false) . "</td><td class=rowfollow align=center>" . gettime($arr[last_action], true, false) . "</td><td class=rowfollow align=center style='padding: 0px'>" . ($userrow['privacy'] != 'strong' || get_user_class() >= $viewanonymous_class ? "<a href=report.php?user={$arr['userid']}>{$reportImage}</a>" : $reportImage) . "</td></tr>\n"; } print "</table>\n"; print $pagerbottom; } else { stdmsg($lang_viewsnatches['std_sorry'], $lang_viewsnatches['std_no_snatched_users']);
function update_casino_ranking() { $res = sql_query("SELECT stake, odds, user_id FROM casino AS c, casinolog AS log WHERE c.win = log.choice AND c.id = log.id AND c.state=4") or sqlerr(__FILE__, __LINE__); unset($winnercount); $winnercount = array(); unset($tkcount); $tkcount = array(); if (mysql_num_rows($res) > 0) { while ($arr = mysql_fetch_assoc($res)) { $winnercount[$arr['user_id']] += $arr['stake'] * $arr['odds'] - $arr['stake']; $tkcount[$arr['user_id']]++; } $res = sql_query("SELECT stake, odds, user_id FROM casino AS c, casinolog AS log WHERE c.win != log.choice AND c.id = log.id AND c.state=4") or sqlerr(__FILE__, __LINE__); while ($arr = mysql_fetch_assoc($res)) { $winnercount[$arr['user_id']] -= $arr['stake']; $tkcount[$arr['user_id']]++; } foreach ($winnercount as $winnername => $winnerbouns) { if (!get_user_row($winnername)) { continue; } sql_query("REPLACE INTO casinorank(id, bonus, lotterycount) VALUES({$winnername}, {$winnerbouns}, " . $tkcount[$winnername] . ");") or sqlerr(__FILE__, __LINE__); } } }
function get_ratio($userid, $html = true) { global $lang_functions; $row = get_user_row($userid); $uped = $row['uploaded']; $downed = $row['downloaded']; if ($html == true) { if ($downed > 0) { $ratio = $uped / $downed; $color = get_ratio_color($ratio); $ratio = number_format($ratio, 3); if ($color) { $ratio = "<font color=\"" . $color . "\">" . $ratio . "</font>"; } } elseif ($uped > 0) { $ratio = $lang_functions['text_inf']; } else { $ratio = "---"; } } else { if ($downed > 0) { $ratio = $uped / $downed; } else { $ratio = 1; } } return $ratio; }
function set_userrow() { $userid = $this->userid; $row = get_user_row($userid); $this->userrow = $row; }
if ($arr['finish'] == "yes") { stderr("出错了!", "该应求已经确认!<a href=viewrequest.php?action=view&id=" . $_POST["id"] . ">点击这里返回</a>", false); } else { $torrentid = $_POST["torrentid"]; } } if ($arr['userid'] == $CURUSER[id] || get_user_class() >= 13) { $amount = $arr["amount"] / count($torrentid); sql_query("UPDATE req SET finish = 'yes', finished_time = '" . date("Y-m-d H:i:s") . "' WHERE id = " . $_POST["id"]) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE resreq SET chosen = 'yes' WHERE reqid = " . $_POST["id"] . " AND ( torrentid = '" . join("' OR torrentid = '", $torrentid) . "' )") or sqlerr(__FILE__, __LINE__); sql_query("DELETE FROM resreq WHERE reqid ='" . $_POST["id"] . "' AND chosen = 'no'") or sqlerr(__FILE__, __LINE__); $res = sql_query("SELECT owner FROM torrents WHERE ( id = '" . join("' OR id = '", $torrentid) . "' ) ") or sqlerr(__FILE__, __LINE__); while ($row = mysql_fetch_array($res)) { $owner[] = $row[0]; } $resuser = get_user_row($arr['userid']); $subject = ($arr['userid'] != $CURUSER[id] ? "管理员" . $CURUSER['username'] . "代替" : "") . $resuser[username] . "通过了你的应求"; $notifs = "你因此获得了悬赏的" . $amount . "麦粒。详情请见[url=viewrequest.php?action=view&id=" . $_POST["id"] . "]这里[/url]"; $added = sqlesc(date("Y-m-d H:i:s")); foreach ($owner as $id) { sql_query("UPDATE users SET seedbonus = seedbonus + {$amount} WHERE id = '" . $id . "'") or sqlerr(__FILE__, __LINE__); writeBonusComment($id, "求种{$_POST['id']} 被确认,增加悬赏{$amount} 麦粒"); sql_query("INSERT INTO messages (sender, receiver, subject, msg, added,goto) VALUES(0, " . $id . ", '{$subject}', '{$notifs}', {$added},1)") or sqlerr(__FILE__, __LINE__); } write_log("求种:" . ($arr['userid'] != $CURUSER["id"] ? "管理员 " : "求种人 ") . $CURUSER["username"] . " 确认了求种 " . $_POST["id"]); stderr("成功", "确认成功,<a href=viewrequest.php?action=view&id=" . $_POST["id"] . ">点击这里返回</a>", false); } break; } } die;
function set_class() { $userid = $this->userid; $row = get_user_row($userid); $this->class = $row['class']; }