Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/12/2006, 14:45
perro_callejro
 
Fecha de Ingreso: febrero-2004
Ubicación: san miguel
Mensajes: 8
Antigüedad: 20 años, 9 meses
Puntos: 0
Con este me logueo

Cita:
<?php require_once('Connections/telviso.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['User'])) {
$loginUsername=$_POST['User'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "loguinok.php";
$MM_redirectLoginFailed = "Nologuin.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_telviso, $telviso);

$LoginRS__query=sprintf("SELECT usuarios, contraseña FROM usuarios WHERE usuarios='%s' AND contraseña='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $telviso) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//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 );
}

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<label>
<input name="User" type="text" id="User" />
</label>
<p>
<label>
<input name="pass" type="text" id="pass" />
</label>
</p>
<p>
<label>
<input name="enviar" type="submit" id="enviar" value="enviar" />
</label>
</p>
</form>
</body>
</html>

y con este form igreso los datos

Cita:
<?php require_once('Connections/telviso.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO usuarios (usuarios, contraseña, redir) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['usuarios'], "text"),
GetSQLValueString($_POST['contrasea'], "text"),
GetSQLValueString($_POST['redir'], "text"));

mysql_select_db($database_telviso, $telviso);
$Result1 = mysql_query($insertSQL, $telviso) or die(mysql_error());

$insertGoTo = "loguinok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bienvenido a camaras ip de telviso</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:260px;
top:202px;
width:360px;
height:153px;
z-index:3;
}
.style5 {color: #0000FF}
.style7 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #000000; }
body {
background-color: #FF9933;
}
.style9 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF; }
.style10 {
color: #000000;
font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
</head>

<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Usuarios:</td>
<td><input type="text" name="usuarios" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Contraseña:</td>
<td><input type="text" name="contrasea" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Redir:</td>
<td><input type="text" name="redir" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Insert record"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
</body>

</html>