Avatar billede chatonline Nybegynder
20. februar 2008 - 21:09 Der er 28 kommentarer og
1 løsning

Lukke for gæstesvar-funktion på min hjemmeside

Hej..

Jeg har ikke rodet med php og mysql i nogle år nu og har glemt stortset alt om det.

Jeg har det problem at jeg har en gæstesvar på min hjemmeside:
http://www.skyskraber.dk

Jeg vil gerne have funktionen lukket så kun oprettede brugere kan svare.
Nogen der har lyst til at hjælpe lidt, så jeg kan komme igang igen.

På forhånd tak.
Avatar billede rax Praktikant
20. februar 2008 - 21:48 #1
jada.. men det kommer jo an på hvordan du har lavet dit system, så du må komme med nogle flere oplysninger :) laver du på nuværende tidspunkt noget check på, om brugeren er logget ind når man besvarer? f.eks. for at indsætte et navn, eller "gæst" hvis det er en anonym besvarer?
Avatar billede thesurfer Nybegynder
20. februar 2008 - 21:50 #2
Hvis der sættes en session når brugeren logger ind, kan du jo bare checke om sessionen er gyldig (indeholder noget der kun kan være der, når en bruger logger ind).

Undgå at bruge cookies til formålet.
Avatar billede thesurfer Nybegynder
20. februar 2008 - 21:51 #3
Jeg går ud fra, at det er pga den massive spam, at du ønsker gæstesvar slået fra.. :-)
Avatar billede mike2002 Nybegynder
20. februar 2008 - 21:58 #4
Nu ved jeg ikke om du bruger sessions til at registrere brugere, men det gør du sikkert. Så er det jo bare at sætte din svar-boks på read.php ind i en if sætning a la:

if(isset($_SESSION["username"]))
    {
      // Her er din svar-boks
    }
else
    {
      // Opret en brugerprofil for at deltage i debatten
    }

Hvis du ikke selv ved, om du bruger sessions skal du nok poste lidt kode - fx dit login script

mvh. Michael
Avatar billede mike2002 Nybegynder
20. februar 2008 - 22:00 #5
Som thesurfer skrev... - brugte lige lidt tid på at kigge på skyskraber.dk inden jeg kom med min kommentar
Avatar billede thesurfer Nybegynder
20. februar 2008 - 22:00 #6
mike2002> Det er ikke nok at sætte den ved svar-boks.. der skal også valideres når formen submittes..

Hvorfor? Fordi så snart man har set svar-boksen 1 gang, kan man downloade siden og rette "action" til.. så kan man submitte igen, selvom svar-boksen fjernes fra siden online.. med mindre at man laver et referer-check.. husk på at visse browsere tillader brugeren at slå referer-oplsyningerne fra..
Avatar billede mike2002 Nybegynder
20. februar 2008 - 22:02 #7
Jeps - det havde jeg ikke tænkt på!
Avatar billede superdreng Nybegynder
20. februar 2008 - 23:14 #8
Synes det er lidt tarveligt at fjerne copyright fra JBJ's forum

Det er endda helt gratis at hente!
Avatar billede chatonline Nybegynder
21. februar 2008 - 11:37 #9
Tak for svarene, kigger på det senere i aften.

Superdreng, det har skam stået der i sin tid. Men det nok blevet fjernet af den seneste programmør da det er flere år siden jeg selv har lavet noget. Men det kommer selvfølgelig på igen.
Avatar billede chatonline Nybegynder
21. februar 2008 - 20:49 #10
Kunne ikke lige finde rundt i det mere, den begyndte at melde fejl når jeg prøvede mig frem :-)
Poster lige read.php filen:
Avatar billede chatonline Nybegynder
21. februar 2008 - 20:49 #11
<?php
    $side = ".";
    require "$side/funcs.php";
    $query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' LIMIT 1");
    $t = mysql_fetch_array($query);
    $side_titel = "Tråd: $t[overskrift]";
  $query = mysql_query("SELECT * FROM forum_board WHERE id = '$_GET[board]' LIMIT 1");
    $b = mysql_fetch_array($query);
  $query = mysql_query("SELECT * FROM forum_emne WHERE id = '$_GET[emneId]' LIMIT 1");
    $r = mysql_fetch_array($query);
    $hvor = "<a href=\"./?emneId=$_GET[emneId]\">Emne: $r[emne]</a> > <a href=\"./board.php?emneId=$_GET[emneId]&board=$_GET[board]\">Board: $b[board]</a> > <b>" . $side_titel . "</b>";
    include "$side/includes/header.php";
?>
<!-- indhold start -->

<script type="text/javascript" language="JavaScript">
<!--
function FormValidator(theForm)
{
    if (document.post.bruger.value == '') {
        alert('Du skal skrive dit navn\n\nOpret en bruger og slip for at udfylde Navn-feltet!');
        document.post.bruger.focus();
        return (false);
    }
    if (document.post.bruger.value == 'Dit navn') {
        alert('Du skal skrive dit navn\n\nOpret en bruger og slip for at udfylde Navn-feltet!');
        document.post.bruger.focus();
        return (false);
    }
    if (document.post.tekst.value == '') {
        alert('Du skal skrive noget i Tekst-feltet');
        document.post.tekst.focus();
        return (false);
    }
    if (document.post.tekst.value == 'Dit svar') {
        alert('Du skal skrive noget i Tekst-feltet');
        document.post.tekst.focus();
        return (false);
    }
}
function makeBold() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[B]" + sTxt + "[/B]";
}
function makeItalic() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[I]" + sTxt + "[/I]";
}
function makeUnderstreget() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[U]" + sTxt + "[/U]";
}
function makeLink() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[url]" + sTxt + "[/url]";
}
function makeCitat() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "
"" + sTxt + ""
";
}
function makeKode() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[KODE]" + sTxt + "[/KODE]";
}
function makeBillede() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[BILLEDE]" + sTxt + "[/BILLEDE]";
}
function emoticon(text) {
    text = '' + text + '';
    if (document.post.tekst.createTextRange && document.post.tekst.caretPos) {
        var caretPos = document.post.tekst.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? text + '' : text;
        document.post.tekst.focus();
    } else {
    document.post.tekst.value  += text;
    document.post.tekst.focus();
    }
}
function NewWin () {
HELP=window.open('ehtml_popup.htm','help','width=500,height=450,toolbar=no,scrollbars=yes')
}
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{

ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
function FormValidatorDummy(theForm)
{
    if (document.dummy.choice.value == 'dum') {
        alert('Du kan ikke vælge det "Quick-menu" punkt!');
        return (false);
    }
    }
//-->
</script>

<table width="100%" cellspacing="1" cellpadding="2" class="tabelBox">
<?php
$sets = mysql_query("SELECT pr_side_t FROM forum_settings WHERE id = '1' LIMIT 1");
$rS = mysql_fetch_array($sets);
$pr_side = $rS["pr_side_t"];
$s = $_GET['s'];
if (!isset($s)) {
    $s = "0";
}
if((!$s) || ($s == 0)){
$pr_side = $pr_side - 1;
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$queryThread = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' LIMIT 1");
} else {
$queryThread = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' AND public = '1' LIMIT 1");
}
$row = mysql_fetch_array($queryThread);
$id = $row["id"];
$emneId = $row["emneId"];
$board = $row["board"];
$text = $row["text"];
$overskrift = $row["overskrift"];
$tbrugerId = $row["brugerId"];
$tbruger = $row["bruger"];
$emneId = $row["emneId"];
$public = $row["public"];
$last_edit_stamp = $row["last_edit_stamp"];
$last_edit_date = date("$_SETS[dato_form]", $row[last_edit_stamp]);
$lock = $row["lock"];
$date = date("$_SETS[dato_form]", $row[date_stamp]);
$query = mysql_query("SELECT * FROM forum_users WHERE id = '$tbrugerId' LIMIT 1");
$user = mysql_fetch_array($query);
?>
<script type="text/javascript" language="JavaScript">
<!--
function Pm<?=$id;?>() {
    window.open("./users/pm.php?til=<?=$tbrugerId;?>","Pm","width=250,height=180,resizable=no,scrollbars=no");
}
function sendThread() {
    window.open("sendThread.php?emneId=<?=$_GET[emneId];?>&board=<?=$_GET[board];?>&id=<?=$_GET[id];?>","sendThread","width=380,height=240,resizable=no,scrollbars=no");
}
//-->
</script>
<?php
include "./replace.php";

echo "
<tr class=\"tr\">
<td width=\"125\">
Forfatter:
</td>
<td>
Overskrift: <b>$overskrift</b>
</td>
<form action=\"../dummy\" method=\"post\" name=\"dummy\" onSubmit=\"return FormValidatorDummy(this);\">
<td align=\"right\">
Quick menu: <select name=\"choice\" size=\"1\" onchange=\"jump(this.form)\" class=\"inputMenu\">
<option value=\"dum\">Vælg et emne/board...</option>";
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$emneQuery = mysql_query("SELECT * FROM forum_emne ORDER BY sort");
} else {
$emneQuery = mysql_query("SELECT * FROM forum_emne WHERE public = '1' ORDER BY sort");
}
while($r = mysql_fetch_array($emneQuery)) {
echo "
<option value=\"./?emneId=$r[id]\" class=\"emneSelectMenu\">$r[emne]</option>";
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$boardQuery = mysql_query("SELECT * FROM forum_board WHERE emneId = '$r[id]' ORDER BY sort");
} else {
$boardQuery = mysql_query("SELECT * FROM forum_board WHERE emneId = '$r[id]' AND public = '1' ORDER BY sort");
}
while($r2 = mysql_fetch_array($boardQuery)) {
echo "
<option value=\"board.php?emneId=$r[id]&board=$r2[id]\" class=\"inputMenu\">$r2[board]</option>";
}
}
echo "
</select>
</td></form></tr>
<form action=\"edit_traad.php\" method=\"post\">
<tr class=\"tdUlige\" valign=\"top\">
<td width=\"110\">
<div class=\"postForfatter\">";
if ($tbrugerId == '-gæst'){
echo "
<b>$tbruger</b><br />
<font size=\"1\">Gæst";
} else {
echo "
<b><a href=\"./users/show.php?brugerId=$tbrugerId\">$tbruger</a></b><br />
<font size=\"1\">";
if($user['rang'] == 1){
echo "Bruger";
} elseif($user['rang'] == 2){
echo "CoAdmin";
} elseif($user['rang'] == 3){
echo "Admin";
}
if($_SETS['avatar'] != 0 && $user['avatar'] != 0){
if($_SETS['avatar'] == 1 || $_SETS['avatar'] == 2 && $user['avatar'] == 1 && $user['avatar_web'] != NULL){
echo "<br /><img src=\"$user[avatar_web]\" border=\"0\" />";
} elseif($_SETS['avatar'] == 2 || $_SETS['avatar'] == 3 && $user['avatar'] == 1 && $user['avatar_upload'] != NULL){
echo "<br /><img src=\"./avatar/$user[avatar_upload]\" border=\"0\" />";
}
}
if($_SETS['posts'] == 1){
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_reply WHERE brugerId = '$tbrugerId'");
$fr = mysql_fetch_array($query);
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_thread WHERE brugerId = '$tbrugerId'");
$ft = mysql_fetch_array($query);
$indlaeg = $fr[antal] + $ft[antal];
echo "<br /><br />
Indlæg: $indlaeg";
} else {
echo "<br />";
}
if(($_COOKIE['loginId']) && ($_COOKIE['loginId'] != $tbrugerId)){
echo "<br /><input type=\"button\" class=\"pm\" value=\"PM\" name=\"sendPM\" onclick=\"java script:Pm$id();\" target=\"Pm\" />";
}
}
echo "</font></div>
<input type=\"hidden\" value=\"$board\" name=\"board\" />
<input type=\"hidden\" value=\"$id\" name=\"id\" />
<input type=\"hidden\" value=\"$emneId\" name=\"emneId\" />
</td>
<td colspan=\"2\">
<div class=\"postTop\">
<b>Indlæg #1</b> skrevet $date &nbsp;&nbsp;&nbsp;&nbsp;";
if($lock != 1){
if($_USER['rang'] == 2){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/flyt/lås tråd\" name=\"send\" />";
} elseif($_USER['rang'] == 3){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/flyt/slet/lås tråd\" name=\"send\" />";
} elseif(($tbrugerId == $_COOKIE['loginId']) && ($_USER['rang'] == 1)){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger tråd\" name=\"send\" />";
}
}
if(($lock == 1) && ($_USER['rang'] == 2 || $_USER['rang'] == 3)){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Lås tråd op\" name=\"send\" />";
}
echo "</div>
<div class=\"postText\">
$text";
if ($last_edit_stamp != NULL){
echo "
<hr width=\"100%\" align=\"left\" size=\"0\" />
<i><font size=\"1\">Sidst redigeret: $last_edit_date</font></i>";
}
echo "
</div></td></tr></form>";
}

if(($_COOKIE['login']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$queryReply = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[id]' ORDER BY id LIMIT $s,$pr_side");
} else {
$queryReply = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[id]' AND public = '1' ORDER BY id LIMIT $s,$pr_side");
}
if((!$s) || ($s == 0)){
$i = 1;
} else {
$i = 0;
}
while ($row = mysql_fetch_array($queryReply)) {
$replyId = $row["id"];
$text = $row["text"];
$overskrift = $row["overskrift"];
$brugerId = $row["brugerId"];
$bruger = $row["bruger"];
$last_edit_stamp = $row["last_edit_stamp"];
$last_edit_date = date("$_SETS[dato_form]", $row[last_edit_stamp]);
$date = date("$_SETS[dato_form]", $row[date_stamp]);
$query = mysql_query("SELECT * FROM forum_users WHERE id = '$brugerId' LIMIT 1");
$user = mysql_fetch_array($query);
include "./replace.php";
$i++;
?>
<script type="text/javascript" language="JavaScript">
<!--
function Pm<?=$replyId;?>() {
    window.open("./users/pm.php?til=<?=$tbrugerId;?>","Pm","width=250,height=180,resizable=no,scrollbars=no");
}
//-->
</script>
<?php
if ($i%2 == 1) {
$class = "tdUlige";
} else {
$class = "tdLige";
}
$svar = $i + $s;
echo "
<form action=\"./edit_svar.php\" method=\"post\">
<tr valign=\"top\" class=\"$class\">
<td width=\"110\">
<div class=\"postForfatter\">";
if ($brugerId == '-gæst'){
echo "
<b>$bruger</b><br />
<font size=\"1\">Gæst";
} else {
echo "
<b><a href=\"./users/show.php?brugerId=$brugerId\">$bruger</a></b><br />
<font size=\"1\">";
if($user['rang'] == 1){
echo "Bruger";
} elseif($user['rang'] == 2){
echo "CoAdmin";
} elseif($user['rang'] == 3){
echo "Admin";
}
if($_SETS['avatar'] != 0 && $user['avatar'] != 0){
if($_SETS['avatar'] == 1 || $_SETS['avatar'] == 2 && $user['avatar'] == 1 && $user['avatar_web'] != NULL){
echo "<br /><img src=\"$user[avatar_web]\" border=\"0\" />";
} elseif($_SETS['avatar'] == 2 || $_SETS['avatar'] == 3 && $user['avatar'] == 1 && $user['avatar_upload'] != NULL){
echo "<br /><img src=\"./avatar/$user[avatar_upload]\" border=\"0\" />";
}
}
if($_SETS['posts'] == 1){
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_reply WHERE brugerId = '$brugerId'");
$fr = mysql_fetch_array($query);
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_thread WHERE brugerId = '$brugerId'");
$ft = mysql_fetch_array($query);
$indlaeg = $fr[antal] + $ft[antal];
echo "<br /><br />
Indlæg: $indlaeg";
} else {
echo "<br />";
}
if(($_COOKIE['loginId']) && ($brugerId != '-gæst') && ($_COOKIE['loginId'] != $brugerId)){
echo "<br /><input type=\"button\" class=\"pm\" value=\"PM\" name=\"sendPM\" onclick=\"java script:Pm$replyId();\" target=\"Pm\" />";
}
}
echo "</font></div>
<input type=\"hidden\" value=\"$replyId\" name=\"id\" />
</td>
<td colspan=\"2\">
<div class=\"postTop\">
<b>Indlæg #$svar</b> skrevet $date &nbsp;&nbsp;&nbsp;&nbsp;";
if($lock != 1){
if($brugerId == $_COOKIE['loginId']){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/slet indlæg\" name=\"send\" />";
} elseif($_USER['rang'] == 2){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger indlæg\" name=\"send\" />";
} elseif($_USER['rang'] == 3){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/slet indlæg\" name=\"send\" />";
}
}
echo "</div>
<div class=\"postText\">
$text";
if ($last_edit_stamp != NULL){
echo "
<hr width=\"100%\" align=\"left\" size=\"0\" />
<i><font size=\"1\">Sidst redigeret: $last_edit_date</font></i>";
}
echo "
</div></td></tr></form>";
}
?>
<tr class="tr">
<td>
&nbsp;
</td>
<td align="right" colspan="2">

<input type="button" class="pm" value="Send tråd til ven" name="sendThread" onclick="java script:sendThread();" target="sendThread" />

<?php
if((!$_GET['s']) || ($_GET['s'] == 0)){
$pr_side = $pr_side + 1;
}
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$g_total = mysql_query("SELECT COUNT(id) AS total FROM forum_reply WHERE reply_to = '$_GET[id]'");
} else {
$g_total = mysql_query("SELECT COUNT(id) AS total FROM forum_reply WHERE reply_to = '$_GET[id]' AND public = '1'");
}
$total = mysql_result($g_total,0);
if ($s >= $pr_side) {
    $previous_s = $s-$pr_side;
    echo "
        <a href=\"?s=$previous_s&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">&lt;&lt;</a> ";
}  else {
        echo "<font class=\"alt\">&lt;&lt;</font> ";
    }
$page = 1;
if($total == 0){
echo "<b>$page</b> ";
}
for($start=0; $total > $start; $start=$start+$pr_side){
    if ($start != $s) {
        echo "<a href=\"?s=$start&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">$page</a> ";
    } else {
        echo "<b>$page</b> ";
    }
    $page++;
}
if ($total > $s+$pr_side) {
    $next_s = $s+$pr_side;
    echo "<a href=\"?s=$next_s&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">&gt;&gt;</a>";
} else {
        echo "<font class=\"alt\">&gt;&gt;</font>";
    }
?>
</td></tr></table>
<br />
<?php if($lock != 1){
if($total <= $s+$pr_side){ ?>
<table width="420" cellspacing="1" cellpadding="2" class="tabelBox">
<form method="post" action="./func.php?function=reply" name="post" onSubmit="return FormValidator(this);">
<tr class="tr">
<td align="center">
<b>Besvar tråd:</b>
</td></tr>
<tr class="trBackground">
<td>
<br /><div align="center">
<input type="button" value="Link" class="button" onClick="makeLink()" />&nbsp;
<input type="button" value="Fed" class="button" onClick="makeBold()" />&nbsp;
<input type="button" value="Kursiv" class="button" onClick="makeItalic()" />&nbsp;
<input type="button" value="Understreget" class="button" onClick="makeUnderstreget()" />&nbsp;
<br><br><input type="button" value="Citat" class="button" onClick="makeCitat()" />&nbsp;
<input type="button" value="Kode" class="button" onClick="makeKode()" />
<input type="button" value="Billede" class="button" onClick="makeBillede()" />
<br />
<a href="java script:NewWin()">Hjælp til knapperne!</a>
<br />
<img src="./img/smiley.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':)');" />&nbsp;&nbsp;
<img src="./img/frown.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':(');" />&nbsp;&nbsp;
<img src="./img/wink.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(';)');" />&nbsp;&nbsp;
<img src="./img/biggrin.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':D');" />&nbsp;&nbsp;
<img src="./img/cool.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8)');" />&nbsp;&nbsp;
<img src="./img/tongue.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':p');" />&nbsp;&nbsp;
<img src="./img/rolleyes.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('@-)');" />&nbsp;&nbsp;
<img src="./img/terrefied.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':0');" />&nbsp;&nbsp;
<img src="./img/sleep.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('|-I');" />&nbsp;&nbsp;
<img src="./img/eek.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8-0');" />&nbsp;&nbsp;
<img src="./img/angry.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':||');" />&nbsp;&nbsp;
<img src="./img/sick.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/sick');" />&nbsp;&nbsp;
<img src="./img/thumbup.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/great');" />&nbsp;&nbsp;
<img src="./img/thumbdown.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/bad');" />&nbsp;&nbsp;
<img src="./img/star.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/star');" />
<br /></div>
<input type="hidden" name="reply_to" value="<?=$id;?>" />
<input type="hidden" name="board" value="<?=$board;?>" />
<input type="hidden" name="emneId" value="<?=$emneId;?>" />
<input type="hidden" name="s" value="<?=$s;?>" />
<?php
if($_COOKIE['login']){
    echo "
    <input class=\"input\" type=\"text\" name=\"bruger\" size=\"30\" value=\"$_COOKIE[login]\" readonly=\"readonly\" />
    <input type=\"hidden\" value=\"$_COOKIE[loginId]\" name=\"brugerId\" />";
    $signQuery = mysql_query("SELECT * FROM forum_users WHERE id = '$_COOKIE[loginId]'");
    $signR = mysql_fetch_array($signQuery);
    echo "
    <input type=\"hidden\" value=\"$signR[signatur]\" name=\"signatur\" /><br />";
    if($signR['optSignatur'] == 1){
    echo "
    <input type=\"checkbox\" name=\"optSignatur\" checked=\"checked\" id=\"sign\" />";
    } else {
    echo "
    <input type=\"checkbox\" name=\"optSignatur\" id=\"sign\" />";   
    }
    echo "
    <label for=\"sign\">Sæt min signatur på dette indlæg</label>";
} else {
    echo "
    <input class=\"input\" type=\"text\" name=\"bruger\" size=\"30\" value=\"Dit navn\" onFocus=\"if(this.value=='Dit navn')this.value='';\" onBlur=\"if(this.value=='')this.value='Dit navn';\" />
    <input type=\"hidden\" value=\"-gæst\" name=\"brugerId\" />";
}
?>
<br />
<textarea cols="50" rows="10" name="tekst" class="input" onFocus="if(this.value=='Dit svar')this.value='';" onBlur="if(this.value=='')this.value='Dit svar';">Dit svar</textarea>
<br />
<div align="center"><input type="submit" name="besvar" value="Besvar" class="button" /></div>

<?php if(!$_COOKIE['login']){ ?>
<br /><br /><a href="./users/opret.php"><b>Opret en bruger nu</b></a>, og nyd godt af fordelene:
<br /><br />
<i><li>Mulighed for redigéring og sletning af svar.</li><br />
<li>Automatisk udfyldning af navn</li><br />
<li>Og meget mere, som er ved at blive lavet!</li></i>
<?php } ?>
</td></tr></table></form>
<?php } else {
echo "<b>Gå til sidste side for at besvare!</b><br />";
}
} else { ?>
<table cellspacing="1" cellpadding="2" class="tabelBox" width="420">
<tr>
<td align="center">
<br /><font color="#ff0000"><b>Denne tråd er låst, derfor kan der ikke oprettes nye indlæg, redigeres eller slettes eksisterende indlæg!</b></font><br /><br />
</td></tr></table>
<?php } ?>

<!-- indhold slut -->
<?php include "$side/includes/footer.php"; ?>
Avatar billede mike2002 Nybegynder
21. februar 2008 - 21:56 #12
Prøv at sætte denne her ind:
Avatar billede mike2002 Nybegynder
21. februar 2008 - 21:56 #13
<?php
    $side = ".";
    require "$side/funcs.php";
    $query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' LIMIT 1");
    $t = mysql_fetch_array($query);
    $side_titel = "Tråd: $t[overskrift]";
  $query = mysql_query("SELECT * FROM forum_board WHERE id = '$_GET[board]' LIMIT 1");
    $b = mysql_fetch_array($query);
  $query = mysql_query("SELECT * FROM forum_emne WHERE id = '$_GET[emneId]' LIMIT 1");
    $r = mysql_fetch_array($query);
    $hvor = "<a href=\"./?emneId=$_GET[emneId]\">Emne: $r[emne]</a> > <a href=\"./board.php?emneId=$_GET[emneId]&board=$_GET[board]\">Board: $b[board]</a> > <b>" . $side_titel . "</b>";
    include "$side/includes/header.php";
?>
<!-- indhold start -->

