Originally Posted by
BMWxi
I also would like it if srl stats were linked to the forum account, but I'm not sure if it could be done safely.
What do people who are more experienced in this think?
Perhaps the forum software could be extended with a request token functionality. Generate a token that you can put in the script. You send the token with the request, server knows which token belongs to which user -> insert data.
Originally Posted by
Justin
@
J J; Do you have anything on this? I know you have stats with graphs for your scripts
Just make sure you put a timestamp and runtime for every commit. Using those two you can generate every graph you want Can even make a search function or plot the average xp/h. That's what I've done with my graphs.
JJ's Willow Chopper
Code:
CREATE TABLE jjswillowchopper (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
time BIGINT UNSIGNED,
runtime SMALLINT UNSIGNED,
xp SMALLINT UNSIGNED,
level TINYINT UNSIGNED
);
Result: http://obduro.org/scriptstats/jjswillowchopper.php
Can do quite a bit with just 6 columns.
Or JJ's Fighter.
Code:
CREATE TABLE jjsfighter (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
time BIGINT UNSIGNED,
runtime SMALLINT UNSIGNED,
attack_xp SMALLINT UNSIGNED,
attack_lvl TINYINT UNSIGNED,
strength_xp SMALLINT UNSIGNED,
strength_lvl TINYINT UNSIGNED,
defence_xp SMALLINT UNSIGNED,
defence_lvl TINYINT UNSIGNED,
ranged_xp SMALLINT UNSIGNED,
ranged_lvl TINYINT UNSIGNED,
magic_xp SMALLINT UNSIGNED,
magic_lvl TINYINT UNSIGNED,
hitpoints_xp SMALLINT UNSIGNED,
hitpoints_lvl TINYINT UNSIGNED
);
It now has a total runtime of 49242066 seconds which is 1 years, 6 months, 29 days, 22 hours, 21 minutes, 6 seconds.
I let the script commit every minute so that is a total of 820701 rows or so.
Warning: long loading time.. http://obduro.org/scriptstats/jjsfighter.php
Just make sure you have at very least a timestamp and runtime for every table.
Hardest part is to make sure it is fast. Eventually you are going to have loads of commits which will make it slow like my jjs fighter graph. So you will have to cache stuff, I'm not sure how to do that.
Another thing is security. All scripts are open source so you can't really do much in there. Ideally you would put the token in the table so you could easily remove all data from that user if they are abusing the commit method.
So I would have the following fields AT LEAST for every table:
Code:
id
timestamp
runtime
token
id: auto increment
timestamp: grab it during the commit, server sided
runtime: send it from the script (in seconds I'd say)
token: send it from the script, user has to generate it and can be identified with it.
EDIT: For the token perhaps do something smart so it stays the same. Base it on username + join date or something and encrypt it. That way you can actually just make a nice php file or something that does this for you. No need to extend the forum software. Make it look like it is a random token. In reality it is based on constant data so you can always identify the user
Just make sure users won't know what encryption and what data is used. Otherwise they could grab that data from anyone like my username and joindate, encrypt it and commit stats on my name.. Although that wouldn't really be a problem.. But they could commit false stuff and get me banned from SRL Stats :P