RadioDJ - Free Radio Automation Software Forum

Creating Rating script for radiodj (Listener is able to like or dislike songs)

Offline Jhonny

  • *****
  • 3752
  • Peace, enjoy life.it's over before you've lived it
    • Jhonny's RadioDJ tutorials.
Think 2gb can be oke for space on a server.
most of the time you use les than 1 gb.
R.T.F.M. means to me, Read The Fantastic Messages.
Make things simple, but don't make simple things simpler!
I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.2.0 Beta

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
I VE YTRIED, BUT  i think this javascriptconflict is breaking me down,its ready,but i really want to make it responsive, and i dont want to let an absolute player and like/dislike buttons, its not good,but its hard to make it work with this javascript conflict. can you look and see if you get an solution?


the first code the first part, sends likes/dislikes to the pages that willsend it to database.

The seconds part of code is the code to load the main div of script to reload after 1 minute, then the song - image- bio etc changes automaticaly, but theres a conflict, if i put everything (php code) at the same div the page loads slowly and i can see the loading at the tab.

and if i press f5 for example after have pressed like or dislik button, the page shows an alert box syn that if i do it itll send data or something like this, its almost like itll send the like again, but of course it wont go because even going, my code prevent the same moment, anyway,idk ,because, if a few moments has spent, idk if its gonna be sent anyway.
« Last Edit: April 14, 2019, 04:12:19 PM by PresidentOfACPJ »
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
Its gonna be really good guys :), . i haeve to make a really good style, in it, i also have to solve some issues. but look to it now...




And now totally responsive! :cool: ive rebuilt all the code. and the player too, the other was stopping without warning.  :D
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
Hey guys,m please, can you make a test on my webpatge, if tis working like its supposed to [question mark]


http://radiorockfm.com.br/like_song/live_stat.php

Thank you all guys :)
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
Please, let your reviews here guys :)


« Last Edit: April 14, 2019, 04:20:49 PM by PresidentOfACPJ »
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
THERES ONLY ONE PROBLEM with the script.

You enter the page, then you click submit button (like or dislike).
BUT instead the rating to be sent, the page refresh, then when its refreshed, you have to click again in the rating submitt button (like/dislike).

What is hapenning, i coudlnt discover yet :(
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

live_stat.js:2 Uncaught ReferenceError: $ is not defined
    at live_stat.js:2
(anonymous) @ live_stat.js:2

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

Offline bpromma

  • *
  • 39
  • THAI MUSIC RADIO www.thaimusic.me
    • THAI MUSIC RADIO
Please, try again:
http://radiorockfm.com.br/like_song/live_stat.php
I tried, clicking on the button to like the music, the whole page is recharging and that causes the cut of the audio player.My web browser is Firefox.
THAIMUSIC.ME - BEST Thai Music! - https://www.thaimusic.me/

Neste momento, nosso servidor de pedidos está fora do ar, por favor volte mais tarde...

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
I tried, clicking on the button to like the music, the whole page is recharging and that causes the cut of the audio player.My web browser is Firefox.

This is my problem now, the same thing happens to me trying in Chrome :(

Idk more what bto do to try toi fix this issue.

I really dont understand why it has this behavior, honestly it wasnt sdupposed to happen like this.
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
Eu nao posso mais perder muito tempo com programação do site e scripts , pois tenho que dar um carinho especial pro meu canal no youtube hehehe. mas aos pouquinhos devagarinho quando der uma brechinha vou produzindo mais codigo pra fazer um puta sistema interativo em site de radio.
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

Offline PresidentOfACPJ

  • ***
  • 135
  • We play all kinds of Rock!
    • RADIO ROCK FM - O ROCK ALTERNATIVO COM PITADAS DE CLASSIC ROCK!
Im gonna have to get another kind of code javascript to send, ajax actually, to sent data from the form to database. but now i have 3 youtubechannels to increase, thank, if you fell able to solve this code issue, please tell us and post the code back again here.
Rádio Rock FM:

http://radiorockfm.com.br/
twitter.com/radiorockfmreal/
fb.com/radiorockfmreal/

EmmaSts

Here's my code for LIKING Songs to give you an idea on how it's put together, feel free to alter to your needs...

////////////////////////////////////////
Structure
////////////////////////////////////////
Song stats page
php parser [in parser folder]
Database Table `likes` [id - member - songid]

For a Dislike -------------------------
Same principle really

Database Table `dislikes` [id - member - songid]

////////////////////////////////////////
On the songs stats page (img below)

Code: [Select]
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$('#likes').submit(function(){$('input[type=submit]', this).attr('disabled', 'disabled');});
function sendLike ( ) {
     var songid = $("#songid");
     var memid = $("#memid");
     var url = "parsefolder/like.php";
      if (songid.val() == "") {
           $("#interactionResults").html('<div class="alert alert-danger"><i class="fa fa-minus-square"></i>&nbsp;<strong>DANGER 922</strong>&nbsp;SYSTEM_ERROR: Sorry!').show().fadeOut(6000);
      } else {
         $.post(url,{songid: songid.val(), memid: memid.val() } , function(data) {
            $("#interactionResults").html(data).show().fadeOut(12000);
            document.sendLike.likes.value='';
           });
     }
}
</script>


<div id="interactionResults">
<form action="javascript:sendLike();" name="likes" id="likes" method="post">
<input type="hidden" name="songid" id="songid" value="<?php echo $songid?>"/>
<input type="hidden" name="memid" id="memid" value="<?php echo $_SESSION['id']; ?>"/>
<button type="submit" class="btn btn-inverse" name="likes"><span class="fa fa-thumbs-up"></span>&nbsp;Like this Song</button>
</form></div>

//////////////////////////////////////
Parser [parsefolder/like.php]

Code: [Select]
<?php
session_start
();
require_once 
"path/to/your/website.config.file.php";
if (isset(
$_POST['songid'])) { 
  
$songid preg_replace('#[^0-9]#'''$_POST['songid']);
  
$memid preg_replace('#[^0-9]#'''$_POST['memid']);
  if (empty(
$songid) || empty($memid)) { 
    echo 
'<div class="alert alert-danger"><i class="fa fa-minus-square"></i>&nbsp;<strong>DANGER 919</strong>&nbsp;SYSTEM_ERROR: Missing Data to continue';
   exit();
  } else {    
  
$sqllikes mysqli_query ($db_conx"INSERT INTO `likes` (`member`,`songid`)VALUES('$memid','$songid')");
}
echo 
'<div style="padding:12px;background-color:#dbf1db;border:#e6e6e6 solid 1px;color:#26642c;font-size:12px;">&nbsp;&nbsp;<strong>Niiiiiice!</strong><br /><br />Thanks for liking</div>';
exit();
}
?>

Mine is membership based but you can alter the code to IP Address instead of a members id then just count distinct rows per song ID and check the database against IP to show a button or not.. It'd be simple to also create a dislike using this code also so it should get you on the right track :)
Hope this helps :)

« Last Edit: August 14, 2019, 07:58:12 PM by EmmaSts »

Offline RFU

  • ****
  • 472
    • Radio Free Ukraine
Im gonna have to get another kind of code javascript to send, ajax actually, to sent data from the form to database. but now i have 3 youtubechannels to increase, thank, if you fell able to solve this code issue, please tell us and post the code back again here.

So what ever happened to this? Did you finish it?
Гордий бути українцем, Ми - Радіо Вільної України.