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