Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- require('header.php');
- $query=mysqli_query($link,"select email from users");
- $email=$link->query($query);
- if(isset($email[0])){
- $query1=mysqli_query($link,"select id from user where email='".$email[0]."' and facebook=1");
- $admin=$link->query($query1);
- $userId=$admin[0];
- }
- if(isset($userId)) {
- /* logged in only */
- }
- $iComments = 0;
- $qComments = $db->query("
- SELECT songs_comments.*, user.id AS uId, user.username AS uName, user.avatar AS uAvatar
- FROM songs_comments LEFT JOIN user ON songs_comments.userid_from = user.id
- WHERE songs_comments.songid = '".$rSong->id."' ORDER BY songs_comments.id DESC");
- while ($rComments = $qComments->fetch_object()) {
- $showComments .= '
- <img src="../'.makeAvatar($rComments->uId,$rComments->uAvatar,50).'" class="avatar float-left" alt>
- <div class="comment">
- <div class="comment-text">'.$rComments->text.'</div>
- <div class="comment-footer">
- <a href="/">'.$rComments->uName.'</a> on '.dateStamp($rComments->time).'
- </div>
- <br style="clear:both;">
- </div>
- ';
- $iComments++;
- } ?>
- <script>
- /*wait for the DOM to be loaded
- $(document).ready(function() {
- // bind 'myForm' and provide a simple callback function
- $('#song-comment-form').ajaxForm(function() {
- alert("Thank you for your comment!");
- });
- }); */
- $(document).ready(function() {
- /*var options = {
- url: 'template/sections/player_comments',
- target: '#player-song-comments', // target element(s) to be updated with server response
- type: 'post' // 'get' or 'post', override for form's 'method' attribute
- };
- $('#song-comment-form').ajaxForm(options); */
- $(document).ready(function() {
- // bind 'myForm' and provide a simple callback function
- $('#song-comment-form').ajaxForm(function() {
- $("#player-song-comments").load('template/sections/player_comments.php');
- alert("Thank you for your comment! The site is currently in maintenance and the comment won't show until you revisit this video");
- });
- });
- });
- </script>
- <div id="player-song-comments-wrap">
- <div id="player-song-comments-heading"><img src="template/images/icons/comments.png" alt> Comments</div>
- <div id="player-song-comments-sub-heading">
- <?=isset($userId)?'<a href="/" id="show-song-comment-form" class="float-right">Add comment</a>':'<a href="/register.php" class="modal float-right">Add comment</a>'?>
- <span id="song-comments-num"><?=$iComments?></span> comments for "<span id="song-comments-title"><?=$rSong->title?></span>"
- by <span id="song-comments-artist"><?=$rSong->artist?></span>
- </div>
- <hr>
- <form id="song-comment-form">
- <input type="hidden" value="<?=$rSong->id?>" class="song-id">
- <textarea class="editor" id="song-comment-textarea"></textarea><br>
- <input type="submit" value="Submit"><input type="button" value="Cancel" id="hide-song-comment-form">
- <hr>
- </form>
- <div id="player-song-comments">
- <?=$showComments?>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement