From d5f727623a2b2d3070c614447bad99fc531fe01e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mart=C3=ADn=20Marrese?= Date: Fri, 15 Aug 2003 20:11:41 +0000 Subject: [PATCH] Agrege una funcion para verificar si un login es valido --- lib/MECON/Usuario.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 -- 2.43.0