Author Topic: Shoutbox ?  (Read 28788 times)

0 Members and 1 Guest are viewing this topic.

Offline Xwoman

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shoutbox ?
« on: May 16, 2003, 08:01:18 PM »
Hi!anybody Know a Shoutbox for 4images?  8O  thx for help

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Shoutbox ?
« Reply #1 on: May 17, 2003, 06:52:04 AM »
no, there is no 4images shoutbox ;)
but many people including myself managed add external shoutbox via <IFRAME>
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Xwoman

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shoutbox ?
« Reply #2 on: May 17, 2003, 10:46:12 AM »
ok :-) than i will make it self and will post it here   :roll:
THX

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
Shoutbox ?
« Reply #3 on: May 20, 2003, 06:39:25 AM »
I have a shoutbox on my site which I made. It works well with 4images. Only registered users of the gallery may post. If you also have the phpbb Intergration mod it has a direct link to the users profile and also uses the date format which registered users of the forum have chosen, to display the date and times of posts.

You can see it here: http://www.myleeneklass.com

I can post the code here if people want it. It's a little messy but I'm sure I can clean it up.

Offline balu

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://www.coverengine.de/4images
Shoutbox ?
« Reply #4 on: May 21, 2003, 12:27:00 PM »
Please are so kind to post your mod here - I am very interested!!!
THX very much! and also the template!
Jürgen
-------------------------------------------------------
Wer Rechtschreibfehler findet, darf sie behalten!


Offline spoiledRHOtten

  • Newbie
  • *
  • Posts: 42
    • View Profile
Shoutbox ?
« Reply #5 on: June 13, 2003, 12:44:13 AM »
I am very interested as well....will you post it please?

Thank you soo much!

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
Shoutbox ?
« Reply #6 on: June 13, 2003, 01:49:40 AM »
I am currently doing a rewrite which includes an administration feature that lets you manage shouts. Also I am compiling the code into one php file and one template file.

Here is the code I have so far. It works great.

----- Create MYSQL table -----
Code: [Select]
CREATE TABLE shoutbox (
  id int(11) NOT NULL auto_increment,
  name text NOT NULL,
  message text NOT NULL,
  timestamp int(11) NOT NULL default '0',
  ip varchar(15) NOT NULL default '0',
  browser varchar(255) NOT NULL default '',
  block int(50) NOT NULL default '0',
  KEY msg_id (id)
) TYPE=MyISAM;

----- shout.php ----- place in the 4images root
Code: [Select]
<?
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');$action = $_GET["action"];
 
if ($action == "shout") {
 
if ($message == !"" && $user_info['user_level'] >= USER){
$ip = $REMOTE_ADDR;
$info = $HTTP_USER_AGENT;
$goto = $HTTP_REFERER;
$add_date=time (void);
$message = stripslashes($message);
$message = htmlspecialchars($message);
$user_name = $user_info['user_name'];
$result=MYSQL_QUERY("INSERT INTO shoutbox (id,name,message,timestamp,ip,browser,block)".
"VALUES ('NULL', '$user_name', '$message', '$add_date', '$ip', '$info', '$block')");  
echo "<META http-equiv='refresh' content='0;URL=http://www.yourdomain/shout.php'>";
}
else {
echo "<META http-equiv='refresh' content='0;URL=http://www.yourdomain/shout.php'>";
}
}
?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Shout Box</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/templates/default/style.css" type=text/css>
</head>
<body>
            <table width="159" border="0" cellspacing="0" cellpadding="0">
              <tbody>
                <tr>
                  <td width="5"></td>
                  <td width="135">
<?php 
include&#40;"shoutbox.php"&#41;; 
?>

                  </td>
                  <td></td>
                </tr>
              </tbody>
            </table>
          </body>
</html>

