PHP
PHP
============================
<form action="process_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>
// Redirect to dashboard.php
header("Location: dashboard.php");
exit();
} else {
echo "Invalid username or password.";
}
?>
===================================================================================
===================================
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>
<?php
// Capture user data from the form
$username = $_POST['name'];
$email = $_POST['email'];
// Redirect to welcome.php
header("Location: welcome.php");
exit();
?>
<?php
// Check if the cookies are set
if (isset($_COOKIE['name']) && isset($_COOKIE['email'])) {
$username = $_COOKIE['name'];
$email = $_COOKIE['email'];
<?php
// Clear the cookies by setting their expiration time in the past
setcookie("name", "", time() - 3600, "/");
setcookie("email", "", time() - 3600, "/");
===================================================================================
=========================
<?php
// Check if the language cookie is set
if (isset($_COOKIE['language'])) {
$language = $_COOKIE['language'];
echo "Your preferred language is: $language";
} else {
echo "No preferred language set.";
}
?>
<?php
// Delete the language cookie by setting its expiration time in the past
setcookie("language", "", time() - 3600, "/"); // Cookie expired 1 hour ago
===================================================================================
============================
// Redirect to display_color.php
header("Location: display_color.php");
exit();
?>
=========display_color.php =============
<?php
// Start the session
session_start();
===================================================================================
==========================
<form action="process_redirect.php" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
===========process_redirecr.php =====================
$name = $_POST['name'];
header("Location: thank_you.php?name=" . urlencode($name));
===================================================================================
=====================
<form action="process_post.php" method="POST">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
===================================================================================
=============================
<form action="process.php" method="GET">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
<label for="age">Age:</label>
<input type="number" id="age" name="age" required><br><br>