static function resetPassword($data) { PDOSql::$pdobj = pdoConnect(); $hash = Sql::esc($data['h']); $type = Sql::esc($data['t']); $email = Sql::esc($data['q']); $pass1 = Sql::esc($data['pass1']); $pass2 = Sql::esc($data['pass2']); if ($pass1 !== $pass2) { return array('success' => false, 'data' => '', 'msg' => 'Las contraseñas no coinciden'); } if ($type == 'C') { $get_hash = "SELECT id, email, resetHash from clientes where email ='" . $email . "' AND resetHash = '" . $hash . "'"; $delete_hash = "UPDATE clientes set password = MD5('" . $pass1 . "'), resetHash = null where email ='" . $email . "' AND resetHash = '" . $hash . "'"; } elseif ($type == 'U') { $get_hash = "SELECT id, email, resetHash from usuarios where email ='" . $email . "' AND resetHash = '" . $hash . "'"; $delete_hash = "UPDATE usuarios set password = MD5('" . $pass1 . "'), resetHash = null where email ='" . $email . "' AND resetHash = '" . $hash . "'"; } else { return array('success' => false, 'data' => '', 'msg' => 'Problema con el reseteo'); } $h = Sql::fetch($get_hash); if (count($h) == 1) { $u = Sql::update($delete_hash); return array('success' => true, 'data' => array('id' => $h[0]['id']), 'msg' => 'Se realizo la operacion con exito.'); } else { return array('success' => false, 'data' => '', 'msg' => 'Codigo invalido'); } }
static function deleteOld() { PDOSql::$pdobj = pdoConnect(); $id = Sql::esc($id); $iduser = Sql::esc($_SESSION['userID']); $res = Sql::delete("DELETE from notifications WHERE status = '1' AND view_date < NOW() - INTERVAL 1 month"); return array('success' => true, 'data' => $res, 'msg' => ''); }
static function getNombreLocalidad($localidad) { $s = Sql::fetch("SELECT ciudad_nombre from ciudad WHERE id = '" . Sql::esc($localidad) . "'"); return $s[0]['ciudad_nombre']; }