Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Online Lighting Showroom</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <header> <nav> <h1>Lighting Showroom</h1> <ul> <li><a href="#home">Home</a></li> <li><a href="#products">Products</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> <li><a href="php/user_login.php">Login</a></li> </ul> </nav> </header> <main> <section id="home"> <h2>Welcome to Our Online Lighting Showroom</h2> <p>Find the best lighting solutions for your home and office.</p> </section> <section id="products"> <h2>Our Products</h2> <div class="product-container"> <!-- Product cards will load here dynamically --> </div> </section> <section id="about"> <h2>About Us</h2> <p>We provide high-quality lighting solutions to brighten your space.</p> </section> <section id="contact"> <h2>Contact Us</h2> <form id="contact-form"> <label for="name">Name:</label> <input type="text" id="name" name="name" required> <label for="email">Email:</label> <input type="email" id="email" name="email" required> <label for="message">Message:</label> <textarea id="message" name="message" required></textarea> <button type="submit">Send</button> </form> </section> </main> <footer> <p>&copy; 2024 Online Lighting Showroom. All rights reserved.</p> </footer> <script src="js/script.js"></script> </body> </html> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>User Registration</title> <link rel="stylesheet" href="../css/style.css"> </head> <body> <div class="form-container"> <h2>Register</h2> <form method="POST"> <label for="username">Username:</label> <input type="text" id="username" name="username" required> <label for="email">Email:</label> <input type="email" id="email" name="email" required> <label for="password">Password:</label> <input type="password" id="password" name="password" required> <button type="submit">Register</button> </form> <p>Already have an account? <a href="login.php">Login here</a>.</p> </div> </body> </html> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>User Login</title> <link rel="stylesheet" href="../css/style.css"> </head> <body> <div class="form-container"> <h2>Login</h2> <form method="POST"> <label for="email">Email:</label> <input type="email" id="email" name="email" required> <label for="password">Password:</label> <input type="password" id="password" name="password" required> <button type="submit">Login</button> </form> <p>Don't have an account? <a href="register.php">Register here</a>.</p> </div> </body> </html> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Home</title> <link rel="stylesheet" href="../css/style.css"> </head> <body> <header> <h1>Welcome, <?php echo $_SESSION['username']; ?>!</h1> <nav> <a href="products.php">Products</a> <a href="contact.php">Contact Us</a> <a href="logout.php">Logout</a> </nav> </header> <main> <h2>Explore our lighting products!</h2> <p>Find the best lighting solutions for your home and office.</p> </main> </body> </html> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Contact Us</title> <link rel="stylesheet" href="../css/style.css"> </head> <body> <header> <h1>Contact Us</h1> <a href="home.php">Back to Home</a> </header> <main> <form> <label for="name">Name:</label> <input type="text" id="name" name="name" required> <label for="email">Email:</label> <input type="email" id="email" name="email" required> <label for="message">Message:</label> <textarea id="message" name="message" required></textarea> <button type="submit">Send</button> </form> </main> </body> </html>

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php use Carbon\Carbon; $now = Carbon::now()->format('d/m/Y'); printf("Today is %s\nCurrent PHP version: %s \n\n", $now, phpversion()); $query = "SELECT VERSION() as version;"; // get DB version using PDO $stmt = $pdo->prepare($query); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); printf('DB version (PDO): %s ' . PHP_EOL, $row['version']); // Run query using mysqli $result = $mysqli->query($query); $version = $result->fetch_object(); printf('DB version (mysqli): %s ' . PHP_EOL, $version->version); // Select using Laravel $version = $db::select($query); printf('DB version (Laravel Query Builder): %s ' . PHP_EOL, $version[0]->version); <?php include 'db_config.php'; if ($_SERVER["REQUEST_METHOD"] == "POST") { $username = $_POST['username']; $email = $_POST['email']; $password = password_hash($_POST['password'], PASSWORD_BCRYPT); $sql = "INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$password')"; if ($conn->query($sql)) { echo "<script>alert('Registration successful!'); window.location.href='login.php';</script>"; } else { echo "<script>alert('Error: " . $conn->error . "');</script>"; } } ?> <?php session_start(); session_destroy(); header("Location: login.php"); exit(); ?>
Copy Clear