function RegisterNewPlayer($Name, $Email) { $returncode = ""; // Check the player name. $bInvalidSymbols = false; $aInvalidSymbols = array("~", "`", "!", "@", "#", "\$", "%", "^", "&", "*", "(", ")", "+", "=", "{", "}", "[", "]", "|", "\\", ":", ";", "\"", "'", "<", ">", "?", "/", ",", " "); $nMAX = count($aInvalidSymbols); for ($i = 0; $i < $nMAX; $i++) { $pos = strpos($Name, $aInvalidSymbols[$i]); if ($pos !== false) { $bInvalidSymbols = true; break; } } // check the length of the player name $bNameLengthInvalid = true; $nMaxLength = 11; if (strlen($Name) <= $nMaxLength) { $bNameLengthInvalid = false; } // Add the player or display an error if (!$bInvalidSymbols && !$bNameLengthInvalid) { //Instantiate the CChess Class $oChess = new CChess($this->ChessCFGFileLocation); $returncode = $oChess->register($this->ChessCFGFileLocation, $Name, $Email); unset($oChess); } else { if ($bInvalidSymbols) { $returncode = array('success' => FALSE, 'msg' => "Invalid characters detected."); } elseif ($bNameLengthInvalid) { $returncode = array('success' => FALSE, 'msg' => "Name must be less than or equal to 11 characters."); } } return $returncode; }
function RegisterNewPlayer($Name, $Email) { $returncode = ""; //Instantiate the CChess Class $oChess = new CChess($this->ChessCFGFileLocation); $returncode = $oChess->register($this->ChessCFGFileLocation, $Name, $Email); unset($oChess); return $returncode; }