format('Y-m-d') === $dob) { $currentDate = new DateTime(); $age = $currentDate->diff($dateOfBirth)->y; if ($age < 18) { echo "This website can only be used for folks 18 years old or older."; echo ""; exit; } } else { echo "Invalid date format."; echo ""; exit; } } else { echo "Date of birth is required."; echo ""; exit; } $target_dir = "profiles/"; $imageFileType = strtolower(pathinfo($_FILES["photo"]["name"], PATHINFO_EXTENSION)); $profileCode = generateProfileCode(); $target_file = $target_dir . $profileCode . "." . $imageFileType; $uploadOk = 1; // Check if image file is an actual image or fake image $check = getimagesize($_FILES["photo"]["tmp_name"]); if ($check !== false) { $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } // Check file size if ($_FILES["photo"]["size"] > 500000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; } else { if (move_uploaded_file($_FILES["photo"]["tmp_name"], $target_file)) { // Convert the image to ASCII art $asciiArt = convertImageToAscii($target_file); // Create profile data $profileData = [ 'name' => htmlspecialchars($_POST['name']), 'dob' => $dob, 'motto' => htmlspecialchars($_POST['motto']), 'hobbies' => htmlspecialchars($_POST['hobbies']), 'summary' => htmlspecialchars($_POST['summary']), 'positive' => htmlspecialchars($_POST['positive']), 'negative' => htmlspecialchars($_POST['negative']), 'password' => htmlspecialchars($_POST['password']), 'email' => isset($_POST['email']) ? htmlspecialchars($_POST['email']) : '', 'ascii' => $asciiArt ]; file_put_contents("profiles/{$profileCode}.txt", json_encode($profileData)); // Generate static HTML profile $htmlContent = "
{$asciiArt} | ";
$htmlContent .= " Name: {$profileData['name']} "; $htmlContent .= "UpTime / Years Old: {$age} years "; $htmlContent .= "Motto or Favorite Quote: {$profileData['motto']} "; $htmlContent .= "Hobbies and Interests: {$profileData['hobbies']} "; $htmlContent .= "Summary: {$profileData['summary']} "; $htmlContent .= "Positive Qualifiers: {$profileData['positive']} "; $htmlContent .= "Qualifiers You Should Know First: {$profileData['negative']} "; $htmlContent .= " |
Your profile code is {$profileCode}. Please keep this for your records. It will be required as your login.
"; echo "Download QR Code"; echo ""; echo ""; } else { echo "Sorry, there was an error uploading your file."; } } } ?>