Avatar Image
Machacateclados
Machacateclados

dataprocess.php

Spoiler

<?php

$goHere="pagina a vincular.html";          // Page to send successfull log-ins to
$logSuccess="1";                 // Track / log successful log-ins (1 = yes and 0 = no)

$namePassCombos = array (        // Add as many lines as you like below

    "name1" => "pass1",      // Add username and password combo here
    "name2" => "pass2",      // Add username and password combo here
    "name3" => "pass3"       // Add username and password combo here

);

// Multiple user Log-In script by Dave Lauderdale - Originally published at: www.digi-dl.com

// The below code may or may not be necessary for you
$loginName = $_POST['loginName']; $passWord = $_POST['passWord'];

// Replace bad characters in user input
$passWord = preg_replace ("/</","[",$passWord); $loginName = preg_replace ("/>/","]",$loginName);
$loginName = str_replace(".."," ",$loginName); $passWord = str_replace(".."," ",$passWord);       
 
// Trim whitespace from user input
$loginName=trim($loginName); $passWord=trim($passWord);

// If log-in was successfull
$logInTracker="successLog.txt";
function success($logSuccess,$logInTracker,$loginName,$goHere)
{
       $date=date ("l dS of F Y h:i:s A");
    $register_globals = (bool) ini_get('register_gobals');
    if ($register_globals) $ip = getenv(REMOTE_ADDR);
    else $ip = $_SERVER['REMOTE_ADDR'];

        // If webmaster wants to log successful logins
    if($logSuccess=="1"){
        $log=fopen("files/$logInTracker", "a+");
             fputs($log, "$loginName logged in on: $date - Logged IP address: $ip\n");
        fclose($log);
    }

        // If no log or after log then go here
    Header("Location: $goHere");
}

// If there is an error
function error($notice)
{
        // Display error notice (0)
    if($notice=="0"){
        echo"
            <title>Log-In Error: Absent username / password</title>
            <body><br><p style=\"font:11pt arial\"><font color=red>NOTICE:</font> Log-In Error: Absent username / password.
            <br><br><br>Click <a href=\"javascript:history.back(1)\" style=\"color:black\">here</a> to try again.
            </body></html>
        "; exit;
    }

        // Display error notice (1)
    if($notice=="1"){
        echo"
            <title>Log-In Error: Incorrect username / password</title>
            <body><br><p style=\"font:11pt arial\"><font color=red>NOTICE:</font> Log-In Error: Incorrect username / password.
            <br><br><br>Click <a href=\"javascript:history.back(1)\" style=\"color:black\">here</a> to try again.
            </body></html>
        "; exit;
    }
}

// If the user doesnt enter a name or password then set error notice to 0 and display error
if (($loginName == "") || ($passWord == "")) { $notice=0; error($notice); }

// If the username and password entered don't match then set error notice to 1 and display error
else if (strcmp($namePassCombos[$loginName],$passWord) != 0) { $notice=1; error($notice); }

// If the log in was sucessful
else if (strcmp($namePassCombos[$loginName],$passWord) == 0) { success($logSuccess,$logInTracker,$loginName,$goHere); }
?>

DONDE UNO SE LOGEARA:

Spoiler:

<html>
<head>
<title>Log-In</title>
<body>
<br>
<center>
<h1>LOGEATE</h1>
<br>
                              <!--  IF DESIRED JUST ADD THE BELOW FORM TO YOUR LOG-IN PAGE  -->

          <form method="post" action="dataProcess.php">
          <input type="hidden" name="logIn" value="yes">
          <p style="font:11pt arial">NOMBRE:&nbsp;<input type="text" name="loginName">
          <p style="font:11pt arial">CONTRASEÑA:&nbsp;&nbsp;&nbsp;<input type="text" name="passWord">
          <p><input type="submit" name="submit" value="Log In">
          </form>

</body></html>


ATENCIÓN: Este tema no tiene actividad desde hace más de 6 MESES,
te recomendamos abrir un nuevo tema en lugar de responder al actual
Opciones:
Ir al subforo:
Permisos:
TU NO PUEDES Escribir nuevos temas
TU NO PUEDES Responder a los temas
TU NO PUEDES Editar tus propios mensajes
TU NO PUEDES Borrar tus propios mensajes
Temas similares
No se han encontrado temas similares