Ir para conteúdo
Fórum Script Brasil

spaulo5

Membros
  • Total de itens

    6
  • Registro em

  • Última visita

Sobre spaulo5

spaulo5's Achievements

0

Reputação

  1. spaulo5

    upload de fotos

    Ola Pessoal não sei se é um problema no arquivo PHP envio o email fazendo upload de fotos a imagem não vai, só vai a mensagem sendo que, se eu mandar a foto pra outro provedor ela vai normal, quando mando pro meu próprio provedor só aparece um quadro com x. alguém pode me dizer o q posso fazer agradecido <?php //pego os dados enviados pelo formulario $nome = $_POST["nome"]; $email = $_POST["email"]; $mensagem = $_POST["mensagem"]; $assunto = $_POST["assunto"]; $email_from = $_POST["email_from"]; //formato o campo da mensagem $mensagem = wordwrap( $mensagem, 50, "<br>", 1); //valido os emails if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email)){ echo"<center>Digite um email valido</center>"; echo "<center><a href=\"java script:history.go(-1)\">Voltar</center></a>"; exit; } if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email_from)){ echo "<center>Digite um email valido</center>"; echo "<center><a href=\"java script:history.go(-1)\"><center>Voltar</center></a>"; exit; } $arquivo = isset($_FILES["arquivo"]) ? $_FILES["arquivo"] : FALSE; if(file_exists($arquivo["tmp_name"]) and !empty($arquivo)){ $fp = fopen($_FILES["arquivo"]["tmp_name"],"rb"); $anexo = fread($fp,filesize($_FILES["arquivo"]["tmp_name"])); $anexo = base64_encode($anexo); fclose($fp); $anexo = chunk_split($anexo); $boundary = "XYZ-" . date("dmYis") . "-ZYX"; $mens = "--$boundary\n"; $mens .= "Content-Transfer-Encoding: 8bits\n"; $mens .= "Content-Type: text/html; charset=\"ISO-8859-1\"\n\n"; //plain $mens .= "$mensagem\n"; $mens .= "--$boundary\n"; $mens .= "Content-Type: ".$arquivo["type"]."\n"; $mens .= "Content-Disposition: attachment; filename=\"".$arquivo["name"]."\"\n"; $mens .= "Content-Transfer-Encoding: base64\n\n"; $mens .= "$anexo\n"; $mens .= "--$boundary--\r\n"; $headers = "MIME-Version: 1.0\n"; $headers .= "From: \"$nome\" <$email_from>\r\n"; $headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n"; $headers .= "$boundary\n"; //envio o email com o anexo mail($email,$assunto,$mens,$headers); echo"Mensagem e Foto enviado com Sucesso!"; } //se não tiver anexo else{ $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: \"$nome\" <$email_from>\r\n"; //envia o email sem anexo mail($email,$assunto,$mensagem, $headers); echo"Mensagem enviado com Sucesso!"; } ?>
  2. Boa Tarde Rafael Agradeço ai sua boa vontade de corrigir o script o texto do email ainda não está funcionando quando envia , ele vai sem o texto digitado, outra coisa, o limitador de caracteres tambem parou
  3. Boa Noite Rafael esse script sempre foi assim mesmo, e ele está funcionando bem o problema é que eu fui adaptar no textarea, um limitador de caracteres daí pra lá o texto não vai, o email vai normal. Alguma coisa fiz de errado tem como você verificar onde está o erro?
  4. Ola, Pessoal gente eu fiz essa adaptação, o email ta indo, mais o texto não alguém pode dá uma conferida, e se tiver errado pode corrigir por favor. agradecido... <script language="javascript" type="text/javascript"> function checa_formulario(email){ if (email.nome.value == ""){ alert("Por Favor não deixe o seu nome em branco!!!"); email.nome.focus(); return (false); } if (email.email_from.value == ""){ alert("Por Favor não deixe o seu email em branco!!!"); email.email_from.focus(); return (false); } if (email.email.value == ""){ alert("não deixe o email destinatario em branco!!!"); email.email.focus(); return (false); } if (email.assunto.value == ""){ alert("não deixe o assunto em branco!!!"); email.assunto.focus(); return (false); } } </script> <head> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" > <link rel="File-List" href="teste_arquivos/filelist.xml"> <title>Enviando texto</title> <style type="text/css"> textarea { width: 300px; height: 200px; } #progreso { background: url(textarea.png) no-repeat; background-position: -300px 0px; width: 300px; height: 14px; text-align: center; color: #000000; font-size: 8pt; font-family: Arial; text-transform: uppercase; } </style> <script type="text/javascript"> var max=250; var ancho=300; function progreso_tecla(obj) { var progreso = document.getElementById("progreso"); if (obj.value.length < max) { progreso.style.backgroundColor = "#FFFFFF"; progreso.style.backgroundImage = "url(textarea.png)"; progreso.style.color = "#000000"; var pos = ancho-parseInt((ancho*parseInt(obj.value.length))/250); progreso.style.backgroundPosition = "-"+pos+"px 0px"; } else { progreso.style.backgroundColor = "#CC0000"; progreso.style.backgroundImage = "url()"; progreso.style.color = "#FFFFFF"; } progreso.innerHTML = "("+obj.value.length+" / "+max+")"; } </script> </head> <body> </style></head><body onLoad="document.email.nome.focus();"><form onsubmit="return checa_formulario(this)" action="foto10.php" method="POST" enctype="multipart/form-data" name="email" style="position: absolute; left: 98px; top: 38px"> <table width="32%" border="0" align="center"> <tr> <td><div align="right"><span class="texto">Seu Nome</span></div></td> <td><input name="nome" type="text" id="nome"></td> </tr> <tr> <td width="33%"><div align="right" class="texto">Seu Email</div></td> <td width="67%"><input name="email_from" type="text" class="email"></td> </tr> <tr> <td><div align="right" class="texto"></div></td> <input name="email" type="text" class="email" value="digite aqui seu email" readonly></td> </tr> <tr> <td><div align="right" class="texto">Categoria</div></td> <td><input name="assunto" type="text" id="assunto"></td> </tr> <tr> <td><div align="right" class="texto">Mensagem</div></td> <td><textarea onkeyup="progreso_tecla(this)" value=""></textarea> <div id="progreso"> </tr> <tr> <td><div align="right" class="texto">Foto</div></td> <td><input name="arquivo" type="file"></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Enviar"></td> </tr> </table> </form>
  5. caraca... Rafael Laurindo isso mesmo q eu tava precisando aí cara quebrou uma árvore muito obrigado mesmo.
  6. Ola, Pessoal estou precisando de ajuda dos amigos, estou no inicio do curso javascript e esse negócio ta embolando minha cabeça, é o seguinte: tenho um formulario de email no meu site,e queria colocar um limitador de caracteres, e se fosse possível retirar a função "para" do formulário e fixar meu email, ou seja o usuário só digita o email dele, o meu estaria fixo, tem como fazer uma adptação do limite de caracter para o formulário segue abaixo tres scripts Formulario,php,limitador de caracteres alguém pode me dá uma luz? Agradecido desde já Formulário <html> <head> <script language="javascript" type="text/javascript"> function checa_formulario(email){ if (email.nome.value == ""){ alert("Por Favor não deixe o seu nome em branco!!!"); email.nome.focus(); return (false); } if (email.email_from.value == ""){ alert("Por Favor não deixe o seu email em branco!!!"); email.email_from.focus(); return (false); } if (email.email.value == ""){ alert("não deixe o email destinatario em branco!!!"); email.email.focus(); return (false); } if (email.assunto.value == ""){ alert("não deixe o assunto em branco!!!"); email.assunto.focus(); return (false); } } </script> <title>Enviando texto</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .email { text-transform: lowercase; } .texto { color: #0000FF } .style1 {color: #FF0000} --> </style> </head> <body onLoad="document.email.nome.focus();"> <form onsubmit="return checa_formulario(this)" action="envia.php" method="post" enctype="multipart/form-data" name="email"> <h1 align="center" class="style1">Formulario de email com anexo </h1> <table width="32%" border="0" align="center"> <tr> <td><div align="right"><span class="texto">Nome</span></div></td> <td><input name="nome" type="text" id="nome"></td> </tr> <tr> <td width="33%"><div align="right" class="texto">De:</div></td> <td width="67%"><input name="email_from" type="text" class="email"></td> </tr> <tr> <td><div align="right" class="texto">Para</div></td> <td><input name="email" type="text" class="email"> </tr> <tr> <td><div align="right" class="texto">Assunto</div></td> <td><input name="assunto" type="text" id="assunto"></td> </tr> <tr> <td><div align="right" class="texto">Mensagem</div></td> <td><textarea name="mensagem" cols="50" rows="10" id="mensagem"></textarea></td> </tr> <tr> <td><div align="right" class="texto">Anexo</div></td> <td><input name="arquivo" type="file"></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Enviar"></td> </tr> </table> </form> </body> </html> Envia.php <?php //pego os dados enviados pelo formulario $nome = $_POST["nome"]; $email = $_POST["email"]; $mensagem = $_POST["mensagem"]; $assunto = $_POST["assunto"]; $email_from = $_POST["email_from"]; //formato o campo da mensagem $mensagem = wordwrap( $mensagem, 50, "<br>", 1); //valido os emails if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email)){ echo"<center>Digite um email valido</center>"; echo "<center><a href=\"java script:history.go(-1)\">Voltar</center></a>"; exit; } if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email_from)){ echo "<center>Digite um email valido</center>"; echo "<center><a href=\"java script:history.go(-1)\"><center>Voltar</center></a>"; exit; } $arquivo = isset($_FILES["arquivo"]) ? $_FILES["arquivo"] : FALSE; if(file_exists($arquivo["tmp_name"]) and !empty($arquivo)){ $fp = fopen($_FILES["arquivo"]["tmp_name"],"rb"); $anexo = fread($fp,filesize($_FILES["arquivo"]["tmp_name"])); $anexo = base64_encode($anexo); fclose($fp); $anexo = chunk_split($anexo); $boundary = "XYZ-" . date("dmYis") . "-ZYX"; $mens = "--$boundary\n"; $mens .= "Content-Transfer-Encoding: 8bits\n"; $mens .= "Content-Type: text/html; charset=\"ISO-8859-1\"\n\n"; //plain $mens .= "$mensagem\n"; $mens .= "--$boundary\n"; $mens .= "Content-Type: ".$arquivo["type"]."\n"; $mens .= "Content-Disposition: attachment; filename=\"".$arquivo["name"]."\"\n"; $mens .= "Content-Transfer-Encoding: base64\n\n"; $mens .= "$anexo\n"; $mens .= "--$boundary--\r\n"; $headers = "MIME-Version: 1.0\n"; $headers .= "From: \"$nome\" <$email_from>\r\n"; $headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n"; $headers .= "$boundary\n"; //envio o email com o anexo mail($email,$assunto,$mens,$headers); echo"Mensagem e Foto enviado com Sucesso!"; } //se não tiver anexo else{ $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: \"$nome\" <$email_from>\r\n"; //envia o email sem anexo mail($email,$assunto,$mensagem, $headers); echo"Mensagem enviado com Sucesso!"; } ?> Limitador de caracteres <html> <body> <head> <!--------COMEÇA AQUI--------------> <HEAD> <script LANGUAGE="JavaScript"> <!-- function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit); else countfield.value = maxlimit - field.value.length; } // --> </script> </HEAD> <BODY> <center> <form name=myform action="YOUR-SCRIPT.CGI"> <font size="1" face="arial, helvetica, sans-serif"> ( Limite de 125 caracteres. )<br> <textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea> <br> faltam&nbsp;<input readonly type=text name=remLen size=3 maxlength=3 value="125"></font> </form> </center> <!--------TERMINA AQUI-------------> </body> </html>
×
×
  • Criar Novo...