參考連結:http://phpbb-tw.net/phpbb/viewtopic.php?t=19482
使用版本:phpBB 2.0.6
網站位置:http://jc.oun.us/phpbb/
免費空間連結:http://www.oun.us
您的 domain(網域名稱) :http://jc.oun.us
狀況描述:
各位大大好
我的論壇與圖庫的資料庫都是放在同一個
論壇程式本身是在phpbb資料夾裡 圖庫則是在art資料夾裡
以前使用別家空間時 裝上隨機圖片功能是成功的
這裡是舊的網址:http://www.ebondawn.com/~jc/phpbb/
後來因為原空間的語系問題 論壇與圖庫都遷移到現在這個新空間
但是隨機圖片功能就顯示不出來了
遷移空間後 程式裡應該修改的路徑我都改了 其他架構都完全沒有更動
希望大大們能幫我看看問題出在哪裡 謝謝
這裡附上此外掛的程式碼:
showpic.php
代碼: 選擇全部
<?
/***************************************************************************
* showpic.php
* ------------------
* begin : Sunday, Nov 17, 2002
* copyright : (C) 2002 Tofu Chen
* email : tofu0913@ms10.url.com.tw
*
* $Id: news.php,v 1.2 2002/05/31 0:37:00 sj26 Exp $
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//
// End session management
//
//
// Start read 4images DB
//
/*$pnlink = mysql_connect("資料庫名稱","連資料庫帳號","密碼") or die ("mysql_connect() failed.");
mysql_select_db("phpbb", $pnlink) or die ("mysql_connect() failed."); */
//$pnquery = mysql_query("SELECT * FROM 4images_images WHERE cat_id ='7' OR cat_id ='2' OR cat_id ='8' OR cat_id ='19' OR cat_id ='11' OR cat_id ='16' OR cat_id ='13' OR cat_id ='14' OR cat_id ='10' order by image_date desc limit 5");
//$pnquery = mysql_query("SELECT A.image_id,A.cat_id,A.image_thumb_file,A.image_name,B.username FROM 4images_images A, phpbb_users B WHERE A.user_id=B.user_id ORDER BY RAND() desc LIMIT 3");
$pnquery = "SELECT A.image_id,A.cat_id,A.image_thumb_file,A.image_name,B.username FROM 4images_images A, phpbb_users B WHERE A.user_id=B.user_id ORDER BY RAND() desc LIMIT 3";
// set template
$template->set_filenames(array("body" => "showpic_body.tpl"));
if ( !($result = $db->sql_query($pnquery)) )
{
message_die(GENERAL_ERROR, '無法取得工作內容!!', '', __LINE__, __FILE__, $pnquery);
}
//while ($myrow = mysql_fetch_row($pnquery)) {
while ($myrow = $db->sql_fetchrow($result)) {
$image=($myrow[2]=="")?"../art/templates/wildland/icons/jpg.gif":"../art/data/thumbnails/".$myrow[1]."/".$myrow[2];
$template->assign_block_vars("images",array(
"image_url" => $myrow[0],
"image" => $image,
"image_title" => $myrow[3],
));
}
$pnquery = "SELECT A.image_id,A.cat_id,A.image_thumb_file,A.image_name,B.username FROM 4images_images A, phpbb_users B WHERE A.user_id=B.user_id ORDER BY image_id desc LIMIT 1";
if ( !($result = $db->sql_query($pnquery)) )
{
message_die(GENERAL_ERROR, '無法取得工作內容!!', '', __LINE__, __FILE__, $pnquery);
}
if ($row = $db->sql_fetchrow($result)) {
$image=($row[2]=="")?"../art/templates/wildland/icons/jpg.gif":"../art/data/thumbnails/".$row[1]."/".$row[2];
$template->assign_block_vars("new_images",array(
"image_url" => $row[0],
"image" => $image,
"image_title" => $row[3],
));
}
//
// End read 4images DB
//
//
// Generate the page
//
$template->assign_vars(array(
"T_TITLE" => $lang['Random_Image'],
"T_TITLE2" => $lang['New_Image']
));
$template->pparse('body');
//mysql_close($pnlink);
?>
showpic_body.tpl
代碼: 選擇全部
<!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
<!-- <html xmlns="http://www.w3.org/1999/xhtml"> -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css">
<!--
a:hover{position:relative;top:1px;left:1px;}
-->
</style>
<style type="text/css">
<!--
.new {
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
font-size: 11px;
color: #C62B0F;
font : bold;
}
-->
</style>
<link rel="stylesheet" href="templates/Aeolus/Aeolus.css" type="text/css" />
</head>
<table width="100%" border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline" HEIGHT=150>
<tr><th colspan="1" align="center" class="thCornerL" width="20%"> {T_TITLE2} </th>
<th colspan="5" align="center" class="thCornerL" width="20%"> {T_TITLE} </th>
<tr>
<!-- BEGIN new_images -->
<td class="row1" nowrap onMouseOver="this.style.backgroundColor='#D0C4A8'" onMouseOut="this.style.backgroundColor='#D8CFB8'" WIDTH="25%"><span class="forumlink">
<center><a href="../art/details.php?image_id={new_images.image_url}" class="index" target="_blank"><img src="{new_images.image}" border="0" onload="javascript:if(this.height>100) this.height=100"><BR>{new_images.image_title}</a><sup class="new">NEW!</sup>{new_images.username}<BR>
<!-- END new_images -->
<!-- BEGIN images -->
<td class="row1" nowrap onMouseOver="this.style.backgroundColor='#D0C4A8'" onMouseOut="this.style.backgroundColor='#D8CFB8'" WIDTH="25%"><span class="forumlink">
<center><a href="../art/details.php?image_id={images.image_url}" class="index" target="_blank"><img src="{images.image}" border="0" onload="javascript:if(this.height>100) this.height=100"><BR>{images.image_title}</a>{images.username}<BR>
<!-- END images -->
</table>
index_body.tpl
代碼: 選擇全部
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="23" align="right" valign="bottom">
<img src="templates/Aeolus/images/top_left.gif" width="23" height="36" border="0" alt="" /></td>
<td width="100%" align="left" valign="middle" background="templates/Aeolus/images/top_center.gif">
<table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="templates/Aeolus/images/spacer.gif" width="1" height="11" border="0" /></td></tr><tr><td align="left" valign="center"><font size=2 color=#465964> <b>藝想森林作品展示</b> </font></td></tr></table></td>
<td width="60" align="left" valign="bottom"><img src="templates/Aeolus/images/top_right.gif" width="60" height="36" border="0" alt="" /></td>
</tr></table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><td><iframe src="showpic.php" width="100%" height="150" frameborder="0" marginwidth="0" marginheight="0" scrolling="no">
</iframe></td></tr>
</table>