Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $uids = $_SESSION['user']['id'];
- $id = preg_replace('/\D/', '', $_GET['id']);
- function getPost($uid) {
- $sql = "SELECT * FROM cms_comments WHERE author = '$uid'";
- $query = mysql_query($sql) or die(mysql_error());
- if(mysql_num_rows($query) > 0 && $_SESSION['user']['rank'] < 5) {
- return true;
- }
- else { return false; }
- }
- if(getPost($uids) == true) { echo 'Du kan bara kommentera en gång!'; }
- function post($data, $story, $uid) {
- $clean = htmlentities(mysql_real_escape_string($data));
- $sql = "INSERT INTO cms_comments (story, comment, date, author) VALUES ('$story', '$clean', '". time() ."', '$uid')";
- $query = mysql_query($sql) or die(mysql_error());
- }
- $posts = getPost($uids);
- if(isset($_POST['comment']) && strlen($_POST['comment']) > 0 && strlen($_POST['comment']) < 500 && $posts == false) {
- post($_POST['comment'], $id, $uids);
- echo '<head><meta http-equiv="refresh" content="0"></head>';
- }
- $sql = "SELECT * FROM cms_comments WHERE story = '{$id}' ORDER BY id DESC";
- $query = mysql_query($sql) or die(mysql_error());
- while($ua = mysql_fetch_array($query)) {
- $uiq = mysql_query("SELECT * FROM users WHERE id = ". $ua['author']) or die(mysql_error());
- $ui = mysql_fetch_array($uiq) or die(mysql_error());
- if($ui['rank'] >= 7) { $username = ''. $ui['username'] .'';}
- else { $username = '<span style="font-family:Arial,Helvetica,sans-serif;">'. $ui['username'] .'</span>'; }
- if($ui['rank'] > 5) { $bg = 'style="border-top: 1px dashed #cccccc;padding: 10px 0;margin-bottom: -1px;text-align: left;';}
- else {$bg = 'style="';}
- echo '
- <div class="badge-div" style="float:left;">
- <div class="badge-content" style="float:left;margin-right: 8px;">
- <label>'. $username .'</label>' . $ua['comment'] . '</div>
- <div class="badge-container" style="overflow:hidden;background: url(/app/tpl/skins/habbo/images/bg2/' . $ui['bg2'] . '.png) bottom center;">
- <div class="badge-img shadow" style="height:70px;background-image:url(http://habbo.it/habbo-imaging/avatarimage?figure=' . $ui['look'] . '&' . $ui['effect'] . 'direction=2&head_direction=2gesture=sml)">
- </div></div><br clear="all"></div>
- ';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement