Also for your "registering" process there a mysql base would come in handy.
You'd make a MYSQL request SELECT
to take only $username from the base.
This is why earlier I said you should learn/find documentation for it, because it is a full topic that is beyond the scope of C2's forum as it is highly depending on how you setted up your server.
But this is what you're looking for for the leaderboard/registering, etc...
The server side PHP/Mysql deals with storing/providing/processing datas of all your clients, your client deals with retrieving specific datas for a user and providing new ones (replays).