5000000) { die("File is too large."); } // Validate format global $imageFileType; if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { die("Sorry, only JPG, JPEG, PNG & GIF files are allowed."); } } function encode_for_slug($string) { $string = strtolower($string); $string = str_replace([" "], "-", $string); $string = str_replace([",", "'", '"'], "", $string); return $string; } function session_to_string($session_index) { if (isset($_SESSION["$session_index"])) { $session_value = $_SESSION["$session_index"]; global $$session_index; $$session_index = $session_value; } } function post_to_sql_string($post_index) { if (isset($_POST["$post_index"])) { $post_value = $_POST["$post_index"]; global $db_connection; $post_value = mysqli_real_escape_string($db_connection, $post_value); global $$post_index; $$post_index = $post_value; } } ?>