hi,
i've this line of code in my login php file. Everything is working fine.
if(!preg_match("/^[a-zA-Z0-9]{1,9}$/", $key))
...
other
To reuse the code, I remove this line from the login file, create a function and save in a separate php file name validate.php.
function validatekey($key)
{ if(!preg_match("/^[a-zA-Z0-9]{1,9}$/", $key))
{ exit();
}
}
By putting it this way, the logic seems to work in the reverse way!
I test the script, call the function, and input the correct key, the program exit! This is not correct.
i solve the problem by removing the ! sign in the line.
if(preg_match("/^[a-zA-Z0-9]{1,9}$/", $key))
But i do not understand why this is happening in this way? Or am i understand the wrong direction?
Any help is appreciated, thanks.