100 DIFFERENT LOGIN & SIGNUP FORMS IN PHP

Table of Contents

INTRODUCTION

This comprehensive collection features 100 unique authentication forms with diverse designs, functionalities, and security features. Each form serves a specific purpose and demonstrates different PHP techniques.


CATEGORY A: BASIC AUTHENTICATION FORMS (1-10)

Form 1: Classic Login

<?php
// classic_login.php
session_start();
if($_POST){
$user = $_POST['username'];
$pass = $_POST['password'];
if($user == "admin" && $pass == "1234"){
$_SESSION['user'] = $user;
header("Location: dashboard.php");
}
}
?>
<form method="POST">
<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<button type="submit">Login</button>
</form>

Form 2: Modern Signup

<?php
// modern_signup.php
$errors = [];
if($_POST){
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$pass = $_POST['password'];
if(strlen($name) < 3) $errors[] = "Name too short";
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) $errors[] = "Invalid email";
if(strlen($pass) < 6) $errors[] = "Password too short";
if(empty($errors)){
// Save to database
echo "Success!";
}
}
?>

Form 3: Minimalist Login

<!-- minimalist_login.php -->
<style>.container{max-width:300px;margin:auto;}</style>
<div class="container">
<form method="POST">
<h2>Sign In</h2>
<input type="email" name="email" placeholder="Email" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit">Continue</button>
</form>
</div>

Form 4: Split Screen Signup

