Yangi formatda davom etish uchun: https://uzfor.net/view.php?act=post&id=21261
Postga havola
DjHuSo [843] [off]
BestMaker, # BestMaker (09.02.2018 / 17:56)
news kommentga Qo'shilaman qo'shilmayman modulini kimda bor?
Bazga yuboramiz:
news kommentga Qo'shilaman qo'shilmayman modulini kimda bor?
view.php ga $post dan keyin. if ($user_id != $row['user_id']) echo ' <div class="ovoz_berish"> <a href="/news/index.php?act=comments&mod=yoqdi&id=' . $id . '&com=' . $row['mid'] . '" class="green"> <img width="18" src="http://fc-arsenal.uz/images/smileys/user/emoji/thumbsup.png"/> Qo\'shilaman <span class="yoqd1i">(' . ($row['yoqdi'] == '' ? '0' : $row['yoqdi']) . ')</span> </a> | <a href="/news/index.php?act=comments&mod=yoqmadi&id=' . $id . '&com=' . $row['mid'] . '" class="red"> <img width="18" src="http://fc-arsenal.uz/images/smileys/user/emoji/thumbsdown.png"/> Qarshiman <span class="yoqmadi1">(' . ($row['yoqmadi'] == '' ? '0' : $row['yoqmadi']) . ')</span> </a> </div>'; else echo ' <div class="ovoz_berish"> <a class="green"> <img width="18" src="http://fc-arsenal.uz/images/smileys/user/emoji/thumbsup.png"/> Qo\'shilganlar <span class="yoqd1i">(' . ($row['yoqdi'] == '' ? '0' : $row['yoqdi']) . ')</span> </a> | <a class="red"> <img width="18" src="http://fc-arsenal.uz/images/smileys/user/emoji/thumbsdown.png"/> Qarshilar <span class="yoqmadi1">(' . ($row['yoqmadi'] == '' ? '0' : $row['yoqmadi']) . ')</span> </a> </div>'; comments.php dagi default: dan oldin. case 'yoqdi': $q = mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_news_comments` WHERE `id`='$com' LIMIT 1;")); if ($q['ovoz_berdi_id'] != $user_id) { $_SESSION['id'] = $id; mysql_query('UPDATE `cms_news_comments` SET `yoqdi`="' . ($q['yoqdi'] ? ++$q['yoqdi'] : 1) . '" WHERE `id`=' . $com); echo '<div class="gmenu">Izoha ovoz berdigiz <a href="../news/index.php?act=view&id=' . $id. '#comments">Yangilikga qaytish</a></div>'; } else { echo '<div class="gmenu">Siz bu izohga <b>Ijobiy</b> ovoz bergansiz. <a href="../news/index.php?act=view&id=' . $id. '#comments">Yangilikga qaytish</a></div>'; } //Header('Location: ../news/index.php?act=view&id=' . $id); break; case 'yoqmadi': $q = mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_news_comments` WHERE `id`='$com' LIMIT 1;")); if ($q['ovoz_berdi_id'] != $user_id) { $_SESSION['id'] = $id; mysql_query('UPDATE `cms_news_comments` SET `yoqmadi`="' . ($q['yoqmadi'] ? ++$q['yoqmadi'] : 1) . '" WHERE `id`=' . $com); echo '<div class="gmenu"Izohga <b>Salbiy</b> ovoz berdingiz. <a href="../news/index.php?act=view&id=' . $id. '#comments">Yangilikga qaytish</a></div>'; } else { echo '<div class="gmenu">Siz bu postga <b>Salbiy</b> ovoz bergansiz. <a href="../news/index.php?act=view&id=' . $id. '#comments">Yangilikga qaytish</a></div>'; } //Header('Location: ../news/index.php?act=view&id=' . $id); break;
Bazga yuboramiz:
ALTER TABLE `cms_news_comments` ADD COLUMN ( `yoqdi` INT(11) UNSIGNED NOT NULL, `yoqmadi` INT(11) UNSIGNED NOT NULL, `ovoz_berdi_id` INT(11) UNSIGNED NOT NULL ) ;