function CONTENIDO_INICIAR_SESION() { if (isset($_POST['iniciar_proceder'])) { ob_start(); $ret = _F_usuario_acceder($_POST['iniciar_campo_correo'], $_POST['iniciar_campo_clave']); $buffer = ob_get_clean(); if ($ret != 1) { echo mensaje("Datos de acceso erroneos, por favor intente de nuevo", _M_ERROR); echo mensaje($buffer, _M_INFO); } } if (S_iniciado()) { if (!empty($_POST['iniciar_retornar'])) { header("location: " . $_POST['iniciar_retornar']); } else { header("location: ./"); } return; } echo "¿Deseas comprar y vender pero aún no tienes una cuenta? " . ui_href("iniciar_sesion_crear_cuenta", "./registrar", "¡entonces registrate ahora!") . ", es gratis, fácil y rápido.<br />"; echo "<span class=\"explicacion\">¡Puedes utilizar tu usuario (o el correo electronico) y contraseña de <b><a target=\"_blank\" href=\"http://svcommunity.org/constancias/constancia-yomachete.com.html\">SVCommunity.org</a></b>!</span>"; $retorno = empty($_POST['iniciar_retornar']) ? "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] : $_POST['iniciar_retornar']; echo "<form action=\"iniciar\" method=\"POST\">"; echo ui_input("iniciar_retornar", $retorno, "hidden"); echo "<table>"; echo ui_tr(ui_td("Correo electronico (e-mail) / Usuario") . ui_td(ui_input("iniciar_campo_correo"))); echo ui_tr(ui_td("Constraseña") . ui_td(ui_input("iniciar_campo_clave", "", "password"))); echo "</table>"; echo ui_input("iniciar_proceder", "Iniciar sesión", "submit") . "<br />"; echo "</form>"; }
function _F_usuario_acceder($email, $clave, $enlazar = true) { global $tablaUsuarios; $email = db_codex(trim($email)); $clave = db_codex(trim($clave)); $c = "SELECT * FROM {$tablaUsuarios} WHERE (LOWER(email)=LOWER('{$email}') OR LOWER(usuario)=LOWER('{$email}')) AND clave=SHA1(CONCAT(LOWER(usuario),'{$clave}')) AND estado!=" . _N_esp_activacion; DEPURAR($c, 0); $resultado = db_consultar($c); if ($resultado) { $n_filas = mysql_num_rows($resultado); if ($n_filas == 1) { $_SESSION['autenticado'] = true; $_SESSION['cache_datos_usuario'] = db_fila_a_array($resultado); $c = "UPDATE {$tablaUsuarios} SET ultimo_acceso=NOW() WHERE id_usuario=" . _F_usuario_cache('id_usuario'); $resultado = db_consultar($c); return 1; } else { if ($enlazar) { // 30/09/2009 /* Con la integración de enlace.php en svcommunity.org, intentaremos verificar si el usuario existe ahí y crear la cuenta acá. Si no existe ni en SVC entonces fallar silenciosamente. */ $url = "http://www.svcommunity.org/forum/enlace.php?m={$email}&p={$clave}"; $SVC = @file_get_contents($url); if (strstr($SVC, '<?xml version="1.0" encoding="UTF-8"?>')) { $XML = new SimpleXMLElement($SVC); $datos["estado"] = _N_activo; $datos["nivel"] = _N_vendedor; $datos["ultimo_acceso"] = mysql_datetime(); $datos["registro"] = date('Y-m-d H:i:s', (double) $XML->date_registered); $datos["usuario"] = $XML->member_name; $datos["nombre"] = $XML->real_name; $datos["email"] = $XML->email_address; $datos["clave"] = $XML->passwd; db_agregar_datos("ventas_usuarios", $datos); echo "DATOS IMPORTADOS<br />"; return _F_usuario_acceder($email, $clave, false); } else { echo $SVC; } } unset($_SESSION['autenticado']); unset($_SESSION['id_usuario']); return -1; } } else { unset($_SESSION['autenticado']); unset($_SESSION['id_usuario']); echo "Error general al autenticar!" . "<br />"; return 0; } }
function DATA__identificar() { $mensaje = ''; //Será que ya envió el POST?, validemos los datos. if (isset($_POST['usuario']) && isset($_POST['clave'])) { $ret = _F_usuario_acceder($_POST['usuario'], $_POST['clave']); switch ($ret) { case 1: header("location: ./"); return; break; case -1: $mensaje = "Datos incorrectos!"; break; case 0: $mensaje = "Error general de falla de acceso"; break; default: $mensaje = "Sucedió un error desconocido"; break; } } // Fondo de acceso echo '<div id="bg"><img src="fondo.jpg" width="100%" height="100%" alt="" /></div>'; // Fonde de formulario echo '<div id="capa_impresora">'; // Mostrar pantalla de acceso echo ' <form action="./" method="post"> <fieldset style="border:0"> Usuario<br /><input type="text" name="usuario" class="i2" value="" /><br /><br /> Clave<br /><input type="password" name="clave" class="i2" value="" /><br /><br /> <input type="submit" name="ingresar" value="Clic aquí para ingresar" /> <input type="hidden" name="sublogin" value="1" /> </fieldset> </form> <div style="color:#F00;font-weight:bolder;margin-top:225px">' . $mensaje . '</div> '; echo '</div>'; }
function DATA__identificar() { $mensaje = ''; //Será que ya envió el POST?, validemos los datos. if (isset($_POST['usuario']) && isset($_POST['clave'])) { switch (_F_usuario_acceder($_POST['usuario'], $_POST['clave'])) { case 1: header("location: ./"); return; break; case -1: $mensaje = "Datos incorrectos!"; break; case 0: $mensaje = "Error general de falla de acceso"; break; default: $mensaje = "Sucedió un error desconocido"; break; } } // Fondo de acceso echo '<div id="bg"><img src="fondo.jpg" width="100%" height="100%" alt=""></div>'; // Mostrar pantalla de acceso echo ' <div style=" background-image: url(\'img/Impresora2.png\');margin-top:100px;height:501px; width:600px;background-repeat:no-repeat;margin-left:auto;margin-right:auto;text-align:center;padding-top:10px" /> <form action="./" method="post"> Usuario<br /><input type="text" name="usuario" class="i2" value="" /><br /><br /> Clave<br /><input type="password" name="clave" class="i2" value="" /><br /><br /> <input type="submit" name="ingresar" value="Clic aquí para ingresar" /> <input type="hidden" name="sublogin" value="1"> </form> <div style="margin-top:10px;height:225px; width:600px;background-repeat:no-repeat;margin-left:auto;margin-right:auto;text-align:center;padding-top:10px;color:#FF0000" /></div> <span style="color:#F00;font-weight:bolder">' . $mensaje . '</span> </div> '; }
$error = null; echo '<div style="text-align:center;vertical-align:middle;">'; echo '<center><strong>Inicio de sesión en sistema BCA</strong></center>'; if (isset($_POST['iniciar_proceder'])) { # was there a reCAPTCHA response? $recaptcha = false; if (isset($_POST["recaptcha_response_field"])) { $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); $recaptcha = $resp->is_valid; $error = $resp->error; } if (RECAPTCHA && !$recaptcha) { echo '<p class="error">Ud. no ingresó correctamente las palabras en la imagen.</p>'; } else { ob_start(); $ret = _F_usuario_acceder($_POST['iniciar_campo_correo'], $_POST['iniciar_campo_clave']); $buffer = ob_get_clean(); echo '<p class="error">Datos de acceso erroneos, por favor intente de nuevo.</p>'; echo '<p>' . $buffer . '</p>'; } } if (S_iniciado()) { if (!empty($_POST['iniciar_retornar'])) { header("location: " . $_POST['iniciar_retornar']); } else { header("location: ./"); } return; } $HEAD_titulo = PROY_NOMBRE . ' - Iniciar sesion'; if (isset($_GET['ref'])) {