<?php
// splitscreen_signup.php
?>
<!DOCTYPE html>
<html>
<head>
<style>
.container{display:flex;height:100vh;}
.left{flex:1;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:white;padding:50px;}
.right{flex:1;padding:50px;background:white;}
input{width:100%;padding:10px;margin:10px 0;border:1px solid #ddd;border-radius:5px;}
button{background:#667eea;color:white;padding:12px 30px;border:none;border-radius:5px;}
</style>
</head>
<body>
<div class="container">
<div class="left">
<h1>Welcome Back!</h1>
<p>Join millions of users worldwide</p>
</div>
<div class="right">
<h2>Create Account</h2>
<form method="POST">
<input type="text" name="fullname" placeholder="Full Name" required>
<input type="email" name="email" placeholder="Email" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit">Sign Up</button>
</form>
</div>
</div>
</body>
</html>

Form 5: Card Style Login

<?php
// card_login.php
?>
<div style="display:flex;justify-content:center;align-items:center;height:100vh;background:#f5f5f5;">
<div style="background:white;padding:40px;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,0.1);width:350px;">
<h2 style="text-align:center;margin-bottom:30px;">Login</h2>
<form method="POST">
<div style="margin-bottom:20px;">
<label>Username</label>
<input type="text" name="username" style="width:100%;padding:10px;border:1px solid #ddd;border-radius:5px;" required>
</div>
<div style="margin-bottom:20px;">
<label>Password</label>
<input type="password" name="password" style="width:100%;padding:10px;border:1px solid #ddd;border-radius:5px;" required>
</div>
<button type="submit" style="width:100%;padding:12px;background:#007bff;color:white;border:none;border-radius:5px;">Login</button>
</form>
</div>
</div>

Form 6: Floating Label Signup

<?php
// floating_labels.php
?>
<style>
.form-group{position:relative;margin:30px 0;}
input{padding:10px;width:100%;border:none;border-bottom:2px solid #ddd;outline:none;}
label{position:absolute;left:0;bottom:10px;color:#999;transition:0.3s;pointer-events:none;}
input:focus ~ label, input:valid ~ label{bottom:30px;font-size:12px;color:#007bff;}
</style>
<form>
<div class="form-group">
<input type="text" required>
<label>Full Name</label>
</div>
<div class="form-group">
<input type="email" required>
<label>Email Address</label>
</div>
<div class="form-group">
<input type="password" required>
<label>Password</label>
</div>
</form>

Form 7: Gradient Background Login

<?php
// gradient_login.php
?>
<style>
body{background:linear-gradient(45deg,#ff6b6b,#4ecdc4);height:100vh;display:flex;align-items:center;}
.form-box{background:rgba(255,255,255,0.9);width:400px;margin:auto;padding:40px;border-radius:10px;backdrop-filter:blur(10px);}
</style>
<div class="form-box">
<h2>Welcome</h2>
<form method="POST">
<input type="text" placeholder="Username" style="width:100%;padding:10px;margin:10px 0;">
<input type="password" placeholder="Password" style="width:100%;padding:10px;margin:10px 0;">
<button type="submit" style="width:100%;padding:12px;background:#ff6b6b;color:white;border:none;">Login</button>
</form>
</div>

Form 8: Neon Theme Login

<?php
// neon_login.php
?>
<style>
body{background:#000;display:flex;align-items:center;height:100vh;}
.neon-box{width:350px;margin:auto;padding:40px;border:2px solid #0ff;box-shadow:0 0 20px #0ff;border-radius:10px;}
h2{color:#0ff;text-align:center;text-shadow:0 0 10px #0ff;}
input{width:100%;padding:10px;margin:10px 0;background:transparent;border:1px solid #0ff;color:#0ff;outline:none;}
button{width:100%;padding:12px;background:#0ff;color:#000;border:none;font-weight:bold;cursor:pointer;}
</style>
<div class="neon-box">
<h2>NEON LOGIN</h2>
<form method="POST">
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button type="submit">ENTER</button>
</form>
</div>

Form 9: Dark Mode Login

<?php
// dark_login.php
?>
<style>
body{background:#1a1a1a;color:#fff;display:flex;align-items:center;height:100vh;}
.dark-box{background:#2d2d2d;width:350px;margin:auto;padding:40px;border-radius:8px;}
input{width:100%;padding:12px;margin:10px 0;background:#3d3d3d;border:1px solid #4d4d4d;color:#fff;border-radius:4px;}
button{width:100%;padding:12px;background:#007acc;color:white;border:none;border-radius:4px;}
</style>
<div class="dark-box">
<h2>Dark Mode</h2>
<form method="POST">
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button type="submit">Sign In</button>
</form>
</div>

Form 10: Transparent Login

<?php
// transparent_login.php
?>
<style>
body{background:url('https://source.unsplash.com/random') no-repeat center;background-size:cover;}
.transparent-box{width:350px;margin:100px auto;padding:40px;background:rgba(255,255,255,0.1);backdrop-filter:blur(10px);border-radius:10px;border:1px solid rgba(255,255,255,0.2);}
input{width:100%;padding:12px;margin:10px 0;background:rgba(255,255,255,0.2);border:1px solid rgba(255,255,255,0.3);color:white;border-radius:5px;}
input::placeholder{color:rgba(255,255,255,0.7);}
</style>
<div class="transparent-box">
<h2 style="color:white;">Login</h2>
<form method="POST">
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button type="submit" style="width:100%;padding:12px;background:white;color:#333;border:none;border-radius:5px;">Login</button>
</form>
</div>

CATEGORY B: DATABASE-DRIVEN FORMS (11-20)

Form 11: MySQL Login

<?php
// mysql_login.php
session_start();
$conn = new mysqli("localhost", "root", "", "users");
if($_POST){
$user = $conn->real_escape_string($_POST['username']);
$pass = md5($_POST['password']);
$result = $conn->query("SELECT * FROM users WHERE username='$user' AND password='$pass'");
if($result->num_rows > 0){
$_SESSION['user'] = $user;
header("Location: dashboard.php");
}
}
?>
<form method="POST">
<input type="text" name="username" required>
<input type="password" name="password" required>
<button type="submit">Login</button>
</form>

Form 12: PDO Registration

<?php
// pdo_register.php
$host = 'localhost';
$dbname = 'auth_system';
$username = 'root';
$password = '';
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if($_POST){
$stmt = $pdo->prepare("INSERT INTO users (name, email, password) VALUES (:name, :email, :password)");
$stmt->execute([
':name' => $_POST['name'],
':email' => $_POST['email'],
':password' => password_hash($_POST['password'], PASSWORD_DEFAULT)
]);
echo "Registration successful!";
}
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
?>

Form 13: MySQLi Signup with Validation

<?php
// mysqli_signup.php
$conn = new mysqli("localhost", "root", "", "test");
if($conn->connect_error) die("Connection failed");
if($_POST){
$name = $conn->real_escape_string($_POST['name']);
$email = $conn->real_escape_string($_POST['email']);
$pass = password_hash($_POST['password'], PASSWORD_BCRYPT);
$check = $conn->query("SELECT id FROM users WHERE email='$email'");
if($check->num_rows == 0){
$conn->query("INSERT INTO users (name, email, password) VALUES ('$name', '$email', '$pass')");
echo "Account created!";
} else {
echo "Email already exists!";
}
}
?>

Form 14: SQLite Login System

<?php
// sqlite_login.php
$db = new SQLite3('users.db');
$db->exec("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, username TEXT, password TEXT)");
if($_POST){
$user = $_POST['username'];
$pass = $_POST['password'];
$stmt = $db->prepare("SELECT * FROM users WHERE username = :user AND password = :pass");
$stmt->bindValue(':user', $user);
$stmt->bindValue(':pass', md5($pass));
$result = $stmt->execute();
if($result->fetchArray()){
echo "Login successful!";
}
}
?>

Form 15: PostgreSQL Login

<?php
// postgres_login.php
$conn = pg_connect("host=localhost dbname=auth user=postgres password=postgres");
if($_POST){
$user = pg_escape_string($_POST['username']);
$pass = md5($_POST['password']);
$result = pg_query("SELECT * FROM users WHERE username='$user' AND password='$pass'");
if(pg_num_rows($result) > 0){
echo "Welcome!";
}
}
?>

Form 16: MongoDB Login

<?php
// mongodb_login.php
require 'vendor/autoload.php';
$client = new MongoDB\Client("mongodb://localhost:27017");
$collection = $client->auth->users;
if($_POST){
$user = $_POST['username'];
$pass = $_POST['password'];
$result = $collection->findOne(['username' => $user, 'password' => md5($pass)]);
if($result){
echo "Login successful!";
}
}
?>

Form 17: Redis Session Login

<?php
// redis_login.php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
session_start();
if($_POST){
$user = $_POST['username'];
$redis->set("user:session:" . session_id(), $user);
$_SESSION['user'] = $user;
}
?>

Form 18: JSON File Storage

<?php
// json_storage.php
$users_file = 'users.json';
if($_POST){
$users = json_decode(file_get_contents($users_file), true) ?? [];
$new_user = [
'name' => $_POST['name'],
'email' => $_POST['email'],
'password' => password_hash($_POST['password'], PASSWORD_DEFAULT),
'created_at' => date('Y-m-d H:i:s')
];
$users[] = $new_user;
file_put_contents($users_file, json_encode($users, JSON_PRETTY_PRINT));
echo "User saved!";
}
?>

Form 19: CSV File Login

<?php
// csv_login.php
if($_POST){
$handle = fopen("users.csv", "r");
$found = false;
while(($data = fgetcsv($handle)) !== FALSE){
if($data[0] == $_POST['username'] && password_verify($_POST['password'], $data[1])){
$found = true;
break;
}
}
fclose($handle);
if($found){
echo "Login successful!";
}
}
?>

Form 20: XML User Database

<?php
// xml_login.php
$xml = simplexml_load_file('users.xml');
if($_POST){
foreach($xml->user as $user){
if($user->username == $_POST['username'] && $user->password == md5($_POST['password'])){
echo "Welcome " . $user->name;
break;
}
}
}
?>

CATEGORY C: SECURITY-FOCUSED FORMS (21-30)

Form 21: Bcrypt Password Hashing

<?php
// bcrypt_login.php
if($_POST){
$password = $_POST['password'];
$hash = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]);
if(password_verify($password, $hash)){
echo "Password verified!";
}
}
?>

Form 22: Argon2 Hashing

<?php
// argon2_login.php
if($_POST){
$password = $_POST['password'];
$hash = password_hash($password, PASSWORD_ARGON2ID);
if(password_verify($password, $hash)){
echo "Secure login with Argon2!";
}
}
?>

Form 23: CSRF Protection

<?php
// csrf_protected.php
session_start();
if(empty($_SESSION['csrf_token'])){
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
if($_POST){
if(!hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])){
die("CSRF attack detected!");
}
// Process login
}
?>
<form method="POST">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">
<input type="text" name="username">
<input type="password" name="password">
<button type="submit">Login</button>
</form>

Form 24: XSS Protected Output

<?php
// xss_protected.php
function escape($data){
return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
}
if($_POST){
$name = escape($_POST['name']);
echo "Welcome, " . $name;
}
?>

Form 25: SQL Injection Prevention

<?php
// sql_injection_prevention.php
$pdo = new PDO("mysql:host=localhost;dbname=test", "root", "");
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ? AND password = ?");
$stmt->execute([$_POST['username'], $_POST['password']]);

Form 26: Brute Force Protection

<?php
// brute_force_protection.php
session_start();
$max_attempts = 5;
$lockout_time = 900; // 15 minutes
if($_POST){
$ip = $_SERVER['REMOTE_ADDR'];
$attempts = $_SESSION['attempts'][$ip] ?? 0;
if($attempts >= $max_attempts){
if(time() - $_SESSION['lockout'][$ip] < $lockout_time){
die("Too many attempts. Try again later.");
} else {
$_SESSION['attempts'][$ip] = 0;
}
}
// Process login
$login_success = false;
if($login_success){
unset($_SESSION['attempts'][$ip]);
} else {
$_SESSION['attempts'][$ip] = $attempts + 1;
$_SESSION['lockout'][$ip] = time();
}
}
?>

Form 27: HTTPS Enforcement

<?php
// https_enforce.php
if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off'){
$redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $redirect);
exit();
}
?>

Form 28: Session Timeout

<?php
// session_timeout.php
session_start();
$timeout = 1800; // 30 minutes
if(isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity'] > $timeout)){
session_unset();
session_destroy();
header("Location: login.php?timeout=1");
}
$_SESSION['last_activity'] = time();
?>

Form 29: IP-based Login Restriction

<?php
// ip_restriction.php
$allowed_ips = ['192.168.1.100', '10.0.0.5'];
$user_ip = $_SERVER['REMOTE_ADDR'];
if(!in_array($user_ip, $allowed_ips)){
die("Access denied from your location.");
}
?>

Form 30: Device Fingerprinting

<?php
// device_fingerprint.php
$fingerprint = md5(
$_SERVER['HTTP_USER_AGENT'] . 
$_SERVER['REMOTE_ADDR'] . 
(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '')
);
session_start();
if(isset($_SESSION['fingerprint']) && $_SESSION['fingerprint'] !== $fingerprint){
session_destroy();
die("Session hijacking detected!");
}
$_SESSION['fingerprint'] = $fingerprint;
?>

CATEGORY D: TWO-FACTOR AUTHENTICATION (31-40)

Form 31: SMS 2FA

<?php
// sms_2fa.php
session_start();
if($_POST){
if(!isset($_SESSION['2fa'])){
$phone = $_POST['phone'];
$code = rand(100000, 999999);
$_SESSION['2fa'] = $code;
$_SESSION['phone'] = $phone;
// Send SMS via API
echo "Code sent to your phone!";
} else {
if($_POST['code'] == $_SESSION['2fa']){
echo "2FA Successful!";
unset($_SESSION['2fa']);
}
}
}
?>

Form 32: Email 2FA

<?php
// email_2fa.php
session_start();
if($_POST){
if(!isset($_SESSION['email_code'])){
$email = $_POST['email'];
$code = rand(100000, 999999);
$_SESSION['email_code'] = $code;
mail($email, "Your 2FA Code", "Your code is: $code");
echo "Code sent to your email!";
} else {
if($_POST['code'] == $_SESSION['email_code']){
echo "Email verified!";
unset($_SESSION['email_code']);
}
}
}
?>

Form 33: Google Authenticator

<?php
// google_auth.php
require_once 'vendor/autoload.php';
use Sonata\GoogleAuthenticator\GoogleAuthenticator;
$g = new GoogleAuthenticator();
$secret = $g->generateSecret();
if($_POST){
if($g->checkCode($secret, $_POST['code'])){
echo "Google Authenticator verified!";
}
}
?>

Form 34: TOTP Authentication

<?php
// totp_auth.php
$secret = "BASE32SECRET123";
$timestamp = floor(time() / 30);
$code = str_pad(rand(0, 999999), 6, '0', STR_PAD_LEFT);
if($_POST){
if($_POST['code'] == $code){
echo "TOTP valid!";
}
}
?>

Form 35: Biometric 2FA

<?php
// biometric_2fa.php
?>
<script>
if(window.PublicKeyCredential){
// WebAuthn implementation
navigator.credentials.create({
publicKey: {
challenge: new Uint8Array(32),
rp: {name: "Example App"},
user: {
id: new Uint8Array(16),
name: "[email protected]",
displayName: "User"
},
pubKeyCredParams: [{alg: -7, type: "public-key"}]
}
});
}
</script>

Form 36: Hardware Token

<?php
// hardware_token.php
$valid_tokens = ['TOKEN123', 'TOKEN456'];
if($_POST){
if(in_array($_POST['token'], $valid_tokens)){
echo "Hardware token verified!";
}
}
?>

Form 37: YubiKey OTP

<?php
// yubikey.php
$yubi_otp = $_POST['otp'];
$client_id = 'YOUR_CLIENT_ID';
$api_key = 'YOUR_API_KEY';
$response = file_get_contents("https://api.yubico.com/wsapi/2.0/verify?id=$client_id&otp=$yubi_otp");
if(strpos($response, 'status=OK') !== false){
echo "YubiKey verified!";
}
?>

Form 38: SMS with Twilio

<?php
// twilio_2fa.php
require_once 'vendor/autoload.php';
use Twilio\Rest\Client;
$sid = 'your_account_sid';
$token = 'your_auth_token';
$twilio = new Client($sid, $token);
if($_POST){
$code = rand(100000, 999999);
$message = $twilio->messages->create(
$_POST['phone'],
['from' => '+1234567890', 'body' => "Your code: $code"]
);
}
?>

Form 39: QR Code 2FA Setup

<?php
// qr_2fa.php
require_once 'phpqrcode/qrlib.php';
$secret = 'JBSWY3DPEHPK3PXP';
$label = '[email protected]';
$issuer = 'MyApp';
$qrData = "otpauth://totp/$issuer:$label?secret=$secret&issuer=$issuer";
QRcode::png($qrData, 'qr.png');
?>
<img src="qr.png" alt="2FA QR Code">

Form 40: Backup Codes

<?php
// backup_codes.php
session_start();
if(!isset($_SESSION['backup_codes'])){
$codes = [];
for($i = 0; $i < 10; $i++){
$codes[] = bin2hex(random_bytes(5));
}
$_SESSION['backup_codes'] = $codes;
}
if($_POST){
if(in_array($_POST['code'], $_SESSION['backup_codes'])){
echo "Backup code accepted!";
// Remove used code
$_SESSION['backup_codes'] = array_diff($_SESSION['backup_codes'], [$_POST['code']]);
}
}
?>

CATEGORY E: SOCIAL MEDIA INTEGRATION (41-50)

Form 41: Google Login

<?php
// google_login.php
require_once 'vendor/autoload.php';
$client = new Google_Client();
$client->setClientId('YOUR_CLIENT_ID');
$client->setClientSecret('YOUR_SECRET');
$client->setRedirectUri('http://localhost/callback.php');
$client->addScope("email");
$client->addScope("profile");
$auth_url = $client->createAuthUrl();
echo "<a href='$auth_url'>Login with Google</a>";
?>

Form 42: Facebook Login

<?php
// facebook_login.php
require_once 'vendor/autoload.php';
$fb = new Facebook\Facebook([
'app_id' => 'YOUR_APP_ID',
'app_secret' => 'YOUR_APP_SECRET',
'default_graph_version' => 'v12.0',
]);
$helper = $fb->getRedirectLoginHelper();
$permissions = ['email'];
$loginUrl = $helper->getLoginUrl('http://localhost/fb-callback.php', $permissions);
echo "<a href='$loginUrl'>Login with Facebook</a>";
?>

Form 43: Twitter Login

<?php
// twitter_login.php
require_once 'vendor/autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth('CONSUMER_KEY', 'CONSUMER_SECRET');
$request_token = $connection->oauth('oauth/request_token', ['oauth_callback' => 'http://localhost/twitter-callback.php']);
$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
$url = $connection->url('oauth/authorize', ['oauth_token' => $request_token['oauth_token']]);
echo "<a href='$url'>Login with Twitter</a>";
?>

Form 44: GitHub Login

<?php
// github_login.php
$client_id = 'YOUR_GITHUB_CLIENT_ID';
$redirect_uri = 'http://localhost/github-callback.php';
$url = "https://github.com/login/oauth/authorize?client_id=$client_id&redirect_uri=$redirect_uri&scope=user";
echo "<a href='$url'>Login with GitHub</a>";
?>

Form 45: LinkedIn Login

<?php
// linkedin_login.php
$client_id = 'YOUR_LINKEDIN_CLIENT_ID';
$redirect_uri = 'http://localhost/linkedin-callback.php';
$url = "https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=$client_id&redirect_uri=$redirect_uri&scope=r_liteprofile%20r_emailaddress";
echo "<a href='$url'>Login with LinkedIn</a>";
?>

Form 46: Instagram Login

<?php
// instagram_login.php
$client_id = 'YOUR_INSTAGRAM_CLIENT_ID';
$redirect_uri = 'http://localhost/instagram-callback.php';
$url = "https://api.instagram.com/oauth/authorize?client_id=$client_id&redirect_uri=$redirect_uri&scope=user_profile,user_media&response_type=code";
echo "<a href='$url'>Login with Instagram</a>";
?>

Form 47: Microsoft Login

<?php
// microsoft_login.php
$client_id = 'YOUR_MICROSOFT_CLIENT_ID';
$redirect_uri = 'http://localhost/microsoft-callback.php';
$url = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=$client_id&response_type=code&redirect_uri=$redirect_uri&scope=openid%20profile%20email";
echo "<a href='$url'>Login with Microsoft</a>";
?>

Form 48: Amazon Login

<?php
// amazon_login.php
$client_id = 'YOUR_AMAZON_CLIENT_ID';
$redirect_uri = 'http://localhost/amazon-callback.php';
$url = "https://www.amazon.com/ap/oa?client_id=$client_id&scope=profile&response_type=code&redirect_uri=$redirect_uri";
echo "<a href='$url'>Login with Amazon</a>";
?>

Form 49: Apple Login

<?php
// apple_login.php
$client_id = 'YOUR_APPLE_CLIENT_ID';
$redirect_uri = 'http://localhost/apple-callback.php';
$url = "https://appleid.apple.com/auth/authorize?client_id=$client_id&redirect_uri=$redirect_uri&response_type=code&scope=name%20email&response_mode=form_post";
echo "<a href='$url'>Login with Apple</a>";
?>

Form 50: Multi-Social Login

<?php
// multi_social.php
$providers = [
'google' => ['url' => 'google_login.php', 'icon' => '🔍'],
'facebook' => ['url' => 'facebook_login.php', 'icon' => '📘'],
'twitter' => ['url' => 'twitter_login.php', 'icon' => '🐦'],
'github' => ['url' => 'github_login.php', 'icon' => '🐙'],
'linkedin' => ['url' => 'linkedin_login.php', 'icon' => '🔗']
];
?>
<div class="social-login">
<?php foreach($providers as $name => $provider): ?>
<a href="<?php echo $provider['url']; ?>" class="social-btn <?php echo $name; ?>">
<?php echo $provider['icon']; ?> Login with <?php echo ucfirst($name); ?>
</a>
<?php endforeach; ?>
</div>

CATEGORY F: ADVANCED FEATURES (51-60)

Form 51: Fingerprint Scanner Simulation

<?php
// fingerprint_scanner.php
?>
<div class="scanner">
<div class="fingerprint" onclick="scan()">
<svg viewBox="0 0 24 24">
<path d="M12 2C8.69 2 6 4.69 6 8v4c0 3.31 2.69 6 6 6s6-2.69 6-6V8c0-3.31-2.69-6-6-6z"/>
</svg>
</div>
<p id="status">Place your finger</p>
</div>
<script>
function scan() {
document.getElementById('status').textContent = 'Scanning...';
setTimeout(() => {
document.getElementById('status').textContent = 'Fingerprint matched!';
}, 2000);
}
</script>

Form 52: Face Recognition Simulation

<?php
// face_recognition.php
?>
<video id="video" autoplay></video>
<canvas id="canvas" style="display:none;"></canvas>
<button onclick="capture()">Capture Face</button>
<script>
navigator.mediaDevices.getUserMedia({video: true})
.then(stream => document.getElementById('video').srcObject = stream);
function capture() {
const video = document.getElementById('video');
const canvas = document.getElementById('canvas');
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext('2d').drawImage(video, 0, 0);
// Simulate face recognition
alert('Face recognized!');
}
</script>

Form 53: Voice Recognition Login

<?php
// voice_login.php
?>
<button onclick="startListening()">Say Your Password</button>
<div id="result"></div>
<script>
function startListening() {
const recognition = new webkitSpeechRecognition();
recognition.onresult = function(event) {
document.getElementById('result').textContent = 
'You said: ' + event.results[0][0].transcript;
};
recognition.start();
}
</script>

Form 54: QR Code Login

<?php
// qr_login.php
session_start();
$token = bin2hex(random_bytes(16));
$_SESSION['qr_token'] = $token;
require_once 'phpqrcode/qrlib.php';
QRcode::png($token, 'qr_login.png');
?>
<img src="qr_login.png" alt="Login QR Code">
<script>
setInterval(checkLogin, 2000);
function checkLogin() {
fetch('check_qr_login.php?token=<?php echo $token; ?>')
.then(r => r.json())
.then(data => {
if(data.logged_in) location.reload();
});
}
</script>

Form 55: NFC Login Simulation

<?php
// nfc_login.php
?>
<div class="nfc">
<div class="nfc-icon">📱</div>
<p>Tap your NFC device</p>
<button onclick="simulateNFC()">Simulate NFC</button>
</div>
<script>
function simulateNFC() {
alert('NFC tag detected! Logging in...');
}
</script>

Form 56: Bluetooth Device Login

<?php
// bluetooth_login.php
?>
<button onclick="connectBluetooth()">Connect Bluetooth Device</button>
<script>
async function connectBluetooth() {
try {
const device = await navigator.bluetooth.requestDevice({
acceptAllDevices: true
});
alert('Connected to: ' + device.name);
} catch(error) {
console.log(error);
}
}
</script>

Form 57: USB Security Key

<?php
// usb_key_login.php
?>
<script>
async function loginWithU2F() {
if(window.u2f) {
u2f.sign([{
version: "U2F_V2",
keyHandle: "KEY_HANDLE_HERE",
appId: window.location.origin
}], function(data) {
if(data.errorCode) {
alert('USB key not detected');
} else {
alert('USB key verified!');
}
});
}
}
</script>
<button onclick="loginWithU2F()">Insert USB Key</button>

Form 58: Smart Card Reader

<?php
// smartcard_login.php
?>
<form method="POST">
<label>Insert Smart Card</label>
<input type="text" name="card_data" placeholder="Card number">
<input type="password" name="pin" placeholder="PIN">
<button type="submit">Authenticate</button>
</form>

Form 59: RFID Login

<?php
// rfid_login.php
?>
<div class="rfid">
<h3>RFID Login</h3>
<p>Please tap your RFID card</p>
<input type="text" id="rfid" placeholder="Card ID will appear here" readonly>
</div>
<script>
// Simulate RFID reading
setTimeout(() => {
document.getElementById('rfid').value = 'RFID: 1234-5678-9012';
}, 3000);
</script>

Form 60: Retina Scan Simulation

<?php
// retina_scan.php
?>
<div class="retina-scanner">
<div class="eye">👁️</div>
<p>Look into the scanner</p>
<div class="progress" style="width:0%; height:5px; background:green;" id="progress"></div>
</div>
<script>
let width = 0;
const interval = setInterval(() => {
width += 10;
document.getElementById('progress').style.width = width + '%';
if(width >= 100) {
clearInterval(interval);
alert('Retina scan complete!');
}
}, 500);
</script>

CATEGORY G: SPECIALIZED FORMS (61-70)

Form 61: Age Verification

<?php
// age_verification.php
if($_POST){
$dob = new DateTime($_POST['dob']);
$now = new DateTime();
$age = $now->diff($dob)->y;
if($age >= 18){
echo "Access granted";
} else {
die("You must be 18 or older");
}
}
?>
<form method="POST">
<input type="date" name="dob" required>
<button type="submit">Verify Age</button>
</form>

Form 62: Parental Consent Form

<?php
// parental_consent.php
if($_POST){
$child_name = $_POST['child_name'];
$parent_name = $_POST['parent_name'];
$parent_email = $_POST['parent_email'];
// Send consent email to parent
$subject = "Consent Required for $child_name";
$message = "Please click here to give consent: ...";
mail($parent_email, $subject, $message);
echo "Consent email sent to parent";
}
?>

Form 63: School/Student Login

<?php
// student_login.php
$valid_ids = [
'S12345' => ['pass' => 'student123', 'grade' => 10],
'S12346' => ['pass' => 'student456', 'grade' => 11]
];
if($_POST){
$student_id = strtoupper($_POST['student_id']);
if(isset($valid_ids[$student_id]) && $valid_ids[$student_id]['pass'] == $_POST['password']){
echo "Welcome Student! Grade: " . $valid_ids[$student_id]['grade'];
}
}
?>

Form 64: Corporate VPN Login

<?php
// vpn_login.php
$employees = [
'john.doe' => ['pass' => 'vpn123', 'dept' => 'IT'],
'jane.smith' => ['pass' => 'vpn456', 'dept' => 'HR']
];
if($_POST){
$username = $_POST['username'];
if(isset($employees[$username]) && $employees[$username]['pass'] == $_POST['password']){
echo "VPN Access granted to " . $employees[$username]['dept'];
// Log VPN access
file_put_contents('vpn_log.txt', date('Y-m-d H:i:s') . " - $username logged in\n", FILE_APPEND);
}
}
?>

Form 65: Banking Login

<?php
// banking_login.php
session_start();
if($_POST){
$account = $_POST['account'];
$pin = $_POST['pin'];
// Simulate bank verification
if(strlen($pin) == 4 && ctype_digit($pin)){
$_SESSION['account'] = $account;
echo "Bank access granted";
}
}
?>
<form method="POST">
<input type="text" name="account" placeholder="Account Number" pattern="[0-9]{10}" required>
<input type="password" name="pin" placeholder="PIN" pattern="[0-9]{4}" maxlength="4" required>
<button type="submit">Access Banking</button>
</form>

Form 66: Healthcare Portal

<?php
// healthcare_login.php
$patients = [
'MRN12345' => ['dob' => '1980-01-01', 'ssn_last4' => '1234']
];
if($_POST){
$mrn = $_POST['mrn'];
$dob = $_POST['dob'];
$ssn = $_POST['ssn_last4'];
if(isset($patients[$mrn]) && 
$patients[$mrn]['dob'] == $dob && 
$patients[$mrn]['ssn_last4'] == $ssn){
echo "Access to medical records granted";
}
}
?>

Form 67: Government Portal

<?php
// government_login.php
if($_POST){
$aadhar = $_POST['aadhar'];
$pan = $_POST['pan'];
// Validate format
if(strlen($aadhar) == 12 && ctype_digit($aadhar) && 
preg_match('/[A-Z]{5}[0-9]{4}[A-Z]/', $pan)){
echo "Government services access granted";
}
}
?>

Form 68: Library Login

<?php
// library_login.php
$library_cards = [
'L123' => ['name' => 'John', 'books' => 2],
'L456' => ['name' => 'Jane', 'books' => 0]
];
if($_POST){
$card = $_POST['library_card'];
$pin = $_POST['pin'];
if(isset($library_cards[$card]) && $pin == '1234'){
echo "Welcome " . $library_cards[$card]['name'];
echo "<br>Books checked out: " . $library_cards[$card]['books'];
}
}
?>

Form 69: Hotel Booking Login

<?php
// hotel_login.php
if($_POST){
$booking_id = $_POST['booking_id'];
$last_name = $_POST['last_name'];
// Check booking system
echo "Welcome to your booking, $last_name";
}
?>
<form method="POST">
<input type="text" name="booking_id" placeholder="Booking ID" required>
<input type="text" name="last_name" placeholder="Last Name" required>
<button type="submit">Access Booking</button>
</form>

Form 70: Airline Check-in

<?php
// airline_login.php
if($_POST){
$pnr = strtoupper($_POST['pnr']);
$last_name = $_POST['last_name'];
// Validate PNR format (6 alphanumeric)
if(preg_match('/^[A-Z0-9]{6}$/', $pnr)){
echo "Check-in successful for $last_name";
}
}
?>

CATEGORY H: UX/UI ENHANCED FORMS (71-80)

Form 71: Animated Login

<?php
// animated_login.php
?>
<style>
@keyframes slideIn {
from {transform: translateY(-50px); opacity:0;}
to {transform: translateY(0); opacity:1;}
}
.animated-form {animation: slideIn 0.5s;}
input {transition: all 0.3s;}
input:focus {transform: scale(1.05); box-shadow: 0 5px 15px rgba(0,0,0,0.2);}
</style>
<form class="animated-form">
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button>Login</button>
</form>

Form 72: Hover Effects Login

<?php
// hover_login.php
?>
<style>
.form-container {width:350px; margin:50px auto;}
.input-group {margin:20px 0; position:relative;}
.input-group input {width:100%; padding:10px; border:2px solid #ddd; border-radius:5px; outline:none;}
.input-group label {position:absolute; left:10px; top:50%; transform:translateY(-50%); color:#999; transition:0.3s; pointer-events:none;}
.input-group input:focus {border-color:#667eea;}
.input-group input:focus ~ label, 
.input-group input:valid ~ label {top:-10px; left:5px; font-size:12px; color:#667eea; background:white; padding:0 5px;}
button:hover {transform:translateY(-2px); box-shadow:0 5px 15px rgba(102,126,234,0.4);}
</style>

Form 73: Typing Effect Login

<?php
// typing_login.php
?>
<div id="typing"></div>
<script>
const text = "Welcome to our platform";
let i = 0;
function typeWriter() {
if(i < text.length) {
document.getElementById('typing').innerHTML += text.charAt(i);
i++;
setTimeout(typeWriter, 100);
}
}
typeWriter();
</script>

Form 74: Particle Background

<?php
// particle_login.php
?>
<style>
#particles {position:fixed; top:0; left:0; width:100%; height:100%; z-index:-1;}
.login-form {position:relative; z-index:1; background:rgba(255,255,255,0.9);}
</style>
<div id="particles"></div>
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
<script>
particlesJS('particles', {
particles: {number: {value: 80}, color: {value: '#667eea'}, line_linked: {enable: true}}
});
</script>

Form 75: 3D Flip Card Login

<?php
// flip_login.php
?>
<style>
.flip-container {perspective:1000px; width:300px; height:400px; margin:auto;}
.flipper {position:relative; width:100%; height:100%; transition:0.6s; transform-style:preserve-3d;}
.front, .back {position:absolute; width:100%; height:100%; backface-visibility:hidden;}
.front {z-index:2;}
.back {transform:rotateY(180deg);}
.flip-container:hover .flipper {transform:rotateY(180deg);}
</style>

Form 76: Progress Bar Login

<?php
// progress_login.php
?>
<div class="progress" style="width:0%; height:5px; background:green;" id="progress"></div>
<script>
document.querySelector('form').addEventListener('input', function() {
let filled = 0;
let inputs = this.querySelectorAll('input');
inputs.forEach(input => {
if(input.value) filled++;
});
let percent = (filled / inputs.length) * 100;
document.getElementById('progress').style.width = percent + '%';
});
</script>

Form 77: Confetti on Success

<?php
// confetti_login.php
?>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1"></script>
<script>
function celebrate() {
confetti({
particleCount: 100,
spread: 70,
origin: { y: 0.6 }
});
}
</script>
<?php if($_POST['success']): ?>
<script>celebrate();</script>
<?php endif; ?>

Form 78: Sound Effects Login

<?php
// sound_login.php
?>
<audio id="success" src="success.mp3"></audio>
<audio id="error" src="error.mp3"></audio>
<script>
function playSound(type) {
document.getElementById(type).play();
}
</script>

Form 79: Loading Animations

<?php
// loading_login.php
?>
<style>
.loader {display:none; width:50px; height:50px; border:5px solid #f3f3f3; border-top:5px solid #3498db; border-radius:50%; animation:spin 1s linear infinite;}
@keyframes spin {0% {transform:rotate(0deg);} 100% {transform:rotate(360deg);}}
</style>
<button onclick="this.style.display='none'; document.querySelector('.loader').style.display='block';">
Login
</button>
<div class="loader"></div>

Form 80: Toast Notifications

<?php
// toast_login.php
?>
<div id="toast" style="visibility:hidden; min-width:250px; background:#333; color:#fff; text-align:center; border-radius:5px; padding:16px; position:fixed; z-index:1; bottom:30px; left:50%; transform:translateX(-50%);">
Login successful!
</div>
<script>
function showToast() {
var toast = document.getElementById('toast');
toast.style.visibility = 'visible';
setTimeout(() => toast.style.visibility = 'hidden', 3000);
}
</script>

CATEGORY I: MOBILE-RESPONSIVE FORMS (81-90)

Form 81: Mobile-First Login

<?php
// mobile_login.php
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {box-sizing: border-box;}
body {margin:0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;}
.form-container {padding:20px; max-width:400px; margin:0 auto;}
@media (max-width:480px) {
.form-container {padding:10px;}
input {font-size:16px !important;} /* Prevent zoom on iOS */
}
</style>

Form 82: Touch ID Login

<?php
// touchid_login.php
?>
<div class="touchid" onclick="authenticate()">
<svg viewBox="0 0 24 24" width="80" height="80">
<path d="M12 2C8.69 2 6 4.69 6 8v4c0 3.31 2.69 6 6 6s6-2.69 6-6V8c0-3.31-2.69-6-6-6z"/>
</svg>
<p>Touch ID</p>
</div>
<script>
function authenticate() {
if(window.PublicKeyCredential) {
// Use WebAuthn API for Touch ID
}
}
</script>

Form 83: SMS Login (Mobile)

<?php
// sms_mobile.php
?>
<div class="sms-login">
<h3>Enter verification code</h3>
<p>We texted you at +1 *** *** 1234</p>
<div class="code-inputs">
<input type="text" maxlength="1" pattern="[0-9]" onkeyup="moveToNext(this, 1)">
<input type="text" maxlength="1" pattern="[0-9]" onkeyup="moveToNext(this, 2)">
<input type="text" maxlength="1" pattern="[0-9]" onkeyup="moveToNext(this, 3)">
<input type="text" maxlength="1" pattern="[0-9]" onkeyup="moveToNext(this, 4)">
</div>
</div>
<script>
function moveToNext(current, next) {
if(current.value.length >= 1) {
document.querySelector(`input:nth-child(${next+1})`).focus();
}
}
</script>

Form 84: Swipe to Login

<?php
// swipe_login.php
?>
<style>
.swipe-container {width:300px; height:50px; background:#ddd; border-radius:25px; position:relative;}
.swipe-button {width:50px; height:50px; background:#667eea; border-radius:50%; position:absolute; cursor:pointer;}
</style>
<div class="swipe-container" id="swipeContainer">
<div class="swipe-button" id="swipeButton" draggable="true">→</div>
</div>
<script>
const button = document.getElementById('swipeButton');
const container = document.getElementById('swipeContainer');
button.addEventListener('drag', (e) => {
if(e.clientX - container.offsetLeft > container.offsetWidth - 50) {
alert('Login successful!');
}
});
</script>

Form 85: Pincode Login

<?php
// pincode_login.php
?>
<div class="pincode">
<h3>Enter PIN</h3>
<input type="password" id="pin" maxlength="4" pattern="[0-9]*" inputmode="numeric">
<div class="keypad">
<?php for($i=1; $i<=9; $i++): ?>
<button onclick="addNumber(<?php echo $i; ?>)"><?php echo $i; ?></button>
<?php endfor; ?>
<button onclick="clearPin()">⌫</button>
<button onclick="addNumber(0)">0</button>
<button onclick="submitPin()">✓</button>
</div>
</div>

Form 86: Pattern Lock

<?php
// pattern_lock.php
?>
<canvas id="pattern" width="300" height="300"></canvas>
<script>
const canvas = document.getElementById('pattern');
const ctx = canvas.getContext('2d');
let points = [];
// Draw 3x3 grid
for(let i=0; i<3; i++) {
for(let j=0; j<3; j++) {
points.push({x: 50 + i*100, y: 50 + j*100});
}
}
// Handle pattern drawing
</script>

Form 87: Proximity Login

<?php
// proximity_login.php
?>
<script>
if(window.DeviceProximityEvent) {
window.addEventListener('deviceproximity', function(event) {
if(event.value < 5) { // Within 5cm
document.getElementById('status').textContent = 'Device detected! Auto-login...';
}
});
}
</script>

Form 88: Shake to Login

<?php
// shake_login.php
?>
<script>
if(window.DeviceMotionEvent) {
let lastX, lastY, lastZ;
let shakeThreshold = 15;
window.addEventListener('devicemotion', function(event) {
let acceleration = event.acceleration;
if(acceleration.x > shakeThreshold) {
alert('Shake detected! Logging in...');
}
});
}
</script>

Form 89: Orientation Login

<?php
// orientation_login.php
?>
<script>
window.addEventListener('orientationchange', function() {
if(window.orientation == 90 || window.orientation == -90) {
document.getElementById('login-form').style.display = 'block';
}
});
</script>

Form 90: Mobile Number Login

<?php
// mobile_number_login.php
if($_POST){
$mobile = $_POST['mobile'];
if(preg_match('/^[0-9]{10}$/', $mobile)){
// Send OTP
$otp = rand(100000, 999999);
// Send SMS
echo "OTP sent to $mobile";
}
}
?>
<form method="POST">
<input type="tel" name="mobile" placeholder="Mobile Number" pattern="[0-9]{10}" required>
<button type="submit">Send OTP</button>
</form>

CATEGORY J: UNIQUE & EXPERIMENTAL (91-100)

Form 91: Mood-based Login

<?php
// mood_login.php
?>
<div class="mood-selector">
<h3>How are you feeling today?</h3>
<div class="moods">
<button onclick="login('happy')">😊 Happy</button>
<button onclick="login('neutral')">😐 Neutral</button>
<button onclick="login('sad')">😢 Sad</button>
</div>
</div>
<script>
function login(mood) {
fetch('login.php?mood=' + mood).then(() => {
alert('Welcome! Today will be a ' + mood + ' day!');
});
}
</script>

Form 92: Color-based Login

<?php
// color_login.php
session_start();
$color = $_POST['color'] ?? '';
if($color){
$_SESSION['color'] = $color;
echo "<body style='background:$color'>Welcome, $color lover!</body>";
}
?>
<form method="POST">
<label>Choose your favorite color:</label>
<input type="color" name="color" required>
<button type="submit">Enter</button>
</form>

Form 93: Math Genius Login

<?php
// math_login.php
session_start();
if(!isset($_SESSION['math_answer'])){
$num1 = rand(1, 20);
$num2 = rand(1, 20);
$_SESSION['math_answer'] = $num1 + $num2;
$question = "$num1 + $num2 = ?";
}
if($_POST){
if($_POST['answer'] == $_SESSION['math_answer']){
echo "You're a math genius!";
}
}
?>
<form method="POST">
<p><?php echo $question; ?></p>
<input type="number" name="answer" required>
<button type="submit">Verify</button>
</form>

Form 94: Puzzle Login

<?php
// puzzle_login.php
?>
<div id="puzzle">
<div draggable="true" ondragstart="drag(event)" id="piece1">1</div>
<div draggable="true" ondragstart="drag(event)" id="piece2">2</div>
<div draggable="true" ondragstart="drag(event)" id="piece3">3</div>
<div class="dropzone" ondrop="drop(event)" ondragover="allowDrop(event)">Drop here</div>
</div>
<script>
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
if(data == 'piece1 piece2 piece3') {
alert('Puzzle solved! Login successful!');
}
}
</script>

Form 95: Riddle Login

<?php
// riddle_login.php
$riddles = [
"What has keys but can't open locks?" => "piano",
"What has to be broken before you can use it?" => "egg",
"I'm tall when I'm young, short when I'm old. What am I?" => "candle"
];
$question = array_rand($riddles);
if($_POST){
if(strtolower($_POST['answer']) == $riddles[$question]){
echo "Correct! Login successful!";
}
}
?>
<form method="POST">
<p><?php echo $question; ?></p>
<input type="text" name="answer" required>
<button type="submit">Answer</button>
</form>

Form 96: Weather-based Login

<?php
// weather_login.php
$weather = file_get_contents("http://api.weatherapi.com/v1/current.json?key=YOUR_KEY&q=London");
$weather_data = json_decode($weather, true);
$temp = $weather_data['current']['temp_c'];
if($_POST){
if($temp > 25){
echo "Hot day! Welcome!";
} else {
echo "Cool day! Welcome!";
}
}
?>
<p>Today's temperature: <?php echo $temp; ?>°C</p>
<form method="POST">
<button type="submit">Login based on weather</button>
</form>

Form 97: Time-based Login

<?php
// time_login.php
$hour = date('H');
$greeting = "";
if($hour < 12) $greeting = "Good Morning";
elseif($hour < 18) $greeting = "Good Afternoon";
else $greeting = "Good Evening";
if($_POST){
echo "$greeting, " . $_POST['name'] . "!";
}
?>
<form method="POST">
<h3><?php echo $greeting; ?></h3>
<input type="text" name="name" placeholder="Your name" required>
<button type="submit">Enter</button>
</form>

Form 98: Location-based Login

<?php
// location_login.php
?>
<script>
navigator.geolocation.getCurrentPosition(function(position) {
document.getElementById('lat').value = position.coords.latitude;
document.getElementById('lng').value = position.coords.longitude;
document.getElementById('location-form').submit();
});
</script>
<form id="location-form" method="POST" style="display:none;">
<input type="hidden" id="lat" name="latitude">
<input type="hidden" id="lng" name="longitude">
</form>

Form 99: Poetry Login

<?php
// poetry_login.php
$poems = [
"The woods are lovely, dark and deep" => "frost",
"Shall I compare thee to a summer's day?" => "shakespeare",
"I wandered lonely as a cloud" => "wordsworth"
];
$poem_line = array_rand($poems);
if($_POST){
if(strtolower($_POST['poet']) == $poems[$poem_line]){
echo "A poetry lover! Welcome!";
}
}
?>
<form method="POST">
<p>"<?php echo $poem_line; ?>"</p>
<p>Who wrote this?</p>
<input type="text" name="poet" required>
<button type="submit">Login</button>
</form>

Form 100: Music Note Login

<?php
// music_login.php
?>
<div class="piano">
<div class="key" data-note="C" onclick="playNote('C')">C</div>
<div class="key" data-note="D" onclick="playNote('D')">D</div>
<div class="key" data-note="E" onclick="playNote('E')">E</div>
<div class="key" data-note="F" onclick="playNote('F')">F</div>
<div class="key" data-note="G" onclick="playNote('G')">G</div>
</div>
<p>Play the secret melody: C - E - G</p>
<script>
let melody = [];
function playNote(note) {
melody.push(note);
if(melody.join('') == 'CEG') {
alert('Correct melody! Login successful!');
}
}
</script>

DATABASE SCHEMA EXAMPLES

-- MySQL schema for users table
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
full_name VARCHAR(100),
role ENUM('admin', 'user', 'editor') DEFAULT 'user',
status ENUM('active', 'inactive', 'banned') DEFAULT 'active',
last_login DATETIME,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
login_attempts INT DEFAULT 0,
lockout_until DATETIME,
two_factor_secret VARCHAR(255),
two_factor_enabled BOOLEAN DEFAULT FALSE
);
-- Session table
CREATE TABLE sessions (
session_id VARCHAR(255) PRIMARY KEY,
user_id INT,
ip_address VARCHAR(45),
user_agent TEXT,
payload TEXT,
last_activity INT,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
-- Login history
CREATE TABLE login_history (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
login_time DATETIME,
ip_address VARCHAR(45),
device_info TEXT,
status ENUM('success', 'failed') DEFAULT 'success',
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);

SECURITY CHECKLIST FOR ALL FORMS

<?php
// security_checklist.php
// 1. Always use HTTPS
if(empty($_SERVER['HTTPS'])) {
header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
// 2. Set secure session parameters
ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_secure', 1);
ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_samesite', 'Strict');
// 3. Generate CSRF token
function generateCSRFToken() {
if(empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
return $_SESSION['csrf_token'];
}
// 4. Validate CSRF token
function validateCSRFToken($token) {
return hash_equals($_SESSION['csrf_token'], $token);
}
// 5. Sanitize input
function sanitizeInput($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
// 6. Validate email
function validateEmail($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
// 7. Strong password requirements
function validatePassword($password) {
$errors = [];
if(strlen($password) < 8) $errors[] = "Password must be at least 8 characters";
if(!preg_match('/[A-Z]/', $password)) $errors[] = "Password must contain uppercase letter";
if(!preg_match('/[a-z]/', $password)) $errors[] = "Password must contain lowercase letter";
if(!preg_match('/[0-9]/', $password)) $errors[] = "Password must contain number";
return $errors;
}
// 8. Rate limiting
function checkRateLimit($ip, $limit = 5, $timeWindow = 900) {
$attempts = $_SESSION['login_attempts'][$ip] ?? ['count' => 0, 'first_attempt' => time()];
if($attempts['count'] >= $limit) {
if(time() - $attempts['first_attempt'] < $timeWindow) {
return false; // Rate limit exceeded
} else {
// Reset counter
$_SESSION['login_attempts'][$ip] = ['count' => 0, 'first_attempt' => time()];
}
}
return true;
}

INSTALLATION & USAGE GUIDE

  1. Server Requirements:
  • PHP 7.4 or higher
  • MySQL/MariaDB (for database forms)
  • Web server (Apache/Nginx)
  • SSL certificate (for production)
  1. Setup Instructions:
   # Clone or download files to web directory
cd /var/www/html/
mkdir auth-forms
# Copy all PHP files to this directory
# Set permissions
chmod 755 /var/www/html/auth-forms
chmod 644 *.php
  1. Database Setup:
   CREATE DATABASE auth_system;
USE auth_system;
-- Run the schema provided above
  1. Configuration:
   // config.php
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'auth_system');
define('SITE_URL', 'http://localhost/auth-forms/');
define('COOKIE_DOMAIN', 'localhost');
define('COOKIE_SECURE', false); // Set to true for HTTPS
  1. Testing:
   # Access forms via browser
http://localhost/auth-forms/basic_login.php
http://localhost/auth-forms/2fa_login.php
# etc...

FEATURE MATRIX

Form CategorySecurity LevelComplexityUse Case
Basic (1-10)LowSimpleDemo, Testing
Database (11-20)MediumModerateProduction apps
Security (21-30)HighComplexBanking, Enterprise
2FA (31-40)Very HighComplexHigh-security apps
Social (41-50)MediumModerateUser convenience
Advanced (51-60)HighComplexModern authentication
Specialized (61-70)VariesModerateSpecific industries
UX/UI (71-80)Low-MediumSimpleUser experience focus
Mobile (81-90)MediumModerateMobile-first apps
Unique (91-100)LowSimpleCreative projects

CONCLUSION

This collection of 100 PHP login and signup forms demonstrates the versatility and flexibility of PHP for authentication systems. Each form serves a specific purpose and can be customized further based on requirements. From basic username/password combinations to advanced biometric and multi-factor authentication, these forms cover the entire spectrum of user authentication needs.

Key Takeaways:

  • Always prioritize security over convenience
  • Use appropriate authentication methods for your use case
  • Implement multiple layers of security for sensitive applications
  • Test thoroughly before deployment
  • Keep user experience in mind while implementing security

These forms can be mixed, matched, and customized to create the perfect authentication system for any web application. Remember to always follow security best practices and keep your PHP version and dependencies up to date.

Leave a Reply

Your email address will not be published. Required fields are marked *


Macro Nepal Helper