Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['body'])){
- $body = strip_tags($_POST['body']);
- if (strlen($_POST['body'] > 250)){
- $errors[] = 'Max character length is 250.';
- }
- if (empty($_POST['body']) === true){
- $errors[] = 'Status cannot be empty.';
- }
- if (empty($errors) === true){
- mysql_query("INSERT INTO `feeds` (user_id, username, body, date) VALUES ('$session_user_id', '" . $user_data['username'] . "', '$body', NOW())");
- }
- }
- ?>
- <div class="status">
- <form action="" method="POST">
- <input type="text" name="body" id="body" class="post_status" placeholder="What are you up to this fine day?">
- <input type="submit" class="post_button" name="submit" value="Post">
- </form>
- <div class="feeds">
- <?php
- if (empty($errors) !== true){
- echo output_errors($errors);
- }
- $getquery = mysql_query("SELECT * FROM `feeds` ORDER BY `DATE` DESC LIMIT 0, 10");
- while($rows = mysql_fetch_assoc($getquery)){
- $id = $rows['id'];
- $user_id = $rows['user_id'];
- $username = $rows['username'];
- $body = $rows['body'];
- $date = $rows['date'];
- $dellink = "| <a href=\"http://localhost/vibeate/wigets/deletepost.php?id=" . $id . "\" style='color: grey;text-decoration:none;'>Delete</a>";
- ?>
- <h2><a href="users/<?php echo $username; ?>"><?php echo $username; ?></a></h2>
- <p><?php echo $body; ?></p><br />
- Posted on <?php echo $date; ?> <?php if ($user_id == $user_data['user_id'] || is_admin($user_data['user_id']) === true){
- echo $dellink;
- }
- ?>
- <br /><hr width="500px">
- <?php
- }
- if (empty($id)){
- echo '<h3>There\'s no posts to show...Be the first to post</h3>';
- }
- ?>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement