Sensibilium Main Logo

Guess the String (v1.5.3)

Enter a string and hit the guess button.

Here is the code

The code has been obfuscated very slightly, just to provide a bit more fun.

<?php
if (isset($_GET['submit']) && $_GET['submit'] == 'Guess') {
	$arrGuess = str_split($_GET['guess']);
	$success = false;
	if (count($arrGuess) == 16) {
		for ($i = 0; $i < 16; $i++) {
			$toSolve = ($i < 10) ? $i+48 : $i+55;
			$arrSolved[] = ($toSolve == ord($arrGuess[$i])) ? 1 : 0;
			if ($arrSolved[$i] == 0) break;
		}
		if (array_unique($arrSolved) == array(1)) $success = true;
	}
	echo ($success) ? '<p>Successful guess</p>' : '<p>Unsuccessful guess</p>';
}
?>