<?php
include 'db.php';
session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $password = $_POST['password'];

    $sql = "INSERT INTO users (name, email, password) VALUES ('$name', '$email', '$password')";
    if (mysqli_query($conn, $sql)) {
        $_SESSION['name'] = $name;
        $_SESSION['email'] = $email;
        header("Location: upload.php");
        exit();
    } else {
        echo "Error while signing up!";
    }
}
?>
<link rel="stylesheet" href="style.css">

<h2>Create Your Account</h2>
<form action="" method="post">
    NAME: <input type="text" name="name" required><br><br>
    EMAIL: <input type="email" name="email" required><br><br>
    PASSWORD: <input type="password" name="password" required><br><br>
    <input type="submit" value="Sign Up">
</form>

<p>Already have an account? <a href="login.php">Login here</a></p>

<?php include 'youtube.php'; ?> 
