Haløjsa...
har gang i et rating script
men har et problem som jeg ikke lige kan finde
min kode ser sådan her ud:
<?php
include("./admin/config.php");
include("$include_path/common.php");
include("$include_path/$table_file");
include("$include_path/doc_head.php");
include("$include_path/styles.php");
global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SESSION_VARS;
global $_SESSION;
if ($HTTP_POST_VARS!="")
$_POST=$HTTP_POST_VARS;
if ($HTTP_GET_VARS!="")
$_GET=$HTTP_GET_VARS;
if ($HTTP_SESSION_VARS!="")
$_SESSION=$HTTP_SESSION_VARS;
include ("Ads_new.php");
include("$include_path/right.php");
include("$include_path/left.php");
if ( isset($_GET['cmd']) )
{
$module_name = $_GET['cmd'];
$fname = "modules/".$module_name."/".$module_name.".php";
include("$fname");
echo "$fname <br>";
exit;
}
else
{
if($r == 1)
{
$faqs="<br><br><center><font class='bold'>You have viewed or rated all the images, please check back again later</font></center><br><br>";
session_unregister("previous_visit_id");
}
$s = "select id from $tb_featureduser where gender ='f'";
$r = mysql_query($s);
echo mysql_error();
if ($d=mysql_fetch_row($r))
$random_id=$d[0];
$sql = "
select
*
from
$tb_users
where
id = '$random_id'
";
$img_src = "";
$query = mysql_query($sql) or die(mysql_query());
$array = mysql_fetch_array($query);
$sql=" select image, image_url from $tb_users where id='$random_id' and user_type='2' ";
$res=mysql_query($sql);
echo mysql_error();
$image_where="here";
if ($data=mysql_fetch_row($res))
{
$image_where=$data[0];
$image_url=$data[1];
}
if ($image_where == "here"){ $img_src = $base_url . "/image.php?id=" . $array["id"] . "&p=1";}
elseif ($image_where == "there"){ $img_src = $image_url;}
$faqs.="<tr>
<td width=100%>
<table width=100% border=1 cellspacing=0 cellpadding=0 >
<tr>
<td width=50% class=s10>
<b>Featured Female</b>
</td>
<td width=50% class=s10>
<b>Featured Male</b>
</td>
</tr>
<tr>
<td width=50%>
<table width=100%>
<tr>
<td width=50%>
<a href='index.php?i=$array[id]'><img border=0 src='$img_src' width=100 height=100></a>
</td>
<td width=50% class=s10>
<a href='index.php?i=$array[id]'>$array[username]</a><br><br>
Name : $array[realname]<br>
Rating : $array[average_rating]<br>
Age :$array[age]<br>
</td>
</tr>
</table>
</td>
<td width=50%> ";
$img_src="";
$array = array();
$totalids='';
$random_id='';
$randomidarray= array();
$rarray=array();
$image1="";
$image2="";
$image3="";
$image4="";
$image5="";
$image6="";
$image7="";
$image8="";
$s = "select id from $tb_featureduser where gender ='m'";
$r = mysql_query($s);
echo mysql_error();
if ($d=mysql_fetch_row($r))
$random_id=$d[0];
$sql = "
select
*
from
$tb_users
where
id = '$random_id'
";
$query = mysql_query($sql) or die(mysql_query());
$array = mysql_fetch_array($query);
$sql=" select image, image_url from $tb_users where id='$random_id' and user_type='1'";
$res=mysql_query($sql);
echo mysql_error();
$image_where="here";
if ($data=mysql_fetch_row($res))
{
$image_where=$data[0];
$image_url=$data[1];
}
if ($image_where == "here")
{
$img_src = $base_url . "/image.php?id=" . $array["id"] . "&p=1";
}
elseif ($image_where == "there")
{
$img_src = $image_url;
}
$faqs.="
<table width=100%>
<tr>
<td width=50%>
<a href='index.php?i=$array[id]'><img border=0 src='$img_src' width=100 height=100></a>
</td>
<td width=50% class=s10>
<a href='index.php?i=$array[id]'>$array[username]</a><br><br>
Name : $array[realname]<br>
Rating : $array[average_rating]<br>
Age :$array[age]<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
";
$forum_sql="select forum_id from $tb_forums where forum_lock='y'";
$forum_qry=mysql_query($forum_sql) or die(mysql_error());
$forum_res_cnt=mysql_num_rows($forum_qry);
$fcnt=1;
while( $forum_res=mysql_fetch_array($forum_qry))
{
$forum_res_qry.="forum_id<> ".$forum_res[0];
if ($fcnt < $forum_res_cnt) { $forum_res_qry .=" and ";}
$fcnt++;
}
if ($forum_res_cnt>0) { $where=" where $forum_res_qry "; }
$sql = "
select
*
from
$tb_threads
$where
order by
timestamp desc limit 0,10
";
$query = mysql_query($sql) or die(mysql_error());
$forum_topics = "<tr>
<td><br></td>
</tr>
<tr><td width=100%>
<table border=1 width=100% cellspacing=0 cellpadding=0>
<tr><td class=s10 width=100% colspan=2> <b>Forum Topics</b></td></tr>
<tr><td width=50%> <table border=0 width=100% cellspacing=0 cellpadding=0>
";
while($array = mysql_fetch_array($query))
{
$alt = $i % 2 ? "alt1" : "alt2";
$i++;
$thread_name = get_thread_name($array["thread_id"]);
$forum_topics.="<tr><td class=s10 width=100%>
<a href=\\"$base_url/posts.php?t=$array[thread_id]\\">$thread_name</a></td></tr>";
}
$forum_topics.="</table></td>
<td width=50%> <table border=0 width=100% cellspacing=0 cellpadding=0> ";
$sql = "
select
*
from
$tb_threads
$where
order by
timestamp desc limit 10,10
";
$query = mysql_query($sql) or die(mysql_error());
while($array = mysql_fetch_array($query))
{
$alt = $i % 2 ? "alt1" : "alt2";
$i++;
$thread_name = get_thread_name($array["thread_id"]);
$forum_topics.="<tr><td class=s10 width=100%>
<a href=\\"$base_url/posts.php?t=$array[thread_id]\\">$thread_name</a></td></tr>";
}
$forum_topics .="</table> </td> </tr></table></td></tr>
<tr><td><br></td></tr>
";
$result = mysql_query("SELECT id, uid, date, title, description, news, link FROM $tb_news ORDER BY date DESC LIMIT 0,5") or die(mysql_error());
$tpl->define_dynamic('news_list', 'news_content_body');
while (list($id, $uid, $date, $title, $description, $news, $link) = mysql_fetch_row($result))
{
if ($uid==0) { $poster="Webmaster"; }
else {
$getposter = mysql_query("SELECT username FROM $tb_users WHERE id='$uid'") or die(mysql_error());
list($poster) = mysql_fetch_row($getposter);
}
if (!($link=="http://")){ $news.=" <a href=$link target=_new>more... </a> "; }
$datetime = date("m.d.y g:i a", $date);
$date = date("m/d/y", $date);
$tpl->assign(array( 'DATE' => $date,
'TITLE' => $title,
'NEWS' => $news,
));
$tpl->parse( ROWS,'.news_list' );
}
$tpl->parse('NEWS_CONTENT_BODY', 'news_content_body');
$tpl->parse('NEWS_CONTENT', 'news_content');
$content =" <tr>
<td class=s10><u><b>News</b></u></td>
</tr>
<tr><td><br></td></tr>
<tr><td width=100%>";
$content.= $tpl->fetch('NEWS_CONTENT');
$content.="</td></tr>";
include("site_description.php");
$faqs=$site_description.$faqs.$forum_topics.$content;
$final_output= table("Welcome to $site_title!", $faqs);
$tpl->assign(array('CONTENT_TEXT' => $final_output));
$tpl->parse('PAGE', 'main');
$final_output = $tpl->fetch('PAGE');
$final_output = final_output($final_output);
}
include ("copy.php");
?>
og her er hvordan fejlen ser ud på siden(alt undtagen fejlen er censureret fordi projektet stadig er en "hemmelighed"
)
som i kan se har jeg en "Featured Female" og en "Featured Male"
Featured Male virker fint nok og den viser billedet fra den nyeste
men af en eller anden grund virker Featured Female ikke (og ja jeg har prøvet at oprette en kvindelig bruger
)
nu er jeg efterhånden ret træt af at sidde og bikse med koden i den fil... så hvis der er en der lige gider at rette den for mig hvis i kan finde fejlen ville det være perfekt
og så bliver der selvfølgelig givet en masse points for det... men kan desværre ikke give mere end 200