tengo varios sistemas hechos con esa libreria y funcionan a la perfeccion, pero ahora en este sistema quiero implementar un logueo...
y me sale este error: Fatal error: Cannot use object of type ADORecordSet_array as array in C:\AppServ\www\medicinauip\quirofano\cabeza.php on line 6
Pagina login.php :
Código PHP:
<?php include_once("conections/quirofano.php"); ?>
<?php require_once('funciones.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['usuario'])) {
$loginUsername=htmlentities($_POST['usuario']);
$password=decripta_clave($_POST['pass']);
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "login.php?msg=error&usuario=".$loginUsername."";
$MM_redirecttoReferrer = false;
// mysql_select_db($database_area, $area);
$LoginRS__query=sprintf("SELECT Codusu, Tipdocusu, Nrodocusu, Clave, Nivelac
FROM funcionario
WHERE Codusu like %s AND Clave=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
// $LoginRS = mysql_query($LoginRS__query, $area) or die(mysql_error());
$LoginRS = $adodb_conn->Execute($LoginRS__query);
if($LoginRS->fields[Codusu] != ""){
$loginFoundUser = true;
}else{
$loginFoundUser = false;
}
if ($loginFoundUser) {
$loginStrGroup = "";
$logueoexitoso="SI";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_Userpass'] = $LoginRS->fields[Clave];
$_SESSION['Idusuario'] = $LoginRS->fields[Codusu];
$_SESSION['MM_UserGroup'] = $LoginRS->fields[Nivelac];
//if (isset($_SESSION['PrevUrl']) && true) {
//$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
$MM_redirectLoginSuccess = GetSQLValueString(htmlentities($_POST['url']), "text2");
//}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
$logueoexitoso="NO";
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<?php if(($_SESSION['Idusuario'] != "") && ($_GET['accesscheck'] == "")){ ?>
<script>
document.location.href='index.php';
</script>
<?php } ?>
<?php if(($_SESSION['Idusuario'] != "") && ($_GET['accesscheck'] != "")){ ?>
<script>
document.location.href='<?php echo $_GET['accesscheck'] ?>';
</script>
<?php } ?>
<?php if($_SESSION['Idusuario'] == ""){ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ingresar al sistema</title>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
body {
margin-left: 0px;
margin-top: 00px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body id="Inicio" bgcolor="#FFFFFF"><?php echo $LoginRS__query; ?>
<table align="center" border="0" width="100%" height="500">
<tr>
<td align="center" valign="middle" bgcolor="#5BADFF"><h2 class="style1"><strong>Sistema de Reservas de Quirofano:</strong></h2></td>
</tr>
<tr><td valign="middle" align="center">
<p> </p>
<table align="center" width="500" border="1" style="border-collapse:collapse;" bordercolor="#000000">
<tr>
<td bgcolor="#5BADFF"><strong class="WhiteLitleTitle style1">Ingresar</strong></td>
</tr>
<tr>
<td class="Cuerpo"><form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<br />
<?php if ($_GET['accesscheck'] != ""){ ?><center><div align="center" style=" width:60%; border:solid; border-color:#CCCCCC; background-color:#FFFFCC"><br />
<p class="Cuerpomediano"><strong>*Debe loguearte para Acceder a esta seccion..</strong><br />
</p>
</div>
</center><?php }else{ ?><br /><?php } ?><br /><br />
<table width="300" border="1" style="border-collapse:collapse;" align="center">
<tr>
<td align="right"><strong>Usuario: </strong></td>
<td align="left"><input name="usuario" type="text" id="usuario" size="15" value="<?php echo $_GET['usuario']; ?>" /></td>
</tr>
<tr>
<td align="right"><strong>Clave:</strong> </td>
<td align="left"><input name="pass" type="password" id="pass" size="15" /></td>
</tr>
<?php if(($_GET['msg'] == "error") && ($_GET['usuario'] != "")){ ?>
<tr>
<td colspan="2" align="center"><span style="color:#FF0000;">*El nombre de usuario y/o clave que ingresaste es incorrecto</span></td>
</tr>
<?php } ?>
<?php if(isset($_GET['usuario']) && ($_GET['usuario'] == "")){ ?>
<tr>
<td colspan="2" align="center"><span style="color:#FF0000;">*Debes completar ambos campos</span></td>
</tr>
<?php } ?>
<tr>
<td colspan="2" align="right"><a href="registro.php"></a>
<label>
<input type="hidden" name="url" id="url" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
</label><input name="iniciosesion" type="hidden" value="form1" />
<input type="submit" name="Submit" value="Ingresar" onClick="document.location.href='panel/'" /></td>
</tr>
</table>
</form>
<p><?php echo $logueoexitoso; ?> </p> </td>
</tr>
</table>
</td></tr></table>
</body>
</html>
<?php }else{ ?>
Ingresando...<br /><br /><br />
Si tu navegador no te direcciona automaticamente hace clic <a href="<?php if($_GET['accesscheck'] == ""){ ?>index.php<?php }else{ echo $_GET['accesscheck']; } ?>">aqui</a>
<?php } ?>
pagina para restringir sesion rsusuario.php (la cual se incluye en todas las paginas con un <?php require_once("rsusuario.php"); ?> :
Código PHP:
<?php include_once("conections/quirofano.php"); ?><?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
$colname_MEMO = "-1";
if (isset($_SESSION['Idusuario'])) {
$colname_MEMO = (get_magic_quotes_gpc()) ? $_SESSION['Idusuario'] : addslashes($_SESSION['Idusuario']);
}
$query_MEMO = sprintf("SELECT Codusu, Tipdocusu, Nrodocusu, Clave, Nivelac
FROM OPERADOR
WHERE Codusu like '%s'", $colname_MEMO);
$row_MEMO = $adodb_conn->Execute($query_MEMO);
?>
en la pagina Index.php
requiero el archivo: <?php require_once("rsusuario.php"); ?> y <?php require_once("cabeza.php"); ?>
dentro del archivo: cabeza.php
hay esto:
Código PHP:
<?php include_once("conections/quirofano.php"); ?><?php require_once("rsusuario.php"); ?><table width="100%" border="1" style="border-collapse:collapse;">
<tr>
<td colspan="2" bgcolor="#5BADFF"><span class="Cabecera">Reservas de Quirofano | Medi-colombia S.A.</span></td>
</tr>
<tr>
<td colspan="2" align="right">[<?php echo $row_MEMO[Codusu]; ?>] <a href="logout.php">Salir</a></td>
</tr>
Código:
Fatal error: Cannot use object of type ADORecordSet_array as array in C:\AppServ\www\medicinauip\quirofano\cabeza.php on line 6
que puede ser esto? HELP!!!!!!