<?php

class userGerencieImobiliario{

	// Connection
	private $conn;

	// Table
	private $db_table = "users_gerenciador_site";
	
	public $id;
	public $users_id;
	public $token;
	

	// Db connection
	public function __construct($db){
		$this->conn = $db;
	}
	 

        // CAPTURA USUARIO ID DO SISTEMA GERENCIADOR IMOBILIARIO
        public function getUserToken(){
			
			$token = $this->token;
			 
            $sqlQuery = "SELECT
                        *
                      FROM
                        ". $this->db_table ."
                    WHERE 
                       token = ?
                    LIMIT 0,1";

            $stmt = $this->conn->prepare($sqlQuery);
            $stmt->bindParam(1, $token);
            $stmt->execute();
			$dataRow = $stmt->fetch(PDO::FETCH_ASSOC);
			if(!empty($dataRow['id'])){
				$this->id = $dataRow['id'];
				$this->users_id = $dataRow['users_id'];
				$this->token = $dataRow['token'];
			}
        }        


}
