<?
include('connectdb.php'); // подключение к серверу MySql и выбор БД
$userinfo='';
$state='0';
if($state != 1) {
if( (isset($_POST['Serial_Program'])) & (isset($_POST['UID_Processor'])) & (isset($_POST['UID_Motherboard'])) ){
$Serial_Program = $_POST['Serial_Program'];
$sql = "SELECT id, UID_Processor, UID_Motherboard FROM Activation WHERE Serial_Program='$Serial_Program'";
$res = mysql_query($sql);
if(mysql_num_rows($res)>0) {// если пользователь есть в БД
$userinfo = mysql_fetch_array($res);
$UID_Processor = $_POST['UID_Processor'];
$UID_Motherboard = $_POST['UID_Motherboard'];
if ( (strcmp($UID_Processor,md5($userinfo['UID_Processor']))) == 0 && (strcmp($UID_Motherboard,md5($userinfo['UID_Motherboard']))) == 0 ){
// достаём все данные из БД
$sql="SELECT * FROM Activation WHERE Serial_Program='$Serial_Program'";
$res=mysql_query($sql);
$userinfo=mysql_fetch_array($res);
$state = 1;
}
}
}
}
if($state != 1) {
?>
<form method="post" action="/index.php">
Serial_Program: <input type="text" size="30" name="Serial_Program">
UID_Processor: <input type="text" size="30" name="UID_Processor" >
UID_Motherboard: <input type="text" size="30" name="UID_Motherboard">
<input type="submit" value="Enter">
</form>
<a href="/register.php">Registration</a>
<?
} else {
echo 'Congratulations!
Your Serial_Program: '.$userinfo["Serial_Program"].'
UID_Processor: '.$userinfo["UID_Processor"].'
UID_Motherboardl: '.$userinfo["UID_Motherboard"].'
<a href="/index.php?exit=y">Exit</a>';
}
?>