ilch Forum » Allgemein » HTML, PHP, SQL,... » shoutbox

Geschlossen
  1. #1
    User Pic
    dilf Mitglied
    Registriert seit
    29.08.2009
    Beiträge
    110
    Beitragswertungen
    0 Beitragspunkte
    hi,

    hab hier n shoutbox script und möchte das so haben, dass die member ned die namen ändern können, sondern dass die nachricht mit dem namen des members mitdem er online ist automatisch gepostet wird, aber ich bekomms einfach ned hin.

    <?php
    $ILCH_HEADER_ADDITIONS .= '
    <style type="text/css">
    <!--
    /* Bubble with an isoceles triangle
    ------------------------------------------ */
    .example-right {
    	position:relative;
    	padding:5px 5px;
    	margin:0;
    	color:#fff;
    	background:#5a8f00; /* default background for browsers without gradient support */
    	
    	/* css3 */
    	-moz-border-radius:10px;
    	-webkit-border-radius:10px;
    	border-radius:10px;
    	/* NOTE: webkit gradient implementation is not as per spec */
    	background:-webkit-gradient(linear, left top, left bottom, from(#b8db29), to(#5a8f00));
    	background:-moz-linear-gradient(top, #b8db29, #5a8f00);
    	background:-o-linear-gradient(top, #b8db29, #5a8f00);
    	background:linear-gradient(top, #b8db29, #5a8f00);
    }
    /* display of quote author (alternatively use a class on the element following the blockquote) */
    .example-right + p {margin:5px 0 2em 40px; font-style:Georgia,serif;}
    /* creates the triangle */
    .example-right:after {
    	content:"\00a0";
    	display:block; /* reduce the damage in FF3.0 */
    	position:absolute;
    	bottom:-30px;
    	left:10px;
    	width:0;
    	height:0;
    	border-width:0 20px 30px 0px;
    	border-style:solid;
    	border-color:transparent #5a8f00;
    }
    -->
    </style>
    <script language="JavaScript" type="text/javascript">
    <!--
    function klapp(div) { with(document.getElementById(div).style) { if(display=="none"){ display="inline"; } else { display="none"; }}}
    //-->
    <!--
    function simple_insert_sb(aTag,eTag) { var input = document.forms[\'shoutbox\'].elements[\'shoutbox_textarea\']; input.focus(); if(typeof document.selection != \'undefined\') { var range = document.selection.createRange(); var insText = range.text; range.text = aTag + insText + eTag;
    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(); } else if(typeof input.selectionStart != \'undefined\') { 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); 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; }else{ var pos = input.value.length; 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 insert_sb ( towrite ) { simple_insert_sb ( towrite, \'\' ); }
    //-->
    </script>
    ';
    function getsmilies_sb() {
      global $lang;
      $zeilen = 5; $i = 0;
    	$b = '<script language="JavaScript" type="text/javascript">function moreSmilies_sb() { var x = window.open("about:blank", "moreSmilies", "width=250,height=200,status=no,scrollbars=yes,resizable=yes"); ';
      $a = '';
      $erg = db_query('SELECT emo, ent, url FROM `prefix_smilies`');
    	while ($row = db_fetch_object($erg) ) {
        $b .= 'x.document.write ("<a href=\"javascript:opener.insert_sb(\''.addslashes(addslashes($row->ent)).'\')\">");';
        $b .= 'x.document.write ("<img style=\"border: 0px; padding: 5px;\" src=\"include/images/smiles/'.$row->url.'\" title=\"'.$row->emo.'\"></a>");';
        if ($i<10) {
          # float einbauen
          if($i%$zeilen == 0 AND $i <> 0) { $a .= '<br /><br />'; }
          $a .= '<a href="javascript:insert_sb(\''.addslashes($row->ent).'\')">';
          $a .= '<img style="margin: 2px;" src="include/images/smiles/'.$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>10) { $a .= '<br /><br /><center><a href="javascript:moreSmilies_sb();">'.$lang['more'].'</a></center>'; }
      $a = $b.$a;
      return ($a);
    }
    
    // Copyright by Manuel
    // Support www.ilch.de
    defined ('main') or die ('no direct access');
    
    $datum=date("j.n.Y");
    $zeit=date(" H:i ");
    
    if (loggedin()) {
        $shoutbox_VALUE_name = $_SESSION['authname'];
    } else {
        $shoutbox_VALUE_name = 'Nickname';
    }
    if (has_right($allgAr['sb_recht'])) {
        if (!empty($_POST['shoutbox_submit']) AND chk_antispam ('shoutbox')) {
            $shoutbox_nickname = escape($_POST['shoutbox_nickname'], 'string');
            $shoutbox_nickname = substr($shoutbox_nickname, 0, 15);
            $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)) {
               db_query('INSERT INTO `prefix_shoutbox` (`nickname`,`textarea`) VALUES ( "<b>' . $shoutbox_nickname . ':</b><br>'.$datum.'|'.$zeit.'" , "' . $shoutbox_textarea . '" ) ');
            }
        }
        echo '<form action="index.php?' . $menu->get_complete() . '" method="POST" name="shoutbox">';
        echo '<input type="text" style="width: 95%" name="shoutbox_nickname" value="' . $shoutbox_VALUE_name . '" onFocus="if (value == \'' . $shoutbox_VALUE_name . '\') {value = \'\'}" onBlur="if (value == \'\') {value = \'' . $shoutbox_VALUE_name . '\'}" maxlength="15">';
        echo '<textarea style="width: 95%;overflow:auto;" rows="2" name="shoutbox_textarea"></textarea>';
        $antispam = get_antispam ('shoutbox', 0);
    	echo $antispam;
    	if (!empty($antispam)) {
    		echo '<br />';
    	}
        echo '<input type="submit" value="' . $lang['formsub'] . '" name="shoutbox_submit">';
    	echo '&nbsp;&nbsp;&nbsp;<a class="smalfont" href="javascript:void(0)" onfocus="if (this.blur) this.blur()" onclick="javascript:klapp(\'smile\')">Smilies</a>';
        echo '<div id="smile" style="display:none;"><br /><br /><center>'.getsmilies_sb().'</center></div></form><br />';
    }
    $erg = db_query('SELECT * FROM `prefix_shoutbox` ORDER BY id DESC LIMIT ' . (is_numeric($allgAr['sb_limit'])?$allgAr['sb_limit']:5));
    $class = 'Cnorm';
    while ($row = db_fetch_object($erg)) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite');
        echo '<blockquote class="example-right"><p>' . preg_replace('/([^\s]{' . $allgAr['sb_maxwordlength'] . '})(?=[^\s])/', "$1\n", bbcode($row->textarea)) . '</p></blockquote>
    			<p>' . $row->nickname . '</p>
    ';
    }
    echo '<a class="box" href="index.php?shoutbox">' . $lang['archiv'] . '</a>';
    
    ?>


    betroffene Homepage: guild-wars2.net
    0 Mitglieder finden den Beitrag gut.
  2. #2
    User Pic
    Fonsi1 Mitglied
    Registriert seit
    01.05.2010
    Beiträge
    455
    Beitragswertungen
    35 Beitragspunkte
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu HTML, PHP, SQL,...

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten