X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/5836c69357427ed50520eb9bcb59f980cb452654..29c3aacc96b54b91f072e7413ec04f5d2c766a9d:/lib/MECON/Usuario.php diff --git a/lib/MECON/Usuario.php b/lib/MECON/Usuario.php index d8ef1eb..bdfd064 100644 --- a/lib/MECON/Usuario.php +++ b/lib/MECON/Usuario.php @@ -270,5 +270,32 @@ class MECON_Usuario { } // -X2C + /** + * Verifica si el login pasado por parametro es valido + * + * @param string $login Login a verificar + * + * @return mixed + * @access public + */ + function verificarLogin($login = null) { + if ($login) { + $db = DB::connect($this->dsn); + if (PEAR::isError($db)) { + return $db; + } + $sql = "SELECT count(*) as cuenta FROM Usuario WHERE login = '$login'"; + $result = $db->query($sql); + if (PEAR::isError($result)) { + return $result; + } + $row = $result->fetchRow(DB_FETCHMODE_ASSOC); + if ($row['cuenta'] != 0) { + return true; + } + } + return false; + } + } // -X2C Class :MECON_Usuario ?> \ No newline at end of file