Hi,
I've added a shoutbox but i have a hard time understanding how to wrapp this code into the macosx theme.
Heres the code i got: <?php
define('IN_COPPERMINE', true);
define('BOX_PHP', true);
require('include/init.inc.php');
pageheader('Shoutbox');
include("shout_cfg.php");
if(!empty($_GET['shoutbox']))
{
echo '<body bgcolor="'.$shout_bg.'">';
$fp = fopen($shout_file,"r");
$Data = fread($fp, 80000);
fclose($fp);
$Data = stripslashes($Data);
echo $shout_font.$Data. "</font>";
}
else
{
if(!empty($_POST['shout_send']))
{
$bool = strstr($_POST['shout'], "<");
if(!$bool)
{
if (empty($_POST['shout']) OR empty($_POST['username']) OR $_POST['username'] == "Username" OR $_POST['shout'] == "Message")
{
die("<p align=\"center\">".$shout_font_error.$shout_nopost."</font></p>");
}
else
{
$time = date("d/m/Y - H:i");
$fp = fopen($shout_file,"r");
$OldData = fread($fp,80000);
fclose($fp);
$Input = "(" .$time. ") <b>" .$_POST['username']. "</b>: " .$_POST['shout']. " <br>\n";
$New = $Input.$OldData;
$fp = fopen($shout_file,"w+");
fwrite($fp, $New, 80000);
fclose( $fp );
}
}
}
?>
<style type="text/css">
.form {font-family: Arial, Helvetica, sans-serif; font-size: 10px; border: 1px solid #666666;}
</style>
<script language="JavaScript" type="text/JavaScript">
var AMOUNT = 1;
var TIME = 1;
var timer = null;
function scrollIt_down(v){
var direction=v?1:-1;
var distance=AMOUNT*direction;
frames['shoutbox'].window.scrollBy(0,distance);
}
function down(v){
if(timer) { clearInterval(timer); timer=null; }
if(v)timer=setInterval("scrollIt_down(true)",TIME);
}
function scrollIt_up(v){
var direction=v?1:-1;
var distance=AMOUNT*direction;
frames['shoutbox'].window.scrollBy(0,-distance);
}
function up(v){
if(timer) { clearInterval(timer); timer=null; }
if(v)timer=setInterval("scrollIt_up(true)",TIME);
}
</script>
<form method="POST">
<table border="0" align="center" class="tn">
<tr>
<td><table border="1" cellpadding="10" cellspacing="0" align="center" width="<?php echo $shout_width; ?>" >
<tr>
<td> <iframe name="shoutbox" id="shoutbox" src="shout.php?shoutbox=1" width="<?php echo $shout_width - 20; ?>" height="<?php echo $shout_height; ?>" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" style="background-color:transparent" allowtransparency="true">
</iframe> </td>
<td width="1"><div align="right"><a href="#" onMouseOver="up(true);" onMouseOut="up(false);" onClick="return false;"><img border="0" src="<?php echo $shout_up_img; ?>" width="10" height="10"></a><br>
<a href="#" onMouseOver="down(true);" onMouseOut="down(false);" onClick="return false;"><img border="0" src="<?php echo $shout_down_img; ?>" width="10" height="10"></a></div></td>
</tr>
</table></td>
</tr>
</table>
<?php
if (USER_NAME != "Guest")
{
?>
<table border="0" align="center">
<tr>
<td><font size="1"><?php echo $shout_msg; ?></font> </td>
<td>
<input type="text" class="form" name="shout" size="<?php echo $shout_input_size; ?>" value="" maxlength="200"> <input type="submit" class="form" value="<?php echo $shout_post; ?>" name="shout_send">
<input type="hidden" name="username" value="<?php echo stripslashes(USER_NAME); ?>">
</td>
</tr>
</table>
<?php
}
else
{
echo '<p align="center"><a href="login.php"><b>Login</b></a> to post.</p>';
}
?>
</form>
<?php
}
?>
I've gotten help before to wrap a javascript into coppermine, however this is different as it mixes alot of php and html, im not that experienced!
Anyone up for the challenge?
Thanks!