Ir para conteúdo
Fórum Script Brasil
  • 0

Mural De Recados


lcslucas

Pergunta

Bom galera, eu peguei este script de mural de recados pronto da internet e editei conforme o que eu queria, so que tem um probleminha, quando eu posto alguma msg ele posta duas a mesma msg ao em ves de postar somente uma vez, porque isto esta acontecendo, bom se alguém conseguir me dar uma forca ae eu ficaria muito grato, o script é esse ae embaixo..!!!

<?

################### INICIALIZAÇÃO DAS VARIÁVEIS #######################

include ("config.php");

include ("funcoes.php");

include ("idiomas/${idioma}.php");

if (($_GET['exibido'] == '') or ($_GET['pagina'] == '')){

   $pagina = 0;

}

conecta();

$sql   = @mysql_query ("SELECT * FROM mural ORDER BY id DESC LIMIT $pagina, $exibido")or die ("<font color=#FF0000><b>$idioma_selecio_dados</b></font>");

$sql2  = @mysql_query ("SELECT * FROM mural")or die ("<font color=#FF0000><b>$idioma_selecio_dados</b></font>");

$posts = @mysql_num_rows ($sql2);

#######################################################################

################### INSERÇÃO DOS DADOS DO MURAL #######################

if ($_POST['acao'] == "cadastrar"){

   conecta();

   $ip      = getenv("REMOTE_ADDR");

   $browser = getenv("HTTP_USER_AGENT");

   $nome    = $_POST['nome'];

   $para     = $_POST['para'];

   $data     = $_POST['data'];

   $msg     = codifica_msg(strip_tags ($_POST['comentario']));

   if (empty($nome)){

  $erro = $idioma_nome_vazio; $err = 1;

   }

   if (empty($para)){

     $erro = $idioma_para_vazia; $err = 1;

   }

   elseif (empty($msg)){

     $erro = $idioma_msg_vazia; $err = 1;

   }

   else{

     @mysql_query ("INSERT INTO mural (ip, browser, nome, para, data, mensagem) VALUES ('$ip','$browser','$nome','$para','$data','$msg')")

  or die ("<font color=#FF0000><b>$idioma_inserir_dados</b></font>");

  header("Location: mural.php");

   }

}

########################################################################

?>

<html>

<head>

<title><? echo $idioma_titulo; ?></title>

<script language=JavaScript" type="text/javascript">

<!--

function ContaCaracteres(){

   intCaracteres = 200 - document.mural.comentario.value.length;

   if (intCaracteres > 0){

      document.mural.caracteres.value = intCaracteres;

      return true;

   }

   else {

      document.mural.caracteres.value = 0;

      document.mural.comentario.value = document.mural.comentario.value.substr(0,200)

      return false;

   }

}

function Validar(){

   if (ContaCaracteres()){

      document.mural.submit();

   }

   else{

      alert("<? echo $idioma_limite_200; ?>.");

   }

}

function emoticon(text) {

var txtarea = document.mural.comentario;

text = ' ' + text + ' ';

if (txtarea.createTextRange && txtarea.caretPos) {

  var caretPos = txtarea.caretPos;

  caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;

  txtarea.focus();

} else {

  txtarea.value  += text;

  txtarea.focus();

}

}

function over(src,clrover) {

    if (!src.contains(event.fromElement)) { src.style.cursor = 'hand'; src.bgColor = clrover; }

}

function out(src,clrIn) {

if (!src.contains(event.toElement)) { src.style.cursor = 'default'; src.bgColor = clrIn; }

}

function abrir(URL) {

    var altura   = 260;

    var largura  = 335;

    var esquerda = 50;

    var topo     = 100;

    window.open(URL,'teste', 'width='+altura+', height='+largura+', top='+topo+', left='+esquerda+', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=auto, resizable=no, fullscreen=no');

}

//-->

</script>

<link href="mural.css" rel="stylesheet" type="text/css">

</head>

<body bgcolor="#FFFFFF" topmargin="8" leftmargin="0" marginheight="0" marginwidth="0">

