Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $nome = strip_tags(trim($_POST['nome']));
- $email = strip_tags(trim($_POST['email']));
- $cidade = strip_tags(trim($_POST['cidade']));
- $pagamento = strip_tags(trim($_POST['pagamento']));
- $valor = strip_tags(trim($_POST['valor']));
- $arquivo = $_FILES['arquivo'];
- $tamanho = 1048576;
- $tipos = array('image/jpeg', 'image/pjpeg');
- if(empty($nome)){
- $msg = 'O Nome é Obrigatório';
- }elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
- $msg = 'Digite um E-mail válido';
- }elseif(empty($cidade)){
- $msg = 'O Campo Cidade é Obrigatório';
- }elseif(empty($pagamento)){
- $msg = 'O Campo Pagamento é Obrigatório';
- }elseif(empty($valor)){
- $msg = 'O Campo Valor é Obrigatório';
- }elseif(!is_uploaded_file($arquivo['tmp_name'])){
- $msg = 'O Comprovante é Obrigatório';
- }elseif($arquivo['size'] > $tamanho){
- $msg = 'O limite do tamanho do arquivo é de 1MB';
- }elseif(!in_array($arquivo['type'], $tipos)){
- $msg = 'O tipo do arquivo permitido é apenas JPEG';
- }else{
- require('PHPMailer/class.phpmailer.php');
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
- $mail->Port = 587;
- $mail->Host = 'smtp.lirhbol.com.br';
- $mail->Username = 'l101113';
- $mail->Password = 'ltn2bzE7';
- $mail->SetFrom('ligadehandebol@lirhbol.com.br', 'Lucas');
- $mail->AddAddress('lukoviz@hotmail.com', 'Claudio');
- $mail->Subject = 'Inscrição no Curso';
- $body = "<strong>Nome :</strong>{$nome} <br />
- <strong>E-mail :</strong>{$email} <br />
- <strong>Titulo :</strong>{$titulo} <br />
- <strong>Mensagem :</strong>{$mensagem} <br />
- <strong>Arquivo :</strong> ".$arquivo['name'];
- $mail->MsgHTML($body);
- $mail->AddAttachment($arquivo['tmp_name'], $arquivo['name']);
- if($mail->Send())
- $msg = 'Sua Mensagem foi enviada com Sucesso!!!';
- else
- $msg = 'Sua Mensagem n�o foi enviada, tente novamente';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement