Ændring af tids rækkefølge
HejJeg har et forum. Her vises de nyeste spørgsmål først. Jeg vil gerne have det ændret således at de seneste kommenterede spørgsmål står først - altså således at hvis et spørgsmål er blevet kommenteret så rykker det op på oversigtslisten.
Har rodet med det selv, men ikke knækket nødden. Nogen der kan hjælpe herinde. Jeg vil gerne betale for hjælp (og altså flytte spørgsmålet over til denne kategori) hvis der er nogle som vil hjælpe mod betaling.
Og ellers er jeg åben for alle gode råd.
Tror at det som skal tilrettes findes i filen: questions.php
Den er herunder:
<?php
ob_start();
require("../inc_main.php");
if($_SERVER['REQUEST_METHOD'] != 'POST')
$_SESSION['questions_timer'] = time();
db_link();
if ($_GET['action']=="delete_q" && $_GET['mid']>0 && ($_SESSION['admin']>0 || $_SESSION['coadmin']>0 || ($_SESSION['user_id'] > 0) && is_last_question_mine($_GET['mid']))) {
delete_question($_GET['mid']);
}
db_unlink();
page_header();
//print_a($_SESSION);
//print_a($_POST);
if ($_POST['close_question'] && $_SESSION['close_q']>0) {
while (list($key,$val)=each($_POST)) {
if (strstr($key,"puid")) {
if (!is_numeric($val)) {
$_SESSION['error'][0]=$_t['msg']['error_points_num'];
$error=1;
header("Location: questions.php?id=".$_SESSION['close_q']."&close_q=".$_SESSION['close_q']);
exit;
}
else {
$a=str_replace("puid_","",$key);
$upid[$a]=$val;
$tot_val=$tot_val+$val;
}
}
}
if (!is_numeric($_POST['pointd_for_me'])) {
$_SESSION['error'][0]=$_t['msg']['error_points_num'];
$error=1;
header("Location: questions.php?id=".$_SESSION['close_q']."&close_q=".$_SESSION['close_q']);
exit;
}
else {
$tot_val=$tot_val+$_POST['pointd_for_me'];
}
if ($error!=1) {
$rs=mysql_query("SELECT * FROM `mesages` WHERE `m_id`='".$_SESSION['close_q']."'");
if (mysql_num_rows($rs)>0) {
$row=mysql_fetch_assoc($rs);
if ($row['m_points']==$tot_val) {
$quser=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `user_id`='".$_SESSION['user_id']."'"));
echo mysql_error();
while (list($key,$val)=each($upid)) {
$rsa1=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `user_id`='".$key."'"));
$rs2a=mysql_query("UPDATE `users` SET `points`='".($rsa1['points']+$val)."' WHERE `user_id`='".$key."'");
if ($val>0) {
$user_url='<a href="'.$ns_static_url.'user/search/profile.php?id='.$_SESSION['user_id'].'">'.$quser['user_name'].'</a>';
$question_url='<a href="'.$ns_static_url.'forum/questions.php?id='.$_SESSION['close_q'].'">'.$row['m_title'].'</a>';
$mail_text=str_replace("[user]",$user_url,$_t['close_question_points']);
$mail_text=str_replace("[question_link]",$question_url,$mail_text);
$mail_text=str_replace("[points]",$val,$mail_text);
//send_mail($rsa1['user_email'],$mail_text,$_t['close_question_points_subject']);
}
}
$rsa1=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `user_id`='".$_SESSION['user_id']."'"));
echo mysql_error();
$n_user_points=($rsa1['points']+$_POST['pointd_for_me']);
$rsa2=mysql_query("UPDATE `users` SET `blocked_points`='".($rsa1['blocked_points']-$row['m_points'])."' WHERE `user_id`='".$_SESSION['user_id']."'");
$rsa2=mysql_query("UPDATE `users` SET `points`='".$n_user_points."' WHERE `user_id`='".$_SESSION['user_id']."'");
$rs=mysql_query("UPDATE `mesages` SET `closed`='1' WHERE `m_id`='".$_SESSION['close_q']."'");
unset($_SESSION['close_q']);
}
else {
$_SESSION['error'][0]=$_t['msg']['error_points_sum'];
header("Location: questions.php?id=".$_SESSION['close_q']."&close_q=".$_SESSION['close_q']);
}
}
}
}
if ($_GET['mkey'] && strlen($_GET['mkey'])==20) {
$rs=mysql_query("SELECT * FROM `guest_mesages` WHERE `g_hash`='".$_GET['mkey']."'");
if (mysql_num_rows($rs)==1) {
$row=mysql_fetch_assoc($rs);
$rs2=mysql_query("UPDATE `mesages` SET `active`='1' WHERE `m_id`='".$row['m_id']."'");
header("Location: questions.php?id=".$row['m_id']);
exit;
}
}
if ($_GET['akey'] && strlen($_GET['akey'])==20) {
$rs=mysql_query("SELECT * FROM `guest_answers` WHERE `hash`='".$_GET['akey']."'");
if (mysql_num_rows($rs)==1) {
$row=mysql_fetch_assoc($rs);
$rs2=mysql_query("UPDATE `answers` SET `active`='1' WHERE `id`='".$row['a_id']."'");
$rs3=mysql_fetch_assoc(mysql_query("SELECT * FROM `answers` WHERE `id`='".$row['a_id']."'"));
$rs4=mysql_fetch_assoc(mysql_query("SELECT * FROM `mesages` WHERE `m_id`='".$rs3['a_m_id']."' AND `active`='1'"));
update_answers_count($rs3['a_m_id']);
if ($rs4['m_user_id']>0) {
$rs5=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `user_id`='".$rs4['m_user_id']."'"));
$aut=$rs5['user_name'];
$umail=$rs5['user_email'];
}
else {
//echo $row['a_id'];
$rs5=mysql_fetch_assoc(mysql_query("SELECT * FROM `guest_mesages` WHERE `m_id`='".$rs3['a_m_id']."'"));
$aut=$rs5['gname'];
$umail=$rs5['gmail'];
}
$url=$ns_static_url.'forum/questions.php?id='.$rs4['m_id'];
$mail_text=stripslashes($_t['email_answered_question']);
$mail_text=str_replace("[author]",$aut,$mail_text);
$mail_text=str_replace("[user]",$row['name'],$mail_text);
$mail_text=str_replace("[question_link]",$url,$mail_text);
send_mail($umail,$mail_text,$_t['email_answered_question_sub']);
// [CANCELED] - sending e-mail to the question's author...
header("Location: questions.php?id=".$rs3['a_m_id']);
exit;
}
}
if($_GET['action'] == "new")
{
if ($_GET['cat']>0) {
$cat=$_GET['cat'];
}
else {
$cat=75;
}
new_question($_POST,$cat);
}
if ($_POST['new_question'] && isset($_SESSION['questions_timer']) && (time()-$_SESSION['questions_timer']) > 10) {
add_new_question($_POST);
if ($_SESSION['user_id']>0) {
if($_SESSION['error'])
{
echo error_handle();
new_question($_POST,75);
page_footer();
exit;
}
else
{
$last_q_id = mysql_insert_id();
header("Location: questions.php?id=". $last_q_id);
}
}
else {
if($_SESSION['error']) {
echo error_handle();
new_question($_POST,75);
page_footer();
exit;
}
else {
echo '<div class="errors">
<ul>
<li>' .$_t['question_succes'] .'</li>
</ul>
</div>';
echo '<table class="forum_answers_list">
<tr>
<th valign="top">'
.$_POST['q_user_name'].'<br />'.format_date(time()).'
</th>
<td>
<strong>'. $_POST['new_q_title'].' - O points</strong><br />'. $_POST['new_q_text'];
echo '</td>
</tr></table>';
question_list($_GET,$_POST['the_fat_cat_q']);
page_footer();
exit;
}
}
}
if ($_POST['new_answer']) {
add_answer($_POST);
$rs=mysql_fetch_assoc(mysql_query("SELECT * FROM `mesages` WHERE `active`=1 AND `m_id`='".$_POST['answer_q_id']."'"));
if(!empty($_SESSION['error']))
{
echo error_handle();
display_question($_POST['answer_q_id']);
answer_to_question($_POST['answer_q_id']);
question_list($_GET,$rs['m_fatcat']);
page_footer();
exit;
}
else
{
header("Location: ". $ns_static_url ."forum/questions.php?id=". $_POST['answer_q_id']);
exit;
}
}
if ($_GET['id']>0 ) {
$rs=mysql_fetch_assoc(mysql_query("SELECT * FROM `mesages` WHERE `active`=1 AND `m_id`='".$_GET['id']."'"));
echo mysql_error();
display_question($_GET['id']);
if ($rs['closed']==0) {
answer_to_question($_GET['id']);
}
if ($rs['m_user_id']==$_SESSION['user_id'] && $rs['closed']==0) {
close_question_form($_GET['id']);
}
question_list($_GET,$rs['m_fatcat']);
page_footer();
exit;
}
if ($_POST['update_question'] && $_POST['ed_m_id']>0 && ($_SESSION['admin']>0 || $_SESSION['coadmin']>0 || ($_SESSION['user_id'] > 0) && is_last_question_mine($_POST['ed_m_id']))) {
update_question($_POST);
$rs=mysql_fetch_assoc(mysql_query("SELECT * FROM `mesages` WHERE `active`=1 AND `m_id`='".$_POST['ed_m_id']."'"));
echo mysql_error();
display_question($_POST['ed_m_id']);
answer_to_question($_POST['ed_m_id']);
question_list($_GET,$rs['m_fatcat']);
page_footer();
exit;
}
if ($_POST['update_answer'] && $_POST['ed_a_id']>0 && ($_SESSION['admin']>0 || ($_SESSION['user_id'] > 0) && is_last_answer_mine($_POST['qid'],$_POST['ed_a_id']))) {
update_answer($_POST);
$rs3=mysql_query("SELECT * FROM `answers` WHERE `id`='".$_POST['ed_a_id']."'");
$row3=mysql_fetch_assoc($rs3);
$rs=mysql_fetch_assoc(mysql_query("SELECT * FROM `mesages` WHERE `active`=1 AND `m_id`='".$row3['a_m_id']."'"));
display_question($row3['a_m_id']);
answer_to_question($row3['a_m_id']);
question_list($_GET,$rs['m_fatcat']);
page_footer();
exit;
}
if ($_GET['action']=="edit_q" && $_GET['mid']>0 && ($_SESSION['admin']>0 || $_SESSION['coadmin']>0 || ($_SESSION['user_id'] > 0) && is_last_question_mine($_GET['mid']))) {
display_question($_GET['mid'],$edit_q=$_GET['mid']);
}
if ($_GET['action']=="edit_answer" && $_GET['aid']>0 && ($_SESSION['admin']>0 || ($_SESSION['user_id'] > 0) && is_last_answer_mine($_GET['qid'],$_GET['aid']))) {
$rs=mysql_fetch_assoc(mysql_query("SELECT * FROM `answers` WHERE `id`='".$_GET['aid']."'"));
display_question($rs['a_m_id'],null,$_GET['aid']);
}
if ($_GET['action']=="delete_answer" && $_GET['aid']>0 && ($_SESSION['admin']>0 || ($_SESSION['user_id'] > 0) && is_last_answer_mine($_GET['qid'],$_GET['aid']))) {
$rs3=mysql_query("SELECT * FROM `answers` WHERE `id`='".$_GET['aid']."'");
$row3=mysql_fetch_assoc($rs3);
$rs=mysql_fetch_assoc(mysql_query("SELECT * FROM `mesages` WHERE `active`=1 AND `m_id`='".$row3['a_m_id']."'"));
delete_answer($_GET['aid']);
update_answers_count($row3['a_m_id']);
display_question($row3['a_m_id']);
answer_to_question($row3['a_m_id']);
question_list($_GET,$rs['m_fatcat']);
page_footer();
exit;
}
echo error_handle();
question_search_form();
question_list($_GET);
new_question($_POST,75);
page_footer();
function edit_answer($id) {
global $_t;
if ($_SESSION['user_id']>0 && $_SESSION['admin']>0) {
$rs=mysql_query("SELECT * FROM `answers` WHERE `id`='".$id."'");
if (mysql_num_rows($rs)==1) {
$row=mysql_fetch_assoc($rs);
echo '<form action="questions.php" method="post">
<textarea name="ed_a_text">'.$row['a_text'].'</textarea>
<input type="hidden" name="ed_a_id" value="'.$id.'" />
<input type="submit" value="'.$_t['update'].'" name="update_answer" />
</form>';
page_footer();
exit;
}
}
}
function update_answer($post) {
if (($_SESSION['user_id']>0 && $_SESSION['admin']>0) || ($_SESSION['user_id']>0 && is_last_answer_mine($post['qid'],$post['ed_a_id']))) {
if ($post['ed_a_id']>0) {
$rs=mysql_query("SELECT * FROM `answers` WHERE `id`='".$post['ed_a_id']."'");
if (mysql_num_rows($rs)==1) {
mysql_query("UPDATE `answers` SET `a_text`='".$post['ed_a_text']."' WHERE `id`='".$post['ed_a_id']."'");
}
}
}
}
function edit_question($id) {
global $_t;
if ($_SESSION['user_id']>0 && $_SESSION['admin']>0) {
$rs=mysql_query("SELECT * FROM `mesages` WHERE `m_id`='".$id."'");
if (mysql_num_rows($rs)==1) {
$row=mysql_fetch_assoc($rs);
echo '<h2>Edit question</h2>
<form action="questions.php" method="post">
<table>
<tr>
<td>'. $_t['headline'] .'</td>
<td><input type="text" name="ed_m_title" value="'.$row['m_title'].'" size="83" /></td>
</tr>
<tr>
<td valign="top">'. $_t['question'] .'</td>
<td><textarea name="ed_m_text" cols="80" rows="15">'.$row['m_text'].'</textarea></td>
</tr>
<tr>
<td><input type="hidden" name="ed_m_id" value="'.$id.'" /> </td>
<td><input type="submit" value="'.$_t['update'].'" name="update_question" /></td>
</tr>
</table>
</form>';
page_footer();
exit;
}
}
}
function update_question($post) {
if (($_SESSION['admin']>0 || $_SESSION['coadmin']>0 || ($_SESSION['user_id'] > 0) && is_last_question_mine($post['ed_m_id']))) {
if ($post['ed_m_id']>0) {
$rs=mysql_query("SELECT * FROM `mesages` WHERE `m_id`='".$post['ed_m_id']."'");
if (mysql_num_rows($rs)==1) {
mysql_query("UPDATE `mesages` SET `m_title`='".$post['ed_m_title']."',`m_text`='".$post['ed_m_text']."' WHERE `m_id`='".$post['ed_m_id']."'");
}
}
}
}
function delete_answer($id) {
if (($_SESSION['user_id']>0 && $_SESSION['admin']>0) || ($_SESSION['user_id']>0 && is_last_answer_mine($_GET['qid'],$id))) {
$rs=mysql_query("SELECT * FROM `answers` WHERE `id`='".$id."'");
if (mysql_num_rows($rs)==1) {
mysql_query("DELETE FROM `answers` WHERE `id`='".$id."'");
}
}
}
function delete_question($id) {
if (($_SESSION['admin']>0 || $_SESSION['coadmin']>0 || ($_SESSION['user_id'] > 0) && is_last_question_mine($id))) {
$rs=mysql_query("SELECT * FROM `mesages` WHERE `m_id`='".$id."'");
if (mysql_num_rows($rs)==1) {
mysql_query("DELETE FROM `mesages` WHERE `m_id`='".$id."'");
mysql_query("DELETE FROM `answers` WHERE `a_m_id`='".$id."'");
}
}
}
function add_answer($post) {
global $_t;
global $ns_static_url;
$rs=mysql_query("SELECT * FROM `blocked_ip` WHERE `ip`='".$_SERVER['REMOTE_ADDR']."'");
if (!mysql_num_rows($rs)>0) {
if ((strlen($post['answer_text'])>0) && ($post['answer_text'] != ucfirst($_t['add_comment']))) {
if ($_SESSION['user_id']>0) {
$rs=mysql_query("INSERT INTO `answers` (`a_m_id`,`a_user_id`,`a_date`,`a_text`,`active`)
VALUES ('".$post['answer_q_id']."','".$_SESSION['user_id']."','".time()."','".$post['answer_text']."','1')");
update_answers_count($post['answer_q_id']);
$rs1=mysql_fetch_assoc(mysql_query("SELECT * FROM `mesages` WHERE `m_id`='".$post['answer_q_id']."'"));
if ($rs1['m_user_id']>0) {
$rs5=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `user_id`='".$rs1['m_user_id']."'"));
$aut=$rs5['user_name'];
$umail=$rs5['user_email'];
}
else {
$rs5=mysql_fetch_assoc(mysql_query("SELECT * FROM `guest_mesages` WHERE `m_id`='".$rs1['m_id']."'"));
$aut=$rs5['gname'];
$umail=$rs5['gmail'];
}
$row=mysql_fetch_assoc(mysql_query("SELECT `user_name` FROM `users` WHERE `user_id`='".$_SESSION['user_id']."'"));
$url=$ns_static_url.'forum/questions.php?id='.$rs1['m_id'];
$mail_text=stripslashes($_t['email_answered_question']);
$mail_text=str_replace("[author]",$aut,$mail_text);
$mail_text=str_replace("[user]",$row['user_name'],$mail_text);
$mail_text=str_replace("[question_link]",$url,$mail_text);
if ($rs1['m_user_id']<>$_SESSION['user_id']) {
send_mail($umail,$mail_text,$_t['email_answered_question_sub']);
}
}
else {
// if (strlen($post['a_guest'])>2) {
if ((strlen($post['a_guest'])>2) && username_exists($post['a_guest']) && ($post['a_guest'] != $_t['a_you_name'])) {
if (is_valid_email($post['a_email'])) {
$rs=mysql_query("INSERT INTO `answers` (`a_m_id`,`a_user_id`,`a_date`,`a_text`)
VALUES ('".$post['answer_q_id']."','".$_SESSION['user_id']."','".time()."','".$post['answer_text']."')");
$i_id=mysql_insert_id();
$ahash=random_string(20);
$rs2=mysql_query("INSERT INTO `guest_answers` (`a_id`,`hash`,`name`,`ip`,`amail`)
VALUES ('".$i_id."','".$ahash."','".$post['a_guest']."','".$_SERVER['REMOTE_ADDR']."','".$post['a_email']."') ");
echo mysql_error();
// $link=$ns_static_url.'forum/questions.php?akey='.$ahash;
// $mail_text=str_replace("[link]",$link,$_t['answer_approuve']);
// send_mail($post['a_email'],$mail_text,$_t['answer_approuve_subject']);
// $link = '<a href="'. $ns_static_url .'forum/questions.php?akey='.$ahash .'">'. $ns_static_url.'forum/questions.php?mkey='.$ghash .'</a>';
$link = $ns_static_url .'forum/questions.php?akey='.$ahash;
$mail_text=str_replace("[name]",$post['a_guest'],stripslashes($_t['question_approuve']));
$mail_text=str_replace("[link]",$link,$mail_text);
send_mail($post['a_email'],$mail_text,$_t['question_approuve_subject']);
$_SESSION['error'][0]=$_t['question_succes'];
}
else {
$_SESSION['error'][0]=$_t['msg']['error_reg_mail_nook'];
}
}
else {
// $_SESSION['error'][0]=$_t['msg']['error_reg_name_lenght'];
$_SESSION['error'][0] = $_t['username_already_taken'];
}
}
}
else {
$_SESSION['error'][0]=$_t['msg']['error_answer'];
}
}
}
function add_new_question($post) {
global $_t;
global $ns_static_url;
$rs=mysql_query("SELECT * FROM `blocked_ip` WHERE `ip`='".$_SERVER['REMOTE_ADDR']."'");
if (!mysql_num_rows($rs)>0) {
if (strlen($post['new_q_title'])<2 || $post['new_q_title']==$post['default_new_q_title']) {
$_SESSION['error'][0]=$_t['msg']['error_q_name'];
$error=1;
}
if (strlen($post['new_q_text'])<2 || $post['new_q_text']==$post['default_new_q_text']) {
$_SESSION['error'][1]=$_t['msg']['error_q_text'];
$error=1;
}
if ($post['the_fat_cat_q']<1) {
$_SESSION['error'][2]=$_t['msg']['error_q_fatcat'];
$error=1;
}
if ($post['new_q_points']=="custom") {
$points=$post['new_q_custom_points'];
}
else {
$points=$post['new_q_points'];
}
if ($_SESSION['user_id']>0) {
if (($post['new_q_points']=="custom" && $post['new_q_custom_points']>0 && $post['new_q_custom_points']<=200) || ($post['new_q_points'])>0) {
if ($error<>1) {
$rsa=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `user_id`='".$_SESSION['user_id']."'"));
if ($rsa['points']>=$points) {
$rs=mysql_query("UPDATE `users` SET `points`='".($rsa['points']-$points)."' WHERE `user_id`='".$_SESSION['user_id']."'");
$rs=mysql_query("UPDATE `users` SET `blocked_points`='".($rsa['blocked_points']+$points)."' WHERE `user_id`='".$_SESSION['user_id']."'");
$rs=mysql_query("INSERT INTO `mesages` (`m_user_id`,`m_date`,`m_title`,`m_text`,`m_fatcat`,`m_points`,`an`,`active` )
VALUES ('".$_SESSION['user_id']."','".time()."','".$post['new_q_title']."','".$post['new_q_text']."',
'".$post['the_fat_cat_q']."', '".$points."',0,1)");
}
else {
$_SESSION['error'][8]=$_t['msg']['error_ask_q_points'];
}
}
}
else {
$_SESSION['error'][3]=$_t['msg']['error_points'];
$error=1;
}
}
else {
if (!is_valid_email($post['q_user_email'])) {
$_SESSION['error'][6]=$_t['msg']['error_reg_mail_nook'];
$error=1;
}
if (strlen($post['q_user_name'])<2 || $post['q_user_name']==$post['default_q_user_name'] || !username_exists($post['q_user_name'])) {
$_SESSION['error'][5]=$_t['username_already_taken'];
$error=1;
}
if ($error<>1) {
$rs=mysql_query("INSERT INTO `mesages` (`m_user_id`,`m_date`,`m_title`,`m_text`,`m_fatcat`,`m_points` )
VALUES ('".$_SESSION['user_id']."','".time()."','".$post['new_q_title']."','".$post['new_q_text']."',
'".$post['the_fat_cat_q']."', '".$points."')");
$i_id=mysql_insert_id();
$g_hash=random_string(20);
$rs2=mysql_query("INSERT INTO `guest_mesages` (`gname`,`gmail`,`g_hash`,`m_id`,`ip`)
VALUES ('".$post['q_user_name']."','".$post['q_user_email']."','".$g_hash."','".$i_id."','".$_SERVER['REMOTE_ADDR']."')");
// $link = '<a href="'. $ns_static_url .'forum/questions.php?mkey='.$g_hash .'">'. $ns_static_url.'forum/questions.php?mkey='.$g_hash .'</a>';
$link = $ns_static_url .'forum/questions.php?mkey='.$g_hash;
$mail_text=str_replace("[name]",$post['q_user_name'],stripslashes($_t['question_approuve']));
$mail_text=str_replace("[link]",$link,$mail_text);
send_mail($post['q_user_email'],$mail_text,$_t['question_approuve_subject']);
}
}
}
}
function update_answers_count($msg_id) {
$rs3=mysql_fetch_assoc(mysql_query("SELECT COUNT(*) as man FROM `answers` WHERE `a_m_id`='".$msg_id."' AND `active`='1'"));
$rs4=mysql_query("UPDATE `mesages` SET `an`='".$rs3['man']."' WHERE `m_id`='".$msg_id."'");
}
function close_question($id) {
global $ns_static_url;
$rs=mysql_query("SELECT * FROM `mesages` WHERE `m_id`='".$id."' AND `m_user_id`='".$_SESSION['user_id']."' AND `closed`='0'");
if (mysql_num_rows($rs)>0) {
$rs2=mysql_query("SELECT * FROM `answers` WHERE `a_m_id`='".$id."'");
if (mysql_num_rows($rs2)>0) {
echo '<a href="'.$ns_static_url.'forum/questions.php?id='.$id.'&close_q='.$id.'" class="btn">Close question</a>';
$_SESSION['close_q']=$id;
}
}
}
function close_question_form($id) {
global $ns_static_url;
global $_t;
$_SESSION['close_q']=$id;
$rs=mysql_query("SELECT DISTINCT(`a_user_id`) FROM `answers` WHERE `a_m_id`='".$id."' AND `a_user_id`>0
AND `a_user_id`<>'".$_SESSION['user_id']."' AND `active`='1'");
if (mysql_num_rows($rs)>0) {
echo '<h3>'. $_t['allocate_points'] .' (<a href="java script:;" onclick="PopWin(\''. $ns_static_url .'popup.php?page=allocate_points\',400,600,\'no\')">?</a>)</h3>
<form action="'.$ns_static_url.'forum/questions.php" method="post">
<table>
';
while ($row=mysql_fetch_assoc($rs)) {
$rs2=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `user_id`='".$row['a_user_id']."'"));
echo '<tr>
<td align="right">'
.$rs2['user_name'].':
</td>
<td>
<input type="text" name="puid_'.$rs2['user_id'].'" value="0" size="4" /> '. $_t['point'] .'
</td>
</tr>';
}
echo '<tr>
<td align="right">
'. $_t['allocate_points_to_myself'] .':
</td>
<td>
<input type="text" name="pointd_for_me" value="0" size="4" /> '. $_t['point'] .'
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" value="'. $_t['allocate_points_btn'] .'" name="close_question" class="btn" />
</td>
</tr>
</table>
</form>';
}
}
ob_end_flush();
?>
- og hjemmesiden hvor forummet er hedder: netspirit.dk