Foros del Web » Creando para Internet » Sistemas de gestión de contenidos »

Nombre de usuario en txt

Estas en el tema de Nombre de usuario en txt en el foro de Sistemas de gestión de contenidos en Foros del Web. Hola, tengo una pagina a la que le agregue un sistema de inicio de secion con php. que solicita nombre de usuario y contraseña. este ...
  #1 (permalink)  
Antiguo 27/02/2011, 14:26
 
Fecha de Ingreso: febrero-2011
Mensajes: 1
Antigüedad: 13 años, 1 mes
Puntos: 0
Nombre de usuario en txt

Hola, tengo una pagina a la que le agregue un sistema de inicio de secion con php. que solicita nombre de usuario y contraseña. este es el codigo:

Código:
<?php
/*
-------------------------------------------------------------------
SAMPLE if you only want to request login and password on login form.
Each row represents different user.

$LOGIN_INFORMATION = array(
  'zubrag' => 'root',
  'test' => 'testpass',
  'admin' => 'passwd'
);

--------------------------------------------------------------------
SAMPLE if you only want to request only password on login form.
Note: only passwords are listed

$LOGIN_INFORMATION = array(
  'root',
  'testpass',
  'passwd'
);

--------------------------------------------------------------------
*/

##################################################################
#  SETTINGS START
##################################################################

// Add login/password pairs below, like described above
// NOTE: all rows except last must have comma "," at the end of line
$LOGIN_INFORMATION = array(
  'NombreDeUsuario' => 'Clave',
  
);

// request login? true - show login and password boxes, false - password box only
define('USE_USERNAME', true);

// User will be redirected to this page after logout
define('LOGOUT_URL', 'http://www.crackbb.com/');

// time out after NN minutes of inactivity. Set to 0 to not timeout
define('TIMEOUT_MINUTES', 1);

// This parameter is only useful when TIMEOUT_MINUTES is not zero
// true - timeout time from last activity, false - timeout time from login
define('TIMEOUT_CHECK_ACTIVITY', true);

##################################################################
#  SETTINGS END
##################################################################


///////////////////////////////////////////////////////
// do not change code below
///////////////////////////////////////////////////////

// show usage example
if(isset($_GET['help'])) {
  die('Include following code into every page you would like to protect, at the very beginning (first line):<br>&lt;?php include("' . str_replace('\\','\\\\',__FILE__) . '"); ?&gt;');
}

// timeout in seconds
$timeout = (TIMEOUT_MINUTES == 0 ? 0 : time() + TIMEOUT_MINUTES * 60);

// logout?
if(isset($_GET['logout'])) {
  setcookie("verify", '', $timeout, '/'); // clear password;
  header('Location: ' . LOGOUT_URL);
  exit();
}

if(!function_exists('showLoginPasswordProtect')) {

// show login form
function showLoginPasswordProtect($error_msg) {
?>
<html>
<head>
  <title>CrackBB.com -- &Aacute;rea VIP</title>
  <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
	background-image: url(http://crackbb.com/images/128-61.jpg);
	background-repeat: repeat;
}
.Estilo1 {color: #FFFFFF}
.Estilo2 {color: #FFFFFF; font-size: 10px; }
a:link {
	color: #CCCCCC;
}
a:visited {
	color: #999999;
}
-->
</style></head>
<body>
  <div align="center">
    <style>
    input { border: 1px solid black; }
  </style>
    <img src="http://crackbb.com/vip/images/header2343.PNG" width="400" height="103">  </div>
  <div style="width:400px; margin-left:auto; margin-right:auto; text-align:center">
  <center>
  <form method="post">
    <h3 class="Estilo1">CrackBB.com -- &Aacute;rea VIP </h3>
    <font color="red"><?php echo $error_msg; ?></font><br />
<?php if (USE_USERNAME) echo '<font color="red">Login:</font><br /><input type="input" name="access_login" /><br /><font color="red">Password:</font><br />'; ?>
    <input type="password" name="access_password" />
        <p>
      <input type="submit" name="Submit" value="Aceptar" />
    </p>
    <p class="Estilo1">Entraste a esta pagina por error? <a href="javascript:history.back()">Atr&aacute;s</a></p>
    <p class="Estilo1">
      <?php include("/home/crackbb/public_html/vip/ip.php"); ?>
	  
	  <?php 

if($_SERVER["HTTP_X_FORWARDED_FOR"]){
echo "La Ip de tu proxy es:{$_SERVER["REMOTE_ADDR"]}<br>";
echo "Tu IP es:{$_SERVER["HTTP_X_FORWARDED_FOR"]}";
}else{
echo "Tu IP es: {$_SERVER["REMOTE_ADDR"]}<br>";
}
?> 
    </p>

    </form>
	</center>
  <br />
  </div>
</body>
</html>

<?php
  // stop at this point
  die();
}
}

// user provided password
if (isset($_POST['access_password'])) {

  $login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
  $pass = $_POST['access_password'];
  if (!USE_USERNAME && !in_array($pass, $LOGIN_INFORMATION)
  || (USE_USERNAME && ( !array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass ) ) 
  ) {
    showLoginPasswordProtect("Password o nombre de usuario incorrecto.");
  }
  else {
    // set cookie if password was validated
    setcookie("verify", md5($login.'%'.$pass), $timeout, '/');
    
    // Some programs (like Form1 Bilder) check $_POST array to see if parameters passed
    // So need to clear password protector variables
    unset($_POST['access_login']);
    unset($_POST['access_password']);
    unset($_POST['Submit']);
  }

}

else {

  // check if password cookie is set
  if (!isset($_COOKIE['verify'])) {
    showLoginPasswordProtect("");
  }

  // check if cookie is good
  $found = false;
  foreach($LOGIN_INFORMATION as $key=>$val) {
    $lp = (USE_USERNAME ? $key : '') .'%'.$val;
    if ($_COOKIE['verify'] == md5($lp)) {
      $found = true;
      // prolong timeout
      if (TIMEOUT_CHECK_ACTIVITY) {
        setcookie("verify", md5($lp), $timeout, '/');
      }
      break;
    }
  }
  if (!$found) {
    showLoginPasswordProtect("");
  }

}

?>
En la parte:

Código:
<?php include("/home/crackbb/public_html/vip/ip.php"); ?>
Este es el codigo de ip.php

Código:
<?php
date_default_timezone_set('America/Caracas');
$fecha = getdate();
$hora = ($fecha["mday"]."/". $fecha["mon"]."/". $fecha["year"]." - ". $fecha["hours"].":". $fecha["minutes"]."");
$txt="La ip:".$_SERVER['REMOTE_ADDR']." ha entrado: ".$hora." Con el navegador:".$_SERVER['HTTP_USER_AGENT'];
$fd = fopen ("visitas.txt", "a")or
die("Problemas en la conexion");
fputs($fd,"\n");
fputs($fd,$txt);
fclose($fd);
?>
Este ip.php me detecta las personas que entran desde venezuela y me las guarda en un documento txt. ahora bien, lo que quiero es que en el php que solicita el password se agregue algo que en lo que yo le de "Aceptar" me guarde el nombre de usuario y la ip de la persona que entro en un .txt

Sera posible esto? agregandolo en ip.php o en el passsword.php ???
  #2 (permalink)  
Antiguo 28/02/2011, 05:34
Avatar de mandrake88  
Fecha de Ingreso: septiembre-2009
Mensajes: 328
Antigüedad: 14 años, 7 meses
Puntos: 13
Respuesta: Nombre de usuario en txt

Seccion equivocada, este subforo es para el script de foros phpBB

Etiquetas: modificar, php, txt, usuarios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:42.