diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index 68616e3e..53b86d6f 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -442,6 +442,10 @@ class User { **/ public function register($username, $password1, $password2, $pin, $email1='', $email2='') { $this->debug->append("STA " . __METHOD__, 4); + if (strlen($username > 40)) { + $this->setErrorMessage('Username exceeding character limit'); + return false; + } if ($this->getEmail($email1)) { $this->setErrorMessage( 'This e-mail address is already taken' ); return false; @@ -482,8 +486,9 @@ class User { $password_hash = $this->getHash($password1); $pin_hash = $this->getHash($pin); $apikey_hash = $this->getHash($username); + $username_clean = strip_tags($username); - if ($this->checkStmt($stmt) && $stmt->bind_param('sssss', $username, $password_hash, $email1, $pin_hash, $apikey_hash)) { + if ($this->checkStmt($stmt) && $stmt->bind_param('sssss', $username_clean, $password_hash, $email1, $pin_hash, $apikey_hash)) { if (!$stmt->execute()) { $this->setErrorMessage( 'Unable to register' ); if ($stmt->sqlstate == '23000') $this->setErrorMessage( 'Username or email already registered' ); diff --git a/public/templates/mmcFE/account/edit/default.tpl b/public/templates/mmcFE/account/edit/default.tpl index c15b56d4..fd445286 100644 --- a/public/templates/mmcFE/account/edit/default.tpl +++ b/public/templates/mmcFE/account/edit/default.tpl @@ -4,7 +4,7 @@
| Username: | {$GLOBAL.userdata.username} | |||||||||||
| Username: | {$GLOBAL.userdata.username|escape} | |||||||||||
| User Id: | {$GLOBAL.userdata.id} | |||||||||||
| API Key: | {$GLOBAL.userdata.api_key} | |||||||||||
| E-Mail: | ||||||||||||
| {$USERS[user].id} | -{$USERS[user].username} | -{$USERS[user].email} | +{$USERS[user].username|escape} | +{$USERS[user].email|escape} | {$USERS[user].shares} | {$USERS[user].hashrate} | {$USERS[user].payout.est_donation|number_format:"8"} | diff --git a/public/templates/mmcFE/global/userinfo.tpl b/public/templates/mmcFE/global/userinfo.tpl index 92105bdc..d9745394 100644 --- a/public/templates/mmcFE/global/userinfo.tpl +++ b/public/templates/mmcFE/global/userinfo.tpl @@ -1,5 +1,5 @@ {if $GLOBAL.userdata.username|default} -{$BLOCKSFOUND[block].finder|default:"unknown"} | +{$BLOCKSFOUND[block].finder|default:"unknown"|escape} | {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} | {$BLOCKSFOUND[block].difficulty|number_format:"2"} | {$BLOCKSFOUND[block].amount|number_format:"2"} | diff --git a/public/templates/mmcFE/statistics/blocks/small_table.tpl b/public/templates/mmcFE/statistics/blocks/small_table.tpl index 731d57ef..2b0f8aac 100644 --- a/public/templates/mmcFE/statistics/blocks/small_table.tpl +++ b/public/templates/mmcFE/statistics/blocks/small_table.tpl @@ -14,7 +14,7 @@ {section block $BLOCKSFOUND}
| {$BLOCKSFOUND[block].height} | -{$BLOCKSFOUND[block].finder|default:"unknown"} | +{$BLOCKSFOUND[block].finder|default:"unknown"|escape} | {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} | {$BLOCKSFOUND[block].shares|number_format} | ||||||||
| {$rank++} | -{$CONTRIBHASHES[contrib].account} | +{$CONTRIBHASHES[contrib].account|escape} | {$CONTRIBHASHES[contrib].hashrate|number_format} | {$estday|number_format:"3"} | {if $GLOBAL.config.price.currency}{($estday * $GLOBAL.price)|default:"n/a"|number_format:"2"} | {/if} @@ -27,7 +27,7 @@ {if $GLOBAL.userdata.hashrate > 0}{math assign="myestday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.hashrate}{/if}|||||||
| n/a | -{$GLOBAL.userdata.username} | +{$GLOBAL.userdata.username|escape} | {$GLOBAL.userdata.hashrate} | {$myestday|number_format:"3"|default:"n/a"} | {if $GLOBAL.config.price.currency}{($myestday * $GLOBAL.price)|default:"n/a"|number_format:"2"} | {/if} diff --git a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl index 2a482209..232e76b2 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl @@ -14,14 +14,14 @@ {section hashrate $CONTRIBSHARES}|||||||
| {$rank++} | -{$CONTRIBSHARES[hashrate].account} | +{$CONTRIBSHARES[hashrate].account|escape} | {$CONTRIBSHARES[hashrate].shares|number_format} | |||||||||
| n/a | -{$GLOBAL.userdata.username} | +{$GLOBAL.userdata.username|escape} | {$GLOBAL.userdata.shares.valid|number_format} |