Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/03/2011, 06:28
jesuscasquet
 
Fecha de Ingreso: marzo-2011
Mensajes: 3
Antigüedad: 13 años, 1 mes
Puntos: 0
Exclamación Problema con autenticacion con Pear y mssql

Buenas.
Ya he usado varias veces los paquetes Auth y mdb2 de Pear para hacer login de autenticacion con mysql obteniendo buenos resultados ya q te facilita mas de una cosa.

Mi problema esta siendo ahora al intentarlo con una base de sql server.

La conexion la hago igual q con mysql, pero cambiando mysql por mssql como indica en todos los sitios que he leido, pero no consigo realizar el login. No da errores, pero no entra, se queda todo el rato en el formulario.

El codigo de autentificacion que uso es :

<?php
require_once "init.php";
require_once "Auth.php";
require_once "MDB2.php";
function loginForm($username = null, $status = null, $auth = null){
echo '<hr/>';
echo '<div class="contPrincipal">
<form id="login-form" method="post" action="">
<fieldset>
<legend>Administrador</legend>';
echo 'Nombre: <input id="login" type="text" name="username" value="'.$username.'"/><br/>';
echo 'Contraseña: <input id="password" type="password" name="pass"/><br/>';
echo '<input class="boton" type="submit" value="Entrar"/>
</fieldset>
</form>';
echo '</div>';


}
$options = array(
'dsn' => "mssql://web_apat1:[email protected]\SQLEXPRESS/web_apat",
'table' => "usuarios",
'usernamecol' => "username",
'passwordcol' => "pass"
);

$a = new Auth("MDB2", $options, "loginForm");

$a->start();
var_dump($a);
// esto actua como "barrera"
if (!$a->checkAuth()) {
echo "<p>Identifiquese como usuario administrador</p>";
pie("pieverde.jpg");
die();
}
if(isset($_GET['logout'])){
$a->logout();

session_destroy();


header("Location: {$_SERVER['PHP_SELF']}");
die;
}

La base de datos a la que quiero conectar es web_apat , usuario : web_apat1 , contraseña : AW2011 y esta en el servidor :10.55.33.100\SQLEXPRESS

por supuesto, con una tabla usuarios , con sus campos username y pass donde tengo un usuario con username : jesus y pass : 2ef35a8b78b572a47f56846acbeef5d3, q viene a ser 2882 en md5

He hecho un var_dump() a $a a ver que valores sacaba de auth, pero no veo nada raro. Si alguien me pudiese sacar donde esta el fallo me haria un gran favor. Gracias de antemano. Aqui me to el resultado de $a al introducir :

jesus
2882

[COLOR="Red"]object(Auth)#1 (31) { ["expire"]=> int(0) ["expired"]=> bool(false) ["idle"]=> int(0) ["idled"]=> bool(false) ["storage"]=> object(Auth_Container_MDB2)#2 (5) { ["options"]=> array(12) { ["table"]=> string(8) "usuarios" ["usernamecol"]=> string(8) "username" ["passwordcol"]=> string(4) "pass" ["dsn"]=> string(58) "mssql://web_apat1:[email protected]\SQLEXPRESS/web_apat" ["db_fields"]=> string(0) "" ["cryptType"]=> string(3) "md5" ["db_options"]=> array(0) { } ["db_where"]=> string(0) "" ["auto_quote"]=> bool(true) ["final_table"]=> string(8) "usuarios" ["final_usernamecol"]=> string(8) "username" ["final_passwordcol"]=> string(4) "pass" } ["db"]=> object(MDB2_Driver_mssql)#3 (36) { ["string_quoting"]=> array(4) { ["start"]=> string(1) "'" ["end"]=> string(1) "'" ["escape"]=> string(1) "'" ["escape_pattern"]=> bool(false) } ["identifier_quoting"]=> array(3) { ["start"]=> string(1) "[" ["end"]=> string(1) "]" ["escape"]=> string(1) "]" } ["db_index"]=> int(1) ["dsn"]=> array(10) { ["phptype"]=> string(5) "mssql" ["dbsyntax"]=> string(5) "mssql" ["username"]=> string(9) "web_apat1" ["password"]=> string(7) "AW2011p" ["protocol"]=> string(3) "tcp" ["hostspec"]=> string(23) "10.55.33.100\SQLEXPRESS" ["port"]=> bool(false) ["socket"]=> bool(false) ["database"]=> bool(false) ["mode"]=> bool(false) } ["connected_dsn"]=> array(10) { ["phptype"]=> string(5) "mssql" ["dbsyntax"]=> string(5) "mssql" ["username"]=> string(9) "web_apat1" ["password"]=> string(7) "AW2011p" ["protocol"]=> string(3) "tcp" ["hostspec"]=> string(23) "10.55.33.100\SQLEXPRESS" ["port"]=> bool(false) ["socket"]=> bool(false) ["database"]=> bool(false) ["mode"]=> bool(false) } ["connection"]=> resource(12) of type (mssql link) ["opened_persistent"]=> bool(false) ["database_name"]=> string(8) "web_apat" ["connected_database_name"]=> string(8) "web_apat" ["connected_server_info"]=> string(0) "" ["supported"]=> array(19) { ["sequences"]=> string(8) "emulated" ["indexes"]=> bool(true) ["affected_rows"]=> bool(true) ["summary_functions"]=> bool(true) ["order_by_text"]=> bool(true) ["transactions"]=> bool(true) ["savepoints"]=> bool(false) ["current_id"]=> string(8) "emulated" ["limit_queries"]=> string(8) "emulated" ["LOBs"]=> bool(true) ["replace"]=> string(8) "emulated" ["sub_selects"]=> bool(true) ["auto_increment"]=> bool(true) ["primary_key"]=> bool(true) ["result_introspection"]=> bool(true) ["prepared_statements"]=> string(8) "emulated" ["identifier_quoting"]=> bool(false) ["pattern_escaping"]=> bool(true) ["new_link"]=> bool(false) } ["options"]=> array(31) { ["ssl"]=> bool(false) ["field_case"]=> int(0) ["disable_query"]=> bool(false) ["result_class"]=> string(14) "MDB2_Result_%s" ["buffered_result_class"]=> string(22) "MDB2_BufferedResult_%s" ["result_wrap_class"]=> bool(false) ["result_buffering"]=> bool(true) ["fetch_class"]=> string(8) "stdClass" ["persistent"]=> bool(false) ["debug"]=> int(0) ["debug_handler"]=> string(23) "MDB2_defaultDebugOutput" ["debug_expanded_output"]=> bool(false) ["default_text_field_length"]=> int(4096) ["lob_buffer_length"]=> int(8192) ["log_line_break"]=> string(1) " " ["idxname_format"]=> string(6) "%s_idx" ["seqname_format"]=> string(6) "%s_seq" ["savepoint_format"]=> string(17) "MDB2_SAVEPOINT_%s" ["statement_format"]=> string(24) "MDB2_STATEMENT_%1$s_%2$s" ["seqcol_name"]=> string(8) "sequence" ["quote_identifier"]=> bool(false) ["use_transactions"]=> bool(true) ["decimal_places"]=> int(2) ["portability"]=> int(127) ["modules"]=> array(6) { ["ex"]=> string(8) "Extended" ["dt"]=> string(8) "Datatype" ["mg"]=> string(7) "Manager" ["rv"]=> string(7) "Reverse" ["na"]=> string(6) "Native" ["fc"]=> string(8) "Function" } ["emulate_prepared"]=> bool(false) ["datatype_map"]=> array(0) { } ["datatype_map_callback"]=> array(0) { } ["nativetype_map_callback"]=> array(0) { } ["database_device"]=> bool(false) ["database_size"]=> bool(false) } ["sql_comments"]=> array(2) { [0]=>