javascript token generator
function generate_token(length){
//edit the token allowed characters
var a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".split("");
var b = [];
for (var i=0; i<length; i++) {
var j = (Math.random() * (a.length-1)).toFixed(0);
b[i] = a[j];
}
return b.join("");
}
generate_token(32); //returns "qweQj4giRJSdMNzB8g1XIa6t3YtRIHPH"