Shoutbox

php shoutbox help - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: php shoutbox help (/showthread.php?tid=53730)

php shoutbox help by Supersonicdarky on 12-08-2005 at 08:21 PM

why doesnt it work?

http://www.kernelsgamez.com/new/shoutbox.php

i suck in php so i dont know what the errors mean :(


RE: php shoutbox help by absorbation on 12-08-2005 at 08:23 PM

can we view your page sorce + the shoutbox source please? :)


RE: php shoutbox help by user35870 on 12-08-2005 at 08:26 PM

Make sure in shoutbox.php there's no spaces before <?php or after ?>.


RE: RE: php shoutbox help by Supersonicdarky on 12-08-2005 at 08:28 PM

No spaces

quote:
Originally posted by Absorbation
can we view your page sorce + the shoutbox source please? :)


here:

code:
<?php
header ( 'Content-Type: text/html; charset=utf-8' );
ob_start ( );
//--------------------------------------------------
// User defined settings. 1 = enable/allow, 0 = disable/disallow
//--------------------------------------------------

// Admin password, change it!!
$sb_admin_password = '****************';

// URL to access the shoutbox. Ex: http://yoursite.com/index.php?page=shoutbox or http://yoursite.com/shoutbox.php
$sb_url = 'http://www.kernelsgamez.com/new/shoutbox.php';

// Order of shouts on the page: 1 for newest shouts to oldest, 0 for oldest to newest
$sb_shouts_order = 1;

// Enable basic checkings to make sure your server can run the shoutbox
$sb_checking = 1;

// Shouts to display per page. 0 for all on one page
$sb_perpage =  10;

// Max characters allowed in poster's name
$sb_max_name_length = 40;

// max characters allowed in poster's message
$sb_max_message_length = 1000;

// The date format, not very important
$sb_date_format = 'm/d/y h:i A';

// timezone different, enter positive or negative HOURS. Enter 0 for no difference
$sb_time_zone = 0;

// spam protection timeout (user will not be able to post again in X seconds)
$sb_spam_timeout = 15;

// insert line breaks for looooooooooooonnnnnnnngggggggg words over this many characters
$sb_wordwrap_length = 90;

// Enable or disable tracking of users reading the shoutbox.
$sb_users_online = 1;

// Timeout in seconds before user is considered OFFLINE(from the shoutbox)
$sb_users_timout = 30;

// Bad word filter, "bitch" will be replaced with "*****"
$sb_language_filter = 1;

// Bad words. Just seperate them words with a command like so: "bad,word,hehe,yes,very,naughty".
//Try not to leave any spaces in between the words, like this: "bad, words, suck, yeah , i know".
$sb_bad_words = 'bitch,fuck,shit,faggot,dick,asshole,gay,nigger,jew';

// Allow BB code
$sb_allow_bb = 1;

// Allow IMG tags with BB codes.
$sb_allow_img_tags = 0;

// Allow smilies parsing. Turns :) into the smilie image.
$sb_allow_smilies = 1;

// URL to the folder of smilies.
// Add trailing slash at the end, meaning "http://google.com/smilies" is wrong, "http://google.com/smilies/" is correct!
$sb_smilies_url = 'smilies/';

//--------------------------------------------------
// Smilies table, if you have disabled smilies, then don't worry about this.
// Look carefully and follow the pattern. The format is:
//     'smilie text'    =>    'smilie icon',
//--------------------------------------------------
$sb_smilies = array
( // Edit in here, don't delete this parenthesis --------------------------------------
    ':)'            => 'smile.gif',
    ':('            => 'frown.gif',
    ':D'            => 'biggrin.gif',
    '=D'            => 'biggrin.gif',
    ';)'            => 'wink.gif',
    ':-/'           => 'rolleyes.gif',
    '8-)'           => 'cool.gif',
    ':cool:'        => 'cool.gif',
    ':tard:'        => 'tard.gif',
    ':mad:'         => 'mad.gif',
    ':o'            => 'eek.gif',
    ':eek:'         => 'eek.gif',
    ':confused:'    => 'confused.gif',
    'b7'            => 'dancebaconsmall.gif',
    ':google:'      => 'google.gif',
    ':lol:'         => 'lol.gif',
); // don't delete this parenthesis and semicolon------------------------


//------------------------------------------------------------------------------
// Avoid variable conflicts. Chances are there will be none but you never know.
//-----------------------------------------------------------------------------
define ( 'G_ACTION',      'act'                     );
define ( 'G_TASK',        'task'                    );
define ( 'G_PAGE',        'pagenumber'              );
define ( 'G_MESSAGE',     'message'                 );
define ( 'G_SHOUTID',     'shoutid'                 );
define ( 'G_HIGHLIGHT',   'highlight'               );
define ( 'G_BACKURL',     'redir'                   );
define ( 'G_QUERY',       'query'                   );

define ( 'P_NAME',        'name'                    );
define ( 'P_MESSAGE',     'message'                 );
define ( 'P_URL',         'url'                     );
define ( 'P_PRIVATE',     'private'                 );
define ( 'P_EMAIL',       'email'                   );
define ( 'P_REMEMBER',    'remember'                );
define ( 'P_ADMIN_PW',    'shoutbox_admin_pw'       );
define ( 'P_TIMEOUT',     'timeout'                 );
define ( 'P_SHOUTS',      'shouts'                  );
define ( 'P_FORM_TASK',   'task'                    );
define ( 'P_IP_ADDR',     'ip_address'              );
define ( 'P_QUERY',       'query'                   );

define ( 'C_NAME',        'shoutbox_name'           );
define ( 'C_URL',         'shoutbox_url'            );
define ( 'C_EMAIL',       'shoutbox_email'          );
define ( 'C_ADMIN_PW',    'shoutbox_admin_pw'       );
define ( 'C_LAST_POST',   'shoutbox_lastpost'       );

//------------------------------------------------------------------------------
// Not much to change in here, (24)
//-----------------------------------------------------------------------------
define ( 'E_NONAME',      1                         );
define ( 'E_LONGNAME',    2                         );
define ( 'E_NOMSG',       3                         );
define ( 'E_LONGMSG',     4                         );
define ( 'E_BAD_PW',      5                         );
define ( 'E_NO_MSG',      6                         );
define ( 'E_INVALID',     10                        );
define ( 'E_NO_SELECTED', 11                        );
define ( 'E_NOTFOUND',    15                        );
define ( 'E_INVALID_IP',  22                        );
define ( 'E_NOQUERY',     23                        );

define ( 'M_LOGGED_OUT',  7                         );
define ( 'M_DEL_FAILED',  8                         );
define ( 'M_DEL_SUCCESS', 9                         );
define ( 'M_EDITED',      13                        );
define ( 'M_NOTEDITED',   14                        );
define ( 'M_BLOCKED',     19                        );
define ( 'M_IP_BLKD',     20                        );
define ( 'M_IP_UNBLKD',   21                        );
define ( 'M_SPAM',        24                        );

define ( 'SHOUTBOX',      'yes'                     );
define ( 'SHOUTS_DIR',    'shouts'                  );
define ( 'ONLINE_FILE',   'online.dat'              );
define ( 'BLOCKED_FILE',  'blocked_ips.dat'           );

//----------------------------------------------------------------------------
// Output messages. Change if you want.
//----------------------------------------------------------------------------
$sb_language = array (

         E_NONAME           => 'You need a name.',

         E_LONGNAME         => 'Your name is longer than ' . $sb_max_name_length . ' characters.',

         E_NOMSG            => 'You need something to say.',

         E_LONGMSG          => 'Your message is longer than ' . $sb_max_message_length . ' characters.',

         E_BAD_PW           => 'Incorrect password. Try again.',

         E_NO_MSG           => 'No message to display',

         E_INVALID          => 'Invalid action.',

         E_NO_SELECTED      => 'You did not select any shout.',

         E_NOTFOUND         => 'That shout does not exist.',

         E_INVALID_IP       => 'That IP address is invalid. IP addresses look like 123.123.123.123',

         E_NOQUERY          => 'You did not specify a search term or your one of the terms is shorter than 3 characters.',

         M_BLOCKED          => 'You have been blocked from posting on this shoutbox by the Administrator.',

         M_LOGGED_OUT       => 'You have been logged out. You will be taken to the shoutbox.',

         M_DEL_SUCCESS      => 'Shouts successfully deleted.',

         M_DEL_FAILED       => 'Unable to delete shout(s).',

         M_EDITED           => 'Shout successfully edited.',

         M_NOTEDITED        => 'An error has occured while editing. The shout ID was invalid therefore the shout could not be found.',

         M_IP_BLKD          => 'IP was blocked.',

         M_IP_UNBLKD        => 'IP was unblocked.',

         M_SPAM             => 'Please wait ' . $sb_spam_timeout . ' seconds before making another post.',

);

//----------------------------------------------------------------------------
// Nothing to edit down here, save this file and you are done!
//----------------------------------------------------------------------------

$sb_old_magic_quotes = get_magic_quotes_runtime( );

set_magic_quotes_runtime( 0 );


function timer ( $start = 0, $digits = 8 )
{
    list ( $m, $s ) = explode ( ' ', microtime ( ) );

    return round ( (double)$s + (double)$m - $start, $digits );
}

$sb_timer_start = timer ( );

//--------------------------------------------------
// Get some variables
//--------------------------------------------------
$sb_root = str_replace ( 'shoutbox.php', '', __FILE__ );

//--------------------------------------------------
// Load some files
//--------------------------------------------------
if ( !file_exists ( $sb_root . 'shoutbox.functions.php' ) )
{
    print 'Could not find "shoutbox.functions.php" in "' . $sb_root . '"';

    return;
}
else
{
    require ( $sb_root . 'shoutbox.functions.php' );
}

//--------------------------------------------------
// Clean GPC
//--------------------------------------------------
$_GET2    = get_magic_quotes_gpc ( ) ? stripslashes_gpc ( $_GET ) : $_GET;
$_POST2   = get_magic_quotes_gpc ( ) ? stripslashes_gpc ( $_POST ) : $_POST;
$_COOKIE2 = get_magic_quotes_gpc ( ) ? stripslashes_gpc ( $_COOKIE ) : $_COOKIE;


//--------------------------------------------------
// Do some checking before starting
//--------------------------------------------------
if ( $sb_checking && ini_get ( 'safe_mode' ) )
{
    print 'Safe mode is on. To ignore this and continue, change checking to 0';

    return;
}

if ( !file_exists ( $sb_root . SHOUTS_DIR ) )
{
    print "The 'shouts' directory does not exists in '$sb_root'";

    return;
}
else
{
    if ( !is_writeable ( $sb_root . SHOUTS_DIR ) )
    {
        print "The 'shouts' directory (" . $sb_root . SHOUTS_DIR  .") is not writeable. <a href=\"http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=chmod\">CHMOD</a> it to 0666/0755/0755.";

        return;
    }
}

if ( $sb_users_online )
{
    if ( !file_exists ( $sb_root . ONLINE_FILE ) )
    {
        print 'The users file does not exists. You cannot track users online. Create an emtpy file called "' . ONLINE_FILE . '" inside the directory "' . $sb_root . '" and CHMOD it to 0666.';

        return;
    }
    if ( !is_writeable ( $sb_root . ONLINE_FILE ) )
    {
        print 'The users online file "' . $sb_root . ONLINE_FILE . '" is not writeable. CHMOD it to 0666 or 0777.';

        return;
    }
}

if ( !file_exists ( $sb_root . BLOCKED_FILE ) )
{
    print 'The blocked ip file does not exists. Create an emtpy file called "' . BLOCKED_FILE . '" inside the directory "' . $sb_root . '" and CHMOD it to 0666.';

    return;
}
if ( !is_writeable ( $sb_root . BLOCKED_FILE ) )
{
    print 'The blocked ip file "' . $sb_root . BLOCKED_FILE . '" is not writeable. CHMOD it to 0666 or 0777.';

    return;
}

//--------------------------------------------------
// Is there a header?
//--------------------------------------------------
print file_exists ( $sb_root . 'shoutbox_header.htm' ) ? get_template ( $sb_root . 'shoutbox_header.htm' ) : '';

//--------------------------------------------------
// Load in action file
//--------------------------------------------------
$sb_action = isset ( $_GET2[G_ACTION] ) ? $_GET2[G_ACTION] : 'Default' ;

switch ( $sb_action )
{
    case 'help': require ( $sb_root . 'shoutbox.help.php' ); break;

    case 'admin':

         require ( $sb_root . 'shoutbox.admin.php' );

    break;

    case 'add': require ( $sb_root . 'shoutbox.add.php' ); break;

    case 'search': require ( $sb_root . 'shoutbox.search.php' ); break;

    case 'stats': require ( $sb_root . 'shoutbox.stats.php' ); break;

    case 'showmsg':

         $sb_back_url = isset ( $_GET2[G_BACKURL] ) ? $_GET2[G_BACKURL] : ( isset ( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : $sb_url );

         header ( 'Refresh: 2;URL=' . $sb_back_url );

         $sb_message = isset ( $_GET2[G_MESSAGE] ) ? $_GET2[G_MESSAGE] : 0;

         $sb_output = isset ( $sb_language[$sb_message] ) ? $sb_language[$sb_message] : $sb_language[E_NO_MSG];

         print get_template ( $sb_root . 'shoutbox_message.htm', array ( 'message' => $sb_output, 'back_url' => $sb_back_url ) );

    break;

    default:
            require ( $sb_root . 'shoutbox.default.php' );
    break;
}

//--------------------------------------------------
// Is there a footer?
//--------------------------------------------------
print file_exists ( $sb_root . 'shoutbox_footer.htm' ) ? get_template ( $sb_root . 'shoutbox_footer.htm', array ( 'timer' => timer ( $sb_timer_start, 4 ) ) ) : '';

set_magic_quotes_runtime( $sb_old_magic_quotes );

ob_end_flush ( );
?>



page source:

code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">
<html>
<head>
    <title>Kernel's Gamez</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" type="text/css" href="stylde.css" />
</head>
<body>
<div id="main">

    <div id="left">
        <div id="top">
            <dl class="left">
                <dt><b>About</b></dt>
                <p>Kernel's Gamez is commited to brining you the best gamez possible, and also very easily accesible. You may suggest what gamez we should add. We are very welcome to have you here. Enjoy!</p>
            </dl>
            <dl class="right">
                <dt><b>Info</b></dt>
                <p>Welcome to Kernel's Gamez. Currently we are at <b>70</b> gamez and still counting! If you have any comments/suggestions or would like to be a news poster, feel free to <a href="contact.php">contact</a> me.</p>
            </dl>
            <div id="topbottom"></div>
        </div>
        <div id="content">
            <div id="headline">
                <h1>Kernel's Gamez</h1>



            </div>
<h2>Shoutbox</h2>

<center>
   <?php
   include ( '../shoutbox/shoutbox.php' );
   ?>
</center>

        </div>


    </div>
   
    <div id="right">
    <div style="background: url(images/topright.gif) no-repeat top right; height: 10px;">&nbsp;</div>
    <div id="inner">
        <form action="#" method="post">
            <label for="name">Name:</label><input type="text" size="10" name="name" id="name" />
            <label for="pw">Password:</label><input type="password" size="10" name="pw" id="pw" />
            <div style="text-align: right;"><a href="">Register</a> | <input type="submit" class="button" value="Go!" name="button" /></div>
        </form>

<form name="sites">
<select style="font-size:9px;color:#59BF3F;font-family:verdana;background-color:#ffffff;" name="menu" onChange="window.open(document.sites.menu.options[document.sites.menu.selectedIndex].value);">
<option value=''>Original Gaming Sites</option>
<option value="http://newgrounds.com/">Newgrounds.com</option>
<option value="http://www.nationlocation.com/">Nationlocation.com</option>
<option value="http://www.mausland.de/">Mausland.de</option>
<option value="http://www.mindistortion.net/">Mindistortion.net</option>
<option value="http://www.gamesarcade.com">Gamesarcade.com</option>
<option value="http://www.ebaumsworld.com">Ebaumsworld.com</option>
<option value="http://www.hurtwood.deamon.co.uk">Hurtwood.deamon.co.uk</option>
<option value="http://www.miniclip.com">Miniclip.com</option>
<option value="http://www.skunkstudios.com">Skunkstudios.com</option>
<option value="http://www.2flashgames.com">2Flashgames.com</option>
</select>
</form>


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="150" height="15" id="xspf_player" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://musicplayer.sourceforge.net/xspf_player.swf?playlist_url=http://webjay.org/by/hideout/zuardi05.xspf&repeat_playlist=true " />
<param name="quality" value="high" />
<param name="bgcolor" value="#e6e6e6" />
<embed src="http://musicplayer.sourceforge.net/xspf_player.swf?player_title=Kernel's Gamez Music -- Click to Start&amp;playlist_url=http://webjay.org/by/hideout/zuardi05.xspf&repeat_playlist=true " quality="high" bgcolor="#e6e6e6" width="150" height="15" name="xspf_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


<br /><br />
        <h5>Navigation</h5>
        <ul class="nav">
            <li><a href="index.php">Home</a></li>
            <li><a href="contact.php">Contact</a></li>
            <li><a href="downloads.html">Downloads</a></li>
            <li><a href="links.php">Links</a></li>
            <li><a href="shoutbox.html">Shoutbox</a></li>
            <li><a href="store.php">Store</a></li>
        </ul>
        <h5>Generes</h5>
        <ul class="nav">
            <li><a href="action.php">Action</a></li>
            <li><a href="adventure.php">Adventure</a></li>
            <li><a href="other.php">Other</a></li>
            <li><a href="puzzle.php">Puzzle</a></li>
            <li><a href="retro.php">Retro</a></li>
            <li><a href="sports.php">Sports</a><li>
        </ul>

        <h5>Visits</h5>
            <p>Since 28/05/05</p><p><IMG src="http://counters.freewebs.com/Members/Counters/counter.jsp?userid=11287498&name=Counter"></p>


        <h5>Rate This Site</h5>
        <form action="http://www.neowin.net/toplist/index.php?act=rate&amp;site=786" method="post">

  <select name="rating">
    <option value="5">5</option>
    <option value="4">4</option>
    <option value="3" selected>3</option>
    <option value="2">2</option>
    <option value="1">1</option>

  </select>
  <input type="submit" value="Rate It!" />
</form>


    </div>
    </div>
    <br style="clear: both;" />
</div>
<div id="footer">&copy 2005 Kernel's Gamez<br />
By t-3k
</div>
</body>

<script language="javascript">

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

</script>

</html>


RE: php shoutbox help by zaher1988 on 12-08-2005 at 08:43 PM

hey kernel !! umm

in case you change ur mind of using that shoutbox !! try
SayBox


RE: php shoutbox help by Supersonicdarky on 12-08-2005 at 08:44 PM

i had that, but it has ads and i want to host it my self


RE: php shoutbox help by Plik on 12-08-2005 at 08:56 PM

quote:
Originally posted by Supersonicdarky
blah....
<center>
   <?php
   include ( '../shoutbox/shoutbox.php' );
   ?>
</center>
blah..
thats your problem, because your including the php script in the middle of the page, when it try to set the headers on the first line of the script it cant because the html before it has already been sent.
delete this line from shoutbox.php
code:
header ( 'Content-Type: text/html; charset=utf-8' );
and put it at the top of the html file, like this
code:
<?php header ( 'Content-Type: text/html; charset=utf-8' ); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">

RE: php shoutbox help by Supersonicdarky on 12-08-2005 at 08:59 PM

removed the tags, still errors

or did u mean something else?


RE: php shoutbox help by Plik on 12-08-2005 at 09:01 PM

opps i forgot to surround it with <?php ?> :-$

code:
<?php header ( 'Content-Type: text/html; charset=utf-8' ); ?>

RE: php shoutbox help by Supersonicdarky on 12-08-2005 at 09:06 PM

still errors

just incase if i got it wrong:

code:
<?php header ( 'Content-Type: text/html; charset=utf-8' ); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">
<html>
<head>
    <title>Kernel's Gamez</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" type="text/css" href="stylde.css" />
</head>
.....


RE: php shoutbox help by Plik on 12-08-2005 at 09:09 PM

actually i just looked at the meta tags in your html file and because you declair the content type there you dont need that line of code, so you can just delete it :chrongue:


RE: php shoutbox help by Supersonicdarky on 12-08-2005 at 09:11 PM

thrn how do i fix it? :S


RE: php shoutbox help by ShawnZ on 12-08-2005 at 09:24 PM

quote:
Originally posted by Supersonicdarky
     header ( 'Refresh: 2;URL=' . $sb_back_url );
also needs to go. And, you don't need the first header() anyway.... :-/
RE: php shoutbox help by Supersonicdarky on 12-08-2005 at 09:55 PM

i get error when i try to admin login

when wrong pass:

code:
Warning: Cannot modify header information - headers already sent by (output started at /home/ssd/public_html/new/shoutbox.php:14) in /home/ssd/public_html/shoutbox/shoutbox.admin_login.php on line 21

when right:
code:
Warning: Cannot modify header information - headers already sent by (output started at /home/ssd/public_html/new/shoutbox.php:14) in /home/ssd/public_html/shoutbox/shoutbox.admin_login.php on line 15

Warning: Cannot modify header information - headers already sent by (output started at /home/ssd/public_html/new/shoutbox.php:14) in /home/ssd/public_html/shoutbox/shoutbox.admin_login.php on line 17

RE: php shoutbox help by ShawnZ on 12-08-2005 at 10:05 PM

whatever shoutbox you are using needs to be on its own page, not included in a custom one.


RE: php shoutbox help by Supersonicdarky on 12-08-2005 at 10:07 PM

but it can:

quote:
Originally posted by Readme

Installation
------------------------------------------------------------------------
1. Extract the files to a temporary directory. Open shoutbox.php
and edit the settings. REMEMBER CHANGE THE ADMIN PASSWORD!!
The settings are explained in the shoutbox file.

2. Upload to your server. The PHP files, the HTM files,
and the directory "shouts" must be in the same directory.

3. CHMOD the "shouts" directory to 0666 or 0777

4. CHMOD the *.dat files to 0666 or 0777

5. Include the shoutbox into your page via PHP or iframe.

   Using PHP
   *****************************************************
   <?php
   include ( '/path/to/shoutbox.php' );
   ?>
   *****************************************************

   Using Iframes (not recommended,a lot of browsers other than IE cannot render iframes properly!):
   *****************************************************
   <iframe src="http://yoursite.com/path/to/shoutbox.php"></iframe>
   *****************************************************

RE: php shoutbox help by ShawnZ on 12-08-2005 at 10:14 PM

well then the readme sucks.