NetVision-Technik

NetVision-Technik (http://www.netvision-technik.de/forum/index.php)
-   Off-Topic (http://www.netvision-technik.de/forum/forumdisplay.php?f=44)
-   -   kleines problem mit bedanko (http://www.netvision-technik.de/forum/showthread.php?t=5654)

tantetoni2 08.08.2010 13:08

haut das für die dankesager doch ganz einfach unter dem angezeigten beiträgen wenn die while schleife dafür zuende ist.

auf die idee müsste man doch selber kommen, und der code dafür ist ja schon da

asus 08.08.2010 14:44

Liste der Anh?nge anzeigen (Anzahl: 1)
hmm sobald ich es aus der while schleife schmeiße wird mir nix mehr angezeigt irgendwie bin ich wohl zu doof

ich hänge meine forums.php mal an (ist ein sauhaufen ich weiß ist ja nicht von mir! sie wird noch aufgeräumt)

danke euch das ihr zumindest helfen tut

hänge da nun stunden dran leider bleibt es so wie ich es schon gesagt habe :-(

Baba 01.12.2010 11:09

Mahlzeit,

also ich habe das bei mir so drin in der forums.php und es funzt bei mir.

Öffnet Eure forums.php und suche das:
Code:

  //---- Get poster thanks
  $resa = mysql_query("SELECT * FROM postthanks WHERE topicid = $topicid") or sqlerr(__FILE__, __LINE__);
  if (mysql_num_rows($resa) > 0) {
  while ($arra = mysql_fetch_array($resa)) {
      $ptuserid = $arra["userid"];
      $ptpostid = $arra["postid"];

      $resb = mysql_query("SELECT id, username, class FROM users WHERE id = $ptuserid") or print(mysql_error());
  while($arrb = mysql_fetch_assoc($resb)) {
  if ($thanks) $thanks .= ",\n";
      $thanks .= "<a href=userdetails.php?id=" . $arrb["id"] . "><font class=".get_class_color($arrb["class"])."><b>" . $arrb["username"] . "</b></font></a>";
      }
    }
  }
  $thanksbutton = ("<form method=\"post\" action=\"forums.php?action=thanks&topicid=$topicid&postid=$postid&userid=$userid\" style=\"display:inline\"><input type=\"submit\" value=\"Bedanken\"></form>");

und ersetze das mit dem:
Code:

  //---- Get poster thanks
  $is_thx = false;
  $resa = mysql_query("SELECT * FROM postthanks WHERE topicid = $topicid") or sqlerr(__FILE__, __LINE__);
  if (mysql_num_rows($resa) > 0) {
  while ($arra = mysql_fetch_array($resa)) {
      $ptuserid = $arra["userid"];
      $ptpostid = $arra["postid"];

      if ($CURUSER["id"] == $ptuserid && $ptpostid == $postid) $is_thx = true;

      $resb = mysql_query("SELECT id, username, class FROM users WHERE id = $ptuserid") or print(mysql_error());
  while($arrb = mysql_fetch_assoc($resb)) {
  if ($thanks) $thanks .= ",\n";
      $thanks .= "<a href=userdetails.php?id=" . $arrb["id"] . "><font class=".get_class_color($arrb["class"])."><b>" . $arrb["username"] . "</b></font></a>";
      }
    }
  }
  $thanksbutton = ("<form method=\"post\" action=\"forums.php?action=thanks&topicid=$topicid&postid=$postid&userid=$userid\" style=\"display:inline\"><input type=\"submit\" value=\"Bedanken\"></form>");

dann suche weiter nach dem:
Code:

  if ($bedanko == "2" && $ptuserid != $CURUSER[id]) {
      $body1 .= "<br>$thanksbutton<br>";
  }
  if ($thanks && $ptpostid == $postid) {
      $body1 .= "<br>Bedankt für diesen Beitrag haben sich:";
      $body1 .= "<br>$thanks<br>";
  }

und ersetze das mit dem:
Code:

  if ($bedanko == "2" && !$is_thx) {
      $body1 .= "<br>$thanksbutton<br>";
  }
  if ($thanks && $ptpostid == $postid) {
      $body1 .= "<br>Bedankt für diesen Beitrag haben sich:";
      $body1 .= "<br>$thanks<br>";
  }

suche weiter nach dem:
Code:

//-------- Action: Thanks
if ($action == "thanks") {
    $userid = $_GET["userid"];
    $topicid = $_GET["topicid"];
    $postid = $_GET["postid"];

if (!is_valid_id($topicid))
    stderr("Forum Fehler", "<b><p>Falsche Beitrags ID $postid.</p></b>");

mysql_query("INSERT INTO postthanks (id,topicid,postid,userid) VALUES (id,$topicid,$postid,$userid)") or sqlerr(__FILE__, __LINE__);

header("Location: $BASEURL/forums.php?action=viewtopic&topicid=$topicid");
die;
}

und ersetze es mit dem:
Code:

//-------- Action: Thanks
if ($action == "thanks") {
$userid = $CURUSER["id"]; // Nicht die $_GET["userid"],  das kann jeder Faken!
$topicid = $_GET["topicid"];
$postid = $_GET["postid"];

$query_check = mysql_query("SELECT * FROM postthanks WHERE topicid = $topicid AND postid= $postid AND userid= $userid") or sqlerr(__FILE__, __LINE__);
$row_check = mysql_num_rows($query_check);

if (!is_valid_id($topicid))
  stderr("Forum Fehler", "<b><p>Falsche Beitrags ID $postid.</p></b>");
elseif($row_check > 0)
  stderr("Forum Fehler", "<b><p>Du hast dich bereits bedankt !</p></b>");

mysql_query("INSERT INTO postthanks (id,topicid,postid,userid) VALUES (id,$topicid,$postid,$userid)") or sqlerr(__FILE__, __LINE__);

header("Location: $BASEURL/forums.php?action=viewtopic&topicid=$topicid");
die;
}

Ich hoffe ich konnte helfen und habe jetzt nix vergessen.

MFG


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:01 Uhr.

Powered by vBulletin® Version 3.8.9 (Deutsch)
Copyright ©2000 - 2025, vBulletin Solutions, Inc.