Dodanie numeru IP użytkownika do shoutboxa
|
mark14 |
Dodany dnia 14.10.2010 22:03:23
|
Przedszkolak
Postów: 28 Ostrzeżeń: 1
v7.01.06 Data rejestracji: 11.07.2007 00:33
|
Nie mogłem znaleźć takiego tematu... Na mojej stronie w shoutboxie trwa ożywiona dyskusja przedwyborcza, a po bliższym jej przejrzeniu zauważyłem po IP, że niektóre osoby pod różnymi nickami dyskutują same ze sobą.
Chciałem to ukrócić przez dodanie do wyświetlanych wiadomości użytkowników ich IP, np. obok daty. Jak to zrobić?
Dodam, że mam wersję v6.01.15 (niestety nie udało mi się przekonwertować skórki do 7.) i skórkę Entourage, ale to pewnie bez znaczenie w tej sprawie.
PW od moderatora:
- Przeniesienie tematu - Pieka 14.10 - 22:10
Edytowane przez mark14 dnia 14.10.2010 23:53:07
|
|
|
|
Wścibski Gość |
Dodany dnia 21.12.2024 17:55:32
|
Pan Kontekstualny
Postów: n^x
Data rejestracji: Zawsze
|
|
IP: localhost |
|
|
eldiablo |
Dodany dnia 14.10.2010 22:32:42
|
Bywalec
Postów: 671 Pomógł: 80
Data rejestracji: 13.07.2009 19:20
|
Oryginalny shoutbox panel z IP:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: shoutbox_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
$link = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
$link = preg_replace("^(&|\?)s_action=(edit|delete)&shout_id=\d*^", "", $link);
$sep = stristr($link, "?") ? "&" : "?";
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "delete") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."'"))) {
$result = dbquery("DELETE FROM ".DB_SHOUTBOX." WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
redirect($link);
}
function sbwrap($text) {
global $locale;
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = mb_substr($text, $i, 1, $locale['charset']);
if ($chr == "<") {
if (mb_substr($text, ($i + 1), 6, $locale['charset']) == "a href" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (mb_substr($text, ($i + 1), 5, $locale['charset']) == "quot;") {
$chars = $chars - 5;
} elseif (mb_substr($text, ($i + 1), 4, $locale['charset']) == "amp;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#39;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#92;") {
$chars = $chars - 4;
} elseif (mb_substr($text, ($i + 1), 3, $locale['charset']) == "lt;" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 18) {
$chr .= "<br />";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
openside($locale['global_150']);
if (iMEMBER || $settings['guestposts'] == "1") {
include_once INCLUDES."bbcode_include.php";
if (isset($_POST['post_shout'])) {
$flood = false;
if (iMEMBER) {
$shout_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$shout_name = trim(stripinput($_POST['shout_name']));
$shout_name = preg_replace("(^[0-9]*)", "", $shout_name);
if (isnum($shout_name)) { $shout_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['sb_captcha_code']) || $securimage->check($_POST['sb_captcha_code']) == false) { redirect($link); }
}
$shout_message = str_replace("\n", " ", $_POST['shout_message']);
$shout_message = preg_replace("/^(.{255}).*$/", "$1", $shout_message);
$shout_message = trim(stripinput(censorwords($shout_message)));
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$comment_updated = false;
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."'"))) {
if ($shout_message) {
$result = dbquery("UPDATE ".DB_SHOUTBOX." SET shout_message='$shout_message' WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
redirect($link);
} elseif ($shout_name && $shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip, shout_hidden) VALUES ('$shout_name', '$shout_message', '".time()."', '".USER_IP."', '0')");
}
}
redirect($link);
}
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$esresult = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, tu.user_id, tu.user_name
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE ts.shout_id='".$_GET['shout_id']."'"
);
if (dbrows($esresult)) {
$esdata = dbarray($esresult);
if ((iADMIN && checkrights("S")) || (iMEMBER && $esdata['shout_name'] == $userdata['user_id'] && isset($esdata['user_name']))) {
if ((isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$edit_url = $sep."s_action=edit&shout_id=".$esdata['shout_id'];
} else {
$edit_url = "";
}
$shout_link = $link.$edit_url;
$shout_message = $esdata['shout_message'];
}
} else {
$shout_link = $link;
$shout_message = "";
}
} else {
$shout_link = $link;
$shout_message = "";
}
echo "<a id='edit_shout' name='edit_shout'></a>\n";
echo "<form name='shout_form' method='post' action='".$shout_link."'>\n";
if (iGUEST) {
echo $locale['global_151']."<br />\n";
echo "<input type='text' name='shout_name' value='' class='textbox' maxlength='30' style='width:140px' /><br />\n";
echo $locale['global_152']."<br />\n";
}
echo "<textarea name='shout_message' rows='4' cols='20' class='textbox' style='width:140px'>".$shout_message."</textarea><br />\n";
echo display_bbcodes("150px;", "shout_message", "shout_form", "smiley|b|u|url|color")."\n";
if (iGUEST) {
echo $locale['global_158']."<br />\n";
echo "<img id='sb_captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('sb_captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['global_159']."<br />\n<input type='text' name='sb_captcha_code' class='textbox' style='width:100px' /><br />\n";
}
echo "<br /><input type='submit' name='post_shout' value='".$locale['global_153']."' class='button' />\n";
echo "</form>\n<br />\n";
} else {
echo "<div style='text-align:center'>".$locale['global_154']."</div><br />\n";
}
$numrows = dbcount("(shout_id)", DB_SHOUTBOX, "shout_hidden='0'");
$result = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, ts.shout_datestamp, ts.shout_ip, tu.user_id, tu.user_name, tu.user_status
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE shout_hidden='0'
ORDER BY ts.shout_datestamp DESC LIMIT 0,".$settings['numofshouts']
);
if (dbrows($result)) {
$i = 0;
while ($data = dbarray($result)) {
echo "<div class='shoutboxname'>";
if ($data['user_name']) {
echo "<span class='side'>".profile_link($data['shout_name'], $data['user_name'], $data['user_status'])." / ".$data['shout_ip']."</span>\n";
} else {
echo $data['shout_name']." / ".$data['shout_ip']."\n";
}
echo "</div>\n";
echo "<div class='shoutboxdate'>".showdate("shortdate", $data['shout_datestamp'])."</div>";
echo "<div class='shoutbox'>".sbwrap(parseubb(parsesmileys($data['shout_message']), "b|i|u|url|color"))."</div>\n";
if ((iADMIN && checkrights("S")) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
echo "[<a href='".$link.$sep."s_action=edit&shout_id=".$data['shout_id']."#edit_shout"."' class='side'>".$locale['global_076']."</a>]\n";
echo "[<a href='".$link.$sep."s_action=delete&shout_id=".$data['shout_id']."' class='side'>".$locale['global_157']."</a>]<br />\n";
}
$i++;
if ($i != $numrows) { echo "<br />\n"; }
}
if ($numrows > $settings['numofshouts']) {
echo "<div style='text-align:center'>\n<a href='".INFUSIONS."shoutbox_panel/shoutbox_archive.php' class='side'>".$locale['global_155']."</a>\n</div>\n";
}
} else {
echo "<div>".$locale['global_156']."</div>\n";
}
closeside();
?>
I oryginalny shoutbox_archive.php z dodanym IP:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: shoutbox_archive.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
$result = dbquery("SELECT panel_access FROM ".DB_PANELS." WHERE panel_filename='shoutbox_panel' AND panel_status='1'");
if (dbrows($result)) {
$data = dbarray($result);
if (!checkgroup($data['panel_access'])) {
redirect(BASEDIR."index.php");
}
} else {
redirect(BASEDIR."index.php");
}
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "delete") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
$result = dbquery("DELETE FROM ".DB_SHOUTBOX." WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
redirect(FUSION_SELF);
}
function sbawrap($text) {
global $locale;
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = mb_substr($text, $i, 1, $locale['charset']);
if ($chr == "<") {
if (mb_substr($text, ($i + 1), 6, $locale['charset']) == "a href" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (mb_substr($text, ($i + 1), 5, $locale['charset']) == "quot;") {
$chars = $chars - 5;
} elseif (mb_substr($text, ($i + 1), 4, $locale['charset']) == "amp;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#39;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#92;") {
$chars = $chars - 4;
} elseif (mb_substr($text, ($i + 1), 3, $locale['charset']) == "lt;" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 40) {
$chr .= " ";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
add_to_title($locale['global_200'].$locale['global_155']);
opentable($locale['global_155']);
if (iMEMBER || $settings['guestposts'] == "1") {
include_once INCLUDES."bbcode_include.php";
if (isset($_POST['post_archive_shout'])) {
$flood = false;
if (iMEMBER) {
$archive_shout_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$archive_shout_name = trim(stripinput($_POST['archive_shout_name']));
$archive_shout_name = preg_replace("(^[0-9]*)", "", $archive_shout_name);
if (isnum($archive_shout_name)) { $archive_shout_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['captcha_code']) || $securimage->check($_POST['captcha_code']) == false) { redirect($link); }
}
$archive_shout_message = str_replace("\n", " ", $_POST['archive_shout_message']);
$archive_shout_message = preg_replace("/^(.{255}).*$/", "$1", $archive_shout_message);
$archive_shout_message = trim(stripinput(censorwords($archive_shout_message)));
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$comment_updated = false;
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
if ($archive_shout_message) {
$result = dbquery("UPDATE ".DB_SHOUTBOX." SET shout_message='$archive_shout_message' WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
redirect(FUSION_SELF);
} elseif ($archive_shout_name && $archive_shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip) VALUES ('$archive_shout_name', '$archive_shout_message', '".time()."', '".USER_IP."')");
}
redirect(FUSION_SELF);
}
}
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$esresult = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, tu.user_id, tu.user_name
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE ts.shout_id='".$_GET['shout_id']."' AND shout_hidden='0'"
);
if (dbrows($esresult)) {
$esdata = dbarray($esresult);
if ((iADMIN && checkrights("S")) || (iMEMBER && $esdata['shout_name'] == $userdata['user_id'] && isset($esdata['user_name']))) {
if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$edit_url = "?action=edit&shout_id=".$esdata['shout_id'];
} else {
$edit_url = "";
}
$archive_shout_link = FUSION_SELF.$edit_url;
$archive_shout_message = $esdata['shout_message'];
}
} else {
$archive_shout_link = FUSION_SELF;
$archive_shout_message = "";
}
} else {
$archive_shout_link = FUSION_SELF;
$archive_shout_message = "";
}
echo "<form name='archive_form' method='post' action='".$archive_shout_link."'>\n";
echo "<div style='text-align:center'>\n";
if (iGUEST) {
echo $locale['global_151']."<br />\n";
echo "<input type='text' name='archive_shout_name' value='' class='textbox' maxlength='30' style='width:200px;' /><br />\n";
echo $locale['global_152']."<br />\n";
}
echo "<textarea name='archive_shout_message' rows='4' cols='50' class='textbox'>".$archive_shout_message."</textarea><br />\n";
echo "<div style='text-align:center'>".display_bbcodes("100%", "archive_shout_message", "archive_form", "smiley|b|i|u|url|color")."</div>\n";
if (iGUEST) {
echo $locale['global_158']."<br />\n";
echo "<img id='captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['global_159']."<br />\n<input type='text' name='captcha_code' class='textbox' style='width:100px' /><br />\n";
}
echo "<br /><input type='submit' name='post_archive_shout' value='".$locale['global_153']."' class='button' />\n";
echo "</div>\n</form>\n<br />\n";
} else {
echo "<div style='text-align:center'>".$locale['global_154']."</div>\n";
}
$rows = dbcount("(shout_id)", DB_SHOUTBOX);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows != 0) {
$result = dbquery(
"SELECT s.shout_id, s.shout_name, s.shout_message, s.shout_datestamp, s.shout_ip, u.user_id, u.user_name, u.user_status
FROM ".DB_SHOUTBOX." s
LEFT JOIN ".DB_USERS." u ON s.shout_name=u.user_id
WHERE s.shout_hidden='0'
ORDER BY s.shout_datestamp DESC LIMIT ".$_GET['rowstart'].",20"
);
while ($data = dbarray($result)) {
echo "<div class='tbl2'>\n";
if ((iADMIN && checkrights("S")) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
echo "<div style='float:right'>\n<a href='".FUSION_SELF."?action=edit&shout_id=".$data['shout_id']."'>".$locale['global_076']."</a> |\n";
echo "<a href='".FUSION_SELF."?action=delete&shout_id=".$data['shout_id']."'>".$locale['global_157']."</a>\n</div>\n";
}
if ($data['user_name']) {
echo "<span class='comment-name'><span class='slink'>".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</span>\n</span>\n [ ".$data['shout_ip']." ] ";
} else {
echo "<span class='comment-name'>".$data['shout_name']."</span>\n [ ".$data['shout_ip']." ]";
}
echo "<span class='small'>".showdate("longdate", $data['shout_datestamp'])."</span>";
echo "</div>\n<div class='tbl1'>\n".sbawrap(parseubb(parsesmileys($data['shout_message']), "b|i|u|url|color"))."</div>\n";
}
} else {
echo "<div style='text-align:center'><br />\n".$locale['global_156']."<br /><br />\n</div>\n";
}
closetable();
echo "<div align='center' style='margin-top:5px;'>\n".makepagenav($_GET['rowstart'], 20, $rows, 3, FUSION_SELF."?")."\n</div>\n";
require_once THEMES."templates/footer.php";
?>
Tylko pamiętaj, że nie każdy lubi jak się jego IP upublicznia.
Edytowane przez eldiablo dnia 14.10.2010 22:37:55
|
|
|
|
jantom |
Dodany dnia 14.10.2010 22:49:22
|
Weteran
Postów: 3460 Pomógł: 123
Data rejestracji: 31.03.2005 20:10
|
Pokazanie IP powinno być albo tylko i wyłącznie dla adminów, albo ostatnie cyfry powinny być ukryte - IP należy do danych prywatnych. |
|
|
|
eldiablo |
Dodany dnia 14.10.2010 23:07:06
|
Bywalec
Postów: 671 Pomógł: 80
Data rejestracji: 13.07.2009 19:20
|
Powinno, powinno, ale nie zawsze tak jest :@
shoutbox_panel.php z dodanym IP usera/gościa tylko dla SuperAdmina
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: shoutbox_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
$link = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
$link = preg_replace("^(&|\?)s_action=(edit|delete)&shout_id=\d*^", "", $link);
$sep = stristr($link, "?") ? "&" : "?";
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "delete") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."'"))) {
$result = dbquery("DELETE FROM ".DB_SHOUTBOX." WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
redirect($link);
}
function sbwrap($text) {
global $locale;
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = mb_substr($text, $i, 1, $locale['charset']);
if ($chr == "<") {
if (mb_substr($text, ($i + 1), 6, $locale['charset']) == "a href" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (mb_substr($text, ($i + 1), 5, $locale['charset']) == "quot;") {
$chars = $chars - 5;
} elseif (mb_substr($text, ($i + 1), 4, $locale['charset']) == "amp;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#39;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#92;") {
$chars = $chars - 4;
} elseif (mb_substr($text, ($i + 1), 3, $locale['charset']) == "lt;" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 18) {
$chr .= "<br />";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
openside($locale['global_150']);
if (iMEMBER || $settings['guestposts'] == "1") {
include_once INCLUDES."bbcode_include.php";
if (isset($_POST['post_shout'])) {
$flood = false;
if (iMEMBER) {
$shout_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$shout_name = trim(stripinput($_POST['shout_name']));
$shout_name = preg_replace("(^[0-9]*)", "", $shout_name);
if (isnum($shout_name)) { $shout_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['sb_captcha_code']) || $securimage->check($_POST['sb_captcha_code']) == false) { redirect($link); }
}
$shout_message = str_replace("\n", " ", $_POST['shout_message']);
$shout_message = preg_replace("/^(.{255}).*$/", "$1", $shout_message);
$shout_message = trim(stripinput(censorwords($shout_message)));
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$comment_updated = false;
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."'"))) {
if ($shout_message) {
$result = dbquery("UPDATE ".DB_SHOUTBOX." SET shout_message='$shout_message' WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
redirect($link);
} elseif ($shout_name && $shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip, shout_hidden) VALUES ('$shout_name', '$shout_message', '".time()."', '".USER_IP."', '0')");
}
}
redirect($link);
}
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$esresult = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, tu.user_id, tu.user_name
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE ts.shout_id='".$_GET['shout_id']."'"
);
if (dbrows($esresult)) {
$esdata = dbarray($esresult);
if ((iADMIN && checkrights("S")) || (iMEMBER && $esdata['shout_name'] == $userdata['user_id'] && isset($esdata['user_name']))) {
if ((isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$edit_url = $sep."s_action=edit&shout_id=".$esdata['shout_id'];
} else {
$edit_url = "";
}
$shout_link = $link.$edit_url;
$shout_message = $esdata['shout_message'];
}
} else {
$shout_link = $link;
$shout_message = "";
}
} else {
$shout_link = $link;
$shout_message = "";
}
echo "<a id='edit_shout' name='edit_shout'></a>\n";
echo "<form name='shout_form' method='post' action='".$shout_link."'>\n";
if (iGUEST) {
echo $locale['global_151']."<br />\n";
echo "<input type='text' name='shout_name' value='' class='textbox' maxlength='30' style='width:140px' /><br />\n";
echo $locale['global_152']."<br />\n";
}
echo "<textarea name='shout_message' rows='4' cols='20' class='textbox' style='width:140px'>".$shout_message."</textarea><br />\n";
echo display_bbcodes("150px;", "shout_message", "shout_form", "smiley|b|u|url|color")."\n";
if (iGUEST) {
echo $locale['global_158']."<br />\n";
echo "<img id='sb_captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('sb_captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['global_159']."<br />\n<input type='text' name='sb_captcha_code' class='textbox' style='width:100px' /><br />\n";
}
echo "<br /><input type='submit' name='post_shout' value='".$locale['global_153']."' class='button' />\n";
echo "</form>\n<br />\n";
} else {
echo "<div style='text-align:center'>".$locale['global_154']."</div><br />\n";
}
$numrows = dbcount("(shout_id)", DB_SHOUTBOX, "shout_hidden='0'");
$result = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, ts.shout_datestamp, ts.shout_ip, tu.user_id, tu.user_name, tu.user_status
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE shout_hidden='0'
ORDER BY ts.shout_datestamp DESC LIMIT 0,".$settings['numofshouts']
);
if (dbrows($result)) {
$i = 0;
while ($data = dbarray($result)) {
echo "<div class='shoutboxname'>";
if ($data['user_name']) {
echo "<span class='side'>".profile_link($data['shout_name'], $data['user_name'], $data['user_status']);
if (iSUPERADMIN) {
echo " / ".$data['shout_ip']."</span>\n";
}
} else {
echo $data['shout_name'];
if (iSUPERADMIN) {
echo " / ".$data['shout_ip']."\n";
}
}
echo "</div>\n";
echo "<div class='shoutboxdate'>".showdate("shortdate", $data['shout_datestamp'])."</div>";
echo "<div class='shoutbox'>".sbwrap(parseubb(parsesmileys($data['shout_message']), "b|i|u|url|color"))."</div>\n";
if ((iADMIN && checkrights("S")) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
echo "[<a href='".$link.$sep."s_action=edit&shout_id=".$data['shout_id']."#edit_shout"."' class='side'>".$locale['global_076']."</a>]\n";
echo "[<a href='".$link.$sep."s_action=delete&shout_id=".$data['shout_id']."' class='side'>".$locale['global_157']."</a>]<br />\n";
}
$i++;
if ($i != $numrows) { echo "<br />\n"; }
}
if ($numrows > $settings['numofshouts']) {
echo "<div style='text-align:center'>\n<a href='".INFUSIONS."shoutbox_panel/shoutbox_archive.php' class='side'>".$locale['global_155']."</a>\n</div>\n";
}
} else {
echo "<div>".$locale['global_156']."</div>\n";
}
closeside();
?>
shoutbox_archive.php z dodanym IP usera/gościa tylko dla SuperAdmina
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: shoutbox_archive.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
$result = dbquery("SELECT panel_access FROM ".DB_PANELS." WHERE panel_filename='shoutbox_panel' AND panel_status='1'");
if (dbrows($result)) {
$data = dbarray($result);
if (!checkgroup($data['panel_access'])) {
redirect(BASEDIR."index.php");
}
} else {
redirect(BASEDIR."index.php");
}
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "delete") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
$result = dbquery("DELETE FROM ".DB_SHOUTBOX." WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
redirect(FUSION_SELF);
}
function sbawrap($text) {
global $locale;
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = mb_substr($text, $i, 1, $locale['charset']);
if ($chr == "<") {
if (mb_substr($text, ($i + 1), 6, $locale['charset']) == "a href" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (mb_substr($text, ($i + 1), 5, $locale['charset']) == "quot;") {
$chars = $chars - 5;
} elseif (mb_substr($text, ($i + 1), 4, $locale['charset']) == "amp;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#39;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#92;") {
$chars = $chars - 4;
} elseif (mb_substr($text, ($i + 1), 3, $locale['charset']) == "lt;" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 40) {
$chr .= " ";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
add_to_title($locale['global_200'].$locale['global_155']);
opentable($locale['global_155']);
if (iMEMBER || $settings['guestposts'] == "1") {
include_once INCLUDES."bbcode_include.php";
if (isset($_POST['post_archive_shout'])) {
$flood = false;
if (iMEMBER) {
$archive_shout_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$archive_shout_name = trim(stripinput($_POST['archive_shout_name']));
$archive_shout_name = preg_replace("(^[0-9]*)", "", $archive_shout_name);
if (isnum($archive_shout_name)) { $archive_shout_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['captcha_code']) || $securimage->check($_POST['captcha_code']) == false) { redirect($link); }
}
$archive_shout_message = str_replace("\n", " ", $_POST['archive_shout_message']);
$archive_shout_message = preg_replace("/^(.{255}).*$/", "$1", $archive_shout_message);
$archive_shout_message = trim(stripinput(censorwords($archive_shout_message)));
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$comment_updated = false;
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
if ($archive_shout_message) {
$result = dbquery("UPDATE ".DB_SHOUTBOX." SET shout_message='$archive_shout_message' WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
redirect(FUSION_SELF);
} elseif ($archive_shout_name && $archive_shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip) VALUES ('$archive_shout_name', '$archive_shout_message', '".time()."', '".USER_IP."')");
}
redirect(FUSION_SELF);
}
}
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$esresult = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, tu.user_id, tu.user_name
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE ts.shout_id='".$_GET['shout_id']."' AND shout_hidden='0'"
);
if (dbrows($esresult)) {
$esdata = dbarray($esresult);
if ((iADMIN && checkrights("S")) || (iMEMBER && $esdata['shout_name'] == $userdata['user_id'] && isset($esdata['user_name']))) {
if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$edit_url = "?action=edit&shout_id=".$esdata['shout_id'];
} else {
$edit_url = "";
}
$archive_shout_link = FUSION_SELF.$edit_url;
$archive_shout_message = $esdata['shout_message'];
}
} else {
$archive_shout_link = FUSION_SELF;
$archive_shout_message = "";
}
} else {
$archive_shout_link = FUSION_SELF;
$archive_shout_message = "";
}
echo "<form name='archive_form' method='post' action='".$archive_shout_link."'>\n";
echo "<div style='text-align:center'>\n";
if (iGUEST) {
echo $locale['global_151']."<br />\n";
echo "<input type='text' name='archive_shout_name' value='' class='textbox' maxlength='30' style='width:200px;' /><br />\n";
echo $locale['global_152']."<br />\n";
}
echo "<textarea name='archive_shout_message' rows='4' cols='50' class='textbox'>".$archive_shout_message."</textarea><br />\n";
echo "<div style='text-align:center'>".display_bbcodes("100%", "archive_shout_message", "archive_form", "smiley|b|i|u|url|color")."</div>\n";
if (iGUEST) {
echo $locale['global_158']."<br />\n";
echo "<img id='captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['global_159']."<br />\n<input type='text' name='captcha_code' class='textbox' style='width:100px' /><br />\n";
}
echo "<br /><input type='submit' name='post_archive_shout' value='".$locale['global_153']."' class='button' />\n";
echo "</div>\n</form>\n<br />\n";
} else {
echo "<div style='text-align:center'>".$locale['global_154']."</div>\n";
}
$rows = dbcount("(shout_id)", DB_SHOUTBOX);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows != 0) {
$result = dbquery(
"SELECT s.shout_id, s.shout_name, s.shout_message, s.shout_datestamp, s.shout_ip, u.user_id, u.user_name, u.user_status
FROM ".DB_SHOUTBOX." s
LEFT JOIN ".DB_USERS." u ON s.shout_name=u.user_id
WHERE s.shout_hidden='0'
ORDER BY s.shout_datestamp DESC LIMIT ".$_GET['rowstart'].",20"
);
while ($data = dbarray($result)) {
echo "<div class='tbl2'>\n";
if ((iADMIN && checkrights("S")) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
echo "<div style='float:right'>\n<a href='".FUSION_SELF."?action=edit&shout_id=".$data['shout_id']."'>".$locale['global_076']."</a> |\n";
echo "<a href='".FUSION_SELF."?action=delete&shout_id=".$data['shout_id']."'>".$locale['global_157']."</a>\n</div>\n";
}
if ($data['user_name']) {
echo "<span class='comment-name'><span class='slink'>".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</span>\n</span>\n";
if (iSUPERADMIN) {
echo " [ ".$data['shout_ip']." ] ";
}
} else {
echo "<span class='comment-name'>".$data['shout_name']."</span>\n";
if (iSUPERADMIN) {
echo " [ ".$data['shout_ip']." ]";
}
}
echo "<span class='small'>".showdate("longdate", $data['shout_datestamp'])."</span>";
echo "</div>\n<div class='tbl1'>\n".sbawrap(parseubb(parsesmileys($data['shout_message']), "b|i|u|url|color"))."</div>\n";
}
} else {
echo "<div style='text-align:center'><br />\n".$locale['global_156']."<br /><br />\n</div>\n";
}
closetable();
echo "<div align='center' style='margin-top:5px;'>\n".makepagenav($_GET['rowstart'], 20, $rows, 3, FUSION_SELF."?")."\n</div>\n";
require_once THEMES."templates/footer.php";
?>
|
|
|
|
mark14 |
Dodany dnia 14.10.2010 23:52:09
|
Przedszkolak
Postów: 28 Ostrzeżeń: 1
v7.01.06 Data rejestracji: 11.07.2007 00:33
|
@eldiablo Dzięki za podanie modyfikacji.
jantom napisał/a:
Pokazanie IP powinno być albo tylko i wyłącznie dla adminów, albo ostatnie cyfry powinny być ukryte - IP należy do danych prywatnych.
Chciałbym jednak jakoś zahamować niektórych użytkowników by sztucznie nie napędzali dyskusji i nie rozmawiali sami ze sobą, ale z drugiej strony nie chcę wprowadzać drastycznych środków, jak kasowanie wypowiedzi itp.
Nie wiem czy istnieje lepszy sposób, ale w takim razie mam pytanie o małą modyfikację, tzn. chcę żeby wyświetlało się IP (z poziomu nawet niezalogowanego gościa), ale 3 ostatnie cyfry żeby były oznaczone X-em np. 79.184.65.XXX
To powinno załatwić sprawę, bo pokaże powtarzające się cyfry w 3 miejscach. Wiecie jak to w ten sposób zmodyfikować? |
|
|
|
eldiablo |
Dodany dnia 15.10.2010 14:58:19
|
Bywalec
Postów: 671 Pomógł: 80
Data rejestracji: 13.07.2009 19:20
|
Do trzech razy sztuka ? taaa ?
shoutbox_panel.php
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: shoutbox_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
$link = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
$link = preg_replace("^(&|\?)s_action=(edit|delete)&shout_id=\d*^", "", $link);
$sep = stristr($link, "?") ? "&" : "?";
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "delete") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."'"))) {
$result = dbquery("DELETE FROM ".DB_SHOUTBOX." WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
redirect($link);
}
function sbwrap($text) {
global $locale;
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = mb_substr($text, $i, 1, $locale['charset']);
if ($chr == "<") {
if (mb_substr($text, ($i + 1), 6, $locale['charset']) == "a href" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (mb_substr($text, ($i + 1), 5, $locale['charset']) == "quot;") {
$chars = $chars - 5;
} elseif (mb_substr($text, ($i + 1), 4, $locale['charset']) == "amp;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#39;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#92;") {
$chars = $chars - 4;
} elseif (mb_substr($text, ($i + 1), 3, $locale['charset']) == "lt;" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 18) {
$chr .= "<br />";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
openside($locale['global_150']);
if (iMEMBER || $settings['guestposts'] == "1") {
include_once INCLUDES."bbcode_include.php";
if (isset($_POST['post_shout'])) {
$flood = false;
if (iMEMBER) {
$shout_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$shout_name = trim(stripinput($_POST['shout_name']));
$shout_name = preg_replace("(^[0-9]*)", "", $shout_name);
if (isnum($shout_name)) { $shout_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['sb_captcha_code']) || $securimage->check($_POST['sb_captcha_code']) == false) { redirect($link); }
}
$shout_message = str_replace("\n", " ", $_POST['shout_message']);
$shout_message = preg_replace("/^(.{255}).*$/", "$1", $shout_message);
$shout_message = trim(stripinput(censorwords($shout_message)));
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$comment_updated = false;
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."'"))) {
if ($shout_message) {
$result = dbquery("UPDATE ".DB_SHOUTBOX." SET shout_message='$shout_message' WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
redirect($link);
} elseif ($shout_name && $shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip, shout_hidden) VALUES ('$shout_name', '$shout_message', '".time()."', '".USER_IP."', '0')");
}
}
redirect($link);
}
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$esresult = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, tu.user_id, tu.user_name
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE ts.shout_id='".$_GET['shout_id']."'"
);
if (dbrows($esresult)) {
$esdata = dbarray($esresult);
if ((iADMIN && checkrights("S")) || (iMEMBER && $esdata['shout_name'] == $userdata['user_id'] && isset($esdata['user_name']))) {
if ((isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$edit_url = $sep."s_action=edit&shout_id=".$esdata['shout_id'];
} else {
$edit_url = "";
}
$shout_link = $link.$edit_url;
$shout_message = $esdata['shout_message'];
}
} else {
$shout_link = $link;
$shout_message = "";
}
} else {
$shout_link = $link;
$shout_message = "";
}
echo "<a id='edit_shout' name='edit_shout'></a>\n";
echo "<form name='shout_form' method='post' action='".$shout_link."'>\n";
if (iGUEST) {
echo $locale['global_151']."<br />\n";
echo "<input type='text' name='shout_name' value='' class='textbox' maxlength='30' style='width:140px' /><br />\n";
echo $locale['global_152']."<br />\n";
}
echo "<textarea name='shout_message' rows='4' cols='20' class='textbox' style='width:140px'>".$shout_message."</textarea><br />\n";
echo display_bbcodes("150px;", "shout_message", "shout_form", "smiley|b|u|url|color")."\n";
if (iGUEST) {
echo $locale['global_158']."<br />\n";
echo "<img id='sb_captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('sb_captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['global_159']."<br />\n<input type='text' name='sb_captcha_code' class='textbox' style='width:100px' /><br />\n";
}
echo "<br /><input type='submit' name='post_shout' value='".$locale['global_153']."' class='button' />\n";
echo "</form>\n<br />\n";
} else {
echo "<div style='text-align:center'>".$locale['global_154']."</div><br />\n";
}
$numrows = dbcount("(shout_id)", DB_SHOUTBOX, "shout_hidden='0'");
$result = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, ts.shout_datestamp, ts.shout_ip, tu.user_id, tu.user_name, tu.user_status
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE shout_hidden='0'
ORDER BY ts.shout_datestamp DESC LIMIT 0,".$settings['numofshouts']
);
if (dbrows($result)) {
$i = 0;
while ($data = dbarray($result)) {
echo "<div class='shoutboxname'>";
if ($data['user_name']) {
echo "<span class='side'>".profile_link($data['shout_name'], $data['user_name'], $data['user_status']);
echo " / ".substr($data['shout_ip'], 0, -3)."xxx</span>\n";
} else {
echo $data['shout_name'];
echo " / ".substr($data['shout_ip'], 0, -3)."xxx\n";
}
echo "</div>\n";
echo "<div class='shoutboxdate'>".showdate("shortdate", $data['shout_datestamp'])."</div>";
echo "<div class='shoutbox'>".sbwrap(parseubb(parsesmileys($data['shout_message']), "b|i|u|url|color"))."</div>\n";
if ((iADMIN && checkrights("S")) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
echo "[<a href='".$link.$sep."s_action=edit&shout_id=".$data['shout_id']."#edit_shout"."' class='side'>".$locale['global_076']."</a>]\n";
echo "[<a href='".$link.$sep."s_action=delete&shout_id=".$data['shout_id']."' class='side'>".$locale['global_157']."</a>]<br />\n";
}
$i++;
if ($i != $numrows) { echo "<br />\n"; }
}
if ($numrows > $settings['numofshouts']) {
echo "<div style='text-align:center'>\n<a href='".INFUSIONS."shoutbox_panel/shoutbox_archive.php' class='side'>".$locale['global_155']."</a>\n</div>\n";
}
} else {
echo "<div>".$locale['global_156']."</div>\n";
}
closeside();
?>
shoutbox_archive.php
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: shoutbox_archive.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
$result = dbquery("SELECT panel_access FROM ".DB_PANELS." WHERE panel_filename='shoutbox_panel' AND panel_status='1'");
if (dbrows($result)) {
$data = dbarray($result);
if (!checkgroup($data['panel_access'])) {
redirect(BASEDIR."index.php");
}
} else {
redirect(BASEDIR."index.php");
}
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "delete") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
$result = dbquery("DELETE FROM ".DB_SHOUTBOX." WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
redirect(FUSION_SELF);
}
function sbawrap($text) {
global $locale;
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = mb_substr($text, $i, 1, $locale['charset']);
if ($chr == "<") {
if (mb_substr($text, ($i + 1), 6, $locale['charset']) == "a href" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (mb_substr($text, ($i + 1), 5, $locale['charset']) == "quot;") {
$chars = $chars - 5;
} elseif (mb_substr($text, ($i + 1), 4, $locale['charset']) == "amp;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#39;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#92;") {
$chars = $chars - 4;
} elseif (mb_substr($text, ($i + 1), 3, $locale['charset']) == "lt;" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 40) {
$chr .= " ";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
add_to_title($locale['global_200'].$locale['global_155']);
opentable($locale['global_155']);
if (iMEMBER || $settings['guestposts'] == "1") {
include_once INCLUDES."bbcode_include.php";
if (isset($_POST['post_archive_shout'])) {
$flood = false;
if (iMEMBER) {
$archive_shout_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$archive_shout_name = trim(stripinput($_POST['archive_shout_name']));
$archive_shout_name = preg_replace("(^[0-9]*)", "", $archive_shout_name);
if (isnum($archive_shout_name)) { $archive_shout_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['captcha_code']) || $securimage->check($_POST['captcha_code']) == false) { redirect($link); }
}
$archive_shout_message = str_replace("\n", " ", $_POST['archive_shout_message']);
$archive_shout_message = preg_replace("/^(.{255}).*$/", "$1", $archive_shout_message);
$archive_shout_message = trim(stripinput(censorwords($archive_shout_message)));
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$comment_updated = false;
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
if ($archive_shout_message) {
$result = dbquery("UPDATE ".DB_SHOUTBOX." SET shout_message='$archive_shout_message' WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
redirect(FUSION_SELF);
} elseif ($archive_shout_name && $archive_shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip) VALUES ('$archive_shout_name', '$archive_shout_message', '".time()."', '".USER_IP."')");
}
redirect(FUSION_SELF);
}
}
if (iMEMBER && (isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$esresult = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, tu.user_id, tu.user_name
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE ts.shout_id='".$_GET['shout_id']."' AND shout_hidden='0'"
);
if (dbrows($esresult)) {
$esdata = dbarray($esresult);
if ((iADMIN && checkrights("S")) || (iMEMBER && $esdata['shout_name'] == $userdata['user_id'] && isset($esdata['user_name']))) {
if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$edit_url = "?action=edit&shout_id=".$esdata['shout_id'];
} else {
$edit_url = "";
}
$archive_shout_link = FUSION_SELF.$edit_url;
$archive_shout_message = $esdata['shout_message'];
}
} else {
$archive_shout_link = FUSION_SELF;
$archive_shout_message = "";
}
} else {
$archive_shout_link = FUSION_SELF;
$archive_shout_message = "";
}
echo "<form name='archive_form' method='post' action='".$archive_shout_link."'>\n";
echo "<div style='text-align:center'>\n";
if (iGUEST) {
echo $locale['global_151']."<br />\n";
echo "<input type='text' name='archive_shout_name' value='' class='textbox' maxlength='30' style='width:200px;' /><br />\n";
echo $locale['global_152']."<br />\n";
}
echo "<textarea name='archive_shout_message' rows='4' cols='50' class='textbox'>".$archive_shout_message."</textarea><br />\n";
echo "<div style='text-align:center'>".display_bbcodes("100%", "archive_shout_message", "archive_form", "smiley|b|i|u|url|color")."</div>\n";
if (iGUEST) {
echo $locale['global_158']."<br />\n";
echo "<img id='captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['global_159']."<br />\n<input type='text' name='captcha_code' class='textbox' style='width:100px' /><br />\n";
}
echo "<br /><input type='submit' name='post_archive_shout' value='".$locale['global_153']."' class='button' />\n";
echo "</div>\n</form>\n<br />\n";
} else {
echo "<div style='text-align:center'>".$locale['global_154']."</div>\n";
}
$rows = dbcount("(shout_id)", DB_SHOUTBOX);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows != 0) {
$result = dbquery(
"SELECT s.shout_id, s.shout_name, s.shout_message, s.shout_datestamp, s.shout_ip, u.user_id, u.user_name, u.user_status
FROM ".DB_SHOUTBOX." s
LEFT JOIN ".DB_USERS." u ON s.shout_name=u.user_id
WHERE s.shout_hidden='0'
ORDER BY s.shout_datestamp DESC LIMIT ".$_GET['rowstart'].",20"
);
while ($data = dbarray($result)) {
echo "<div class='tbl2'>\n";
if ((iADMIN && checkrights("S")) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
echo "<div style='float:right'>\n<a href='".FUSION_SELF."?action=edit&shout_id=".$data['shout_id']."'>".$locale['global_076']."</a> |\n";
echo "<a href='".FUSION_SELF."?action=delete&shout_id=".$data['shout_id']."'>".$locale['global_157']."</a>\n</div>\n";
}
if ($data['user_name']) {
echo "<span class='comment-name'><span class='slink'>".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</span>\n</span>\n";
echo " [ ".substr($data['shout_ip'], 0, -3)."xxx ] ";
} else {
echo "<span class='comment-name'>".$data['shout_name']."</span>\n";
echo " [ ".substr($data['shout_ip'], 0, -3)."xxx ]";
}
echo "<span class='small'>".showdate("longdate", $data['shout_datestamp'])."</span>";
echo "</div>\n<div class='tbl1'>\n".sbawrap(parseubb(parsesmileys($data['shout_message']), "b|i|u|url|color"))."</div>\n";
}
} else {
echo "<div style='text-align:center'><br />\n".$locale['global_156']."<br /><br />\n</div>\n";
}
closetable();
echo "<div align='center' style='margin-top:5px;'>\n".makepagenav($_GET['rowstart'], 20, $rows, 3, FUSION_SELF."?")."\n</div>\n";
require_once THEMES."templates/footer.php";
?>
EDIT: do skasowania -> v7 wersjia. :| Lub do przeniesienia do działu dla v7, może komuś się przyda.
Edytowane przez eldiablo dnia 15.10.2010 21:35:16
|
|
|
|
mark14 |
Dodany dnia 15.10.2010 19:20:16
|
Przedszkolak
Postów: 28 Ostrzeżeń: 1
v7.01.06 Data rejestracji: 11.07.2007 00:33
|
Wkleiłem, ale pojawia się komunikat:
Warning: include_once(includes/bbcode_include.php) [function.include-once]: failed to open stream: No such file or directory in /home/a6307058/public_html/infusions/shoutbox_panel/shoutbox_panel.php on line 74
Może kod jest napisany do wersji 7, a ja mam 6.01.15?
Edytowane przez Pieka dnia 15.10.2010 19:57:46
|
|
|
|
Pieka |
Dodany dnia 15.10.2010 19:58:22
|
Postów: 19885 Pomógł: 767
v7.02.03 Data rejestracji: 23.02.2005 18:12
|
mark14 napisał/a:
...Może kod jest napisany do wersji 7, a ja mam 6.01.15?
A jestesmy w dziale dla v7, czy v6? Poza tym, bledy w code, a nie quote.
Jestem jaki jestem
|
|
|