before I start, I want to admit that I am a novice at PHP, so if I am doing something way off please tell me as 100% of this code is mine and I am trying to learn on my own.
I am working on this code for a unique twist at entry for my server. The idea is that the page echo's 3 numbers, and if you are a member you take the keygen and put those three numbers in the keygen and then the keygen gives you the correct authentication code. you put that in the corisponding boxes benieth the numbers. The problem is that I can't figure out how to get it too work. So I will supply you guys with my code so far, and see if you guys could possibly assist me.
<?php
/// Secure Server Auth Code Maker ////
// Talon (a.k.a The Mad Hatter) //
//=======config===========/
$self= $_SERVER[’PHP_SELF’];
$pattern = "1234567890";
$space = "-";
//=======================//
//====Random Number======//
$key1 = $pattern{rand(0,9)};
$key2 = $pattern{rand(0,9)};
$key3 = $pattern{rand(0,9)};
//===================//
echo "<center><font color='006699'><b>$key1 $key2 $key3</b></font></center>";
$auth1 = $_POST["auth1"];
$auth2 = $_POST["auth2"];
$auth3 = $_POST["auth3"];
echo "<center><form action='$self' method='post'>";
echo "<input name='auth1' size= '6' type='text'>";
echo "<input name='auth2' size= '6' type='text'>";
echo "<input name='auth3' size= '6' type='text'> <input type='submit' value='Test'></center>";
//=====Security Code=====//
$replaceArray = Array(
"1"=>"AF*!LP",
"2"=>"ee%lel",
"3"=>"@geMql",
"4"=>"Drn?lO",
"5"=>"Q~^met",
"6"=>"O{aa{",
"7"=>"bk|>nl",
"8"=>"axf&Of",
"9"=>"ec/*xf",
"0"=>"wqd@tf");
//===============//
$word1 == $auth1;
foreach($replaceArray as $key=>$value)
{
$word1 = str_replace($key, $value, $word1);
}
if($key1 == $word1){
echo "welcome";
}else {
echo "You are not allowed to see this page";
}
?>