<?php include_once 'includes/connect.php'; include_once 'includes/config.php'; include_once 'includes/functions.php'; $url = mysql_real_escape_string($_GET['url']); $description = mysql_real_escape_string($_GET['description']); $date = date("Y\\-m\\-d H:i:s"); $user_id = api_to_id($_GET['api']); if (timedout(url_to_short($url), $date) == FALSE) { mysql_query("INSERT INTO train (user_id, url, description, date) VALUES ('{$user_id}', '{$url}', '{$description}', '{$date}')"); } else { echo 'Please do not spam the train.'; }
<?php include_once 'includes/header.php'; echo '<form action="" method="POST">'; echo 'URL: <input name="url" type="text" />'; echo 'Description: <input name="description" type="text" />'; echo '<input type="submit" name="submit" value="Join" />'; echo '</form>'; if (!isset($_POST['url']) or $_POST['url'] == '' or (!isset($_POST['description']) or $_POST['description'] == '') or (!isset($_POST['submit']) or $_POST['submit'] == '')) { echo 'You need to fill in all of the fields above.'; } else { $url = mysql_real_escape_string($_POST['url']); $description = mysql_real_escape_string($_POST['description']); $date = date("Y\\-m\\-d H:i:s"); if (timedout(url_to_short($url), $date) == FALSE) { $url = url_to_short(mysql_real_escape_string($_POST['url'])); $description = mysql_real_escape_string($_POST['description']); $date = date("Y\\-m\\-d H:i:s"); $user_id = $_SESSION['user_id']; mysql_query("INSERT INTO train (user_id, url, description, date) VALUES ('{$user_id}', '{$url}', '{$description}', '{$date}')"); echo 'You have been added to the <a href="train.php">train</a>.'; } else { echo 'Please do not spam the train.'; } } include_once 'includes/footer.php';