/clases/fb/dlm_usuarios.php
PHP | 123 lines | 93 code | 28 blank | 2 comment | 6 complexity | 720f6e884714de93954d51972f383c98 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, MIT, LGPL-3.0, LGPL-2.1
- <?php
-
- include '../conexion_publico.php';
-
-
- class usuario{
- //constructor
- var $conexion;
-
- function usuario(){
-
- include '..//conexion_publico.php';
-
- }
-
-
- function comprueba_id_fb($id_fb,$email,&$a_user){
- $respuesta = "NO";
- $a_user = array();
- $sql= "SELECT * from v_user where id_fb='".$id_fb."' or e_mail='".$email."'";
-
- $result = mysql_query($sql) or die("errorlogin".mysql_error());
- if($row = mysql_fetch_array($result)) {
- $a_user[0]=$row['tipo_usuario'];
- $a_user[1]=$row['nick'];
- $a_user[2]=$row['id_usuario'];
- $a_user[3]=$row['nombre'];
- $a_user[4]=$row['nombre_foto_perfil'];
- $a_user[5]=$row['id_empresa'];
- $a_user[6]=$row['fecha_nacimiento'];
- $a_user[7]=$row['tipo_modalidad'];
- $a_user[8]=$row['id_provincia'];
- $a_user[9]=$row['id_comunidad'];
- $a_user[10]=$row['sexo'];
- $a_user[11]=$row['estado_weddcam'];
- $a_user[12]=$row['id_evento'];
- $a_user[13]="";
-
- if ($row['id_evento']!="0") {
- $sql= "SELECT estado from eventos where id_evento='".$row['id_evento']."'";
- $result2 = mysql_query($sql) or die("errorlogin".mysql_error());
- $row2 = mysql_fetch_array($result2);
- $a_user[13]=$row2['estado'];
- }
- mysql_close();
- return "SI";
- }
-
- mysql_close();
- return "NO";
- }
- function comprueba_email($mail ){
- $respuesta = "NO";
- $a_user = array();
- $sql= "SELECT id_usuario from usuarios where e_mail='".$mail."'";
-
- $result = mysql_query($sql) or die("errorlogin".mysql_error());
- if($row = mysql_fetch_array($result)) {
- mysql_close();
- return "SI";
- }
- //mysql_close();
- return "NO";
- }
-
-
-
- function graba_usuario_con_id( $user, &$id_usuario)
-
- {
- $result=true;
- if ($this->comprueba_email($user['e_mail'])=="SI"){
-
- $dml = " update usuarios set id_fb= " .$user['id_fb'] ." where e_mail=" .$user['e_mail'] ;
-
- }
-
- else{
- $campos=""; $valores="";
- foreach ($user as $key=>$value){
- $campos .= "" .$key .",";
- $valores .= "'" .$user[$key] ."'," ;
- }
-
- $dml = " INSERT INTO usuarios (" .substr($campos,0,-1) .") VALUES (". substr($valores,0,-1) .")" ;
- }
- $result=mysql_query($dml) or die("error3-altausuario".mysql_error());
- if (!$result)
- {
- return false;
- }
-
- $id_usuario=mysql_insert_id();
- mysql_close();
- return true;
-
- }
-
-
-
- function get_datos_poblacion( $poblacion)
- {
- $row = array();
-
- $dml = "SELECT id_poblacion, cp,id_provincia FROM poblaciones WHERE (poblacion='".$poblacion ."') ";
- $result = mysql_query($dml) or die("error-leer_poblaciones".mysql_error());
- while ( $aRow = mysql_fetch_array( $result ) )
- {
- $row = array();
- $row[0]=$aRow['id_poblacion'];
- $row[1]=$aRow['id_provincia'];
- $row[2]=$aRow['cp'];
- }
- return $row;
- }
- function trae_rango_edad()
- {
- return mysql_query("SELECT * from rango_edad");
- }
-
- }
-
- ?>