[EF IV] Punkty za dodany komentarz
|
kartacz |
Dodany dnia 04.11.2008 15:13:03
|
Przedszkolak
Postów: 20
v7.02.04 Data rejestracji: 24.07.2007 16:33
|
Witam. W którym miejscu umieścić wpis odpowiadający za dodawanie punktów za napisany komentarz? Umieszczałem go w kilku miejscach i mam ciągle ten sam problem, punkty dodaje, ale już za samo wejście w komentarze, a nie za napisanie. Mój plik comments_include jest zmodyfikowany w ten sposób, że są avatary w komentarzach, pod nimi ilość pkt usera i ranga oraz dodany atyspam...brakuje mi pkt za dodany komentarz. Wpis odpowiadający za pkt wygląda tak :
if (EPS && iMEMBER){
$przydzial = dbarray(dbquery("SELECT point_ammount from ".DB_PREFIX."eps_points WHERE point_id='7'"));
$result = dbquery("UPDATE ".DB_PREFIX."users SET points_normal=points_normal+".($przydzial['point_ammount'])." WHERE user_id='".$userdata['user_id']."'");
}
Kliknij i zaczekaj na załadowanie kodu ...
Mój plik comments_include wygląda następująco:
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright 2002 - 2005 Nick Jones
| http://www.php-fu...
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Comments system developed by CrappoMan
| email:
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location:../index.php"); exit; }
include LOCALE.LOCALESET."comments.php";
function showcomments($ctype,$cdb,$ccol,$cid,$clink) {
global $settings,$locale,$userdata,$aidlink,$status;
if (isset($_POST['post_comment'])) {
if ($_POST['validation'] != "" && $_POST['validation'] == $_POST['validation_answer'])
{
if (dbrows(dbquery("SELECT $ccol FROM ".DB_PREFIX."$cdb WHERE $ccol='$cid'"))==0) {
fallback(BASEDIR."index.php");
}
if (iMEMBER) {
$comment_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$comment_name = trim(stripinput($_POST['comment_name']));
$comment_name = preg_replace("(^[0-9]*)", "", $comment_name);
if (isNum($comment_name)) $comment_name="";
}
$comment_message = trim(stripinput(censorwords($_POST['comment_message'])));
$comment_smileys = isset($_POST['disable_smileys']) ? "0" : "1";
if ($comment_name != "" && $comment_message != "") {
$result = dbquery("INSERT INTO ".DB_PREFIX."comments VALUES('', '$cid', '$ctype', '$comment_name', '$comment_message', '$comment_smileys', '".time()."', '".USER_IP."')");
redirect($clink);
}
} else {
$invalid = true;
$comment_message2 = trim(stripinput(censorwords($_POST['comment_message'])));
echo "<div style='text-align:center'><br /><b><font color='orange'>Nieprawidłowy wynik. Spróboj jeszcze raz.</b></font><br /><br /></div>";
}
}
tablebreak();
opentable($locale['c100']);
$result = dbquery(
"SELECT * FROM ".DB_PREFIX."comments tcm
LEFT JOIN ".DB_PREFIX."users tcu ON tcm.comment_name=tcu.user_id
WHERE comment_item_id='$cid' AND comment_type='$ctype'
ORDER BY comment_datestamp ASC"
);
if (dbrows($result) != 0) {
$i = 0;
while ($data = dbarray($result)) {
echo" <table ellpadding='0' cellspacing='1' width='100%' class='tbl-border'>
<tr>
<td width='20%' class='tbl1' align='center'>";
if ($data['user_name']) {
echo "<a href='".BASEDIR."profile.php?lookup=".$data['comment_name']."'><font color='#".$data['user_color']."'><b>".$data['user_name']."</b></font></a>";
} else {
echo $data['comment_name'];
}
echo"</td>
<td width='80%' class='tbl2' align='right'>";
echo "<span class='small'>".$locale['041'].showdate("longdate", $data['comment_datestamp'])."</span>\n";
echo"</td>
</tr>
<tr>
<td width='20%' class='tbl1' align='center' valign='top'>";
echo "<table cellspacing='0' cellpadding='0' border='0'><tr>\n";
echo "<td><img src='".IMAGES."avatar_mod/gora_lewa.png' height='12' width='12'></td>\n";
echo "<td><img src='".IMAGES."avatar_mod/gora_srodek.png' height='12' width='100%'></td>\n";
echo "<td><img src='".IMAGES."avatar_mod/gora_prawa.png' height='12' width='12'></td></tr>\n";
echo "<td align='left'><img src='".IMAGES."avatar_mod/srodek_lewa.png' width='12' height='100%'></td>\n";
echo "<td align='center' height='1%'>";
echo ($data['user_avatar'] ? "<img src='".IMAGES."avatars/".$data['user_avatar']."' alt='avatar' height='50' width='50'''>" : "<img src='".FORUM."images/brak.gif' alt='avatar' height='50' width='50''>")."</td>";
echo "<td align='right'><img src='".IMAGES."avatar_mod/srodek_prawa.png' height='100%' width='12'></td></tr><tr>\n";
echo "<td><img src='".IMAGES."avatar_mod/dol_lewa.png' height='12' width='12'></td>\n";
echo "<td><img src='".IMAGES."avatar_mod/dol_srodek.png' height='12' width='100%'></td>\n";
echo "<td><img src='".IMAGES."avatar_mod/dol_prawa.png' height='12' width='12'></td></tr>\n";
echo "</tr></table>";
if (EPS) {
echo " ".$locale['560']." ".check_rang($data['user_id'])." <br>
".$locale['561']." ".show_points($data['user_id'])."<br>\n";
}
echo"</td>
<td width='80%' class='tbl1' valign='top'>";
if ($data['comment_smileys'] == "1") {
$comment_message = parsesmileys($data['comment_message']);
} else {
$comment_message = $data['comment_message'];
}
$comment_message = nl2br(parseubb($comment_message));
echo"".$comment_message."";
echo"</td>
</tr>
</table><br>";
}
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n";
if (checkrights("C")) echo "<tr>\n<td align='right' class='".($i% 2==0?"tbl1":"tbl2")."'><a href='".ADMIN."comments.php".$aidlink."&ctype=$ctype&cid=$cid'>".$locale['c106']."</a></td>\n</tr>\n";
echo "</table>\n";
} else {
echo $locale['c101']."\n";
}
closetable();
tablebreak();
// Calculate random equation and answer
$var1 = rand(1,5);
$var2 = rand(1,5);
$equation = $var1 . " + " . $var2 . ":";
$validation_answer = $var1 + $var2;
opentable($locale['c102']);
if (iMEMBER || $settings['guestposts'] == "1") {
echo "<form name='inputform' method='post' action='$clink'>
<table align='center' cellspacing='0' cellpadding='0' class='tbl'>\n";
if (iGUEST) {
echo "<tr>
<td>".$locale['c103']."</td>
</tr>
<tr>
<td><input type='text' name='comment_name' maxlength='50' class='textbox' style='width:100%;'></td>
</tr>\n";
}
echo "<tr>
<td align='center'><textarea name='comment_message' rows='6' class='textbox' style='width:400px'>"; if($invalid) echo $comment_message2; echo"</textarea><br>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('comment_message', '', '');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('comment_message', '', '');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('comment_message', '', '');\">
<input type='button' value='url' class='button' style='width:30px;' onClick=\"addText('comment_message', '[url]', '[/url]');\">
<input type='button' value='mail' class='button' style='width:35px;' onClick=\"addText('comment_message', '[mail]', '[/mail]');\">
<input type='button' value='img' class='button' style='width:30px;' onClick=\"addText('comment_message', '[img]', '[/img]');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('comment_message', '', ' ');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('comment_message', '', '');\">
<input type='button' value='code' class='button' style='width:40px;' onClick=\"addText('comment_message', '', ' ');\">
<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('comment_message', '', ' ');\"><br><br>
".displaysmileys("comment_message")."<br><br>
</tr>
<tr style=' text-align: center; height: 25px;'>
<td>".$equation." <input type='text' name='validation' value='' class='textbox' style='width:400px'><br>
<input type='hidden' name='validation_answer' value='$validation_answer' class='textbox' style='width:250px'>
</td>
</tr>
<tr>
<td align='center'><font color='orange'><b>Wpisz w pole sumę dwóch liczb aby dodać komentarz</font></b><br><input type='checkbox' name='disable_smileys' value='1'>".$locale['c107']."<br><br>
<input type='submit' name='post_comment' value='".$locale['c102']."' class='button'></td>
</tr>
</table>
</form>\n";
} else {
echo $locale['c105']."\n";
}
closetable();
}
?> Kliknij i zaczekaj na załadowanie kodu ...
Dziękuję i pozdrawiam
Edytowane przez Grzes dnia 04.11.2008 15:43:42
|
|
|
|
Wścibski Gość |
Dodany dnia 25.11.2024 08:38:47
|
Pan Kontekstualny
Postów: n^x
Data rejestracji: Zawsze
|
|
IP: localhost |
|
|
bartek124 |
Dodany dnia 04.11.2008 15:56:13
|
Weteran
Postów: 3264 Pomógł: 236
v7.02.06 Data rejestracji: 26.05.2007 12:25
|
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright 2002 - 2005 Nick Jones
| http://www.php-fu...
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Comments system developed by CrappoMan
| email:
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location:../index.php"); exit; }
include LOCALE.LOCALESET."comments.php";
function showcomments($ctype,$cdb,$ccol,$cid,$clink) {
global $settings,$locale,$userdata,$aidlink,$status;
if (isset($_POST['post_comment'])) {
if ($_POST['validation'] != "" && $_POST['validation'] == $_POST['validation_answer'])
{
if (dbrows(dbquery("SELECT $ccol FROM ".DB_PREFIX."$cdb WHERE $ccol='$cid'"))==0) {
fallback(BASEDIR."index.php");
}
if (iMEMBER) {
$comment_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$comment_name = trim(stripinput($_POST['comment_name']));
$comment_name = preg_replace("(^[0-9]*)", "", $comment_name);
if (isNum($comment_name)) $comment_name="";
}
$comment_message = trim(stripinput(censorwords($_POST['comment_message'])));
$comment_smileys = isset($_POST['disable_smileys']) ? "0" : "1";
if ($comment_name != "" && $comment_message != "") {
$result = dbquery("INSERT INTO ".DB_PREFIX."comments VALUES('', '$cid', '$ctype', '$comment_name', '$comment_message', '$comment_smileys', '".time()."', '".USER_IP."')");
if (EPS && iMEMBER){
$przydzial = dbarray(dbquery("SELECT point_ammount from ".DB_PREFIX."eps_points WHERE point_id='7'"));
$result = dbquery("UPDATE ".DB_PREFIX."users SET points_normal=points_normal+".($przydzial['point_ammount'])." WHERE user_id='".$userdata['user_id']."'");
}
redirect($clink);
}
} else {
$invalid = true;
$comment_message2 = trim(stripinput(censorwords($_POST['comment_message'])));
echo "<div style='text-align:center'><br /><b><font color='orange'>Nieprawidłowy wynik. Spróboj jeszcze raz.</b></font><br /><br /></div>";
}
}
tablebreak();
opentable($locale['c100']);
$result = dbquery(
"SELECT * FROM ".DB_PREFIX."comments tcm
LEFT JOIN ".DB_PREFIX."users tcu ON tcm.comment_name=tcu.user_id
WHERE comment_item_id='$cid' AND comment_type='$ctype'
ORDER BY comment_datestamp ASC"
);
if (dbrows($result) != 0) {
$i = 0;
while ($data = dbarray($result)) {
echo" <table ellpadding='0' cellspacing='1' width='100%' class='tbl-border'>
<tr>
<td width='20%' class='tbl1' align='center'>";
if ($data['user_name']) {
echo "<a href='".BASEDIR."profile.php?lookup=".$data['comment_name']."'><font color='#".$data['user_color']."'><b>".$data['user_name']."</b></font></a>";
} else {
echo $data['comment_name'];
}
echo"</td>
<td width='80%' class='tbl2' align='right'>";
echo "<span class='small'>".$locale['041'].showdate("longdate", $data['comment_datestamp'])."</span>\n";
echo"</td>
</tr>
<tr>
<td width='20%' class='tbl1' align='center' valign='top'>";
echo "<table cellspacing='0' cellpadding='0' border='0'><tr>\n";
echo "<td><img src='".IMAGES."avatar_mod/gora_lewa.png' height='12' width='12'></td>\n";
echo "<td><img src='".IMAGES."avatar_mod/gora_srodek.png' height='12' width='100%'></td>\n";
echo "<td><img src='".IMAGES."avatar_mod/gora_prawa.png' height='12' width='12'></td></tr>\n";
echo "<td align='left'><img src='".IMAGES."avatar_mod/srodek_lewa.png' width='12' height='100%'></td>\n";
echo "<td align='center' height='1%'>";
echo ($data['user_avatar'] ? "<img src='".IMAGES."avatars/".$data['user_avatar']."' alt='avatar' height='50' width='50'''>" : "<img src='".FORUM."images/brak.gif' alt='avatar' height='50' width='50''>")."</td>";
echo "<td align='right'><img src='".IMAGES."avatar_mod/srodek_prawa.png' height='100%' width='12'></td></tr><tr>\n";
echo "<td><img src='".IMAGES."avatar_mod/dol_lewa.png' height='12' width='12'></td>\n";
echo "<td><img src='".IMAGES."avatar_mod/dol_srodek.png' height='12' width='100%'></td>\n";
echo "<td><img src='".IMAGES."avatar_mod/dol_prawa.png' height='12' width='12'></td></tr>\n";
echo "</tr></table>";
if (EPS) {
echo " ".$locale['560']." ".check_rang($data['user_id'])." <br>
".$locale['561']." ".show_points($data['user_id'])."<br>\n";
}
echo"</td>
<td width='80%' class='tbl1' valign='top'>";
if ($data['comment_smileys'] == "1") {
$comment_message = parsesmileys($data['comment_message']);
} else {
$comment_message = $data['comment_message'];
}
$comment_message = nl2br(parseubb($comment_message));
echo"".$comment_message."";
echo"</td>
</tr>
</table><br>";
}
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n";
if (checkrights("C")) echo "<tr>\n<td align='right' class='".($i% 2==0?"tbl1":"tbl2")."'><a href='".ADMIN."comments.php".$aidlink."&ctype=$ctype&cid=$cid'>".$locale['c106']."</a></td>\n</tr>\n";
echo "</table>\n";
} else {
echo $locale['c101']."\n";
}
closetable();
tablebreak();
// Calculate random equation and answer
$var1 = rand(1,5);
$var2 = rand(1,5);
$equation = $var1 . " + " . $var2 . ":";
$validation_answer = $var1 + $var2;
opentable($locale['c102']);
if (iMEMBER || $settings['guestposts'] == "1") {
echo "<form name='inputform' method='post' action='$clink'>
<table align='center' cellspacing='0' cellpadding='0' class='tbl'>\n";
if (iGUEST) {
echo "<tr>
<td>".$locale['c103']."</td>
</tr>
<tr>
<td><input type='text' name='comment_name' maxlength='50' class='textbox' style='width:100%;'></td>
</tr>\n";
}
echo "<tr>
<td align='center'><textarea name='comment_message' rows='6' class='textbox' style='width:400px'>"; if($invalid) echo $comment_message2; echo"</textarea><br>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('comment_message', '', '');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('comment_message', '', '');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('comment_message', '', '');\">
<input type='button' value='url' class='button' style='width:30px;' onClick=\"addText('comment_message', '[url]', '[/url]');\">
<input type='button' value='mail' class='button' style='width:35px;' onClick=\"addText('comment_message', '[mail]', '[/mail]');\">
<input type='button' value='img' class='button' style='width:30px;' onClick=\"addText('comment_message', '[img]', '[/img]');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('comment_message', '', ' ');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('comment_message', '', '');\">
<input type='button' value='code' class='button' style='width:40px;' onClick=\"addText('comment_message', '', ' ');\">
<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('comment_message', '', ' ');\"><br><br>
".displaysmileys("comment_message")."<br><br>
</tr>
<tr style=' text-align: center; height: 25px;'>
<td>".$equation." <input type='text' name='validation' value='' class='textbox' style='width:400px'><br>
<input type='hidden' name='validation_answer' value='$validation_answer' class='textbox' style='width:250px'>
</td>
</tr>
<tr>
<td align='center'><font color='orange'><b>Wpisz w pole sumę dwóch liczb aby dodać komentarz</font></b><br><input type='checkbox' name='disable_smileys' value='1'>".$locale['c107']."<br><br>
<input type='submit' name='post_comment' value='".$locale['c102']."' class='button'></td>
</tr>
</table>
</form>\n";
} else {
echo $locale['c105']."\n";
}
closetable();
}
?> Kliknij i zaczekaj na załadowanie kodu ...
Nie pomagam na komunikatorach oraz PW!
|
|
|
|
kartacz |
Dodany dnia 04.11.2008 16:16:32
|
Przedszkolak
Postów: 20
v7.02.04 Data rejestracji: 24.07.2007 16:33
|
Śliczne dzięki Bartek Działa jak należy. |
|
|