Hola a todo al parecer esta resuelto, pues he colocado lo que me han sugerido y me ingresa como quiero, aqui dejo el codigo por que puede haber un error, me dicen si esta bien?, gracias.
Código PHP:
<?php require_once('Connections/conex.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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_conex, $conex);
$query_menu = "SELECT * FROM categorias";
$menu = mysql_query($query_menu, $conex) or die(mysql_error());
$row_menu = mysql_fetch_assoc($menu);
$totalRows_menu = mysql_num_rows($menu);
?>
<?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=$_POST['usuario'];
$password=md5($_POST['password']);
$MM_fldUserAuthorization = "nivel";
//$MM_redirectLoginSuccess = "colegios.php";
$MM_redirectLoginSuccess = "seccion".$nivel.".php";
session_start();
switch ($_SESSION['MM_UserGroup']) {
case 1:
include("seccion1.php");break;
case 2:
include("seccion2.php");break;
case 3:
include("seccion3.php");break;
}
$MM_redirecttoReferrer = false;
mysql_select_db($database_conex, $conex);
$LoginRS__query=sprintf("SELECT usuario, password, nivel FROM usuarios WHERE usuario=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conex) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'nivel');
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<html>
<head>
<title>PRUEBAS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META lang=es content="PRUEBAS" name=Keywords>
<META content="PRUEBAS" name=Description>
<META content=worldwide name=coverage>
<META content=all name=robots>
<META content=general name=rating>
<META content="1 days" name=revisit-after>
<meta name="distribution" content="local">
</script>
<script language="JavaScript1.2">
<!--
top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
//-->
</script>
<link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link href="estilo.css" rel="stylesheet" type="text/css">
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.Estilo2 {
font-size: 14px;
color: #000000;
font-weight: bold;
}
.Estilo3 {font-size: 10px}
a:visited {
color: #000000;
}
a:hover {
color: #666666;
}
a:active {
color: #333333;
}
.Estilo7 {color: #000000}
.Estilo10 {font-size: 9pt; color: #FFFFFF; }
.Estilo12 {font-size: 12pt}
.Estilo13 {font-size: 12px; }
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="571" height="768" border="0" align="center" cellpadding="0" cellspacing="0" id="principal">
<tr>
<td width="571" height="462" valign="top" class="content"><p align="center" class="titulos Estilo12">Registro de Clientes</p>
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="69%" align="center">
<tr>
<th width="51%" scope="row"><div align="right" class="Estilo13">Nombre de usuario:</div></th>
<th width="49%" scope="row"><label>
<div align="left">
<input name="usuario" type="text" id="usuario" size="45">
</div>
</label></th>
</tr>
<tr>
<th scope="row"><div align="right" class="Estilo13">Password:</div></th>
<th scope="row"><div align="left">
<input name="password" type="password" id="password" size="45">
</div></th>
</tr>
</table>
<p>
<label>
<div align="center">
<input type="submit" name="button" id="button" value="Ingresar">
</div>
</label>
</p>
</form> <p align="center" class="titulos Estilo12"> </p> </td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($menu);
?>