I’m setting up a very simple page “protected” by a password, up to there all OK, but we would like to have it where only first 3 digits/characters used get verified.
The page is not something that is top secret or anything, we only want it this way to avoid “general” people (without the knowledge on how to get in) from accessing the content.
So for example at the moment we have:
$password = "NBX9785";
And then the content that is being hidden is hidden as follows:
<?php
if (isset($_POST["password"]) && ($_POST["password"]=="$password")) {
?>
But what we want is to just have the NBX count and not the numbers or rest of the password, which will basically allow us to give out more codes without the need of extra coding.
Is this possible and is there an easy way to do this?
To push it even further is it possible to set it to have say NBX99D24 where NBX are fixed, but 99, D and 24 are numbers and a letter respectively?
You can get the first three characters from the string and compare
OR
Also all is here: http://php.net/manual/en/ref.strings.php