#проверяем если ли такой mac в БД
$dbmac = mysqli_query($link,"SELECT mac FROM DataUsers WHERE ip='$ip'");
$dben = mysqli_query($link, "SELECT enable FROM DataUsers WHERE ip='$ip'");
$rows_db = mysqli_num_rows($dbmac);
$enable = 0;
for ($i=0; $i < $rows_db; $i++)
{
$dbmac_i = mysqli_result($dbmac,$i);
if($dbmac_i == $mac) {$enable = mysqli_result($dben,$i);}
}
if($enable==0)
{
header('HTTP/1.1 511 Network Authentication Required', TRUE, 511);
if ($_SERVER['SERVER_NAME'] != "$servername.$domain_name")
{
header("location:http://$servername.$domain_name/index.php?add=" .
urldecode($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']));
exit;
}
if (!isset($_POST['access_code']))
{
if ((!isset($_POST['tel'])) || ($_POST['tel'] < 9000000000))
{
print_header(); ?>