<script type="text/javascript" language="JavaScript">
<!--
function FormValidator(theForm)
{
    if (document.post.bruger.value == '') {
        alert('Du skal skrive dit navn\n\nOpret en bruger og slip for at udfylde Navn-feltet!');
        document.post.bruger.focus();
        return (false);
    }
    if (document.post.bruger.value == 'Dit navn') {
        alert('Du skal skrive dit navn\n\nOpret en bruger og slip for at udfylde Navn-feltet!');
        document.post.bruger.focus();
        return (false);
    }
    if (document.post.tekst.value == '') {
        alert('Du skal skrive noget i Tekst-feltet');
        document.post.tekst.focus();
        return (false);
    }
    if (document.post.tekst.value == 'Dit svar') {
        alert('Du skal skrive noget i Tekst-feltet');
        document.post.tekst.focus();
        return (false);
    }
}
function makeBold() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[B]" + sTxt + "[/B]";
}
function makeItalic() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[I]" + sTxt + "[/I]";
}
function makeUnderstreget() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[U]" + sTxt + "[/U]";
}
function makeLink() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[url]" + sTxt + "[/url]";
}
function makeCitat() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "
"" + sTxt + ""
";
}
function makeKode() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[KODE]" + sTxt + "[/KODE]";
}
function makeBillede() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[BILLEDE]" + sTxt + "[/BILLEDE]";
}
function emoticon(text) {
    text = '' + text + '';
    if (document.post.tekst.createTextRange && document.post.tekst.caretPos) {
        var caretPos = document.post.tekst.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? text + '' : text;
        document.post.tekst.focus();
    } else {
    document.post.tekst.value  += text;
    document.post.tekst.focus();
    }
}
function NewWin () {
HELP=window.open('ehtml_popup.htm','help','width=500,height=450,toolbar=no,scrollbars=yes')
}
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{

ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
function FormValidatorDummy(theForm)
{
    if (document.dummy.choice.value == 'dum') {
        alert('Du kan ikke vælge det "Quick-menu" punkt!');
        return (false);
    }
    }
//-->
</script>

<table width="100%" cellspacing="1" cellpadding="2" class="tabelBox">
<?php
$sets = mysql_query("SELECT pr_side_t FROM forum_settings WHERE id = '1' LIMIT 1");
$rS = mysql_fetch_array($sets);
$pr_side = $rS["pr_side_t"];
$s = $_GET['s'];
if (!isset($s)) {
    $s = "0";
}
if((!$s) || ($s == 0)){
$pr_side = $pr_side - 1;
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$queryThread = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' LIMIT 1");
} else {
$queryThread = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' AND public = '1' LIMIT 1");
}
$row = mysql_fetch_array($queryThread);
$id = $row["id"];
$emneId = $row["emneId"];
$board = $row["board"];
$text = $row["text"];
$overskrift = $row["overskrift"];
$tbrugerId = $row["brugerId"];
$tbruger = $row["bruger"];
$emneId = $row["emneId"];
$public = $row["public"];
$last_edit_stamp = $row["last_edit_stamp"];
$last_edit_date = date("$_SETS[dato_form]", $row[last_edit_stamp]);
$lock = $row["lock"];
$date = date("$_SETS[dato_form]", $row[date_stamp]);
$query = mysql_query("SELECT * FROM forum_users WHERE id = '$tbrugerId' LIMIT 1");
$user = mysql_fetch_array($query);
?>
<script type="text/javascript" language="JavaScript">
<!--
function Pm<?=$id;?>() {
    window.open("./users/pm.php?til=<?=$tbrugerId;?>","Pm","width=250,height=180,resizable=no,scrollbars=no");
}
function sendThread() {
    window.open("sendThread.php?emneId=<?=$_GET[emneId];?>&board=<?=$_GET[board];?>&id=<?=$_GET[id];?>","sendThread","width=380,height=240,resizable=no,scrollbars=no");
}
//-->
</script>
<?php
include "./replace.php";

echo "
<tr class=\"tr\">
<td width=\"125\">
Forfatter:
</td>
<td>
Overskrift: <b>$overskrift</b>
</td>
<form action=\"../dummy\" method=\"post\" name=\"dummy\" onSubmit=\"return FormValidatorDummy(this);\">
<td align=\"right\">
Quick menu: <select name=\"choice\" size=\"1\" onchange=\"jump(this.form)\" class=\"inputMenu\">
<option value=\"dum\">Vælg et emne/board...</option>";
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$emneQuery = mysql_query("SELECT * FROM forum_emne ORDER BY sort");
} else {
$emneQuery = mysql_query("SELECT * FROM forum_emne WHERE public = '1' ORDER BY sort");
}
while($r = mysql_fetch_array($emneQuery)) {
echo "
<option value=\"./?emneId=$r[id]\" class=\"emneSelectMenu\">$r[emne]</option>";
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$boardQuery = mysql_query("SELECT * FROM forum_board WHERE emneId = '$r[id]' ORDER BY sort");
} else {
$boardQuery = mysql_query("SELECT * FROM forum_board WHERE emneId = '$r[id]' AND public = '1' ORDER BY sort");
}
while($r2 = mysql_fetch_array($boardQuery)) {
echo "
<option value=\"board.php?emneId=$r[id]&board=$r2[id]\" class=\"inputMenu\">$r2[board]</option>";
}
}
echo "
</select>
</td></form></tr>
<form action=\"edit_traad.php\" method=\"post\">
<tr class=\"tdUlige\" valign=\"top\">
<td width=\"110\">
<div class=\"postForfatter\">";
if ($tbrugerId == '-gæst'){
echo "
<b>$tbruger</b><br />
<font size=\"1\">Gæst";
} else {
echo "
<b><a href=\"./users/show.php?brugerId=$tbrugerId\">$tbruger</a></b><br />
<font size=\"1\">";
if($user['rang'] == 1){
echo "Bruger";
} elseif($user['rang'] == 2){
echo "CoAdmin";
} elseif($user['rang'] == 3){
echo "Admin";
}
if($_SETS['avatar'] != 0 && $user['avatar'] != 0){
if($_SETS['avatar'] == 1 || $_SETS['avatar'] == 2 && $user['avatar'] == 1 && $user['avatar_web'] != NULL){
echo "<br /><img src=\"$user[avatar_web]\" border=\"0\" />";
} elseif($_SETS['avatar'] == 2 || $_SETS['avatar'] == 3 && $user['avatar'] == 1 && $user['avatar_upload'] != NULL){
echo "<br /><img src=\"./avatar/$user[avatar_upload]\" border=\"0\" />";
}
}
if($_SETS['posts'] == 1){
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_reply WHERE brugerId = '$tbrugerId'");
$fr = mysql_fetch_array($query);
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_thread WHERE brugerId = '$tbrugerId'");
$ft = mysql_fetch_array($query);
$indlaeg = $fr[antal] + $ft[antal];
echo "<br /><br />
Indlæg: $indlaeg";
} else {
echo "<br />";
}
if(($_COOKIE['loginId']) && ($_COOKIE['loginId'] != $tbrugerId)){
echo "<br /><input type=\"button\" class=\"pm\" value=\"PM\" name=\"sendPM\" onclick=\"java script:Pm$id();\" target=\"Pm\" />";
}
}
echo "</font></div>
<input type=\"hidden\" value=\"$board\" name=\"board\" />
<input type=\"hidden\" value=\"$id\" name=\"id\" />
<input type=\"hidden\" value=\"$emneId\" name=\"emneId\" />
</td>
<td colspan=\"2\">
<div class=\"postTop\">
<b>Indlæg #1</b> skrevet $date &nbsp;&nbsp;&nbsp;&nbsp;";
if($lock != 1){
if($_USER['rang'] == 2){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/flyt/lås tråd\" name=\"send\" />";
} elseif($_USER['rang'] == 3){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/flyt/slet/lås tråd\" name=\"send\" />";
} elseif(($tbrugerId == $_COOKIE['loginId']) && ($_USER['rang'] == 1)){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger tråd\" name=\"send\" />";
}
}
if(($lock == 1) && ($_USER['rang'] == 2 || $_USER['rang'] == 3)){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Lås tråd op\" name=\"send\" />";
}
echo "</div>
<div class=\"postText\">
$text";
if ($last_edit_stamp != NULL){
echo "
<hr width=\"100%\" align=\"left\" size=\"0\" />
<i><font size=\"1\">Sidst redigeret: $last_edit_date</font></i>";
}
echo "
</div></td></tr></form>";
}

if(($_COOKIE['login']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$queryReply = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[id]' ORDER BY id LIMIT $s,$pr_side");
} else {
$queryReply = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[id]' AND public = '1' ORDER BY id LIMIT $s,$pr_side");
}
if((!$s) || ($s == 0)){
$i = 1;
} else {
$i = 0;
}
while ($row = mysql_fetch_array($queryReply)) {
$replyId = $row["id"];
$text = $row["text"];
$overskrift = $row["overskrift"];
$brugerId = $row["brugerId"];
$bruger = $row["bruger"];
$last_edit_stamp = $row["last_edit_stamp"];
$last_edit_date = date("$_SETS[dato_form]", $row[last_edit_stamp]);
$date = date("$_SETS[dato_form]", $row[date_stamp]);
$query = mysql_query("SELECT * FROM forum_users WHERE id = '$brugerId' LIMIT 1");
$user = mysql_fetch_array($query);
include "./replace.php";
$i++;
?>
<script type="text/javascript" language="JavaScript">
<!--
function Pm<?=$replyId;?>() {
    window.open("./users/pm.php?til=<?=$tbrugerId;?>","Pm","width=250,height=180,resizable=no,scrollbars=no");
}
//-->
</script>
<?php
if ($i%2 == 1) {
$class = "tdUlige";
} else {
$class = "tdLige";
}
$svar = $i + $s;
echo "
<form action=\"./edit_svar.php\" method=\"post\">
<tr valign=\"top\" class=\"$class\">
<td width=\"110\">
<div class=\"postForfatter\">";
if ($brugerId == '-gæst'){
echo "
<b>$bruger</b><br />
<font size=\"1\">Gæst";
} else {
echo "
<b><a href=\"./users/show.php?brugerId=$brugerId\">$bruger</a></b><br />
<font size=\"1\">";
if($user['rang'] == 1){
echo "Bruger";
} elseif($user['rang'] == 2){
echo "CoAdmin";
} elseif($user['rang'] == 3){
echo "Admin";
}
if($_SETS['avatar'] != 0 && $user['avatar'] != 0){
if($_SETS['avatar'] == 1 || $_SETS['avatar'] == 2 && $user['avatar'] == 1 && $user['avatar_web'] != NULL){
echo "<br /><img src=\"$user[avatar_web]\" border=\"0\" />";
} elseif($_SETS['avatar'] == 2 || $_SETS['avatar'] == 3 && $user['avatar'] == 1 && $user['avatar_upload'] != NULL){
echo "<br /><img src=\"./avatar/$user[avatar_upload]\" border=\"0\" />";
}
}
if($_SETS['posts'] == 1){
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_reply WHERE brugerId = '$brugerId'");
$fr = mysql_fetch_array($query);
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_thread WHERE brugerId = '$brugerId'");
$ft = mysql_fetch_array($query);
$indlaeg = $fr[antal] + $ft[antal];
echo "<br /><br />
Indlæg: $indlaeg";
} else {
echo "<br />";
}
if(($_COOKIE['loginId']) && ($brugerId != '-gæst') && ($_COOKIE['loginId'] != $brugerId)){
echo "<br /><input type=\"button\" class=\"pm\" value=\"PM\" name=\"sendPM\" onclick=\"java script:Pm$replyId();\" target=\"Pm\" />";
}
}
echo "</font></div>
<input type=\"hidden\" value=\"$replyId\" name=\"id\" />
</td>
<td colspan=\"2\">
<div class=\"postTop\">
<b>Indlæg #$svar</b> skrevet $date &nbsp;&nbsp;&nbsp;&nbsp;";
if($lock != 1){
if($brugerId == $_COOKIE['loginId']){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/slet indlæg\" name=\"send\" />";
} elseif($_USER['rang'] == 2){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger indlæg\" name=\"send\" />";
} elseif($_USER['rang'] == 3){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/slet indlæg\" name=\"send\" />";
}
}
echo "</div>
<div class=\"postText\">
$text";
if ($last_edit_stamp != NULL){
echo "
<hr width=\"100%\" align=\"left\" size=\"0\" />
<i><font size=\"1\">Sidst redigeret: $last_edit_date</font></i>";
}
echo "
</div></td></tr></form>";
}
?>
<tr class="tr">
<td>
&nbsp;
</td>
<td align="right" colspan="2">

<input type="button" class="pm" value="Send tråd til ven" name="sendThread" onclick="java script:sendThread();" target="sendThread" />

<?php
if((!$_GET['s']) || ($_GET['s'] == 0)){
$pr_side = $pr_side + 1;
}
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$g_total = mysql_query("SELECT COUNT(id) AS total FROM forum_reply WHERE reply_to = '$_GET[id]'");
} else {
$g_total = mysql_query("SELECT COUNT(id) AS total FROM forum_reply WHERE reply_to = '$_GET[id]' AND public = '1'");
}
$total = mysql_result($g_total,0);
if ($s >= $pr_side) {
    $previous_s = $s-$pr_side;
    echo "
        <a href=\"?s=$previous_s&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">&lt;&lt;</a> ";
}  else {
        echo "<font class=\"alt\">&lt;&lt;</font> ";
    }
