]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Saving various popup.html example
authorJean-Marc Pigeon <jmp@safe.c>
Tue, 2 Sep 2025 20:03:25 +0000 (16:03 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Tue, 2 Sep 2025 20:03:25 +0000 (16:03 -0400)
www/login.php [new file with mode: 0644]
www/popup.html [new file with mode: 0644]
www/popup2.html [new file with mode: 0644]

diff --git a/www/login.php b/www/login.php
new file mode 100644 (file)
index 0000000..a81d71d
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+// In a real application, connect to a database and verify credentials securely.
+// This is a simplified example for demonstration.
+
+if ($_SERVER["REQUEST_METHOD"] == "POST") {
+    $username = $_POST['username'];
+    $password = $_POST['password'];
+
+    // Example: Check if username is 'test' and password is 'wrongpass'
+    if ($username === 'test' && $password === 'correctpass') {
+        // Successful login, redirect or set session
+        echo "<script> alert('Login successful!'); window.location.href = 'dashboard.php';</script>";
+    } else {
+        // Incorrect password, display a JavaScript alert as a popup
+        echo "<script>alert('Invalid username or password. Please try again.');</script>";
+    }
+}
+?>
diff --git a/www/popup.html b/www/popup.html
new file mode 100644 (file)
index 0000000..45fa69e
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+
+<form action="login.php" method="post">
+<label for="username">Username:</label>
+<input type="text" id="username" name="username" required><br><br>
+<label for="password">Password:</label>
+<input type="password" id="password" name="password" required><br><br>
+<input type="submit" value="Login">
+</form>
+
+</body>
+</html>
diff --git a/www/popup2.html b/www/popup2.html
new file mode 100644 (file)
index 0000000..1e6a150
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function check()
+{ 
+    if(form1.userid.value == "admin" && form1.pwd.value == "root") {
+    document.location.href = "mailleur.php";
+}
+else {
+    alert("Incorrect Username or Password");
+    event.preventDefault();
+    return false;
+} 
+} 
+</script>
+<title>Login</title></head>
+<body> 
+<form id="form1" method="post" action="mailleur.php" onsubmit="check()">
+    <label>User Name</label>
+    <input type="text" name="userid"><br>
+    <label>Password</label>:
+    <input type="Password" name="pwd"><br>
+    <input type="submit" value="Login">
+</form>
+</body> 
+</html>