[#] hm X_Shell Backd00r [#]

Current Path : /var/www/clients/client35/web46/web/buen-fin/app/model/
Upload File :
Current File : /var/www/clients/client35/web46/web/buen-fin/app/model/registrar3.class.php

<?php
	require_once 'conexion.class.php';

	class Registrar{

	public $txt_nombre;
	public $txt_correo;
	public $txt_nombre2;
	public $txt_correo2;
	public $txt_nombre3;
	public $txt_correo3;
	public $txt_codigo;
	public $txt_promo;
	public $txt_tipo;
	

	public function __construct(){
		$this->conex = Conexion::singleton_conexion();
	}
	
	public function insertRegistro(){
		try{
			    $sql = "INSERT INTO registro(nombre,correo,codigo,promocion,tipo,ip) VALUES (:nombre,:correo,:codigo,:promo,:tipo,:ip),(:nombre2,:correo2,:codigo,:promo,:tipo,:ip),(:nombre3,:correo3,:codigo,:promo,:tipo,:ip)";
				$query =$this->conex->prepare($sql);
				$query->execute(array(
						":nombre"=>$this->txt_nombre,
						":correo"=>$this->txt_correo,
						":codigo"=>$this->txt_codigo,
						":promo"=>$this->txt_promo,
						":tipo"=>$this->txt_tipo,
						":nombre2"=>$this->txt_nombre2,
						":correo2"=>$this->txt_correo2,
						":nombre3"=>$this->txt_nombre3,
						":correo3"=>$this->txt_correo3,
						":ip"=>$_SERVER['REMOTE_ADDR']
					));
			if($query)
			  	return true;
			else
				return false;
		}catch(PDOExeption $e){
			print "Error!: ".$e->getMessage();
		}
	}
	public  function generar_clave($longitud){ 
   					$cadena="[^a-zA-Z0-9]"; 
   					return substr(preg_replace($cadena, "", md5(rand())). 
   	  				preg_replace($cadena, "", md5(rand())). 
   	  				preg_replace($cadena, "", md5(rand())), 
   	  				0, $longitud);
   	  				return $cadena; 
				}
	public function sendMail(){
		 $destino = $this->txt_correo;
		 $destino2 = $this->txt_correo2;
		 $destino3 = $this->txt_correo3;
		 $aux     = $this->txt_tipo;
		switch ($aux) {
			case 'auto':
				$msj = "Track day Auto";
			break;
			case 'moto':
				$msj = "Track day Moto";
			break;
			case 'Arrancones':
				$msk = "Arrancones Nocturnos";
			break;
		}
	//echo "Se envio correo a ".$destino.$destino2.$destino3;
	$from = "Autodromo Intl. Miguel E. Abed";
	$body = '<html> 
							<head> 
								<title>Autodromo Miguel E. Abed | Buen fin</title>
								<meta http-equiv=\"\" content=\"text/html; charset=iso-8859-1\">  
							</head>
								<body style="font-family:Arial, Helvetica, sans-serif">
									<img src="http://www.autodromomabed.com/buen-fin/img/buen-fin-banner.jpg" alt="">
									<p style="text-align:center;font-size:"><strong>Muchas gracias por su registro</strong></p>
									<p style="text-align:center;font-size:35px;font-weigth:bold;">C&oacute;digo de registro</p>
									<div style="text-align:center;padding: 27px 29px;background-color: #d2d2d2;font-size: 25px;">'.$this->txt_promo.'<br>'.$this->txt_codigo.'</div>
									<p style="text-align:center;font-size:30px;font-weigth:bold;"><strong>'.$msj.'</strong></p>
									
									<p>Por medio de este correo se informa que ha quedado registrado. Para hacer valida la promoci&oacute;n "'.$this->txt_promo.'" en los eventos de pista abierta de "Noviembre o diciembre dependiendo el evento".Se notif&iacute;ca que este C&oacute;digo de seguridad tiene que ser presentado impreso el dia del evento en el Aut&oacute;dromo, de no ser asi, la promoci&oacute;n no ser&aacute; v&aacute;lida para la persona registrada</p>
								</body> 
							</html>';
	require_once '../library/mail/class.phpmailer.php';
 	$mail = new PHPMailer(true);
    $mail->IsSMTP();
	try {		
			$mail->SMTPAuth=true;
			$mail->SMTPSecure = 'ssl';
			$mail->Host="smtp.zoho.com";
			$mail->Port=465;	
			//$mail->SMTPSecure = 'tls';
			//$mail->Port=587;							
			$mail->Username="autodromo.m.abed-buenfin@racingface.com";
			$mail->Password="si23ufdg239!@";			
			$mail->SMTPDebug=1;
			$mail->Helo = "www.autodromomabed.com"; //Muy importante para que llegue a hotmail y otros								
			//$mail->CharSet="UTF-8";		
			$mail->AddAddress($destino);
			$mail->AddAddress($destino2);
			$mail->AddAddress($destino3);
			//$mail->SetFrom("german_1441@hotmail.com");
			$mail->IsHTML(true);
			$mail->Subject="Autodromo Intl. Miguel E. Abed";
			$mail->From="autodromo.m.abed-buenfin@racingface.com";
			$mail->FromName= $from;
			$mail->Timeout=30;
			$mail->Body= $body;
			$mail->AltBody = strip_tags($body);
			$exito=$mail->Send();
			return true;
		} catch (phpmailerException $e){
			echo $e->errorMessage(); //Pretty error messages from PHPMailer							
		} catch (Exception $e) {
			echo $e->getMessage(); //Boring error messages from anything else!							
		}		
	}
}
?>

Mr.hm X_Shell Backd00r 1.0, Coded By Mr.hm X_Shell Backd00r