• Guest, we are doing a new map (refresh) for Herocraft. Gather your friends and get ready! Coming next Friday, 06/28/24 @ 7PM CT play.hc.to
    Read up on the guides and new systems! Here.
    View the LIVE Map here @ hc.to/map
    Stuck or have a problem? use "/pe create" to to open a ticket with staff (There are some known issues and other hotfixes we will be pushing asap)
  • Guest, Make sure to use our LAUNCHER! Read more here!

Bug January Top Voters still not registering/listed

Kainzo

The Disposable Hero
Staff member
Founder
Adventure Team
Joined
Jan 7, 2011
Location
The 7th Circle of Heaven
Just a FYI :)

-yav
Leads me to believe that the change from 2014 to 2015 broke this. This worked fine before then, right?

// Change these to reflect your database information
Code:
function connect() {
  var url = "jdbc:mysql://" + host + ":" + port + "/" + database
  return java.sql.DriverManager.getConnection(url, user, pass)
}

function createTable() {
  var connection = connect()
  var statement = connection.createStatement()
  statement.executeUpdate("CREATE TABLE IF NOT EXISTS `votes` (`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `username` VARCHAR(255) NOT NULL, `service` VARCHAR(255) NOT NULL, `address` VARCHAR(255) NOT NULL, `timestamp` TIMESTAMP NOT NULL, PRIMARY KEY(`id`))")
  connection.close()
}

function addVote() {
  createTable()
  var connection = connect()
  var statement = connection.createStatement()
  var rows = statement.executeUpdate("INSERT INTO `votes` (`username`, `service`, `address`, `timestamp`) VALUES ('" + username + "', '" + service + "', '" + address + "', NOW())")
  connection.close()
}

addVote()
 

Watermelon_01

Legacy Supporter 2
Joined
Oct 14, 2014
Location
Hilo, Hawaii
Well in December it showed up but it didn't exactly change very often. I believe someone made a bug thread for this before forget if it was Yavool or not.
 

Kainzo

The Disposable Hero
Staff member
Founder
Adventure Team
Joined
Jan 7, 2011
Location
The 7th Circle of Heaven
Looks like this is it.
Code:
        $voters = $mcdb->query("SELECT `id`, `username` , COUNT( * ) AS votes
                FROM `votes`
                WHERE `timestamp`
                BETWEEN '2015-".$month."-01'
                AND '2015-".$month."-".$day."'
                GROUP BY `username`
                ORDER BY votes DESC
                LIMIT 10"
        );
 
Top