hier ist mal die php von shoutbox
<?php # Copyright by Manuel # Support www.ilch.de defined ('main') or die ( 'no direct access' ); //Smilies in der Textarea ausgeben function smilies ($string) { global $smilies_array; if (!isset($smilies_array)) { $smilies_array = array(); $erg = db_query("SELECT ent, url, emo FROM `prefix_smiliesshb`"); while ($row = db_fetch_object($erg) ) { $smilies_array[$row->ent] = $row->emo.'#@#-_-_-#@#'.$row->url; } } foreach ($smilies_array as $k => $v) { list($emo, $url) = explode('#@#-_-_-#@#', $v); $string = str_replace($k,'<img src="include/images/smiliesshb/'.$url.'" border="0" alt="'.$emo.'" title="'.$emo.'" />',$string); } return $string; } //Smilies in die Textarea übermitteln function smiliesshb () { global $lang; $zeilen = 5; $i = 0; $b = '<script language="JavaScript" type="text/javascript">function moreSmilies () { var x = window.open("about:blank", "moreSmilies", "width=900,height=500,left=485,top=150,status=no,scrollbars=yes,resizable=yes"); '; $a = ''; $erg = db_query('SELECT emo, ent, url FROM `prefix_smiliesshb`'); while ($row = db_fetch_object($erg) ) { $b .= 'x.document.write ("<a href=\"javascript:opener.put_shb(\''.addslashes(addslashes($row->ent)).'\')\">");'; $b .= 'x.document.write ("<img style=\"border: 0px; padding: 5px;\" src=\"include/images/smiliesshb/'.$row->url.'\" title=\"'.$row->emo.'\"></a>");'; if ($i<0) { # float einbauen if($i%$zeilen == 0 AND $i <> 0) { $a .= '<br /><br />'; } $a .= '<a href="javascript:put_shb(\''.addslashes($row->ent).'\')">'; $a .= '<img style="margin: 2px;" src="include/images/smilesshb/'.$row->url.'" border="0" title="'.$row->emo.'"></a>'; } $i++; } $b .= ' x.document.write("<br /><br /><center><a href=\"javascript:window.close();\">'.$lang['close'].'</a></center>"); x.document.close(); }</script>'; if ($i>0) { $a .= '<a href="javascript:moreSmilies();">Smilies</a>'; } $a = $b.$a; return ($a); } // IP und Zeit ausgeben $shoutbox_VALUE_name2 = getenv("REMOTE_ADDR"); $datum = date("j.n.Y"); $zeit = date(" H:i "); //Nickname und Gast if ( loggedin() ) { $shoutbox_VALUE_name = $_SESSION['authname']; } else { $shoutbox_VALUE_name = 'Gast'; } //Shoutbox , Namenschutz if (has_right($allgAr['sb_recht'])){ if (!empty($_POST['shoutbox_submit']) AND chk_antispam ('shoutbox')) { $insert = true; if (!loggedin()) { $shoutbox_nickname = escape($_POST['shoutbox_nickname'], 'string'); $shoutbox_nickname = substr($shoutbox_nickname, 0, 15); if (db_count_query("SELECT COUNT(*) FROM prefix_user WHERE name LIKE '%$shoutbox_nickname%'") > 0) { $insert = false; echo '<center><font color="#ff0000">Benutzen sie einen anderen Namen, dieser ist bereits vergeben.</font></center><br />'; } } else { $shoutbox_nickname = escape($_SESSION['authname'], 'string'); } $shoutbox_textarea = escape($_POST['shoutbox_textarea'], 'textarea'); $shoutbox_textarea = preg_replace("/\[.?(url|b|i|u|img|code|quote)[^\]]*?\]/i", "", $shoutbox_textarea); $shoutbox_textarea = strip_tags($shoutbox_textarea); if (!empty($shoutbox_nickname) AND !empty($shoutbox_textarea) AND $insert) { db_query('INSERT INTO `prefix_shoutbox` (`nickname`,`textarea`,`time`) VALUES ( "' . $shoutbox_nickname . '" , "' . $shoutbox_textarea . '", ' . time() . ' ) '); } } ?> <script type="text/javascript"> // S-Box-Smileys START function simple_insert_shb(aTag,eTag) { var input = document.forms['shoutbox'].elements['shoutbox_textarea']; input.focus(); /* für Internet Explorer */ if(typeof document.selection != 'undefined') { /* Einfügen des Formatierungscodes */ var range = document.selection.createRange(); var insText = range.text; range.text = aTag + insText + eTag; /* Anpassen der Cursorposition */ range = document.selection.createRange(); if (insText.length == 0) { range.move('character', -eTag.length); } else { range.moveStart('character', aTag.length + insText.length + eTag.length); } range.select(); } /* für neuere auf Gecko basierende Browser */ else if(typeof input.selectionStart != 'undefined') { /* Einfügen des Formatierungscodes */ var start = input.selectionStart; var end = input.selectionEnd; var insText = input.value.substring(start, end); input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end); /* Anpassen der Cursorposition */ var pos; if (insText.length == 0) { pos = start + aTag.length; } else { pos = start + aTag.length + insText.length + eTag.length; } input.selectionStart = pos; input.selectionEnd = pos; } /* für die übrigen Browser */ else { /* Abfrage der Einfügeposition */ var pos = input.value.length; /* Einfügen des Formatierungscodes */ var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:"); input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos); } } function put_shb ( towrite ) { simple_insert_shb ( towrite, '' ); } // S-Box-Smileys END </script> <?php echo '<link rel="stylesheet" href="include/boxes/shoutbox/shoutbox_style.css" type="text/css"/>'; echo '<form action="index.php" method="POST" name="shoutbox">'; echo '<table width="100%" cellpadding="1" cellspacing="1" border="0" class="shoutbox_oben"> <tr><td style="font-size:11px; text-align:center;"> </b></td></tr> '; echo ' <tr><td align="center">'.$avatar.' <input type="text" size="15px" name="shoutbox_nickname" value="'.$shoutbox_VALUE_name.'" onFocus="if (value == \''.$shoutbox_VALUE_name.'\') {value = \'\'}" onBlur="if (value == \'\') {value = \''.$shoutbox_VALUE_name.'\'}" maxlength="15"> '.get_antispam ('shoutbox', 0).'<input type="submit" value="'.$lang['formsub'].'" name="shoutbox_submit"> <textarea style="width: 90%" cols="5" rows="2" name="shoutbox_textarea"></textarea> '.smiliesshb ('shoutbox', 0).' | <span style="float:center;"><a class="archivbut_sh_box" href="index.php?shoutbox" title="Shoutbox Archiv anzeigen">'.$lang['archiv'].'</a></span></td></tr> '; echo '</form>'; } else { //Gaeste echo '<link rel="stylesheet" href="include/boxes/shoutbox/shoutbox_style.css" type="text/css"/>'; echo '<table width="100%" cellpadding="2" cellspacing="1" border="0" class="shoutbox_oben"> <tr><td style="font-size:11px; text-align:center;"><span style="font-size:10px;color:#888888;"><b>Zum Posten<br />Bitte Einloggen!<br /></b><span style="font-size:10px;color:#FFF;">Deine IP: '.$shoutbox_VALUE_name2.'</td></tr> </table><br/>'; } echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><td height="10"></td>'; $erg = db_query('SELECT `prefix_shoutbox`.*, `prefix_user`.name,`prefix_user`.`id` as uid, `prefix_user`.avatar FROM `prefix_shoutbox` LEFT JOIN `prefix_user` ON `prefix_user`.name = `prefix_shoutbox`.nickname ORDER BY id DESC LIMIT ' . (is_numeric($allgAr['sb_limit'])?$allgAr['sb_limit']:5)); $class = 'Cnorm'; while ($row = db_fetch_object($erg)) { // Avatar prüfen und ggf. anzeigen if ($allgAr['sh_avatar'] == 1) { if ($row->name) { if (file_exists($row->avatar)) { $avatar = $row->avatar; // $row->avatar sollte den Pfad zum Bild enthalten } else { $avatar = 'include/images/avatars/wurstegal.jpg'; } } else { $avatar = 'include/images/avatars/wurstegal_gast.jpg'; } $avatar = '<img src="'.$avatar.'" class="gradualfader" border="0" width="55"/>'; } else { $avatar = ''; } if ($row->uid) { $nickname = '<a href="index.php?user-details-'.$row->uid.'">'.$row->nickname.'</a>'; } else { $nickname = '.$row->nickname.'; } $class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' ); $time = is_null($row->time) ? '<br />' : ' '.date('d.m.y - H:i',$row->time).' Uhr'; echo ' <tr><td class="shoutboxfeld"><span class="time_sh_box" title="Eintrag von '.$row->nickname.' am '.$time.'"> <span style="float:left;width: 59px;"><a href="index.php?user-details-'.$row->uid.'"><div class="hovergallery">'.$avatar.'</div></a></span><span style="font-size:10px;color:#FF0000;"><span style="float:left;"> '.$row->nickname.'</span><br> <span style="font-size:10px;color:#FF0000;"><span style="float:left;"> '.$time.'</span><br> <span style="font-size:10px;color:#999999;">'.smilies(preg_replace( '/([^\s]{'.$allgAr['sb_maxwordlength'].'})(?=[^\s])/', "$1\n", bbcode($row->textarea))).'</td></tr> <tr><td class="shoutboxend"></td></tr> <tr><td class="losse"><td height="5"></td></tr>'; } echo '</table>'; ?>
Zuletzt modifiziert von MG-Mike am 15.05.2013 - 00:50:52