Votifier Webpage Display [Votifier, PHP, AJAX]

Discussion in 'Archived: Plugin Requests' started by ndvenckus1, Aug 28, 2012.

  1. Offline

    ndvenckus1

    My Request
    _________________________________________________________________________________

    I'm looking for a plugin that can display the amount of votes of each user on my webpage. I'm very familiar with HTML and CSS, and have some knowledge of javascript, but nothing with PHP or Java, which is why I need the scripting to be very simple to insert onto my webpage. A simple config file to adjust a few settings would be awesome, and ability to style with CSS would be huge plus, but it's really not at all a necessity. My goal is to have this working on my server by the morning of September 1st (votes reset). I would like the page to instantly update when a player votes, which I'm guessing would involve the use of AJAX, but again, not a necessity. So long as the page accurately displays the number of votes for each user upon load/refresh, then I'll be extremely happy.

    I'm currently using JCVaultListener (it's its own plugin) to reward money to players, give them messages, and display votes upon voting. I have seen HTTP Listener, but I'm very confused as to what exactly it does, mostly because I can't understand the developer, I think he's German :D I already have JCVaultListener, which works very well for displaying votes, rewarding players through vault, and being as easy to customize and configure as I want it to be. I think HTTP Listener attempts to do this itself.

    If someone could, first and foremost, point me to a plugin/listener that does this, well, that would be the best :p But if someone could write a plugin/listener that does this, and provide instructions on how to use this, I will remember you in my heart forever.

    Specifics
    _________________________________________________________________________________

    Most Ideal
    ● Easily configurable (for someone with no PHP or AJAX knowledge :p)
    ● Instant updating (most likely with AJAX?)
    ● Style-able with CSS or Configuration file
    ● Requires only CSS, HTML, or use of config file on my part (or instructions on how to edit the PHP/Javascript)
    ● Displays the player who voted and the number of times he or she voted on a webpage (I hope this was obvious :D)
    ● Command to reset the votes

    Acceptable

    ● Requires only CSS, HTML, or use of config file on my part (or instructions on how to edit
    the PHP/Javascript)
    ● Displays the player who voted and the number of times he or she voted on a webpage
    ● Command to reset the votes

    Things to Note
    _________________________________________________________________________________
    ● My website is hosted on a Linux server, so ASP and ASP.NET will not work.
    ● I'd prefer a simple "upload to my server" or "paste on my webpage" sort of installation, if at all possible.
    ● I'll need instructions on how to get this going, because I'm a noob :p

    To anyone who can create this for me/link me to what I'm asking for, you're amazing! I spent a huuuge amount of time putting this post together, so I'd at least like a response :D
     
  2. Offline

    np98765

    ndvenckus1: Please read the stickied thread labelled [READ ME FIRST].
     
  3. Offline

    jamietech

    why, it's perfectly readable
     
  4. Offline

    np98765

    I'm not talking about format; rather the part that discusses a monetary reward.
     
  5. Offline

    jamietech

    Sorry then :p
     
  6. Offline

    ndvenckus1

    Oh, I'm sorry. I had skimmed it before writing this, so at least I've got that :p I just assumed it was okay since I seemingly remember seeing requests that offered payment in the past.

    Anyway, I've removed the payment offer. Sorry for the trouble.
     
  7. Offline

    np98765

    At least you used proper grammar/spelling, made the post look good, and didn't post something impossible... -_-

    But actually, I've been looking for something similar to this as well... Reads from a MySQL database, has a display option where it can query the database and display the results, etc.

    I'm now watching this thread. :3
     
  8. Offline

    ndvenckus1

    Haha, I don't blame ya :D In my mind, at least, I find that with the proper knowledge, something like this should be fairly simple, and extremely useful.

    Whoever does end up creating this (if anyone :eek:), I'd encourage you to post this under votifier listeners or even as your own plugin. Coming from a server owner, the usefulness of this enormously outweighs the pain of creating and managing it. And who knows? You might get a few thankful donations/mentions while you're at it :p
     
  9. Offline

    np98765

    So far, this has been something that's been limited to the servers that pay their developers to make these.

    I think that it's great for developers to make something that was previously inaccessible suddenly free and able to be used by many.
     
  10. Offline

    ndvenckus1

    I couldn't agree more. Who knows? Maybe after two years of learning AJAX, MySQL, PHP, and Java, I'll be the one to create this :D Just give me two years.
     
  11. Offline

    Safixk

    I've had previous knowlegde of HTML and CSS, and I'm currently learning more about PHP, Java, and MySQL.
    I can't promise a working copy. But do you mind if I have a shot at this?
     
  12. Offline

    javoris767

    Me/Mcluke500 made a plugin that I use for my server to log votes to a MYSQL database then we made a php page to get the info :3 Want it?

    Preview: www.pr3datorcraft.com/stats/vote.php
    Sorry if this isn't want you want i hate reading :/

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
    ndvenckus1 likes this.
  13. Offline

    ndvenckus1

    It would be awesome if you took a shot at this :D Working copy or not, I think it would be useful to both you and I. I'm really interested in seeing what you can come up with.

    I'm not much of a reader myself :p But anyway, that would be awesome! Aside from the instant updating, which isn't possible with PHP anyway, this is basically exactly what I was looking for! I'm going to need seeerious instructions on how to configure this, though, so I hope you're a writer xD. Like I mentioned before, my knowledge of HTML and CSS is pretty advanced, but PHP, nada.

    All I really need instructions on are these things:

    (1) Assuming there's a limit on how many players there can be on the page, I would like this to be unlimited. Or at least have an extremely large limit, that would only be reached if someone somehow figured out how to flood the system.

    (2) Basic text/style changes. Will this be obvious upon opening the PHP document? I really don't have a clue about PHP :D Can CSS and HTML be placed directly into the document?

    (3) Instructions on how to actually configure this whole thing :p I need to know where to put the host name/password/table of my own database, what to upload onto my web server, and what needs to be installed/configured on the minecraft server itself.

    I think that's it. Anyway, thanks so much for this, javoris! I don't think there's anything else I need to know, but if there is, I'll be sure to ask you or get help from someone else.
     
  14. Offline

    Safixk

    I'll need bit of time, as integrating the MySQL into the listener will be a new thing for me, and I don't know any AJAX, so I guess my plugin will around the same as his, so for now use his, I will still develop this, it's great practice, and later on I will update my listener with new features, I will be also releasing it. So later if I do something you might want, or if you have a idea for me to implement, tell me.
     
  15. Offline

    ndvenckus1

    I'd definitely like to keep updated on this. Sounds like a really cool project.
     
  16. Offline

    Safixk

    I'm working on integrating the MySQL, and I'm failing.
    javoris767 Would you mind if you sent me the source code or the .jar(which I can decompile)?
    I can't find any tutorials anywhere, and the MySQL is being a pain in the arse
    If you could send me it, it would be of great help toward the development of this plugin, and my knowledge of programming, thank you.
     
  17. Offline

    javoris767

    Oh I was editing it for him o-O
     
  18. Offline

    Safixk

    It's fine, I don't think I could have finished, this, I need to do easier tasks to gain more knowledge, after you're done, could I still have the source code so I can use it for future reference? Thanks again
     
  19. Offline

    javoris767

    All done. http://pr3datorcraft.com/dl/VoteSQL.jar
    Source Code: http://pastie.org/4607479
    It will create a config and just put your sql info in.
    For the php just change these.
    PHP:
    $user_name "USERNAME_HERE";
    $password "PASSWORD_HERE";
    $database "DATABASE_HERE";
    $server "IP_HERE";
    Here is the code you would put in your .php file.
    PHP:
              <table class="table table-condensed">
              <thead>
              <tr>
              <th>#</th>
              <th>Username</th>
              <th>Votes</th>
              </tr></thead>
              <tbody>
    <?PHP
     
    $user_name 
    "USERNAME_HERE";
    $password "PASSWORD_HERE";
    $database "DATABASE_HERE";
    $server "IP_HERE";
    $db_handle mysql_connect($server$user_name$password);
    $db_found mysql_select_db($database$db_handle);
     
    if (
    $db_found) {
     
    $SQL "SELECT * FROM votingnumbers ORDER BY votes DESC";
    $result mysql_query($SQL);
    $value 1;
    while (
    $db_field mysql_fetch_assoc($result)) {
    print 
    "<tr>";
    print 
    "<td>" $value "</td>";
    print 
    "<td>" $db_field['playername'] . "</td>";
    print 
    "<td>" $db_field['votes'] . "</td>";
    $value $value 1;
    print 
    "</tr>";
    }
     
    mysql_close($db_handle);
     
    }
    else {
    print 
    "Database NOT Found ";
    mysql_close($db_handle);
    }
     
    ?>
                     
                        </tbody>
              </table>
     
    Chillax_Team likes this.
  20. Offline

    Safixk

    Thank you, did you make this plugin yourself?
     
  21. Offline

    ndvenckus1

    Thank you sooooo much! I never thought I would have this done in one night, but you just accomplished that :)

    And from what it looks like, HTML can be put directly into the php document. Can CSS as well? Again, thank you, thank you, thank you.
     
  22. Offline

    Safixk

    HTML is fine in the <?php> brackets, I usually recommend CSS to be put in a different file and be linked there, if that can't happen, put the CSS before the <?php> brackets, and that should work.
     
  23. Offline

    ndvenckus1

    I always use an external document anyway :p But I've got a bit of a problem.
    Code:
    2012-08-28 22:11:22 [SEVERE] Could not load 'plugins\VoteSQL.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: com.pr3datorcraft.votesql.VoteSQL
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:155)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:222)
        at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:198)
        at net.minecraft.server.ServerConfigurationManagerAbstract.<init>(ServerConfigurationManagerAbstract.java:50)
        at net.minecraft.server.ServerConfigurationManager.<init>(SourceFile:11)
        at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:105)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Caused by: java.lang.ClassNotFoundException: com.pr3datorcraft.votesql.VoteSQL
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:41)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:29)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:144)
        ... 9 more
    I placed the VoteSQL.jar into my plugins folder and started up a test server. The only plugins it's running are Votifier and JCVaultListener. Was I supposed to place it somewhere else?
     
  24. Offline

    javoris767

    Oh that was a careless error lemme fix it.

    Ok fixed. Redownload at the same place :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  25. Offline

    ndvenckus1

    Alright, thanks :D

    New error :/ I'm using 1.3.1 R2.0
    Code:
    2012-08-28 22:25:47 [INFO] [VoteSQL] Enabling VoteSQL v0.1
    2012-08-28 22:25:47 [INFO] VoteSQL v0.1 is now enabled
    2012-08-28 22:25:47 [INFO] [VoteSQL v0.1] Votifier found!
    2012-08-28 22:25:47 [SEVERE] Error occurred while enabling VoteSQL v0.1 (Is it up to date?)
    java.lang.NullPointerException
        at me.javoris767.votesql.VoteSQL.onEnable(VoteSQL.java:29)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:365)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:265)
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:247)
        at net.minecraft.server.MinecraftServer.i(MinecraftServer.java:296)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:275)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:225)
        at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:140)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  26. Offline

    javoris767

    Now it works lol. I was trying to fix while testing, thinking of whats wrong and I was getting a headache so I removed a word and it fixed it -.- Download at the same link
     
  27. Offline

    ndvenckus1

    Lol, thanks.

    It worked fine on initial startup, but once I entered the MySQL info into the config file, it gave me this:
    Code:
    2012-08-28 23:22:19 [INFO] [VoteSQL] Enabling VoteSQL v0.1
    2012-08-28 23:22:19 [INFO] VoteSQL v0.1 is now enabled
    2012-08-28 23:22:19 [SEVERE] Error occurred while enabling VoteSQL v0.1 (Is it up to date?)
    java.lang.NullPointerException
        at me.javoris767.votesql.VoteSQL.onEnable(VoteSQL.java:37)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:365)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:265)
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:247)
        at net.minecraft.server.MinecraftServer.i(MinecraftServer.java:296)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:275)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:225)
        at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:140)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Do I need to create the table and rows manually, or will the plugin do it itself? If I do need to create it manually, what do they need to be called? Do I need to have the web server up with the PHP document first before this can work? Because I haven't put it on there yet.

    Sorry, I need to get some rest, so I won't be able to respond to you/pester you with questions again until tomorrow morning or afternoon :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  28. Offline

    LegoPal92

    hey javoris767, i was looking to make a website for my server, do you mind if i take parts of it and base it off of pr3datorcraft website at all? I stumbled upon it in my search for a good website to base it off of, and i instantly liked it.
     
  29. Offline

    javoris767

    Grrr... It works on my server >:[ redownload o-o

    http://twitter.github.com/bootstrap/

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  30. Offline

    ndvenckus1

    I've got the PHP file configured and uploaded onto my web server, and I've got the plugin uploaded and installed onto my server, but when I tried voting, it simply said this in the console:
    Code:
    2012-08-29 16:32:06 [INFO] java.sql.SQLException: No value specified for parameter 3
    The vote still went through just fine with Votifier and JCVaultListener, but it didn't display on the webpage or add anything to the MySQL table.

    So what's parameter 3? Is it in the config file, or the PHP file?
     

Share This Page