I need help with a php code?

<?php
if($_GET['KEY'] isin /productkeys.txt) {
echo("Key is vaild");
}
?>

if the key is in the file it will say vaild
/index.php?KEY=dfefciiowqwhatever

how do i do this? someone give me code
I haven't done php code for awhile. i need help :(
 
The answers before will work, but be insecure..if somebody sends KEY=a or KEY=b, and either of those letters are inside any of your keys, then it will result in a truth value

Here is a secure answer that allows you to put each key on a new line

<?PHP
$keys = explode("\n", file_get_contents("/productkeys.txt"));
if (in_array($_GET["KEY"], $keys)) {
echo "Key is valid";
}
?>
 
The answers before will work, but be insecure..if somebody sends KEY=a or KEY=b, and either of those letters are inside any of your keys, then it will result in a truth value

Here is a secure answer that allows you to put each key on a new line

<?PHP
$keys = explode("\n", file_get_contents("/productkeys.txt"));
if (in_array($_GET["KEY"], $keys)) {
echo "Key is valid";
}
?>
 
The answers before will work, but be insecure..if somebody sends KEY=a or KEY=b, and either of those letters are inside any of your keys, then it will result in a truth value

Here is a secure answer that allows you to put each key on a new line

<?PHP
$keys = explode("\n", file_get_contents("/productkeys.txt"));
if (in_array($_GET["KEY"], $keys)) {
echo "Key is valid";
}
?>
 
The answers before will work, but be insecure..if somebody sends KEY=a or KEY=b, and either of those letters are inside any of your keys, then it will result in a truth value

Here is a secure answer that allows you to put each key on a new line

<?PHP
$keys = explode("\n", file_get_contents("/productkeys.txt"));
if (in_array($_GET["KEY"], $keys)) {
echo "Key is valid";
}
?>
 
Back
Top