Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* CREATE TABLE `bug_reports`
- (
- `user` VARCHAR(24),
- `bug` TEXT(1024),
- `time` VARCHAR(24)
- )
- */
- $user = getUserFromSession($_SESSION['session_id']);
- $bug = $_POST['bug'];
- $time = date("Y-m-d");
- $form = $_POST['form'];
- if (!strlen($bug) && $form)
- {
- $form = 2;
- echo "<font color='red'>You did not enter a bug in the box provided. Please try again.</font><br>";
- }
- if (!strlen($user) && $form)
- {
- $form = 2;
- echo "<font color='red'>You are not currently logged in. Please log in and try again.</font><br>";
- }
- if ($form == 2)
- {
- $query = "INSERT INTO `bug_reports` (`user`,`bug`,`time`) VALUES('$user','$bug','$time')");
- $result = mysql_query($query);
- if (mysql_affected_rows($result))
- {
- echo "<font color='green'>Bug report sent successfully</font><br>";
- mysql_free_result($result);
- break;
- }
- else
- {
- echo "<font color='red'>Bug report went wrong. Try again.</font><br>";
- mysql_free_result($result);
- break;
- }
- }
- echo "<form action='bug.php' method='post'>";
- echo "<input type='hidden' name='form' value='1'>"; // add a hidden value to declare whether they have submitted the form yet or not
- echo "<textarea cols='25' rows='10'>Write the bug here with as much description as possible.</textarea>";
- echo "<input type='submit' value='Submit bug'>";
- echo "</form>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement