getLoginUrl(array('redirect_uri'=>$homeurl,'scope'=>$fbPermissions)); echo '
'; }else{ $user_profile = $facebook->api('/me?fields=id,first_name,last_name,email,gender,locale'); $user = new Users(); $user_data = $user->checkUser('facebook',$user_profile['id'],$user_profile['first_name'],$user_profile['last_name'],$user_profile['email'],$user_profile['gender'],$user_profile['locale']); if(!empty($user_data)){ session_start(); //Variables de BD $ip = 'localhost'; $usuario = 'admin_hhit'; $password = 'Passw0rd'; $db_name = 'admin_hhit'; mysql_connect($ip,$usuario,$password)or die ('Ha fallado la conexión: '.mysql_error()); mysql_select_db($db_name)or die ('Error al seleccionar la Base de Datos: '.mysql_error()); mysql_query("SET NAMES 'utf8'"); mysql_query("SET time_zone = '-5:00';"); //Funciones de conexión mysql_connect($ip,$usuario,$password)or die ('Ha fallado la conexión: '.mysql_error()); mysql_select_db($db_name)or die ('Error al seleccionar la Base de Datos: '.mysql_error()); mysql_query("SET time_zone = '-5:00';"); $_SESSION["UsrType"] = 'Post'; $cadena = "Select * from PC_Postulantes where LOGINFACEBOOK = ".$user_data["id"]; //echo $cadena; $result2 = mysql_query($cadena); while($row2 = mysql_fetch_array($result2)) { //echo 'Llenamos'; $_SESSION["CustId"] = $row2["ID_POSTULANTE"]; $_SESSION["Mail"] = $row2["CORREO"]; $_SESSION["UsrType"] = 'Post'; $_SESSION["Nombres"] = $row2["NOMBRES"]; $_SESSION["Apellidos"] = $row2["APELLIDOS"]; $_SESSION["CORREO"] = $row2["CORREO"]; $_SESSION["IDLINK"] = $row2["IDLINK"]; $_SESSION["LOGINFACEBOOK"] = $row2["LOGINFACEBOOK"]; $_SESSION["LOGINTWITTER"] = $row2["LOGINTWITTER"]; $_SESSION["LOGINGOOGLE"] = $row2["LOGINGOOGLE"]; } $_SESSION['userdata'] = $user_data; header("Location:account.php"); }else{ die('Some problem occurred, please try again.'); } } ?>