Download signup.php from Pezh/pde: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/Pezh/pde/resolve/main/signup.php
- Command line
-
hf download hf://spaces/Pezh/pde/signup.php
-
curl -L -o signup.php https://huggingface.co/spaces/Pezh/pde/resolve/main/signup.php
1.04 kB
| // Assuming you have already established a database connection | |
| if ($_SERVER["REQUEST_METHOD"] == "POST") { | |
| $username = $_POST["username"]; | |
| $password = $_POST["password"]; | |
| // Check if the username already exists in the database | |
| $checkQuery = "SELECT * FROM users WHERE username='$username'"; | |
| $checkResult = mysqli_query($connection, $checkQuery); | |
| if (mysqli_num_rows($checkResult) == 0) { // Username is available, add user to the database | |
| $insertQuery = "INSERT INTO users (username, password) VALUES ('$username', '$password')"; | |
| if (mysqli_query($connection, $insertQuery)) { | |
| // User successfully added, redirect to video page | |
| header('Location: videos.php'); | |
| exit(); | |
| } else { | |
| echo "Error: " . $insertQuery . "<br>" . mysqli_error($connection); | |
| } | |
| } else { // Username already exists, display an error or redirect back to signup form | |
| echo "Username already exists. Please choose a different username."; | |
| } | |
| } | |