----- shoutbox.php ----- place this file anywhere you like and call it up in shout.php using the 'include' function.
Code: [Select]
<?PHP
 
 $result = mysql_query("SELECT * FROM `shoutbox` WHERE block <> 1 ORDER BY 'id' DESC LIMIT 20") or died("Query Error");
 while($row = mysql_fetch_array($result))
{    
    $id = $row["id"];
    $timestamp = strftime("%d %b - %H:%M", $row["timestamp"]);
    $name = $row["name"];
    $message = $row["message"];
 $ip = $row["ip"];
 $browser = $row["browser"];
 
$badwords[] = array('shit', '****');
$badwords[] = array('tra-la-la', '****');
foreach ($badwords as $badword) {
     $message = eregi_replace($badword[0],$badword[1],$message);
  }

$message = str_replace(":)","<img src=\"/images/smile.gif\" align=\"texttop\">",$message);
$message = str_replace(":D","<img src=\"/images/teeth.gif\" align=\"texttop\">",$message);
$message = str_replace(":o)","<img src=\"/images/clown.gif\" align=\"texttop\">",$message);
$message = str_replace(":0)","<img src=\"/images/clown.gif\" align=\"texttop\">",$message);
$message = str_replace(":O)","<img src=\"/images/clown.gif\" align=\"texttop\">",$message);
$message = str_replace(":-/","<img src=\"/images/hmm.gif\" align=\"texttop\">",$message);
$message = str_replace(":(","<img src=\"/images/frown.gif\" align=\"texttop\">",$message);
$message = str_replace(":p","<img src=\"/images/tounge.gif\" align=\"texttop\">",$message);
$message = str_replace(":P","<img src=\"/images/tounge.gif\" align=\"texttop\">",$message);
$name = strtolower($name);
 
echo("<span style=\"cursor:default\"><table align=\"center\" width=\"135\" bgcolor=\"EEEEEE\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">
<tr><td>
<table width=\"135\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" title=\"Posted: $timestamp, IP Logged\">
  <tr>
  <td width=\"135\" bgcolor=\"#EEEEEE\"><font class=\"name\"> $name</font></td>
  </tr>
  <tr>
    <td><font class=\"message\">$message</font></td>
  </tr>
</table></td></tr></table></span><img src=\"/images/spacer.gif\" width=\"1\" height=\"4\" border=\"0\">");
}  
 
?>

The WHERE block <> 1 in the above MYSQL query is there to give you a bit more control over what messages are viewed. for example if you want to hide a bad or offensive message from public view but dont want it deleted, then place a '1' in the 'block' cell of the MYSQL table for that post. I added this feature because I don't like deleting the messages from MYSQL. I like to keep all the bad messages so I can track trouble makers. You can disable this feature by removing the WHERE block <> 1. Finally the code you need for your templates

----- place this code where you want the shoutbox displayed -----
Code: [Select]
<iframe src="shout.php" name="shoutbox" scrolling="no" width="159" height="235" frameborder="0" onload="document.shout.reset()"></iframe>
                  {if user_loggedin}
                  <SCRIPT language=JavaScript type=text/javascript>
<!--
function emoticon(text) {
 text = ''+text+' ';
 if (document.shout.message.createTextRange && document.shout.message.caretPos) {
  var caretPos = document.shout.message.caretPos;
  caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
  document.shout.message.focus();
 } else {
 document.shout.message.value  += text;
 document.shout.message.focus();
 }
}
//-->
</SCRIPT> <form method="post" name="shout" action="shout.php?action=shout" target="shoutbox">
                    <table align="center" cellspacing="0" cellpadding="0" width="147" border="0">
                      <tr>
                        <td colspan="2" align="center"><input type="text" name="message" maxlength="200">
                          <input type='hidden' name='block' value=''></td>
                      </tr>
                      <tr>
                        <td width="84" align="center" valign="top">
<img src="/images/smile.gif" onmouseover="this.style.cursor='hand';" onclick="emoticon(':)');" alt="// laughing&#13;&#10;click to add" width="12" height="12" hspace="1" border="0"><img src="/images/teeth.gif" onmouseover="this.style.cursor='hand';" onclick="emoticon(':D');" alt="// cheezy grin&#13;&#10;click to add" width="12" height="12" hspace="1" border="0"><img src="/images/clown.gif" onmouseover="this.style.cursor='hand';" onclick="emoticon(':o)');" alt="// clowning around&#13;&#10;click to add" width="12" height="12" hspace="1" border="0"><img src="/images/hmm.gif" onmouseover="this.style.cursor='hand';" onclick="emoticon(':-/');" alt="// upset and crying&#13;&#10;click to add" width="12" height="12" hspace="1" border="0"><img src="/images/frown.gif" onmouseover="this.style.cursor='hand';" onclick="emoticon(':(');" alt="// frowning&#13;&#10;click to add" width="12" height="12" hspace="1" border="0"><img src="/images/tounge.gif" onmouseover="this.style.cursor='hand';" onclick="emoticon(':P');" alt="// sticking your tongue out&#13;&#10;click to add" width="12" height="12" hspace="1" border="0">
                        </td>
                        <td width="63"><input type="submit" value="Shout"></td>
                      </tr>
                    </table>
                  </form>
                  {endif user_loggedin} {if user_loggedout}
                  <table align="center" cellspacing="0" cellpadding="0" width="147" border="0">
                    <tr>
                      <td align="center">Please login or register to post in the shoutbox.</td>
                    </tr>
                  </table>
                  {endif user_loggedout}


And thats it, it needs bit of modification to work on another site as it was built for myself. But the basics of the code is there. If you need any pointers please do ask.

Good luck. I will post my new version when I build it.

Carl

Offline spoiledRHOtten

  • Newbie
  • *
  • Posts: 42
    • View Profile
hi!
« Reply #7 on: June 13, 2003, 06:29:00 AM »
Thank you soo much for your help!!!!

I was wondering if you could help me out by posting your exact shoutbox.php and shout.php that you have on your page. I'm having issues formatting and i know that if I had somewhere to start I could customize from there. If you don't wish to post, you could email it to spoiledRHOtten@Hotmail.com.

I'm just really having a hard time with the layout of shoutbox.php .
THank you soo much in advance!

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
Shoutbox ?
« Reply #8 on: June 13, 2003, 06:35:17 AM »
My shoutbox uses mostly javascript and <DIV>

You can look at my source code if that will help. The contents of my shoutbox.php and shout.php are as above. Tell me which parts of the formatting you are having trouble with.

Carl

Offline Extirpator

  • Pre-Newbie
  • Posts: 9
    • View Profile
    • http://www.phoenixxx.org/
Shoutbox ?
« Reply #9 on: July 02, 2003, 04:30:43 PM »
hi,

i see your shoutbox users are linked to their profile page... how do i do that? :D

Offline Extirpator

  • Pre-Newbie
  • Posts: 9
    • View Profile
    • http://www.phoenixxx.org/
Shoutbox ?
« Reply #10 on: July 02, 2003, 04:34:32 PM »
& erm... is there a cutoff like how many shouts will appear in the box?

Offline Kyo

  • Pre-Newbie
  • Posts: 9
    • View Profile
Re: Shoutbox ?
« Reply #11 on: July 21, 2005, 02:16:37 PM »
Code: [Select]
Parse error: parse error, unexpected '&' in /home/httpd/vhosts/httpdocs/foto/shout.php on line 42 Where is the problem? :?

TheOracle

  • Guest
Re: Shoutbox ?
« Reply #12 on: August 25, 2005, 03:03:10 PM »
Let's revise shout.php and shoutbox.php for a min.

Shout.php - revised :

Code: [Select]

<?php

define
('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

$main_template "shout";

if (
$action == "shout") {

if (
$message == !"" && $user_info['user_level'] >= USER) {

$ip $REMOTE_ADDR;
$info $HTTP_USER_AGENT;
$goto $HTTP_REFERER;
$add_date time (void);
$message stripslashes(trim($message));
$message htmlspecialchars($message);
$user_name $user_info['user_name'];

$sql "

INSERT INTO "
.SHOUTBOX_TABLE."
(id, name, message, timestamp, ip, browser, block)
VALUES ('NULL', '
$user_name', '$message', '$add_date', '$ip', '$info', '$block')

"
;

$result $site_db->query($sql);

header ('refresh: 0; url=".$site_sess->url(ROOT_PATH."index.php")."');

} else {

header ('refresh: 0; url=".$site_sess->url(ROOT_PATH."index.php")."');

####### End of if statement.

$site_template->print_template($site_template->parse_template($main_template));

####### End of if statement.

?>



Then, shoutbox.php - revised :

Code: [Select]

<?php

define
('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

$main_template "shoutbox";

$sql "

SELECT *
FROM "
.SHOUTBOX_TABLE."
WHERE block <> 1
ORDER BY 'id' DESC
LIMIT 20

"
;

$result $site_db->query($sql);

while (
$row $site_db->fetch_array($result)) {    

$id $row['id'];
$timestamp strftime("%d %b - %H:%M"$row['timestamp']);
$name $row['name'];
$message $row['message'];
$ip $row['ip'];
$browser $row['browser'];

$badwords[] = array('shit''****');
$badwords[] = array('tra-la-la''****');

foreach (
$badwords as $badword) {

$message eregi_replace($badword[0], $badword[1], $message);

####### End of foreach statement.

$message str_replace(":)","<img src=\"".get_gallery_image("smile.gif")."\" border=\"0\" align=\"texttop\">",$message);
$message str_replace(":D","<img src=\"".get_gallery_image("teeth.gif")."\" border=\"0\" align=\"texttop\">",$message);
$message str_replace(":o)","<img src=\"".get_gallery_image("clown.gif")."\" border=\"0\" align=\"texttop\">",$message);
$message str_replace(":0)","<img src=\"".get_gallery_image("clown.gif")."\" border=\"0\" align=\"texttop\">",$message);
$message str_replace(":O)","<img src=\"".get_gallery_image("clown.gif")."\" border=\"0\" align=\"texttop\">",$message);
$message str_replace(":-/","<img src=\"".get_gallery_image("hmm.gif")."\" border=\"0\" align=\"texttop\">",$message);
$message str_replace(":(","<img src=\"".get_gallery_image("frown.gif")."\" border=\"0\" align=\"texttop\">",$message);
$message str_replace(":p","<img src=\"".get_gallery_image("tounge.gif")."\" border=\"0\" align=\"texttop\">",$message);
$message str_replace(":P","<img src=\"".get_gallery_image("tounge.gif")."\" border=\"0\" align=\"texttop\">",$message);
$name = (strtolower($name));

$site_template->register_vars(array(
"name" => $name,
"message" => $message,
"timestamp" => $timestamp
));

####### End of while statement.

$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a></span>";

$site_template->register_vars(array(
"clickstream" => $clickstream
));

$site_template->print_template($site_template->parse_template($main_template));
 
?>



Then, in includes/constants.php file,

add, above the ?> tag ;

Code: [Select]

define ('SHOUTBOX_TABLE', 'shoutbox');


Then, in your includes/page_header.php file,

find :

Quote

"url_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php"),


add below :

Code: [Select]

"url_shoutbox" => $site_sess->url(ROOT_PATH."shoutbox.php"),


Then, on the same file,

find :

Quote

"charset" => $lang['charset'],


add below :

Code: [Select]

"lang_shoutbox" => $lang['shoutbox'],


Then, in your templates/<your_template>/shout.html (yes, a new file you must create),

add this :

Code: [Select]

<table width="159" border="0" cellspacing="0" cellpadding="0">
             <tbody>
               <tr>
                 <td width="5"></td>
                 <td width="135">
<a href="{url_shoutbox}">{lang_shoutbox}</a>
                 </td>
                 <td></td>
               </tr>
             </tbody>
           </table>


Then, in your lang/<your_lang>/main.php file,

add the following above the ?> tag :

Code: [Select]

$lang['shoutbox'] = "Shoutbox";


Then, in your templates/<your_template>/shoutbox.html file (new file - create),

add :

Code: [Select]

<span style="cursor:default"><table align="center" width="135" bgcolor="EEEEEE" border="0" cellpadding="1" cellspacing="0">
<tr><td>
<table width="135" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" title="Posted: {timestamp}, IP Logged">
 <tr>
 <td width="135" bgcolor="#EEEEEE"><font class="name"> {name}</font></td>
 </tr>
 <tr>
   <td><font class="message">{message}</font></td>
 </tr>
</table></td></tr></table></span><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />


That should be all. ;)

Offline badass

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Shoutbox ?
« Reply #13 on: August 31, 2005, 12:25:07 PM »

Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: Shoutbox ?
« Reply #14 on: August 31, 2005, 10:26:08 PM »
Hi,

It doesn´t work for me.

you can see it at http://www.e-cardss.com/pics/shoutbox.php

i did all step by step, i also create a sql table but only i see a small line on the site.

can anybody help me?
thanx a lot