原帖由 long98227 于 2005-8-30 16:27 发表
二手市场 错误
images_market.php
找
CODE: [Copy to clipboard]
--------------------------------------------------------------------------------
if ($postoffset >= $num){
$posto ...
二手市场 错误
images_market.php
找
if ($postoffset >= $num){
$postoffset = $num - 1;
下加
}
if ($postoffset < 0){
$postoffset = 0;
--------------------------------------------------------------------------------
下加的位置
應該是這樣!
if ($postoffset < 0){
$postoffset = 0;
}
這是 T.O、M虛擬形象FOR 2.0繁體版virtualimage_for2_big5 的原始版!
images_market.php
<?
//**************************************************//
// t.o.m. 虛擬形象 for Discuz!2.0 //
//--------------------------------------------------//
// 歡迎來信交流 //
// theoldmemory@vip.sina.com //
//--------------------------------------------------//
// 源碼開放,個人免費 //
//**************************************************//
if(!defined("IMAGES_INDEX")) {
die("Access Denied");
}
images_loadtemplates('images_index,navigation,images_user,images_market,images_showmarket');
eval("\$images_navigation = \"$images_tempcache[navigation]\";");
//------------------顯示形象
$gender = $imagesuser[gender];
if ($gender == 1)
{
$usergender = "帥哥";
$tempequip = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0'; //男性的初始值
$sex = "m";
$upid = "init";
}
elseif($gender == 2)
{
$usergender = "美女";
$tempequip = '0-0-0-0-0-0-0-0-initf-initf-0-initf-0-initf-initf-0-0-0-initf-0-0-0-0-0-0-0'; //女性的初始值
$sex = "f";
$upid = "initf";
}
else{$sex = 'no';}
$imagesquery = $db->query("SELECT * FROM $tablepre"."images_user where userid = '$imagesuser[uid]' and dafaultuse = '1'");
$userwearip = '400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400-400';//商品的過期屬性
$cookiearray = split('-', $tempequip);
$weararray = split('-', $userwearip);
$imageschange = 0;
while ($userimages = $db->fetch_array($imagesquery)){
if (($userimages[suitable] != $sex) and ($userimages[suitable] != 't'))
{
$db->query("UPDATE $tablepre"."images_user SET dafaultuse = '0' where userid = '$imagesuser[uid]' and classid = '$userimages[classid]' and picid = '$userimages[picid]'");
$imageschange = 1;
}
if($setting[beold]){
$images_weardate = $userimages[endurance] - (time() - $userimages[lastuse]);
$db->query("UPDATE $tablepre"."images_user SET endurance = '$images_weardate',lastuse='".time()."' WHERE userid='$imagesuser[uid]' and picid = '$userimages[picid]' and classid= '$userimages[classid]' and dafaultuse='1'");
$images_weardate = ceil($images_weardate/86400);
if ($images_weardate <= 0){
$db->query("UPDATE $tablepre"."images_user SET dafaultuse = '3' WHERE userid='$imagesuser[uid]' and picid = '$userimages[picid]' and classid= '$userimages[classid]' and dafaultuse='1'");
$imageschange = 1;
if($userimages[classid] == 8||$userimages[classid]==9||$userimages[classid]==11||$userimages[classid]==13||$userimages[classid]==14||$userimages[classid]==18){
$userupid = $upid;
}else{
$userupid = "0";
}
$weararray[$tempi] = $userupid;
}else{
$weararray[$tempi] = $images_weardate;
}
}
}
$imagesquery = $db->query("SELECT * FROM $tablepre"."images_user where userid = '$imagesuser[uid]' and dafaultuse = '1'");
while ($userimages = $db->fetch_array($imagesquery)){
$tempi = $userimages[classid];
$cookiearray[$tempi] = $userimages[picid];
}
$tempequip = implode("-", $cookiearray);
$userwear = implode("-", $weararray);
$cookie = $_REQUEST[tempequip];
$userimagecookie = $tempequip;
if ($cookie=='' || $imageschange==1)
{
if ($userimagecookie != "")
{
$tempequip = $userimagecookie;
}
setcookie("tempequip", "$tempequip");
}
//------------------------------
//------------------------------顯示物品
$num = 0;
$imagesquery = $db->query("SELECT userid,classid,picid,buydata FROM $tablepre"."images_user WHERE dafaultuse = '8'");
while ($imagestemp=$db->fetch_array($imagesquery)){
$sellday = ceil($setting[sellday] - (time() - $imagestemp[buydata])/86400);
if($sellday <= 0){$db->query("DELETE FROM $tablepre"."images_user WHERE userid = '$imagestemp[userid]' and classid = '$imagestemp[classid]' and picid = '$imagestemp[picid]' and dafaultuse = '8' LIMIT 1");
}else{$num++;}
}
$postoffset = intval($_REQUEST["postoffset"]);
$perpage = 10;
if ($postoffset < 0){
$postoffset = 0;
}
$pagenum = ceil($num / $perpage);
if ($page){
if($page<1){
$page=1;
}elseif($page>$pagenum){
$page=$pagenum;
}
$postoffset = $perpage * ($page-1);
}else{
$page = $postoffset/$perpage+1;
}
if ($postoffset < 0){
$postoffset = 0;
}
if ($postoffset >= $num){
$postoffset = $num - 1;
}
//修正 二手市場錯誤
if ($postoffset < 0){
$postoffset = 0;
}
//修正 二手市場錯誤
$imagesquery = $db->query("SELECT * FROM $tablepre"."images_user WHERE dafaultuse = '8' ORDER BY buydata DESC limit $postoffset, $perpage");
$pages = "第".$page."頁,第".((($postoffset+1) < 0) ? 0 : ($postoffset+1))
."-" . ((($postoffset + $perpage) > $num) ? $num : ($postoffset+$perpage))."條,";
$pages .= "共<font color=#ff0000'> $num </font>條記錄 <font color=#ff0000'>$pagenum</font>頁 ";
if ($page > 1)//分頁顯示頁面
{
$pages .= "<a href='$PHP_SELF?index=market&page=1'>"
."<span text-decoration:none; color:#000000'>首頁</span></a> <a href='$PHP_SELF?index=market&page="
.($page-1)."'>"
."<span text-decoration:none; color:#000000'>前頁</span></a> ";
}
else
{
$pages .= "<span style='font-family:宋體; color:#CCCCCC'>首頁 前頁</span>";
}
if ($page < $pagenum)//分頁顯示頁面
{
$pages .= "<a href='$PHP_SELF?index=market&page=".($page+1)."'>"
."<span text-decoration:none; color:#000000'>后頁</span></a> "
."<a href='$PHP_SELF?index=market&page=$pagenum'>"
."<span text-decoration:none; color:#000000'>末頁</span></a>";
}
else
{
$pages .= "<span style = 'font-family:宋體; color:#CCCCCC'>后頁 末頁</span>";
}
$pages .=" <input type=submit value=跳躍至 class=bginput> 第<input type=text size=2 name=jumppage>頁";
$break = 1;
while($imagesdata = $db->fetch_array($imagesquery)){
$graphic = $imagesdata[picid].'.gif';
$tempquery = $db->query("SELECT * FROM $tablepre"."images_data WHERE sort = '$imagesdata[classid]' and graphic = '$graphic'");
$imagesinfo = $db->fetch_array($tempquery);
$sellday = ceil($setting[sellday] - (time() - $imagesdata[buydata])/86400);
$endurance = ceil($imagesdata[endurance]/86400);
if(!$imagesinfo[open]){$cost = '貴賓商品,恕不出售';
}else{$cost = $imagesinfo[cost].' '.$credittitle.'/個';}
if($imagesdata[suitable] == 'm'){
$xingbies = "帥哥";
}elseif($imagesdata[suitable] == 'f'){
$xingbies = "美女";
}else{
$xingbies = "全部";
}
$pic = "<img style=\"CURSOR: hand\" alt=\"耐用度:$imagesinfo[endurance] 天 市場價格:$cost 適用:$xingbies 市場庫存:$imagesinfo[stock] 件 \" src = images/virtualimage/".$imagesdata[classid]."/".$imagesdata[picid]."x.gif height=84 border=0\" onClick=\"javascript:CHECK('$imagesdata[classid]','$imagesdata[picid]','$imagesdata[suitable]','$sex')\">";
$userquery = $db->query("SELECT username FROM $table_members WHERE uid='$imagesdata[userid]'");
$username = $db->fetch_array($userquery);
$username = $username[username];
$buyurl = "virtualimage.php?index=operation&action=buymarket&classid=$imagesdata[classid]&id=$imagesdata[picid]&userid=$imagesdata[userid]";
eval("\$showimages \.= \"$images_tempcache[images_showmarket]\";");
if ($break%2 == 0)
{
$huanhang = "</tr><tr>";
}
else
{
$huanhang = "";
}
$break++;
$showimages = $showimages.$huanhang;
}
//--------------------------------------------------------
$userbutton = '<IMG height=20 src=images/virtualimage/main_right_26.gif width=55 border=0 title=恢復到原始形象 style="CURSOR: hand" onclick=javascript:initshow(); >';
eval("\$images_left = \"$images_tempcache[images_user]\";");
eval("\$images_center = \"$images_tempcache[images_market]\";");
eval("\$images_index = \"$images_tempcache[images_index]\";");
echo $images_index;
images_cdb_output();
?>
[ 本帖最后由 ll9073 于 2005-9-1 21:37 编辑 ] |