$page = 1;
if($total == 0){
echo "<b>$page</b> ";
}
for($start=0; $total > $start; $start=$start+$pr_side){
    if ($start != $s) {
        echo "<a href=\"?s=$start&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">$page</a> ";
    } else {
        echo "<b>$page</b> ";
    }
    $page++;
}
if ($total > $s+$pr_side) {
    $next_s = $s+$pr_side;
    echo "<a href=\"?s=$next_s&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">&gt;&gt;</a>";
} else {
        echo "<font class=\"alt\">&gt;&gt;</font>";
    }
?>
</td></tr></table>
<br />
<?php if($lock != 1){
if($total <= $s+$pr_side){
  if(isset($_COOKIE["login"])){ ?>
<table width="420" cellspacing="1" cellpadding="2" class="tabelBox">
<form method="post" action="./func.php?function=reply" name="post" onSubmit="return FormValidator(this);">
<tr class="tr">
<td align="center">
<b>Besvar tråd:</b>
</td></tr>
<tr class="trBackground">
<td>
<br /><div align="center">
<input type="button" value="Link" class="button" onClick="makeLink()" />&nbsp;
<input type="button" value="Fed" class="button" onClick="makeBold()" />&nbsp;
<input type="button" value="Kursiv" class="button" onClick="makeItalic()" />&nbsp;
<input type="button" value="Understreget" class="button" onClick="makeUnderstreget()" />&nbsp;
<br><br><input type="button" value="Citat" class="button" onClick="makeCitat()" />&nbsp;
<input type="button" value="Kode" class="button" onClick="makeKode()" />
<input type="button" value="Billede" class="button" onClick="makeBillede()" />
<br />
<a href="java script:NewWin()">Hjælp til knapperne!</a>
<br />
<img src="./img/smiley.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':)');" />&nbsp;&nbsp;
<img src="./img/frown.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':(');" />&nbsp;&nbsp;
<img src="./img/wink.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(';)');" />&nbsp;&nbsp;
<img src="./img/biggrin.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':D');" />&nbsp;&nbsp;
<img src="./img/cool.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8)');" />&nbsp;&nbsp;
<img src="./img/tongue.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':p');" />&nbsp;&nbsp;
<img src="./img/rolleyes.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('@-)');" />&nbsp;&nbsp;
<img src="./img/terrefied.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':0');" />&nbsp;&nbsp;
<img src="./img/sleep.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('|-I');" />&nbsp;&nbsp;
<img src="./img/eek.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8-0');" />&nbsp;&nbsp;
<img src="./img/angry.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':||');" />&nbsp;&nbsp;
<img src="./img/sick.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/sick');" />&nbsp;&nbsp;
<img src="./img/thumbup.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/great');" />&nbsp;&nbsp;
<img src="./img/thumbdown.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/bad');" />&nbsp;&nbsp;
<img src="./img/star.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/star');" />
<br /></div>
<input type="hidden" name="reply_to" value="<?=$id;?>" />
<input type="hidden" name="board" value="<?=$board;?>" />
<input type="hidden" name="emneId" value="<?=$emneId;?>" />
<input type="hidden" name="s" value="<?=$s;?>" />
<?php

    echo "
    <input class=\"input\" type=\"text\" name=\"bruger\" size=\"30\" value=\"$_COOKIE[login]\" readonly=\"readonly\" />
    <input type=\"hidden\" value=\"$_COOKIE[loginId]\" name=\"brugerId\" />";
    $signQuery = mysql_query("SELECT * FROM forum_users WHERE id = '$_COOKIE[loginId]'");
    $signR = mysql_fetch_array($signQuery);
    echo "
    <input type=\"hidden\" value=\"$signR[signatur]\" name=\"signatur\" /><br />";
    if($signR['optSignatur'] == 1){
    echo "
    <input type=\"checkbox\" name=\"optSignatur\" checked=\"checked\" id=\"sign\" />";
    } else {
    echo "
    <input type=\"checkbox\" name=\"optSignatur\" id=\"sign\" />";   
    }
    echo "
    <label for=\"sign\">Sæt min signatur på dette indlæg</label>";

?>
<br />
<textarea cols="50" rows="10" name="tekst" class="input" onFocus="if(this.value=='Dit svar')this.value='';" onBlur="if(this.value=='')this.value='Dit svar';">Dit svar</textarea>
<br />
<div align="center"><input type="submit" name="besvar" value="Besvar" class="button" /></div>

</td></tr></table></form>
<?php } else {
<table width="420" cellspacing="1" cellpadding="2" class="tabelBox">
<tr class="tr">
<td align="center">
<br /><br /><a href="./users/opret.php"><b>Opret en bruger nu</b></a>, og nyd godt af fordelene:
<br /><br />
<i><li>Mulighed for redigéring og sletning af svar.</li><br />
<li>Automatisk udfyldning af navn</li><br />
<li>Og meget mere, som er ved at blive lavet!</li></i>
</td>
</tr>
</table>
<?php }
else
{
echo "<b>Gå til sidste side for at besvare!</b><br />";
}
else
{ ?>

<table cellspacing="1" cellpadding="2" class="tabelBox" width="420">
<tr>
<td align="center">
<br /><font color="#ff0000"><b>Denne tråd er låst, derfor kan der ikke oprettes nye indlæg, redigeres eller slettes eksisterende indlæg!</b></font><br /><br />
</td></tr></table>
<?php } ?>

<!-- indhold slut -->
<?php include "$side/includes/footer.php"; ?>
Avatar billede mike2002 Nybegynder
21. februar 2008 - 22:01 #14
Den skulle gerne sørge for, at svar-boksen kun står der, når en bruger er logget ind...

Men for at sørge for, at der ikke er nogen, der kan fuske, skal du også sætte et cookie-tjek ved indsætning i table i func.php
Avatar billede chatonline Nybegynder
22. februar 2008 - 08:31 #15
Den viser nu intet overhovedet i read.php filen :-)
Kun tom side
Avatar billede mike2002 Nybegynder
22. februar 2008 - 11:12 #16
Det er sandsynligvis fordi der er fejl i scriptet - jeg har ikke haft mulighed for at teste det selv... Din server burde dog give en fejlmeddelelse a la PARSE ERROR... Har den ikke givet fejlmeddelelser tidligere?

Der manglede et }'er... Prøv at sætte den ind nu:

<?php
    $side = ".";
    require "$side/funcs.php";
    $query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' LIMIT 1");
    $t = mysql_fetch_array($query);
    $side_titel = "Tråd: $t[overskrift]";
  $query = mysql_query("SELECT * FROM forum_board WHERE id = '$_GET[board]' LIMIT 1");
    $b = mysql_fetch_array($query);
  $query = mysql_query("SELECT * FROM forum_emne WHERE id = '$_GET[emneId]' LIMIT 1");
    $r = mysql_fetch_array($query);
    $hvor = "<a href=\"./?emneId=$_GET[emneId]\">Emne: $r[emne]</a> > <a href=\"./board.php?emneId=$_GET[emneId]&board=$_GET[board]\">Board: $b[board]</a> > <b>" . $side_titel . "</b>";
    include "$side/includes/header.php";
?>
<!-- indhold start -->

<script type="text/javascript" language="JavaScript">
<!--
function FormValidator(theForm)
{
    if (document.post.bruger.value == '') {
        alert('Du skal skrive dit navn\n\nOpret en bruger og slip for at udfylde Navn-feltet!');
        document.post.bruger.focus();
        return (false);
    }
    if (document.post.bruger.value == 'Dit navn') {
        alert('Du skal skrive dit navn\n\nOpret en bruger og slip for at udfylde Navn-feltet!');
        document.post.bruger.focus();
        return (false);
    }
    if (document.post.tekst.value == '') {
        alert('Du skal skrive noget i Tekst-feltet');
        document.post.tekst.focus();
        return (false);
    }
    if (document.post.tekst.value == 'Dit svar') {
        alert('Du skal skrive noget i Tekst-feltet');
        document.post.tekst.focus();
        return (false);
    }
}
function makeBold() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[B]" + sTxt + "[/B]";
}
function makeItalic() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[I]" + sTxt + "[/I]";
}
function makeUnderstreget() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[U]" + sTxt + "[/U]";
}
function makeLink() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[url]" + sTxt + "[/url]";
}
function makeCitat() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "
"" + sTxt + ""
";
}
function makeKode() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[KODE]" + sTxt + "[/KODE]";
}
function makeBillede() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[BILLEDE]" + sTxt + "[/BILLEDE]";
}
function emoticon(text) {
    text = '' + text + '';
    if (document.post.tekst.createTextRange && document.post.tekst.caretPos) {
        var caretPos = document.post.tekst.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? text + '' : text;
        document.post.tekst.focus();
    } else {
    document.post.tekst.value  += text;
    document.post.tekst.focus();
    }
}
function NewWin () {
HELP=window.open('ehtml_popup.htm','help','width=500,height=450,toolbar=no,scrollbars=yes')
}
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{

ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
function FormValidatorDummy(theForm)
{
    if (document.dummy.choice.value == 'dum') {
        alert('Du kan ikke vælge det "Quick-menu" punkt!');
        return (false);
    }
    }
//-->
</script>

<table width="100%" cellspacing="1" cellpadding="2" class="tabelBox">
<?php
$sets = mysql_query("SELECT pr_side_t FROM forum_settings WHERE id = '1' LIMIT 1");
$rS = mysql_fetch_array($sets);
$pr_side = $rS["pr_side_t"];
$s = $_GET['s'];
if (!isset($s)) {
    $s = "0";
}
if((!$s) || ($s == 0)){
$pr_side = $pr_side - 1;
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$queryThread = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' LIMIT 1");
} else {
$queryThread = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' AND public = '1' LIMIT 1");
}
$row = mysql_fetch_array($queryThread);
$id = $row["id"];
$emneId = $row["emneId"];
$board = $row["board"];
$text = $row["text"];
$overskrift = $row["overskrift"];
$tbrugerId = $row["brugerId"];
$tbruger = $row["bruger"];
$emneId = $row["emneId"];
$public = $row["public"];
$last_edit_stamp = $row["last_edit_stamp"];
$last_edit_date = date("$_SETS[dato_form]", $row[last_edit_stamp]);
$lock = $row["lock"];
$date = date("$_SETS[dato_form]", $row[date_stamp]);
$query = mysql_query("SELECT * FROM forum_users WHERE id = '$tbrugerId' LIMIT 1");
$user = mysql_fetch_array($query);
?>
<script type="text/javascript" language="JavaScript">
<!--
function Pm<?=$id;?>() {
    window.open("./users/pm.php?til=<?=$tbrugerId;?>","Pm","width=250,height=180,resizable=no,scrollbars=no");
}
function sendThread() {
    window.open("sendThread.php?emneId=<?=$_GET[emneId];?>&board=<?=$_GET[board];?>&id=<?=$_GET[id];?>","sendThread","width=380,height=240,resizable=no,scrollbars=no");
}
//-->
</script>
<?php
include "./replace.php";

echo "
<tr class=\"tr\">
<td width=\"125\">
Forfatter:
</td>
<td>
Overskrift: <b>$overskrift</b>
</td>
<form action=\"../dummy\" method=\"post\" name=\"dummy\" onSubmit=\"return FormValidatorDummy(this);\">
<td align=\"right\">
Quick menu: <select name=\"choice\" size=\"1\" onchange=\"jump(this.form)\" class=\"inputMenu\">
<option value=\"dum\">Vælg et emne/board...</option>";
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$emneQuery = mysql_query("SELECT * FROM forum_emne ORDER BY sort");
} else {
$emneQuery = mysql_query("SELECT * FROM forum_emne WHERE public = '1' ORDER BY sort");
}
while($r = mysql_fetch_array($emneQuery)) {
echo "
<option value=\"./?emneId=$r[id]\" class=\"emneSelectMenu\">$r[emne]</option>";
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$boardQuery = mysql_query("SELECT * FROM forum_board WHERE emneId = '$r[id]' ORDER BY sort");
} else {
$boardQuery = mysql_query("SELECT * FROM forum_board WHERE emneId = '$r[id]' AND public = '1' ORDER BY sort");
}
while($r2 = mysql_fetch_array($boardQuery)) {
echo "
<option value=\"board.php?emneId=$r[id]&board=$r2[id]\" class=\"inputMenu\">$r2[board]</option>";
}
}
echo "
</select>
</td></form></tr>
<form action=\"edit_traad.php\" method=\"post\">
<tr class=\"tdUlige\" valign=\"top\">
<td width=\"110\">
<div class=\"postForfatter\">";
if ($tbrugerId == '-gæst'){
echo "
<b>$tbruger</b><br />
<font size=\"1\">Gæst";
} else {
echo "
<b><a href=\"./users/show.php?brugerId=$tbrugerId\">$tbruger</a></b><br />
<font size=\"1\">";
if($user['rang'] == 1){
echo "Bruger";
} elseif($user['rang'] == 2){
echo "CoAdmin";
} elseif($user['rang'] == 3){
echo "Admin";
}
if($_SETS['avatar'] != 0 && $user['avatar'] != 0){
if($_SETS['avatar'] == 1 || $_SETS['avatar'] == 2 && $user['avatar'] == 1 && $user['avatar_web'] != NULL){
echo "<br /><img src=\"$user[avatar_web]\" border=\"0\" />";
} elseif($_SETS['avatar'] == 2 || $_SETS['avatar'] == 3 && $user['avatar'] == 1 && $user['avatar_upload'] != NULL){
echo "<br /><img src=\"./avatar/$user[avatar_upload]\" border=\"0\" />";
}
}
if($_SETS['posts'] == 1){
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_reply WHERE brugerId = '$tbrugerId'");
$fr = mysql_fetch_array($query);
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_thread WHERE brugerId = '$tbrugerId'");
$ft = mysql_fetch_array($query);
$indlaeg = $fr[antal] + $ft[antal];
echo "<br /><br />
Indlæg: $indlaeg";
} else {
echo "<br />";
}
if(($_COOKIE['loginId']) && ($_COOKIE['loginId'] != $tbrugerId)){
echo "<br /><input type=\"button\" class=\"pm\" value=\"PM\" name=\"sendPM\" onclick=\"java script:Pm$id();\" target=\"Pm\" />";
}
}
echo "</font></div>
<input type=\"hidden\" value=\"$board\" name=\"board\" />
<input type=\"hidden\" value=\"$id\" name=\"id\" />
<input type=\"hidden\" value=\"$emneId\" name=\"emneId\" />
</td>
<td colspan=\"2\">
<div class=\"postTop\">
<b>Indlæg #1</b> skrevet $date &nbsp;&nbsp;&nbsp;&nbsp;";
if($lock != 1){
if($_USER['rang'] == 2){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/flyt/lås tråd\" name=\"send\" />";
} elseif($_USER['rang'] == 3){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/flyt/slet/lås tråd\" name=\"send\" />";
} elseif(($tbrugerId == $_COOKIE['loginId']) && ($_USER['rang'] == 1)){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger tråd\" name=\"send\" />";
}
}
if(($lock == 1) && ($_USER['rang'] == 2 || $_USER['rang'] == 3)){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Lås tråd op\" name=\"send\" />";
}
echo "</div>
<div class=\"postText\">
$text";
if ($last_edit_stamp != NULL){
echo "
<hr width=\"100%\" align=\"left\" size=\"0\" />
<i><font size=\"1\">Sidst redigeret: $last_edit_date</font></i>";
}
echo "
</div></td></tr></form>";
}

if(($_COOKIE['login']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$queryReply = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[id]' ORDER BY id LIMIT $s,$pr_side");
} else {
$queryReply = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[id]' AND public = '1' ORDER BY id LIMIT $s,$pr_side");
}
if((!$s) || ($s == 0)){
$i = 1;
} else {
$i = 0;
}
while ($row = mysql_fetch_array($queryReply)) {
$replyId = $row["id"];
$text = $row["text"];
$overskrift = $row["overskrift"];
$brugerId = $row["brugerId"];
$bruger = $row["bruger"];
$last_edit_stamp = $row["last_edit_stamp"];
$last_edit_date = date("$_SETS[dato_form]", $row[last_edit_stamp]);
$date = date("$_SETS[dato_form]", $row[date_stamp]);
$query = mysql_query("SELECT * FROM forum_users WHERE id = '$brugerId' LIMIT 1");
$user = mysql_fetch_array($query);
include "./replace.php";
$i++;
?>
<script type="text/javascript" language="JavaScript">
<!--
function Pm<?=$replyId;?>() {
    window.open("./users/pm.php?til=<?=$tbrugerId;?>","Pm","width=250,height=180,resizable=no,scrollbars=no");
}
//-->
</script>
<?php
if ($i%2 == 1) {
$class = "tdUlige";
} else {
$class = "tdLige";
}
$svar = $i + $s;
echo "
<form action=\"./edit_svar.php\" method=\"post\">
<tr valign=\"top\" class=\"$class\">
<td width=\"110\">
<div class=\"postForfatter\">";
if ($brugerId == '-gæst'){
echo "
<b>$bruger</b><br />
<font size=\"1\">Gæst";
} else {
echo "
<b><a href=\"./users/show.php?brugerId=$brugerId\">$bruger</a></b><br />
<font size=\"1\">";
if($user['rang'] == 1){
echo "Bruger";
} elseif($user['rang'] == 2){
echo "CoAdmin";
} elseif($user['rang'] == 3){
echo "Admin";
}
if($_SETS['avatar'] != 0 && $user['avatar'] != 0){
if($_SETS['avatar'] == 1 || $_SETS['avatar'] == 2 && $user['avatar'] == 1 && $user['avatar_web'] != NULL){
echo "<br /><img src=\"$user[avatar_web]\" border=\"0\" />";
} elseif($_SETS['avatar'] == 2 || $_SETS['avatar'] == 3 && $user['avatar'] == 1 && $user['avatar_upload'] != NULL){
echo "<br /><img src=\"./avatar/$user[avatar_upload]\" border=\"0\" />";
}
}
if($_SETS['posts'] == 1){
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_reply WHERE brugerId = '$brugerId'");
$fr = mysql_fetch_array($query);
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_thread WHERE brugerId = '$brugerId'");
$ft = mysql_fetch_array($query);
$indlaeg = $fr[antal] + $ft[antal];
echo "<br /><br />
Indlæg: $indlaeg";
} else {
echo "<br />";
}
if(($_COOKIE['loginId']) && ($brugerId != '-gæst') && ($_COOKIE['loginId'] != $brugerId)){
echo "<br /><input type=\"button\" class=\"pm\" value=\"PM\" name=\"sendPM\" onclick=\"java script:Pm$replyId();\" target=\"Pm\" />";
}
}
echo "</font></div>
<input type=\"hidden\" value=\"$replyId\" name=\"id\" />
</td>
<td colspan=\"2\">
<div class=\"postTop\">
<b>Indlæg #$svar</b> skrevet $date &nbsp;&nbsp;&nbsp;&nbsp;";
if($lock != 1){
if($brugerId == $_COOKIE['loginId']){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/slet indlæg\" name=\"send\" />";
} elseif($_USER['rang'] == 2){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger indlæg\" name=\"send\" />";
} elseif($_USER['rang'] == 3){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/slet indlæg\" name=\"send\" />";
}
}
echo "</div>
<div class=\"postText\">
$text";
if ($last_edit_stamp != NULL){
echo "
<hr width=\"100%\" align=\"left\" size=\"0\" />
<i><font size=\"1\">Sidst redigeret: $last_edit_date</font></i>";
}
echo "
</div></td></tr></form>";
}
?>
<tr class="tr">
<td>
&nbsp;
</td>
<td align="right" colspan="2">

<input type="button" class="pm" value="Send tråd til ven" name="sendThread" onclick="java script:sendThread();" target="sendThread" />

<?php
if((!$_GET['s']) || ($_GET['s'] == 0)){
$pr_side = $pr_side + 1;
}
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$g_total = mysql_query("SELECT COUNT(id) AS total FROM forum_reply WHERE reply_to = '$_GET[id]'");
} else {
$g_total = mysql_query("SELECT COUNT(id) AS total FROM forum_reply WHERE reply_to = '$_GET[id]' AND public = '1'");
}
$total = mysql_result($g_total,0);
if ($s >= $pr_side) {
    $previous_s = $s-$pr_side;
    echo "
        <a href=\"?s=$previous_s&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">&lt;&lt;</a> ";
}  else {
        echo "<font class=\"alt\">&lt;&lt;</font> ";
    }
$page = 1;
if($total == 0){
echo "<b>$page</b> ";
}
for($start=0; $total > $start; $start=$start+$pr_side){
    if ($start != $s) {
        echo "<a href=\"?s=$start&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">$page</a> ";
    } else {
        echo "<b>$page</b> ";
    }
    $page++;
}
if ($total > $s+$pr_side) {
    $next_s = $s+$pr_side;
    echo "<a href=\"?s=$next_s&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">&gt;&gt;</a>";
} else {
        echo "<font class=\"alt\">&gt;&gt;</font>";
    }
