Hier kann eine Notiz zum Merk-Eintrag hinzugefügt werden (optional)
| [ 1 | 2 ] | [ Anmelden zum schreiben ] |
| Doppelposts unterbinden | |||
|---|---|---|---|
| Anarchy 90210 Mitglied
Posts: 580 |
Huhu =)
Ich suche nach einer möglichkeit Doppelposts der User mittels Code zu Unterbinden. Ich stelle es mir so vor, dass anstatt von "Dein Beitrag wurde erfolgreich erstellt" halt dasteht, "Du kannst nicht 2mal hintereinander einen Beitrag schreiben" verwendete ilchClan Version: 1.1 |
||
| Mairu Coder
Posts: 12617 |
contents/forum/new_post.php
if ( !loggedin() ) {
$name = '<tr><td class="Cmite"0><b>'.$lang['name'].'</b></td>';
$name .= '<td class="Cnorm"><input type="text" value="'.unescape($xnn).'" maxlength="15" name="Gname"></td></tr>';
} elseif (!is_siteadmin() and db_result($qry = db_query("SELECT erstid, id FROM prefix_posts WHERE tid = '$tid' ORDER BY id DESC LIMIT 1"),0 , 0) == $_SESSION['authid']) {
$wdlinks = array('Zurück zum Thema' => 'index.php?forum-showposts-'.$tid,
'Letzten Beitrag editieren' => 'index.php?forum-editpost-'.$tid.'-'.db_result($qry,0,1),
'Forenübersicht' => 'index.php?forum');
echo wd($wdlinks, 'Du hast bereits den letzten Post in diesem Thema gemacht und dies ist eine Doppelpostsperre ;).<br />
An dieser Steller der Tipp: du kannst deine Beiträge auch editieren.', 15);
$design->footer(1);
} Ab dem elseif ist neu, so um die Zeile 49.Und auch immer mal ein Blick auf die FAQ werfen. | Mairus Ilchseite |
||
| rubberduck2006 Mitglied
Posts: 433 |
brauche das auch aber geht irgendwie bei mir net hier mal meine datei wo ich es eingetragen habe:
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
if ($aktTopicRow['stat'] == 0 OR $forum_rights['reply'] == FALSE ) {
if ( $aktTopicRow['stat'] == 0 AND $_SESSION['authright'] > '-7') {
if($forum_rights['mods'] == FALSE)
$forum_failure[] = $lang['topicclosed'];
} elseif ($aktTopicRow['stat'] != 0 AND $_SESSION['authright'] > '-7') {
if($forum_rights['mods'] == FALSE)
$forum_failure[] = $lang['nopermission'];
}
check_forum_failure($forum_failure);
}
$title = $allgAr['title'].' :: Forum :: '.aktForumCats($aktForumRow['kat'],'title').' :: '.$aktForumRow['name'].' :: neuer Beitrag';
$hmenu = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> » </b>'.aktForumCats($aktForumRow['kat']).'<b> » </b><a class="smalfont" href="index.php?forum-showtopics-'.$fid.'">'.$aktForumRow['name'].'</a><b> » </b>';
$hmenu .= '<a class="smalfont" href="index.php?forum-showposts-'.$tid.'">'.$aktTopicRow['name'].'</a>'.$extented_forum_menu_sufix;
$dppk_time = time();
$time = time();
if (!isset($_SESSION['klicktime'])) { $_SESSION['klicktime'] = 0; }
$topic = '';
$txt = '';
$xnn = '';
if (isset($_POST['txt'])) {
$txt = trim(escape($_POST['txt'], 'textarea'));
}
if (isset($_POST['Gname'])) {
$xnn = trim(escape_nickname($_POST['Gname']));
}
if (($_SESSION['klicktime'] + 15) > $dppk_time OR empty($txt) OR !empty($_POST['priview']) OR (empty($_POST['Gname']) AND !loggedin()) OR !chk_antispam ('newpost')) {
$design = new design ( $title , $hmenu, 1);
$design->header();
$name = '';
if ( !loggedin() ) {
$name = '<tr><td class="Cmite"0><b>'.$lang['name'].'</b></td>';
$name .= '<td class="Cnorm"><input type="text" value="'.unescape($xnn).'" maxlength="15" name="Gname"></td></tr>';
}if ( !loggedin() ) {
$name = '<tr><td class="Cmite"0><b>'.$lang['name'].'</b></td>';
$name .= '<td class="Cnorm"><input type="text" value="'.unescape($xnn).'" maxlength="15" name="Gname"></td></tr>';
} elseif (!is_siteadmin() and db_result($qry = db_query("SELECT erstid, id FROM prefix_posts WHERE tid = '$tid' ORDER BY id DESC LIMIT 1"),0 , 0) == $_SESSION['authid']) {
$wdlinks = array('Zurück zum Thema' => 'index.php?forum-showposts-'.$tid,
'Letzten Beitrag editieren' => 'index.php?forum-editpost-'.$tid.'-'.db_result($qry,0,1),
'Forenübersicht' => 'index.php?forum');
echo wd($wdlinks, 'Du hast bereits den letzten Post in diesem Thema gemacht und dies ist eine Doppelpostsperre ;).<br />
An dieser Steller der Tipp: du kannst deine Beiträge auch editieren.', 15);
$design->footer(1);
}
$tpl = new tpl ('forum/newpost');
$xtext = '';
if ( $menu->getA(3) == 'z' ) {
$row = db_fetch_object(db_query("SELECT txt,erst FROM prefix_posts WHERE id = ".$menu->getE(3)));
$xtext = '[quote='.escape_nickname($row->erst).']'."\n".$row->txt."\n[/quote]";
}
if ( $menu->getA(3) == 'f' ) {
$r = db_fetch_assoc(db_query("SELECT id,text,title FROM prefix_faqs WHERE id = ".$menu->getE(3)));
$xtext = 'FAQ Artikel: [url=index.php?faqs-s'.$r['id'].'#FAQ'.$r['id'].']'.$r['title'].'[/url]'."\n".unescape($r['text']);
}
if (isset($_POST['priview'])) {
$tpl->set_out('txt', bbcode(unescape($txt)), 0);
}
if (empty($txt)) {
$txt = $xtext;
}
$tpl = new tpl ('forum/newpost');
$ar = array (
'txt' => escape_for_fields(unescape($txt)),
'tid' => $tid,
'name' => $name,
'SMILIES' => getsmilies(),
'antispam'=> get_antispam('newpost',1)
);
$tpl->set_ar_out($ar,1);
$erg = db_query('SELECT erst, txt FROM `prefix_posts` WHERE tid = "'.$tid.'" ORDER BY time DESC LIMIT 0,5');
while ($row = db_fetch_assoc($erg)) {
$row['txt'] = bbcode($row['txt']);
$tpl->set_ar_out($row, 2);
}
$tpl->out(3);
} else {
# save post
$_SESSION['klicktime'] = $dppk_time;
$design = new design ( $title , $hmenu, 1);
$design->header();
if (loggedin()) {
$uid = $_SESSION['authid'];
$erst = escape($_SESSION['authname'],'string');
db_query("UPDATE `prefix_user` set posts = posts+1 WHERE id = ".$uid);
} else {
$erst = $xnn;
$uid = 0;
}
# topic alert ausfuehren.
$topic_alerts_abf = "SELECT
prefix_topics.name as topic,
prefix_user.email as email,
prefix_user.name as user,
prefix_user.id as uid
FROM prefix_topic_alerts
LEFT JOIN prefix_topics ON prefix_topics.id = prefix_topic_alerts.tid
LEFT JOIN prefix_user ON prefix_user.id = prefix_topic_alerts.uid
WHERE prefix_topic_alerts.tid = ".$tid;
$topic_alerts_erg = db_query($topic_alerts_abf);
while ($topic_alerts_row = db_fetch_assoc($topic_alerts_erg)) {
if ($uid == $topic_alerts_row['uid']) continue;
$page = $_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"];
$text = sprintf ($lang['topicalertmessage'], $topic_alerts_row['user'], $topic_alerts_row['topic'], $page, $tid);
icmail ($topic_alerts_row['email'], 'neue Antwort im Thema: "'.$topic_alerts_row['topic'].'"', $text);
debug ($topic_alerts_row['email']);
}
db_query("DELETE FROM prefix_topic_alerts WHERE tid = ".$tid);
# topic alert insert wenn gewaehlt.
if (!empty($_POST['topic_alert']) AND $_POST['topic_alert'] == 'yes' AND loggedin()) {
if (0 == db_result(db_query("SELECT COUNT(*) FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid),0)) {
db_query("INSERT INTO prefix_topic_alerts (tid,uid) VALUES (".$tid.", ".$_SESSION['authid'].")");
}
}
# topic alert ende
db_query ("INSERT INTO `prefix_posts` (tid,fid,erst,erstid,time,txt) VALUES ( ".$tid.", ".$fid.", '".$erst."', ".$uid.", ".$time.", '".$txt."')");
$pid = db_last_id();
db_query("UPDATE `prefix_topics` SET last_post_id = ".$pid.", rep = rep + 1 WHERE id = ".$tid);
db_query("UPDATE `prefix_forums` SET posts = posts + 1, last_post_id = ".$pid." WHERE id = ".$fid );
$page = ceil ( ($aktTopicRow['rep']+1) / $allgAr['Fpanz'] );
# toipc als gelesen markieren
$_SESSION['forumSEE'][$fid][$tid] = time();
wd ( array (
$lang['backtotopic'] => 'index.php?forum-showposts-'.$tid.'-p'.$page.'#'.$pid,
$lang['backtotopicoverview'] => 'index.php?forum-showtopics-'.$fid
) , $lang['createpostsuccessful'] , 3 );
}
$design->footer();
?> |
||
| Mairu Coder
Posts: 12617 |
Also ich habs getestet und bei mir gings, ich muss dazu natürlich sagen, dass ich es extra so geschrieben hab, dass Admins natürlich doppelposten dürfen und ich nehme mal stark an, dass du es als Admin getestet hast
![]() Und auch immer mal ein Blick auf die FAQ werfen. | Mairus Ilchseite |
||
| Anarchy 90210 Mitglied
Posts: 580 |
Bei mir geht es auch, DANKE Mairu =)
P.S. Diese Funktion ist wichtig |
||
| rubberduck2006 Mitglied
Posts: 433 |
Zitat geschrieben von Mairu
Also ich habs getestet und bei mir gings, ich muss dazu natürlich sagen, dass ich es extra so geschrieben hab, dass Admins natürlich doppelposten dürfen und ich nehme mal stark an, dass du es als Admin getestet hast
aso stimmt hehehe ja ok dann danke |
||
| mobi Mitglied
Posts: 85 |
kann man das auch so schreiben das Leader doppelpostings machen dürfen
|
||
| Chapter Moderator
Posts: 5658 |
warum soll das gut sein. es gibt die edit-funktion wodurch er weitere infos hinzufügen kann.
Spamming, sinnlose Beiträge, Pushing, Doppelposting und Werbung sind verboten |
||
| mobi Mitglied
Posts: 85 |
Zitat geschrieben von Chapter
warum soll das gut sein. es gibt die edit-funktion wodurch er weitere infos hinzufügen kann. Manchmal bräuchte das auch ein Leader z.B. wenn ein War sich verändert etc. Dadurch rutscht der Thread sofort wieder nach oben(LastForumsbox etc.) Fände das nicht schlecht Zuletzt modifiziert von mobi am 09.04.2010 - 23:27:51 |
||
| Mairu Coder
Posts: 12617 |
Da steht ja irgendwo is_siteadmin(), wenn du da has_right(-6) draus machst, sollte es auch für Leader gelten.
Und auch immer mal ein Blick auf die FAQ werfen. | Mairus Ilchseite |
||
| mobi Mitglied
Posts: 85 |
Danke dir Mairu
Funzt einwandfrei
Zuletzt modifiziert von mobi am 10.04.2010 - 12:10:58 |
||
| corian Mitglied
Posts: 26 |
Sorry wenn ich das Thema noch mal aus der Versenkung hole, aber wenn man auf Schnellantwort geht, kann man dennoch doppelt posten. Wie kann man das vermeiden??
|
||
| Lord|Schirmer Administrator
Posts: 4409 |
Bei der Shoutbox habe ich das mal so gelöst:
// Doppelpost prüfen
$lasttextarea = db_result(db_query("SELECT textarea FROM `prefix_shoutbox` WHERE nickname = '".$shoutbox_nickname."' ORDER BY id DESC LIMIT 1"),0);
if ($lasttextarea == $shoutbox_textarea) { $doppelpost = true; } else { $doppelpost = false; }
... könnte man so ähnlich auch für das Forum machen "In mir schlummert ein Genie, leider wacht es nicht auf!" my portfolio | my community | important link |
||
| corian Mitglied
Posts: 26 |
wärst du so lieb und könntest mir das umschreiben?? und mir vielleicht sagen welche zeile es dann rein gehört?
![]() |
||
| Lord|Schirmer Administrator
Posts: 4409 |
Hast Du das Ilch-Standard-Forum?
"In mir schlummert ein Genie, leider wacht es nicht auf!" my portfolio | my community | important link |
||
| corian Mitglied
Posts: 26 |
hey, nein (ilchbb_forenmod-0.5) ich poste einfach mal meinen code
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
if ($aktTopicRow['stat'] == 0 OR $forum_rights['reply'] == FALSE ) {
if ( $aktTopicRow['stat'] == 0 AND $_SESSION['authright'] > '-7') {
if($forum_rights['mods'] == FALSE)
$forum_failure[] = $lang['topicclosed'];
} elseif ($aktTopicRow['stat'] != 0 AND $_SESSION['authright'] > '-7') {
if($forum_rights['mods'] == FALSE)
$forum_failure[] = $lang['nopermission'];
}
check_forum_failure($forum_failure);
}
$title = $allgAr['title'].' :: Forum :: '.aktForumCats($aktForumRow['kat'],'title').' :: '.$aktForumRow['name'].' :: neuer Beitrag';
$hmenu = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> » </b>'.aktForumCats($aktForumRow['kat']).'<b> » </b><a class="smalfont" href="index.php?forum-showtopics-'.$fid.'">'.$aktForumRow['name'].'</a><b> » </b>';
$hmenu .= '<a class="smalfont" href="index.php?forum-showposts-'.$tid.'">'.$aktTopicRow['name'].'</a>'.$extented_forum_menu_sufix;
$dppk_time = time();
$time = time();
if (!isset($_SESSION['klicktime'])) { $_SESSION['klicktime'] = 0; }
$topic = '';
$txt = '';
$xnn = '';
if (isset($_POST['txt'])) {
$txt = trim(escape($_POST['txt'], 'textarea'));
}
if (isset($_POST['Gname'])) {
$xnn = trim(escape_nickname($_POST['Gname']));
}
if (($_SESSION['klicktime'] + 15) > $dppk_time OR empty($txt) OR !empty($_POST['priview']) OR (empty($_POST['Gname']) AND !loggedin()) OR !chk_antispam ('newpost')) {
$design = new design ( $title , $hmenu, 1);
$design->header();
$name = '';
if ( !loggedin() ) {
$name = '<tr><td class="Cmite"0><b>'.$lang['name'].'</b></td>';
$name .= '<td class="Cnorm"><input type="text" value="'.unescape($xnn).'" maxlength="15" name="Gname"></td></tr>';
}
if ( !loggedin() ) {
$name = '<tr><td class="Cmite"0><b>'.$lang['name'].'</b></td>';
$name .= '<td class="Cnorm"><input type="text" value="'.unescape($xnn).'" maxlength="15" name="Gname"></td></tr>';
} elseif (!is_siteadmin() and db_result($qry = db_query("SELECT erstid, id FROM prefix_posts WHERE tid = '$tid' ORDER BY id DESC LIMIT 1"),0 , 0) == $_SESSION['authid']) {
$wdlinks = array('Zurück zum Thema' => 'index.php?forum-showposts-'.$tid,
'Letzten Beitrag editieren' => 'index.php?forum-editpost-'.$tid.'-'.db_result($qry,0,1),
'Forenübersicht' => 'index.php?forum');
echo wd($wdlinks, 'Du hast bereits den letzten Post in diesem Thema gemacht und dies ist eine Doppelpostsperre ;).<br />
An dieser Steller der Tipp: du kannst deine Beiträge auch editieren.', 15);
$design->footer(1);
}
$tpl = new tpl ('forum/newpost');
$xtext = '';
if ( $menu->getA(3) == 'z' ) {
$row = db_fetch_object(db_query("SELECT txt,erst FROM prefix_posts WHERE id = ".$menu->getE(3)));
$xtext = '[quote='.escape_nickname($row->erst).']'."\n".$row->txt."\n[/quote]";
}
if ( $menu->getA(3) == 'f' ) {
$r = db_fetch_assoc(db_query("SELECT id,text,title FROM prefix_faqs WHERE id = ".$menu->getE(3)));
$xtext = 'FAQ Artikel: [url=index.php?faqs-s'.$r['id'].'#FAQ'.$r['id'].']'.$r['title'].'[/url]'."\n".unescape($r['text']);
}
if (isset($_POST['priview'])) {
$tpl->set_out('txt', bbcode(unescape($txt)), 0);
}
if (empty($txt)) {
$txt = $xtext;
}
$tpl = new tpl ('forum/newpost');
$ar = array (
'txt' => escape_for_fields(unescape($txt)),
'tid' => $tid,
'name' => $name,
'SMILIES' => getsmilies(),
'antispam'=> get_antispam('newpost',1)
);
$tpl->set_ar_out($ar,1);
$erg = db_query('SELECT erst, txt FROM `prefix_posts` WHERE tid = "'.$tid.'" ORDER BY time DESC LIMIT 0,5');
while ($row = db_fetch_assoc($erg)) {
$row['txt'] = bbcode($row['txt']);
$tpl->set_ar_out($row, 2);
}
$tpl->out(3);
} else {
# save post
$_SESSION['klicktime'] = $dppk_time;
$design = new design ( $title , $hmenu, 1);
$design->header();
if (loggedin()) {
$uid = $_SESSION['authid'];
$erst = escape($_SESSION['authname'],'string');
db_query("UPDATE `prefix_user` set posts = posts+1 WHERE id = ".$uid);
} else {
$erst = $xnn;
$uid = 0;
}
# topic alert ausfuehren.
$topic_alerts_abf = "SELECT
prefix_topics.name as topic,
prefix_user.email as email,
prefix_user.name as user,
prefix_user.id as uid
FROM prefix_topic_alerts
LEFT JOIN prefix_topics ON prefix_topics.id = prefix_topic_alerts.tid
LEFT JOIN prefix_user ON prefix_user.id = prefix_topic_alerts.uid
WHERE prefix_topic_alerts.tid = ".$tid;
$topic_alerts_erg = db_query($topic_alerts_abf);
while ($topic_alerts_row = db_fetch_assoc($topic_alerts_erg)) {
if ($uid == $topic_alerts_row['uid']) continue;
$page = $_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"];
$text = sprintf ($lang['topicalertmessage'], $topic_alerts_row['user'], $topic_alerts_row['topic'], $page, $tid);
icmail ($topic_alerts_row['email'], 'neue Antwort im Thema: "'.$topic_alerts_row['topic'].'"', $text);
debug ($topic_alerts_row['email']);
}
db_query("DELETE FROM prefix_topic_alerts WHERE tid = ".$tid);
# topic alert insert wenn gewaehlt.
if (!empty($_POST['topic_alert']) AND $_POST['topic_alert'] == 'yes' AND loggedin()) {
if (0 == db_result(db_query("SELECT COUNT(*) FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid),0)) {
db_query("INSERT INTO prefix_topic_alerts (tid,uid) VALUES (".$tid.", ".$_SESSION['authid'].")");
}
}
# topic alert ende
db_query ("INSERT INTO `prefix_posts` (tid,fid,erst,erstid,time,txt) VALUES ( ".$tid.", ".$fid.", '".$erst."', ".$uid.", ".$time.", '".$txt."')");
$pid = db_last_id();
db_query("UPDATE `prefix_topics` SET last_post_id = ".$pid.", rep = rep + 1 WHERE id = ".$tid);
db_query("UPDATE `prefix_forums` SET posts = posts + 1, last_post_id = ".$pid." WHERE id = ".$fid );
$page = ceil ( ($aktTopicRow['rep']+1) / $allgAr['Fpanz'] );
# toipc als gelesen markieren
$_SESSION['forumSEE'][$fid][$tid] = time();
wd ( array (
$lang['backtotopic'] => 'index.php?forum-showposts-'.$tid.'-p'.$page.'#'.$pid,
$lang['backtotopicoverview'] => 'index.php?forum-showtopics-'.$fid
) , $lang['createpostsuccessful'] , 3 );
}
$design->footer();
?>
Zuletzt modifiziert von corian am 15.09.2011 - 17:17:44 |
||
| Lord|Schirmer Administrator
Posts: 4409 |
Probiers mal ... ungetestet!
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
if ($aktTopicRow['stat'] == 0 OR $forum_rights['reply'] == FALSE ) {
if ( $aktTopicRow['stat'] == 0 AND $_SESSION['authright'] > '-7') {
if($forum_rights['mods'] == FALSE)
$forum_failure[] = $lang['topicclosed'];
} elseif ($aktTopicRow['stat'] != 0 AND $_SESSION['authright'] > '-7') {
if($forum_rights['mods'] == FALSE)
$forum_failure[] = $lang['nopermission'];
}
check_forum_failure($forum_failure);
}
$title = $allgAr['title'].' :: Forum :: '.aktForumCats($aktForumRow['kat'],'title').' :: '.$aktForumRow['name'].' :: neuer Beitrag';
$hmenu = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> » </b>'.aktForumCats($aktForumRow['kat']).'<b> » </b><a class="smalfont" href="index.php?forum-showtopics-'.$fid.'">'.$aktForumRow['name'].'</a><b> » </b>';
$hmenu .= '<a class="smalfont" href="index.php?forum-showposts-'.$tid.'">'.$aktTopicRow['name'].'</a>'.$extented_forum_menu_sufix;
$dppk_time = time();
$time = time();
if (!isset($_SESSION['klicktime'])) { $_SESSION['klicktime'] = 0; }
$topic = '';
$txt = '';
$xnn = '';
if (isset($_POST['txt'])) {
$txt = trim(escape($_POST['txt'], 'textarea'));
}
if (isset($_POST['Gname'])) {
$xnn = trim(escape_nickname($_POST['Gname']));
}
if (($_SESSION['klicktime'] + 15) > $dppk_time OR empty($txt) OR !empty($_POST['priview']) OR (empty($_POST['Gname']) AND !loggedin()) OR !chk_antispam ('newpost')) {
$design = new design ( $title , $hmenu, 1);
$design->header();
$name = '';
if ( !loggedin() ) {
$name = '<tr><td class="Cmite"><b>'.$lang['name'].'</b></td>';
$name .= '<td class="Cnorm"><input type="text" value="'.unescape($xnn).'" maxlength="15" name="Gname"></td></tr>';
}
if ( !loggedin() ) {
$name = '<tr><td class="Cmite"><b>'.$lang['name'].'</b></td>';
$name .= '<td class="Cnorm"><input type="text" value="'.unescape($xnn).'" maxlength="15" name="Gname"></td></tr>';
} elseif (!is_siteadmin() and db_result($qry = db_query("SELECT erstid, id FROM prefix_posts WHERE tid = '$tid' ORDER BY id DESC LIMIT 1"),0 , 0) == $_SESSION['authid']) {
$wdlinks = array('Zurück zum Thema' => 'index.php?forum-showposts-'.$tid,
'Letzten Beitrag editieren' => 'index.php?forum-editpost-'.$tid.'-'.db_result($qry,0,1),
'Forenübersicht' => 'index.php?forum');
echo wd($wdlinks, 'Du hast bereits den letzten Post in diesem Thema gemacht und dies ist eine Doppelpostsperre ;).<br />
An dieser Steller der Tipp: du kannst deine Beiträge auch editieren.', 15);
$design->footer(1);
}
$tpl = new tpl ('forum/newpost');
$xtext = '';
if ( $menu->getA(3) == 'z' ) {
$row = db_fetch_object(db_query("SELECT txt,erst FROM prefix_posts WHERE id = ".$menu->getE(3)));
$xtext = '[quote='.escape_nickname($row->erst).']'."\n".$row->txt."\n[/quote]";
}
if ( $menu->getA(3) == 'f' ) {
$r = db_fetch_assoc(db_query("SELECT id,text,title FROM prefix_faqs WHERE id = ".$menu->getE(3)));
$xtext = 'FAQ Artikel: [url=index.php?faqs-s'.$r['id'].'#FAQ'.$r['id'].']'.$r['title'].'[/url]'."\n".unescape($r['text']);
}
if (isset($_POST['priview'])) {
$tpl->set_out('txt', bbcode(unescape($txt)), 0);
}
if (empty($txt)) {
$txt = $xtext;
}
$tpl = new tpl ('forum/newpost');
$ar = array (
'txt' => escape_for_fields(unescape($txt)),
'tid' => $tid,
'name' => $name,
'SMILIES' => getsmilies(),
'antispam'=> get_antispam('newpost',1)
);
$tpl->set_ar_out($ar,1);
$erg = db_query('SELECT erst, txt FROM `prefix_posts` WHERE tid = "'.$tid.'" ORDER BY time DESC LIMIT 0,5');
while ($row = db_fetch_assoc($erg)) {
$row['txt'] = bbcode($row['txt']);
$tpl->set_ar_out($row, 2);
}
$tpl->out(3);
} else {
# save post
$_SESSION['klicktime'] = $dppk_time;
$design = new design ( $title , $hmenu, 1);
$design->header();
if (loggedin()) {
$uid = $_SESSION['authid'];
$erst = escape($_SESSION['authname'],'string');
db_query("UPDATE `prefix_user` set posts = posts+1 WHERE id = ".$uid);
} else {
$erst = $xnn;
$uid = 0;
}
// Doppelpost prüfen
$lastdbtxt = db_result(db_query('SELECT txt FROM `prefix_posts` WHERE erst LIKE = "'.$erst.'" ORDER BY id DESC LIMIT 1'),0);
if ($lastdbtxt != $txt) {
# topic alert ausfuehren.
$topic_alerts_abf = "SELECT
prefix_topics.name as topic,
prefix_user.email as email,
prefix_user.name as user,
prefix_user.id as uid
FROM prefix_topic_alerts
LEFT JOIN prefix_topics ON prefix_topics.id = prefix_topic_alerts.tid
LEFT JOIN prefix_user ON prefix_user.id = prefix_topic_alerts.uid
WHERE prefix_topic_alerts.tid = ".$tid;
$topic_alerts_erg = db_query($topic_alerts_abf);
while ($topic_alerts_row = db_fetch_assoc($topic_alerts_erg)) {
if ($uid == $topic_alerts_row['uid']) continue;
$page = $_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"];
$text = sprintf ($lang['topicalertmessage'], $topic_alerts_row['user'], $topic_alerts_row['topic'], $page, $tid);
icmail ($topic_alerts_row['email'], 'neue Antwort im Thema: "'.$topic_alerts_row['topic'].'"', $text);
debug ($topic_alerts_row['email']);
}
db_query("DELETE FROM prefix_topic_alerts WHERE tid = ".$tid);
# topic alert insert wenn gewaehlt.
if (!empty($_POST['topic_alert']) AND $_POST['topic_alert'] == 'yes' AND loggedin()) {
if (0 == db_result(db_query("SELECT COUNT(*) FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid),0)) {
db_query("INSERT INTO prefix_topic_alerts (tid,uid) VALUES (".$tid.", ".$_SESSION['authid'].")");
}
}
# topic alert ende
db_query ("INSERT INTO `prefix_posts` (tid,fid,erst,erstid,time,txt) VALUES ( ".$tid.", ".$fid.", '".$erst."', ".$uid.", ".$time.", '".$txt."')");
$pid = db_last_id();
db_query("UPDATE `prefix_topics` SET last_post_id = ".$pid.", rep = rep + 1 WHERE id = ".$tid);
db_query("UPDATE `prefix_forums` SET posts = posts + 1, last_post_id = ".$pid." WHERE id = ".$fid );
$page = ceil ( ($aktTopicRow['rep']+1) / $allgAr['Fpanz'] );
# toipc als gelesen markieren
$_SESSION['forumSEE'][$fid][$tid] = time();
wd ( array (
$lang['backtotopic'] => 'index.php?forum-showposts-'.$tid.'-p'.$page.'#'.$pid,
$lang['backtotopicoverview'] => 'index.php?forum-showtopics-'.$fid
) , $lang['createpostsuccessful'] , 3 );
}
}
$design->footer();
?>
Zuletzt modifiziert von Lord|Schirmer am 16.09.2011 - 18:47:42 "In mir schlummert ein Genie, leider wacht es nicht auf!" my portfolio | my community | important link |
||
| corian Mitglied
Posts: 26 |
sorry aber geht leider nicht. habe es als user getestet.
|
||
| Lord|Schirmer Administrator
Posts: 4409 |
Habe es nochmal geändert ... bitte testen!
"In mir schlummert ein Genie, leider wacht es nicht auf!" my portfolio | my community | important link |
||
| corian Mitglied
Posts: 26 |
hmmmm nein leider immer noch nicht, das gewünschte ergebniss.
|
||
| Lord|Schirmer Administrator
Posts: 4409 |
So ... habe es nochmal anders aufgebaut!
Wenn das jetzt nicht klappt ... dann bin ich auch erstmal überfragt ^^ "In mir schlummert ein Genie, leider wacht es nicht auf!" my portfolio | my community | important link |
||
| corian Mitglied
Posts: 26 |
Super
jetzt funktioniert es! Vielen Dank für deine Müh und Arbeit. |
||
| Lord|Schirmer Administrator
Posts: 4409 |
Juhu ^^
"In mir schlummert ein Genie, leider wacht es nicht auf!" my portfolio | my community | important link |
||
| corian Mitglied
Posts: 26 |
Lord? also ich bekomme heute diesen Fehler:
MySQL Error: 1054 : Unknown column 'corian' in 'where clause' in Query: SELECT txt FROM `ic3_posts` WHERE erst = corian ORDER BY id DESC LIMIT 1 Debug backtrace: @ mysql.php:32 -- debug_bt() @ mysql.php:50 -- db_check_error(...) @ new_post.php:121 -- db_query(...) @ forum.php:132 -- require_once(...) @ index.php:35 -- require_once(...) Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /mnt/webg/d1/53/52907853/htdocs/elite/include/includes/func/db/mysql.php on line 54 Ich hoffe du kannst mir weiter helfen sonnst mach ich alles wieder rückgängig. |
||
| oink ForenTroll
Posts: 684 |
stringvergleiche gehen in sql auch mit LIKE und nicht = operator
before creation there must be destruction |
||
| corian Mitglied
Posts: 26 |
also wenn ich das = durch LIKE ersetze kommt der gleiche fehler
Zuletzt modifiziert von corian am 16.09.2011 - 17:24:43 |
||
| Tr3icio Mitglied
|
weil man alles was kein Intger ist ( Integer sind Zahlen ohne Kommastellen ) in ' bzw. " machen muss!
a = b - ist falsch! a LIKE b - ist zwar schon besser ab trotzdem falsch a LIKE 'b' - ist komplett richtig! |
||
| corian Mitglied
Posts: 26 |
$lastdbtxt = db_result(db_query("SELECT txt FROM `prefix_posts` WHERE erst LIKE ".$erst." ORDER BY id DESC LIMIT 1"),0);
so steht es da, ich komm da nicht weiter und ich kenn mich auch nicht wirklich mit php aus. kann mir einer sagen was ich genau ändern muss? vielleicht etwas verständlicher? Zuletzt modifiziert von corian am 16.09.2011 - 18:06:02 |
||
| Tr3icio Mitglied
|
Zitat
".$erst."
... Lies meinen vorherigen Post! Bist du es nicht selbst kapiert hast antworte bitte nicht! Tipp: Wenn du mit "SELECT beginnst musst du für strings ' nutzen |
||
| Lord|Schirmer Administrator
Posts: 4409 |
Habe es oben nochmal angepasst!
$lastdbtxt = db_result(db_query('SELECT txt FROM `prefix_posts` WHERE erst LIKE "'.$erst.'" ORDER BY id DESC LIMIT 1'),0);"In mir schlummert ein Genie, leider wacht es nicht auf!" my portfolio | my community | important link |
||
| [ 1 | 2 ] | [ Anmelden zum schreiben ] |