<div align="center">

  <p><img src="imagens/logo_1.gif" width="550" height="72"></p>

  <table class=tabela width=550 border=0 align=center cellpadding=5 cellspacing=0>

    <tr>

      <td bgcolor=#FFCC99><div align=center><? echo $idioma_total; ?>: <b><? echo $posts; ?>

          <br><? echo $idioma_controle; ?><br>

<?

######################## SISTEMA DE NAVEGAÇÃO ################################

$pagina2 = $pagina + $exibido;

$pagina3 = $pagina - $exibido;

if ($pagina3 < 0)

   echo "&laquo;";

else

   echo '<b><a href="mural.php?pagina='.$pagina3.'&exibido='.$exibido.'">&laquo;</a></b>';

$index = 1;

while ($linhalista = mysql_fetch_array($sql2)){

  $index++;

}

$divis = (($index -1)/$exibido);

if ($divis == 1)$um = 0; else $um = 1;

if (($index -1) == $exibido) $um = 1;

for ($j = 1 ; $j < ($divis)+$um ; $j++){

  $pagina = ($j * $exibido) - $exibido;

  echo '<b><a href="mural.php?pagina='.$pagina.'&exibido='.$exibido.'"> '.$j.' </a></b>';

}

if ($pagina2 > $pagina)

  echo "&raquo;";

else

  echo '<b><a href="mural.php?pagina='.$pagina2.'&exibido='.$exibido.'">&raquo;</a></b>';

#################################################################################

?>

</b></div></td>

    </tr>

  </table>

</div>

<br>

<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

    <td width="550">

<?

########################### RESULTADOS NA TELA ##################################

while ($resultado = mysql_fetch_array ($sql)){

  $nome     = stripslashes (strip_tags ($resultado['nome], '<i>'));

  $para     = stripslashes (strip_tags ($resultado['para'], '<i>'));;

  $data     = $resultado['data'];

  $mensagem = stripslashes (strip_tags ($resultado['mensagem'], '<br>'));

?>

     <table width=100%" height="48" border="0" align="center" cellpadding="5" cellspacing="0" class="tabela">

        <tr bgcolor="#FFCC99">

          <td width="29%"><b><? echo $nome; ?></b></td>

          <td width="50%" bgcolor="#FFCC99" ><b></b><? echo $para; ?></b></td>

          <td width="21%" align="left"><? echo $data; ?></td>

        </tr>

        <tr bgcolor="#F2E3D0">

          <td colspan="3"><? echo codifica_url(quebra_linha($mensagem)); ?> <div align="justify"></div></td>

        </tr>

      </table>

      <br>

<?

######################### VERIFICA DADOS NA TELA ################################

}

$linhas = mysql_num_rows ($sql2);

if ($linhas == 0){

  echo "<table class=tabela width=100% border=0 align=center cellpadding=5 cellspacing=0>

       <tr><td bgcolor=#FFCC99><div align=center><b>$idioma_nao_encontrada</b></div>

       </td></tr></table>";

}

#################################################################################

?>

    </td>

</tr>

</table><br>

<form action="mural.php" name="mural" method="post">

  <input type="hidden" name="acao" value="cadastrar">

<input name="data" type="hidden" value="<? echo date("d/m/y H:i"); ?>">

  <table width="550" border="0" align="center" cellpadding="5" cellspacing="0" class="tabela">

    <? if ($err == 1) { ?>

    <tr bgcolor="#F2E3D0">

      <td colspan="2" valign="top"><div align="center"><b><? echo $erro; ?></b></div></td>

    </tr>

    <? } ?>

    <tr bgcolor="#FFCC99">

      <td colspan="2" valign="top"><? echo $idioma_nome; ?>:<br> <input name="nome" type="text" class="campos" value="<? echo $_POST['nome]; ?>" size="50" maxlength="50"></td>

    </tr>

    <tr bgcolor="#F2E3D0">

      <td colspan="2" valign="top"><? echo $idioma_para; ?>:<br>

        <input name="para" type="text" class="campos" value="<? echo $_POST['para']; ?>" size=50" maxlength="50"></td>

    </tr>

    <tr bgcolor="#FFCC99">

      <td valign="top"><? echo $idioma_mensagem; ?>:<br>

        <textarea name="comentario" cols="50" rows="5" class="campos" onKeyup='ContaCaracteres();' ><? echo $_POST['comentario]; ?></textarea>

        <br> <? echo $idioma_caracteres; ?> <input name="caracteres" type="text" disabled class="campos" value="200" size="3" maxlength="3">

        <? echo $idioma_caracteres2; ?>. </td>

      <td align="center" valign="middle">

   <table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#F2E3D0">

          <tr>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':anj:')"><img src="imagens/smilies/001.gif" alt="<? echo $idioma_smilie_01; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':ner:')"><img src="imagens/smilies/002.gif" alt="<? echo $idioma_smilie_02; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':dog:')"><img src="imagens/smilies/003.gif" alt="<? echo $idioma_smilie_03; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':lov:')"><img src="imagens/smilies/004.gif" alt="<? echo $idioma_smilie_04; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':bol:')"><img src="imagens/smilies/005.gif" alt="<? echo $idioma_smilie_05; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':enj:')"><img src="imagens/smilies/006.gif" alt="<? echo $idioma_smilie_06; ?>" width="19" height="19" border="0"></a></div></td>

          </tr>

          <tr>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':cho:')"><img src="imagens/smilies/007.gif" alt="<? echo $idioma_smilie_07; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':tim:')"><img src="imagens/smilies/008.gif" alt="<? echo $idioma_smilie_08; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':cor:')"><img src="imagens/smilies/009.gif" alt="<? echo $idioma_smilie_09; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':bej:')"><img src="imagens/smilies/010.gif" alt="<? echo $idioma_smilie_10; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':lua:')"><img src="imagens/smilies/011.gif" alt="<? echo $idioma_smilie_11; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':MSN:')"><img src="imagens/smilies/012.gif" alt="<? echo $idioma_smilie_12; ?>" width="16" height="16" border="0"></a></div></td>

          </tr>

          <tr>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':mid:')"><img src="imagens/smilies/013.gif" alt="<? echo $idioma_smilie_13; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':esp:')"><img src="imagens/smilies/014.gif" alt="<? echo $idioma_smilie_14; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':tel:')"><img src="imagens/smilies/015.gif" alt="<? echo $idioma_smilie_15; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':pre:')"><img src="imagens/smilies/016.gif" alt="<? echo $idioma_smilie_16; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':ale:')"><img src="imagens/smilies/017.gif" alt="<? echo $idioma_smilie_17; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':flo:')"><img src="imagens/smilies/018.gif" alt="<? echo $idioma_smilie_18; ?>" width="19" height="19" border="0"></a></div></td>

          </tr>

          <tr>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':tri:')"><img src="imagens/smilies/019.gif" alt="<? echo $idioma_smilie_19; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':ocu:')"><img src="imagens/smilies/020.gif" alt="<? echo $idioma_smilie_20; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':est:')"><img src="imagens/smilies/021.gif" alt="<? echo $idioma_smilie_21; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':sor:')"><img src="imagens/smilies/022.gif" alt="<? echo $idioma_smilie_22; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':lin:')"><img src="imagens/smilies/023.gif" alt="<? echo $idioma_smilie_23; ?>" width="19" height="19" border="0"></a></div></td>

            <td onmouseover="over(this,'#FFCC99');" onmouseout="out(this,'#F2E3D0');"><div align="center"><a href="javascript:emoticon(':olh:')"><img src="imagens/smilies/024.gif" alt="<? echo $idioma_smilie_24; ?>" width="19" height="19" border="0"></a></div></td>

          </tr>

        </table>

        <br>

        <a href="javascript:abrir('ajuda.php');"><b><? echo $idioma_codigo; ?></b></a></td>

    </tr>

    <tr bgcolor="#F2E3D0">

      <td width="265"><div align="center"><br>

          <input name="Submit" type="submit" class="botao" onClick="javascript:Validar();" value="<? echo $idioma_enviar; ?>">

        </div></td>

      <td width="265"><br> </td>

    </tr>

  </table>

</form>

<? copyright(); mysql_close ($conexao); ?>

</body>

</html>

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,2k
×
×
  • Criar Novo...