?>
</td></tr></table>
<br />
<?php if($lock != 1){
if($total <= $s+$pr_side){
  if(isset($_COOKIE["login"])){ ?>
<table width="420" cellspacing="1" cellpadding="2" class="tabelBox">
<form method="post" action="./func.php?function=reply" name="post" onSubmit="return FormValidator(this);">
<tr class="tr">
<td align="center">
<b>Besvar tråd:</b>
</td></tr>
<tr class="trBackground">
<td>
<br /><div align="center">
<input type="button" value="Link" class="button" onClick="makeLink()" />&nbsp;
<input type="button" value="Fed" class="button" onClick="makeBold()" />&nbsp;
<input type="button" value="Kursiv" class="button" onClick="makeItalic()" />&nbsp;
<input type="button" value="Understreget" class="button" onClick="makeUnderstreget()" />&nbsp;
<br><br><input type="button" value="Citat" class="button" onClick="makeCitat()" />&nbsp;
<input type="button" value="Kode" class="button" onClick="makeKode()" />
<input type="button" value="Billede" class="button" onClick="makeBillede()" />
<br />
<a href="java script:NewWin()">Hjælp til knapperne!</a>
<br />
<img src="./img/smiley.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':)');" />&nbsp;&nbsp;
<img src="./img/frown.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':(');" />&nbsp;&nbsp;
<img src="./img/wink.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(';)');" />&nbsp;&nbsp;
<img src="./img/biggrin.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':D');" />&nbsp;&nbsp;
<img src="./img/cool.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8)');" />&nbsp;&nbsp;
<img src="./img/tongue.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':p');" />&nbsp;&nbsp;
<img src="./img/rolleyes.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('@-)');" />&nbsp;&nbsp;
<img src="./img/terrefied.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':0');" />&nbsp;&nbsp;
<img src="./img/sleep.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('|-I');" />&nbsp;&nbsp;
<img src="./img/eek.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8-0');" />&nbsp;&nbsp;
<img src="./img/angry.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':||');" />&nbsp;&nbsp;
<img src="./img/sick.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/sick');" />&nbsp;&nbsp;
<img src="./img/thumbup.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/great');" />&nbsp;&nbsp;
<img src="./img/thumbdown.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/bad');" />&nbsp;&nbsp;
<img src="./img/star.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/star');" />
<br /></div>
<input type="hidden" name="reply_to" value="<?=$id;?>" />
<input type="hidden" name="board" value="<?=$board;?>" />
<input type="hidden" name="emneId" value="<?=$emneId;?>" />
<input type="hidden" name="s" value="<?=$s;?>" />
<?php

    echo "
    <input class=\"input\" type=\"text\" name=\"bruger\" size=\"30\" value=\"$_COOKIE[login]\" readonly=\"readonly\" />
    <input type=\"hidden\" value=\"$_COOKIE[loginId]\" name=\"brugerId\" />";
    $signQuery = mysql_query("SELECT * FROM forum_users WHERE id = '$_COOKIE[loginId]'");
    $signR = mysql_fetch_array($signQuery);
    echo "
    <input type=\"hidden\" value=\"$signR[signatur]\" name=\"signatur\" /><br />";
    if($signR['optSignatur'] == 1){
    echo "
    <input type=\"checkbox\" name=\"optSignatur\" checked=\"checked\" id=\"sign\" />";
    } else {
    echo "
    <input type=\"checkbox\" name=\"optSignatur\" id=\"sign\" />";   
    }
    echo "
    <label for=\"sign\">Sæt min signatur på dette indlæg</label>";

?>
<br />
<textarea cols="50" rows="10" name="tekst" class="input" onFocus="if(this.value=='Dit svar')this.value='';" onBlur="if(this.value=='')this.value='Dit svar';">Dit svar</textarea>
<br />
<div align="center"><input type="submit" name="besvar" value="Besvar" class="button" /></div>

</td></tr></table></form>
<?php } else {
<table width="420" cellspacing="1" cellpadding="2" class="tabelBox">
<tr class="tr">
<td align="center">
<br /><br /><a href="./users/opret.php"><b>Opret en bruger nu</b></a>, og nyd godt af fordelene:
<br /><br />
<i><li>Mulighed for redigéring og sletning af svar.</li><br />
<li>Automatisk udfyldning af navn</li><br />
<li>Og meget mere, som er ved at blive lavet!</li></i>
</td>
</tr>
</table>
<?php }
else
{
echo "<b>Gå til sidste side for at besvare!</b><br />";
}}
else
{ ?>

<table cellspacing="1" cellpadding="2" class="tabelBox" width="420">
<tr>
<td align="center">
<br /><font color="#ff0000"><b>Denne tråd er låst, derfor kan der ikke oprettes nye indlæg, redigeres eller slettes eksisterende indlæg!</b></font><br /><br />
</td></tr></table>
<?php }} ?>

<!-- indhold slut -->
<?php include "$side/includes/footer.php"; ?>
Avatar billede chatonline Nybegynder
22. februar 2008 - 11:31 #17
Måske b-one.dk har skiftet deres serverfiler.

Den kommer stadig bare med en tom side.

Fortæller ingen fejl.
Avatar billede mike2002 Nybegynder
22. februar 2008 - 12:19 #18
øjeblik... er lige ved at installere wamp server på min lokale maskine..
Avatar billede mike2002 Nybegynder
22. februar 2008 - 12:56 #19
nu giver den ikke parse error hos mig:

<?php
    $side = ".";
    require "$side/funcs.php";
    $query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' LIMIT 1");
    $t = mysql_fetch_array($query);
    $side_titel = "Tråd: $t[overskrift]";
  $query = mysql_query("SELECT * FROM forum_board WHERE id = '$_GET[board]' LIMIT 1");
    $b = mysql_fetch_array($query);
  $query = mysql_query("SELECT * FROM forum_emne WHERE id = '$_GET[emneId]' LIMIT 1");
    $r = mysql_fetch_array($query);
    $hvor = "<a href=\"./?emneId=$_GET[emneId]\">Emne: $r[emne]</a> > <a href=\"./board.php?emneId=$_GET[emneId]&board=$_GET[board]\">Board: $b[board]</a> > <b>" . $side_titel . "</b>";
    include "$side/includes/header.php";
?>
<!-- indhold start -->

<script type="text/javascript" language="JavaScript">
<!--
function FormValidator(theForm)
{
    if (document.post.bruger.value == '') {
        alert('Du skal skrive dit navn\n\nOpret en bruger og slip for at udfylde Navn-feltet!');
        document.post.bruger.focus();
        return (false);
    }
    if (document.post.bruger.value == 'Dit navn') {
        alert('Du skal skrive dit navn\n\nOpret en bruger og slip for at udfylde Navn-feltet!');
        document.post.bruger.focus();
        return (false);
    }
    if (document.post.tekst.value == '') {
        alert('Du skal skrive noget i Tekst-feltet');
        document.post.tekst.focus();
        return (false);
    }
    if (document.post.tekst.value == 'Dit svar') {
        alert('Du skal skrive noget i Tekst-feltet');
        document.post.tekst.focus();
        return (false);
    }
}
function makeBold() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[B]" + sTxt + "[/B]";
}
function makeItalic() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[I]" + sTxt + "[/I]";
}
function makeUnderstreget() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[U]" + sTxt + "[/U]";
}
function makeLink() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[url]" + sTxt + "[/url]";
}
function makeCitat() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "
"" + sTxt + ""
";
}
function makeKode() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[KODE]" + sTxt + "[/KODE]";
}
function makeBillede() {
sT = document.selection.createRange();
sTxt = sT.text;
if(!sTxt.length > 0) { return( false); }
sT.text = "[BILLEDE]" + sTxt + "[/BILLEDE]";
}
function emoticon(text) {
    text = '' + text + '';
    if (document.post.tekst.createTextRange && document.post.tekst.caretPos) {
        var caretPos = document.post.tekst.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? text + '' : text;
        document.post.tekst.focus();
    } else {
    document.post.tekst.value  += text;
    document.post.tekst.focus();
    }
}
function NewWin () {
HELP=window.open('ehtml_popup.htm','help','width=500,height=450,toolbar=no,scrollbars=yes')
}
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{

ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
function FormValidatorDummy(theForm)
{
    if (document.dummy.choice.value == 'dum') {
        alert('Du kan ikke vælge det "Quick-menu" punkt!');
        return (false);
    }
    }
//-->
</script>

<table width="100%" cellspacing="1" cellpadding="2" class="tabelBox">
<?php
$sets = mysql_query("SELECT pr_side_t FROM forum_settings WHERE id = '1' LIMIT 1");
$rS = mysql_fetch_array($sets);
$pr_side = $rS["pr_side_t"];
$s = $_GET['s'];
if (!isset($s)) {
    $s = "0";
}
if((!$s) || ($s == 0)){
$pr_side = $pr_side - 1;
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$queryThread = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' LIMIT 1");
} else {
$queryThread = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]' AND public = '1' LIMIT 1");
}
$row = mysql_fetch_array($queryThread);
$id = $row["id"];
$emneId = $row["emneId"];
$board = $row["board"];
$text = $row["text"];
$overskrift = $row["overskrift"];
$tbrugerId = $row["brugerId"];
$tbruger = $row["bruger"];
$emneId = $row["emneId"];
$public = $row["public"];
$last_edit_stamp = $row["last_edit_stamp"];
$last_edit_date = date("$_SETS[dato_form]", $row[last_edit_stamp]);
$lock = $row["lock"];
$date = date("$_SETS[dato_form]", $row[date_stamp]);
$query = mysql_query("SELECT * FROM forum_users WHERE id = '$tbrugerId' LIMIT 1");
$user = mysql_fetch_array($query);
?>
<script type="text/javascript" language="JavaScript">
<!--
function Pm<?=$id;?>() {
    window.open("./users/pm.php?til=<?=$tbrugerId;?>","Pm","width=250,height=180,resizable=no,scrollbars=no");
}
function sendThread() {
    window.open("sendThread.php?emneId=<?=$_GET[emneId];?>&board=<?=$_GET[board];?>&id=<?=$_GET[id];?>","sendThread","width=380,height=240,resizable=no,scrollbars=no");
}
//-->
</script>
<?php
include "./replace.php";

echo "
<tr class=\"tr\">
<td width=\"125\">
Forfatter:
</td>
<td>
Overskrift: <b>$overskrift</b>
</td>
<form action=\"../dummy\" method=\"post\" name=\"dummy\" onSubmit=\"return FormValidatorDummy(this);\">
<td align=\"right\">
Quick menu: <select name=\"choice\" size=\"1\" onchange=\"jump(this.form)\" class=\"inputMenu\">
<option value=\"dum\">Vælg et emne/board...</option>";
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$emneQuery = mysql_query("SELECT * FROM forum_emne ORDER BY sort");
} else {
$emneQuery = mysql_query("SELECT * FROM forum_emne WHERE public = '1' ORDER BY sort");
}
while($r = mysql_fetch_array($emneQuery)) {
echo "
<option value=\"./?emneId=$r[id]\" class=\"emneSelectMenu\">$r[emne]</option>";
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$boardQuery = mysql_query("SELECT * FROM forum_board WHERE emneId = '$r[id]' ORDER BY sort");
} else {
$boardQuery = mysql_query("SELECT * FROM forum_board WHERE emneId = '$r[id]' AND public = '1' ORDER BY sort");
}
while($r2 = mysql_fetch_array($boardQuery)) {
echo "
<option value=\"board.php?emneId=$r[id]&board=$r2[id]\" class=\"inputMenu\">$r2[board]</option>";
}
}
echo "
</select>
</td></form></tr>
<form action=\"edit_traad.php\" method=\"post\">
<tr class=\"tdUlige\" valign=\"top\">
<td width=\"110\">
<div class=\"postForfatter\">";
if ($tbrugerId == '-gæst'){
echo "
<b>$tbruger</b><br />
<font size=\"1\">Gæst";
} else {
echo "
<b><a href=\"./users/show.php?brugerId=$tbrugerId\">$tbruger</a></b><br />
<font size=\"1\">";
if($user['rang'] == 1){
echo "Bruger";
} elseif($user['rang'] == 2){
echo "CoAdmin";
} elseif($user['rang'] == 3){
echo "Admin";
}
if($_SETS['avatar'] != 0 && $user['avatar'] != 0){
if($_SETS['avatar'] == 1 || $_SETS['avatar'] == 2 && $user['avatar'] == 1 && $user['avatar_web'] != NULL){
echo "<br /><img src=\"$user[avatar_web]\" border=\"0\" />";
} elseif($_SETS['avatar'] == 2 || $_SETS['avatar'] == 3 && $user['avatar'] == 1 && $user['avatar_upload'] != NULL){
echo "<br /><img src=\"./avatar/$user[avatar_upload]\" border=\"0\" />";
}
}
if($_SETS['posts'] == 1){
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_reply WHERE brugerId = '$tbrugerId'");
$fr = mysql_fetch_array($query);
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_thread WHERE brugerId = '$tbrugerId'");
$ft = mysql_fetch_array($query);
$indlaeg = $fr[antal] + $ft[antal];
echo "<br /><br />
Indlæg: $indlaeg";
} else {
echo "<br />";
}
if(($_COOKIE['loginId']) && ($_COOKIE['loginId'] != $tbrugerId)){
echo "<br /><input type=\"button\" class=\"pm\" value=\"PM\" name=\"sendPM\" onclick=\"java script:Pm$id();\" target=\"Pm\" />";
}
}
echo "</font></div>
<input type=\"hidden\" value=\"$board\" name=\"board\" />
<input type=\"hidden\" value=\"$id\" name=\"id\" />
<input type=\"hidden\" value=\"$emneId\" name=\"emneId\" />
</td>
<td colspan=\"2\">
<div class=\"postTop\">
<b>Indlæg #1</b> skrevet $date &nbsp;&nbsp;&nbsp;&nbsp;";
if($lock != 1){
if($_USER['rang'] == 2){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/flyt/lås tråd\" name=\"send\" />";
} elseif($_USER['rang'] == 3){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/flyt/slet/lås tråd\" name=\"send\" />";
} elseif(($tbrugerId == $_COOKIE['loginId']) && ($_USER['rang'] == 1)){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger tråd\" name=\"send\" />";
}
}
if(($lock == 1) && ($_USER['rang'] == 2 || $_USER['rang'] == 3)){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Lås tråd op\" name=\"send\" />";
}
echo "</div>
<div class=\"postText\">
$text";
if ($last_edit_stamp != NULL){
echo "
<hr width=\"100%\" align=\"left\" size=\"0\" />
<i><font size=\"1\">Sidst redigeret: $last_edit_date</font></i>";
}
echo "
</div></td></tr></form>";
}

if(($_COOKIE['login']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$queryReply = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[id]' ORDER BY id LIMIT $s,$pr_side");
} else {
$queryReply = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[id]' AND public = '1' ORDER BY id LIMIT $s,$pr_side");
}
if((!$s) || ($s == 0)){
$i = 1;
} else {
$i = 0;
}
while ($row = mysql_fetch_array($queryReply)) {
$replyId = $row["id"];
$text = $row["text"];
$overskrift = $row["overskrift"];
$brugerId = $row["brugerId"];
$bruger = $row["bruger"];
$last_edit_stamp = $row["last_edit_stamp"];
$last_edit_date = date("$_SETS[dato_form]", $row[last_edit_stamp]);
$date = date("$_SETS[dato_form]", $row[date_stamp]);
$query = mysql_query("SELECT * FROM forum_users WHERE id = '$brugerId' LIMIT 1");
$user = mysql_fetch_array($query);
include "./replace.php";
$i++;
?>
<script type="text/javascript" language="JavaScript">
<!--
function Pm<?=$replyId;?>() {
    window.open("./users/pm.php?til=<?=$tbrugerId;?>","Pm","width=250,height=180,resizable=no,scrollbars=no");
}
//-->
</script>
<?php
if ($i%2 == 1) {
$class = "tdUlige";
} else {
$class = "tdLige";
}
$svar = $i + $s;
echo "
<form action=\"./edit_svar.php\" method=\"post\">
<tr valign=\"top\" class=\"$class\">
<td width=\"110\">
<div class=\"postForfatter\">";
if ($brugerId == '-gæst'){
echo "
<b>$bruger</b><br />
<font size=\"1\">Gæst";
} else {
echo "
<b><a href=\"./users/show.php?brugerId=$brugerId\">$bruger</a></b><br />
<font size=\"1\">";
if($user['rang'] == 1){
echo "Bruger";
} elseif($user['rang'] == 2){
echo "CoAdmin";
} elseif($user['rang'] == 3){
echo "Admin";
}
if($_SETS['avatar'] != 0 && $user['avatar'] != 0){
if($_SETS['avatar'] == 1 || $_SETS['avatar'] == 2 && $user['avatar'] == 1 && $user['avatar_web'] != NULL){
echo "<br /><img src=\"$user[avatar_web]\" border=\"0\" />";
} elseif($_SETS['avatar'] == 2 || $_SETS['avatar'] == 3 && $user['avatar'] == 1 && $user['avatar_upload'] != NULL){
echo "<br /><img src=\"./avatar/$user[avatar_upload]\" border=\"0\" />";
}
}
if($_SETS['posts'] == 1){
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_reply WHERE brugerId = '$brugerId'");
$fr = mysql_fetch_array($query);
$query = mysql_query("SELECT COUNT(*) as antal FROM forum_thread WHERE brugerId = '$brugerId'");
$ft = mysql_fetch_array($query);
$indlaeg = $fr[antal] + $ft[antal];
echo "<br /><br />
Indlæg: $indlaeg";
} else {
echo "<br />";
}
if(($_COOKIE['loginId']) && ($brugerId != '-gæst') && ($_COOKIE['loginId'] != $brugerId)){
echo "<br /><input type=\"button\" class=\"pm\" value=\"PM\" name=\"sendPM\" onclick=\"java script:Pm$replyId();\" target=\"Pm\" />";
}
}
echo "</font></div>
<input type=\"hidden\" value=\"$replyId\" name=\"id\" />
</td>
<td colspan=\"2\">
<div class=\"postTop\">
<b>Indlæg #$svar</b> skrevet $date &nbsp;&nbsp;&nbsp;&nbsp;";
if($lock != 1){
if($brugerId == $_COOKIE['loginId']){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/slet indlæg\" name=\"send\" />";
} elseif($_USER['rang'] == 2){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger indlæg\" name=\"send\" />";
} elseif($_USER['rang'] == 3){
echo "<input type=\"submit\" class=\"rbutton\" value=\"Rediger/slet indlæg\" name=\"send\" />";
}
}
echo "</div>
<div class=\"postText\">
$text";
if ($last_edit_stamp != NULL){
echo "
<hr width=\"100%\" align=\"left\" size=\"0\" />
<i><font size=\"1\">Sidst redigeret: $last_edit_date</font></i>";
}
echo "
</div></td></tr></form>";
}
?>
<tr class="tr">
<td>
&nbsp;
</td>
<td align="right" colspan="2">

<input type="button" class="pm" value="Send tråd til ven" name="sendThread" onclick="java script:sendThread();" target="sendThread" />

<?php
if((!$_GET['s']) || ($_GET['s'] == 0)){
$pr_side = $pr_side + 1;
}
if(($_COOKIE['loginId']) && ($_USER['rang'] == 2) || ($_USER['rang'] == 3)){
$g_total = mysql_query("SELECT COUNT(id) AS total FROM forum_reply WHERE reply_to = '$_GET[id]'");
} else {
$g_total = mysql_query("SELECT COUNT(id) AS total FROM forum_reply WHERE reply_to = '$_GET[id]' AND public = '1'");
}
$total = mysql_result($g_total,0);
if ($s >= $pr_side) {
    $previous_s = $s-$pr_side;
    echo "
        <a href=\"?s=$previous_s&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">&lt;&lt;</a> ";
}  else {
        echo "<font class=\"alt\">&lt;&lt;</font> ";
    }
$page = 1;
if($total == 0){
echo "<b>$page</b> ";
}
for($start=0; $total > $start; $start=$start+$pr_side){
    if ($start != $s) {
        echo "<a href=\"?s=$start&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">$page</a> ";
    } else {
        echo "<b>$page</b> ";
    }
    $page++;
}
if ($total > $s+$pr_side) {
    $next_s = $s+$pr_side;
    echo "<a href=\"?s=$next_s&emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[id]\">&gt;&gt;</a>";
} else {
        echo "<font class=\"alt\">&gt;&gt;</font>";
    }
?>
</td></tr></table>
<br />
<?php if($lock != 1){
if($total <= $s+$pr_side){
  if(isset($_COOKIE["login"])){ ?>
<table width="420" cellspacing="1" cellpadding="2" class="tabelBox">
<form method="post" action="./func.php?function=reply" name="post" onSubmit="return FormValidator(this);">
<tr class="tr">
<td align="center">
<b>Besvar tråd:</b>
</td></tr>
<tr class="trBackground">
<td>
<br /><div align="center">
<input type="button" value="Link" class="button" onClick="makeLink()" />&nbsp;
<input type="button" value="Fed" class="button" onClick="makeBold()" />&nbsp;
<input type="button" value="Kursiv" class="button" onClick="makeItalic()" />&nbsp;
<input type="button" value="Understreget" class="button" onClick="makeUnderstreget()" />&nbsp;
<br><br><input type="button" value="Citat" class="button" onClick="makeCitat()" />&nbsp;
<input type="button" value="Kode" class="button" onClick="makeKode()" />
<input type="button" value="Billede" class="button" onClick="makeBillede()" />
<br />
<a href="java script:NewWin()">Hjælp til knapperne!</a>
<br />
<img src="./img/smiley.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':)');" />&nbsp;&nbsp;
<img src="./img/frown.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':(');" />&nbsp;&nbsp;
<img src="./img/wink.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(';)');" />&nbsp;&nbsp;
<img src="./img/biggrin.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':D');" />&nbsp;&nbsp;
<img src="./img/cool.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8)');" />&nbsp;&nbsp;
<img src="./img/tongue.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':p');" />&nbsp;&nbsp;
<img src="./img/rolleyes.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('@-)');" />&nbsp;&nbsp;
<img src="./img/terrefied.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':0');" />&nbsp;&nbsp;
<img src="./img/sleep.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('|-I');" />&nbsp;&nbsp;
<img src="./img/eek.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8-0');" />&nbsp;&nbsp;
<img src="./img/angry.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':||');" />&nbsp;&nbsp;
<img src="./img/sick.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/sick');" />&nbsp;&nbsp;
<img src="./img/thumbup.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/great');" />&nbsp;&nbsp;
<img src="./img/thumbdown.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/bad');" />&nbsp;&nbsp;
<img src="./img/star.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('/star');" />
<br /></div>
<input type="hidden" name="reply_to" value="<?=$id;?>" />
<input type="hidden" name="board" value="<?=$board;?>" />
<input type="hidden" name="emneId" value="<?=$emneId;?>" />
<input type="hidden" name="s" value="<?=$s;?>" />
<?php

    echo "
    <input class=\"input\" type=\"text\" name=\"bruger\" size=\"30\" value=\"$_COOKIE[login]\" readonly=\"readonly\" />
    <input type=\"hidden\" value=\"$_COOKIE[loginId]\" name=\"brugerId\" />";
    $signQuery = mysql_query("SELECT * FROM forum_users WHERE id = '$_COOKIE[loginId]'");
    $signR = mysql_fetch_array($signQuery);
    echo "
    <input type=\"hidden\" value=\"$signR[signatur]\" name=\"signatur\" /><br />";
    if($signR['optSignatur'] == 1){
    echo "
    <input type=\"checkbox\" name=\"optSignatur\" checked=\"checked\" id=\"sign\" />";
    } else {
    echo "
    <input type=\"checkbox\" name=\"optSignatur\" id=\"sign\" />";   
    }
    echo "
    <label for=\"sign\">Sæt min signatur på dette indlæg</label>";

?>
<br />
<textarea cols="50" rows="10" name="tekst" class="input" onFocus="if(this.value=='Dit svar')this.value='';" onBlur="if(this.value=='')this.value='Dit svar';">Dit svar</textarea>
<br />
<div align="center"><input type="submit" name="besvar" value="Besvar" class="button" /></div>

</td></tr></table></form>
<?php } else { ?>
<table width="420" cellspacing="1" cellpadding="2" class="tabelBox">
<tr class="tr">
<td align="center">
<br /><br /><a href="./users/opret.php"><b>Opret en bruger nu</b></a>, og nyd godt af fordelene:
<br /><br />
<i><li>Mulighed for redigéring og sletning af svar.</li><br />
<li>Automatisk udfyldning af navn</li><br />
<li>Og meget mere, som er ved at blive lavet!</li></i>
</td>
</tr>
</table>
<?php }}
else
{
echo "<b>Gå til sidste side for at besvare!</b><br />";
}}
else
{ ?>

<table cellspacing="1" cellpadding="2" class="tabelBox" width="420">
<tr>
<td align="center">
<br /><font color="#ff0000"><b>Denne tråd er låst, derfor kan der ikke oprettes nye indlæg, redigeres eller slettes eksisterende indlæg!</b></font><br /><br />
</td></tr></table>
<?php } ?>

<!-- indhold slut -->
<?php include "$side/includes/footer.php"; ?>
Avatar billede chatonline Nybegynder
22. februar 2008 - 18:12 #20
Tusinde tak, det var pænt af dig og hjælpe så meget :-)

Må lige sidde mig ned og finde ud af hvad du gjorde så jeg lære lidt af det.
Kan du ikke smide en mail til admin@skyskraber.dk hvis du er ineteresseret i at lave mere og få evt. penge for det.

Mangler bare du lige giver svarf, så jeg kan acceptere points.
Avatar billede chatonline Nybegynder
22. februar 2008 - 18:18 #21
Det var mærkeligt, nu kan man ikke se nogle tråde. Se evt. selv på:

http://www.skyskraber.dk/poker/read.php?emneId=13&board=82&id=648
Avatar billede chatonline Nybegynder
22. februar 2008 - 18:19 #22
Arg. det er lige meget :-) fordi de to forums kører med hver sin database. Retter jeg lige :-)
Avatar billede mike2002 Nybegynder
22. februar 2008 - 19:54 #23
Ja, så vidt jeg kan se kører det da udmærket nu.

Som surfer skrev længere oppe bør du ikke bruge cookies til at tjekke om folk er lukket ind - brug sessions i stedet...

Og så mangler du stadig at validere, når formen submittes. Så vidt jeg kan se sker det i func.php - hvis den ikke er alt for uoverskuelig, kan du poste den her og så skal jeg se, om jeg hurtigt kan rette den til...

Kan godt være du lige får en mail - har ikke noget programmeringsarbejde pt. og starter først nyt job til april...
Avatar billede chatonline Nybegynder
23. februar 2008 - 15:23 #24
Nej det rigtig, burde få det ændret så sikkerheden er bedre.
Poster lige func.php, for forstår ikke det du skriver med validere? :-)
Avatar billede chatonline Nybegynder
23. februar 2008 - 15:24 #25
<?php
require "./funcs.php";

// Gemmer tråd
if (($_GET['function'] == "thread") && ($_POST['opret'])){
if($_POST['mail']){
$mail = "1";
} else {
$mail = "0";
}
$query = mysql_query("SELECT * FROM forum_board WHERE id = '$_POST[board]'");
while ($r = mysql_fetch_array($query)) {
    $thread = mysql_query("INSERT INTO forum_thread (overskrift, bruger, brugerId, text, board, ip, emneId, last_reply_stamp, mail, public, date_stamp)" . "VALUES ('$_POST[overskrift]','$_POST[bruger]','$_POST[brugerId]','$_POST[tekst]','$_POST[board]','$_SETS[ip]','$_POST[emneId]','$_SETS[tid]','$mail','$r[public]','$_SETS[tid]')");
$query = mysql_query("SELECT * FROM forum_thread ORDER BY id DESC LIMIT 1");
while ($r = mysql_fetch_array($query)) {
    header("Location: ./read.php?emneId=$_POST[emneId]&board=$_POST[board]&id=$r[id]");
}
}
}

// Gemmer svar
if (($_GET['function'] == "reply") && ($_POST['besvar'])){
if($_POST['optSignatur']){
$besked = $_POST['tekst'] . "\n_________________\n" . $_POST['signatur'];
} else {
$besked = $_POST['tekst'];
}
    $reply = mysql_query("INSERT INTO forum_reply (bruger, brugerId, board, text, reply_to, ip, emneId, date_stamp)" . "VALUES ('$_POST[bruger]','$_POST[brugerId]','$_POST[board]','$besked','$_POST[reply_to]','$_SETS[ip]','$_POST[emneId]','$_SETS[tid]')");
    $update = mysql_query("UPDATE `forum_thread` SET `last_reply_stamp` = '$_SETS[tid]' WHERE `id` = '$_POST[reply_to]' LIMIT 1");
// Tjekker om der skal sendes en mail
$query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_POST[reply_to]' LIMIT 1");
while ($r = mysql_fetch_array($query)) {
if($r['mail'] == 1 && ($r['brugerId'] != $_COOKIE['loginId'])){
$query2 = mysql_query("SELECT * FROM forum_users WHERE id = '$r[brugerId]' LIMIT 1");
while ($r2 = mysql_fetch_array($query2)) {
mail("$r2[email]", "Din tråd \"$r[overskrift]\" er blevet besvaret", "Der er kommet svar på din tråd \"$r[overskrift]\" \n\n Klik her for at hoppe direkte til tråden: " . $_SETS[url] . "read.php?emneId=$r[emneId]&board=$r[board]&id=$r[id]", "From:$_SETS[adminmail]");
}
}
}   
header("Location: ./read.php?s=$_POST[s]&emneId=$_POST[emneId]&board=$_POST[board]&id=$_POST[reply_to]");
}

// Slet svar
if ($_GET['function'] == "slet_svar"){
    $delete = mysql_query("DELETE FROM `forum_reply` WHERE `id` = '$_GET[id]' LIMIT 1");
$query = mysql_query("SELECT * FROM forum_reply WHERE reply_to = '$_GET[reply_to]' ORDER BY id DESC LIMIT 1");
$antal = mysql_num_rows($query);
if ($antal == 0){
$query2 = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[reply_to]' ORDER BY id DESC LIMIT 1");
while ($r = mysql_fetch_array($query2)) {
$update = mysql_query("UPDATE `forum_thread` SET `last_reply_stamp` = '$r[date_stamp]' WHERE `id` = '$_GET[reply_to]' LIMIT 1");
}
} else {
while ($r = mysql_fetch_array($query)) {
$update = mysql_query("UPDATE `forum_thread` SET `last_reply_stamp` = '$r[date_stamp]' WHERE `id` = '$_GET[reply_to]' LIMIT 1");
}
}
    header("Location: ./read.php?emneId=$_GET[emneId]&board=$_GET[board]&id=$_GET[reply_to]");
}

// Rediger svar
if (($_GET['function'] == "edit_svar") && ($_POST['edit'])){
    $update = mysql_query("UPDATE `forum_reply` SET `text` = '$_POST[tekst]', `last_edit_stamp` = '$_SETS[tid]' WHERE `id` = '$_POST[id]'");
    header("Location: ./read.php?emneId=$_POST[emneId]&board=$_POST[board]&id=$_POST[reply_to]");
}

// flyt traad
if (($_GET['function'] == "flyt_traad") && ($_POST['flyt'])){
$query = mysql_query("SELECT * FROM forum_board WHERE id = '$_POST[newBoard]' ORDER BY sort");
while($r = mysql_fetch_array($query)) {
    $update = mysql_query("UPDATE `forum_thread` SET `board` = '$_POST[newBoard]', `emneId` = '$r[emneId]', `public` = '$r[public]' WHERE `id` = '$_POST[id]' ");
        $update = mysql_query("UPDATE `forum_reply` SET `board` = '$_POST[newBoard]', `emneId` = '$r[emneId]', `public` = '$r[public]' WHERE `reply_to` = '$_POST[id]' ");
    header("Location: read.php?emneId=$r[emneId]&board=$_POST[newBoard]&id=$_POST[id]");
}
}

// edit traad
if (($_GET['function'] == "edit_traad") && ($_POST['edit'])){
    $update = mysql_query("UPDATE `forum_thread` SET `text` = '$_POST[tekst]', `last_edit_stamp` = '$_SETS[tid]', `overskrift` = '$_POST[overskrift]' WHERE `id` = '$_POST[id]' ");
    header("Location: ./read.php?emneId=$_POST[emneId]&board=$_POST[board]&id=$_POST[id]");
}

// lock
if ($_GET['function'] == "lock" && ($_USER['rang'] == 2 || $_USER['rang'] == 3)){
    $update = mysql_query("UPDATE `forum_thread` SET `lock` = '1' WHERE `id` = '$_GET[id]' ");

    $query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]'");
    $r = mysql_fetch_array($query);
    header("Location: ./read.php?emneId=$r[emneId]&board=$r[board]&id=$_GET[id]");
}

// open
if ($_GET['function'] == "open" && ($_USER['rang'] == 2 || $_USER['rang'] == 3)){
    $update = mysql_query("UPDATE `forum_thread` SET `lock` = '0' WHERE `id` = '$_GET[id]' ");

    $query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_GET[id]'");
    $r = mysql_fetch_array($query);
    header("Location: ./read.php?emneId=$r[emneId]&board=$r[board]&id=$_GET[id]");
}

// slet traad
if ($_GET['function'] == "slet_traad"){
    $delete = mysql_query("DELETE FROM `forum_thread` WHERE `id` = '$_GET[id]' LIMIT 1");
    $delete = mysql_query("DELETE FROM `forum_reply` WHERE `reply_to` = '$_GET[id]'");
    header("Location: ./");
}
?>
Avatar billede chatonline Nybegynder
24. februar 2008 - 16:21 #26
Hvordan kan det være at der stadig er en spammer der kan blive ved med at bruge gæstesvar?

Kan ses på:
http://www.skyskraber.dk/bb/read.php?emneId=3&board=10&id=12

Det er rigtig irrtierende, spammeren har lavet 10.000 svar på et tidspunkt.
Avatar billede mike2002 Nybegynder
24. februar 2008 - 20:05 #27
Det kan være fordi, der er en spammer, der gør som thesurfer skrev 22/2 22:00:29...

Når svarboksen submittes, er action="func.php?function=reply" - I func.php skal du derfor se efter dér, hvor der står $_GET["function"] == "reply" - den er jo her:

// Gemmer svar
if (($_GET['function'] == "reply") && ($_POST['besvar'])){
if($_POST['optSignatur']){
$besked = $_POST['tekst'] . "\n_________________\n" . $_POST['signatur'];
} else {
$besked = $_POST['tekst'];
}
    $reply = mysql_query("INSERT INTO forum_reply (bruger, brugerId, board, text, reply_to, ip, emneId, date_stamp)" . "VALUES ('$_POST[bruger]','$_POST[brugerId]','$_POST[board]','$besked','$_POST[reply_to]','$_SETS[ip]','$_POST[emneId]','$_SETS[tid]')");
    $update = mysql_query("UPDATE `forum_thread` SET `last_reply_stamp` = '$_SETS[tid]' WHERE `id` = '$_POST[reply_to]' LIMIT 1");
// Tjekker om der skal sendes en mail
$query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_POST[reply_to]' LIMIT 1");
while ($r = mysql_fetch_array($query)) {
if($r['mail'] == 1 && ($r['brugerId'] != $_COOKIE['loginId'])){
$query2 = mysql_query("SELECT * FROM forum_users WHERE id = '$r[brugerId]' LIMIT 1");
while ($r2 = mysql_fetch_array($query2)) {
mail("$r2[email]", "Din tråd \"$r[overskrift]\" er blevet besvaret", "Der er kommet svar på din tråd \"$r[overskrift]\" \n\n Klik her for at hoppe direkte til tråden: " . $_SETS[url] . "read.php?emneId=$r[emneId]&board=$r[board]&id=$r[id]", "From:$_SETS[adminmail]");
}
}
}   
header("Location: ./read.php?s=$_POST[s]&emneId=$_POST[emneId]&board=$_POST[board]&id=$_POST[reply_to]");
}

Den skal også rettes til. Der skal laves et tjek, men når du nu gør det med cookies, er det højst sandsynligt, at spammeren allerede har en cookie liggende på sin maskine, og derfor vil det reelt ikke hjælpe... Men det gøres sådan her:

// Gemmer svar
if (($_GET['function'] == "reply") && ($_POST['besvar'])){
// Tjek om bruger er logget ind
if(isset($_COOKIE["login"]))
{
if($_POST['optSignatur']){
$besked = $_POST['tekst'] . "\n_________________\n" . $_POST['signatur'];
} else {
$besked = $_POST['tekst'];
}
    $reply = mysql_query("INSERT INTO forum_reply (bruger, brugerId, board, text, reply_to, ip, emneId, date_stamp)" . "VALUES ('$_POST[bruger]','$_POST[brugerId]','$_POST[board]','$besked','$_POST[reply_to]','$_SETS[ip]','$_POST[emneId]','$_SETS[tid]')");
    $update = mysql_query("UPDATE `forum_thread` SET `last_reply_stamp` = '$_SETS[tid]' WHERE `id` = '$_POST[reply_to]' LIMIT 1");
// Tjekker om der skal sendes en mail
$query = mysql_query("SELECT * FROM forum_thread WHERE id = '$_POST[reply_to]' LIMIT 1");
while ($r = mysql_fetch_array($query)) {
if($r['mail'] == 1 && ($r['brugerId'] != $_COOKIE['loginId'])){
$query2 = mysql_query("SELECT * FROM forum_users WHERE id = '$r[brugerId]' LIMIT 1");
while ($r2 = mysql_fetch_array($query2)) {
mail("$r2[email]", "Din tråd \"$r[overskrift]\" er blevet besvaret", "Der er kommet svar på din tråd \"$r[overskrift]\" \n\n Klik her for at hoppe direkte til tråden: " . $_SETS[url] . "read.php?emneId=$r[emneId]&board=$r[board]&id=$r[id]", "From:$_SETS[adminmail]");
}
}
}   
header("Location: ./read.php?s=$_POST[s]&emneId=$_POST[emneId]&board=$_POST[board]&id=$_POST[reply_to]");
}
}
Avatar billede mike2002 Nybegynder
24. februar 2008 - 20:07 #28
Hvis du i stedet bruger sessions, gemmes brugeren kun i browseren og vil blive slettet, når han logger ud eller når browseren lukkes - evt. efter session timeout.

Som alternativ kunne du ændre den cookie, man skal have liggende på sin maskine for at vise, at man er logget på. Det skal gøres i dit login-script vil jeg tro...
Avatar billede chatonline Nybegynder
26. februar 2008 - 13:54 #29
Mike er det noget du har lyst til at lave?
Send mig evt. en mail.

Har også et stort chat program med en login fejl, som jeg gerne vil have lavet mod betaling.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester