Estimado, copie el codigo que me diste dentro de la pagina, pero al validar no me reenvia se queda en la misma pagina
asi quedo el codigo:
Código PHP:
<?php require_once('Connections/localhost.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
session_start();
require_once('Connections/localhost.php');
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_localhost, $localhost);
$query_usuarios = "SELECT * FROM usuarios";
$usuarios = mysql_query($query_usuarios, $localhost) or die(mysql_error());
$row_usuarios = mysql_fetch_assoc($usuarios);
$totalRows_usuarios = mysql_num_rows($usuarios);
// *** 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['user'])) {
$loginUsername=$_POST['user'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "atri";
$MM_redirectLoginAdmin = "admins.php";
$MM_redirectLoginTecnico = "formtecopt.php";
$MM_redirectLoginCliente ="AQUI LA PAGINA DE REDIRECCION DE CLIENTES";
$MM_redirectLoginFailed = "error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_localhost, $localhost);
$LoginRS__query=sprintf("SELECT usuario, pass, atri FROM usuarios WHERE usuario=%s AND pass=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $localhost) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'atri');
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['MM_UserGroup']) == 'administrador') {
header("Location: ". $MM_redirectLoginAdmin );
}elseif(isset($_SESSION['MM_UserGroup']) == 'tecnico'){
header("Location: ". $MM_redirectLoginTecnico );
}elseif(isset($_SESSION['MM_UserGroup']) == 'cliente'){
header("Location: ". $MM_redirectLoginCliente );
}else{
header("Location: ". $MM_redirectLoginFailed ); }
}else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" dir="ltr" lang="es"><head>
<link rel="Shortcut Icon" href="icono.ico">
<title>Plataforma</title>
<!-- Contents -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="es">
<meta http-equiv="last-modified" content="04/04/2011 12:40:32">
<meta http-equiv="Content-Type-Script" content="text/javascript">
<meta name="description" content="">
<meta name="keywords" content="">
<!-- imCustomHead -->
<meta http-equiv="Expires" content="0">
<meta name="Resource-Type" content="document">
<meta name="Distribution" content="global">
<meta name="Robots" content="index, follow">
<meta name="Revisit-After" content="21 days">
<meta name="Rating" content="general">
<!-- Others -->
<meta name="Generator" content="Incomedia WebSite X5 Evolution Evolution 8.0.9 - www.websitex5.com">
<meta http-equiv="ImageToolbar" content="False">
<meta name="MSSmartTagsPreventParsing" content="True">
<!-- Parent -->
<link rel="sitemap" href="imsitemap.html" title="Mapa general del sitio">
<!-- Res -->
<script type="text/javascript" src="res/x5engine.js"></script>
<link rel="stylesheet" type="text/css" href="res/styles.css" media="screen, print">
<link rel="stylesheet" type="text/css" href="res/template.css" media="screen">
<link rel="stylesheet" type="text/css" href="res/print.css" media="print">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="res/iebehavior.css" media="screen" /><![endif]-->
<link rel="stylesheet" type="text/css" href="res/p003.css" media="screen, print">
<link rel="stylesheet" type="text/css" href="res/handheld.css" media="handheld">
<link rel="alternate stylesheet" title="Alto contraste - Accesibilidad" type="text/css" href="res/accessibility.css" media="screen">
<style type="text/css">
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
</style>
</head>
<body link="#FFFFFF">
<div id="imSite">
<table width="964" border="0" align="center">
<tbody><tr>
<td><img src="imagenes/logoOPT.jpg" alt="" height="85" width="200"></td>
<td align="right"><p><img src="imagenes/direcciones.jpg" alt="" height="106" width="250"></p></td>
</tr>
</tbody></table>
<div class="imInvisible">
<hr>
<a href="#imGoToCont" title="Saltar el menú principal">Ir al Contenido</a>
</div>
<div id="imBody">
<div>
<!-- Menu START -->
<a name="imGoToMenu"></a><p class="imInvisible">Menú Principal:</p>
<div id="imMnMn">
<ul>
<li><a class="imMnItm_1" href="index.php" title=""><span class="imHidden">Presentación</span></a></li>
<li><a class="imMnItm_2" href="noticias.html" title=""><span class="imHidden">Noticias</span></a></li>
<li><a class="imMnItm_3" href="plataforma.php" title=""><span class="imHidden">Plataforma</span></a></li>
<li><a class="imMnItm_5" href="contacto.html" title=""><span class="imHidden">Contacto</span></a></li>
</ul>
</div>
<!-- Menu END -->
</div>
<hr class="imInvisible">
<a name="imGoToCont"></a>
<div id="imContent">
<!-- Page START -->
<h2>Plataforma</h2>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<form id="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="903" border="0">
<tr>
<td width="447" align="right">Ingrese su RUT: </td>
<td width="436"><label for="user"></label>
<input type="text" name="user" id="user" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"><p>Ingrese su Contraseña:: </p></td>
<td><label for="pass"></label>
<input type="password" name="pass" id="pass" /></td>
</tr>
</table>
<p> </p>
<p> </p>
<table width="903" border="0">
<tr>
<td width="400" align="right"><input type="submit" name="ingresar" id="ingresar" value="Ingresar" /></td>
<td width="89"> </td>
<td width="400"><input type="reset" name="restaurar" id="restaurar" value="Restablecer datos" /></td>
</tr>
</table>
<p> </p>
</form>
</div>
</div>
</div>
<div class="imInvisible">
<hr>
<a href="#imGoToCont" title="Leer esta página de nuevo">Regresar al contenido</a> | <a href="#imGoToMenu" title="Leer este sitio de nuevo">Regresar al menú principal</a>
</div>
<div id="imShowBoxBG" style="display: none;" onclick="imShowBoxHide()"></div>
<div id="imShowBoxContainer" style="display: none;" onclick="imShowBoxHide()"><div id="imShowBox" style="height: 200px; width: 200px;"></div></div>
<div id="imBGSound"></div>
<div id="imToolTip"><script type="text/javascript">var imt = new IMTip;</script></div>
<script type="text/javascript">imPreloadImages('res/immnu_01b.gif,res/immnu_02b.gif,res/immnu_03b.gif,res/immnu_04b.gif,res/immnu_05b.gif')</script>
</body></html>
<?php
mysql_free_result($usuarios);
?>
gracias ;)