<?php
include_once("../scripts/connect.php");
include("../scripts/session.php");
//Validar Session

    $sesion=new Sesion("","","");/*Se crea un objeto nuevo con el privilegio necesario para la pag. actual*/

    if(!$sesion->isValida("4")){ /*Sesion invalida*/
	header("Location: ../login.php?err=NoSesion");
    }/*no hay sesion*/

    else{
       $dato=explode("|",$_SESSION['usuario']);
       $sesion->setDatos($dato[0],$dato[1],$dato[2]);
    }
    //fin validar session

     $conexion=conecta_default();
  $ok=0;
	
   $qa = "SELECT id_inver, rfc, nombre, appat, apmat, estatus_idestatus FROM inversionista WHERE rfc = '".$_POST['rfcpr']."'";
   $ca = mysql_query($qa) or die ('Error (Registro No Encontrado): ' . mysql_error());

   if(mysql_affected_rows())
   {
       	
   	$ra = mysql_fetch_object($ca);
	$id = $ra->id_inver;
    $rfc = $ra->rfc;
	$nombre = $ra->nombre;
	$apat = $ra->appat;
	$amat = $ra->apmat;
    $estatus = $ra->estatus_idestatus;
    
    if($estatus == 1)
    {
		echo "<html>";
		echo "<head> </head>";
 		echo "<body>";
  		echo "<form name='f1' action='regwithprom.php' method='post'>";	
 		echo "<table border='0' width='500' height='400' align='center' style='background: url(usuario_comun/logotransp2.gif)'>";
 		echo "<tr height='50'><td></tr>";
 		echo "<tr height='80'><td align='center'><label style='color:#5C3C12; font-size:28px; font-weight:bold'>PROMOTOR ENCONTRADO</tr>";
		echo "<tr height='40'><td align='center' style='font-size:18px;'><label style='color:#5C3C12; font-size:18px;'>RFC Promotor:</label> $rfc </tr><br />";
	    echo "<tr height='40'><td align='center' style='font-size:18px;'><label style='color:#5C3C12; font-size:18px;'>Nombre:</label> $nombre $apat $amat </tr>";
		echo "<tr><td align='center' valign='middle'><input type='submit' value='Continuar'></tr>";
		echo "<tr><td align='center' valign='middle'><input type='hidden' name='idinv' value='$id'></tr>";
		echo "</table>";
  		echo "</form>";
 		echo "</body>";
		echo "</html>";
    }
    else 
    {
     echo "<html>";
   	 echo "<head><meta http-equiv='Refresh' content='5;URL=javascript: history.go(-1)'></head>";
     echo "<center>";
   	 echo "<div style='width:500px; height:400; background: url(logotransp2.gif)'";
   	 echo "<form name='form1' action='index.php' method='post' style='padding-top:120px'>";
   	 echo "<label style='color:#FF0000; font-weight:bold; font-size:26px; padding-left:30px;'>ERROR:</label> <br /> <label style='color:#5C3C12; font-weight:bold; font-size:22px; padding-left:30px;'> EL PROMOTOR QUE ESCRIBISTE NO HA SIDO ACEPTADO O HA SIDO BLOQUEADO, CONSULTA A UN ADMINISTRADOR.</label>";
     echo "<br /><br />Pulsa <a onclick='javascript: history.go(-1)' style='cursor:pointer; color:#5C3C12'>aqu&iacute;</a> si tu navegador no te redirecciona automaticamente";  	
   	 echo "</form>";
   	 echo "</div>";
     echo "</center>";
     echo "</html>";	
    }

   }
   else
   {
   	echo "<html>";
   	echo "<head><meta http-equiv='Refresh' content='3;URL=javascript: history.go(-1)'></head>";
    echo "<center>";
   	echo "<div style='width:500px; height:400; background: url(logotransp2.gif)'";
   	echo "<form name='form1' action='index.php' method='post' style='padding-top:120px'>";
   	echo "<label style='color:#FF0000; font-weight:bold; font-size:26px; padding-left:30px;'>ERROR:</label> <br /> <label style='color:#5C3C12; font-weight:bold; font-size:22px; padding-left:30px;'> EL RFC QUE INGRESASTE NO FUE ENCONTRADO FAVOR DE VERIFICARLO.</label>";
    echo "<br /><br />Pulsa <a onclick='javascript: history.go(-1)' style='cursor:pointer; color:#5C3C12'>aqu&iacute;</a> si tu navegador no te redirecciona automaticamente";
   	
   	echo "</form>";
   	echo "</div>";
    echo "</center>";
    echo "</html>";
   }
?>