-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcybersecurity.php
38 lines (31 loc) · 1.06 KB
/
cybersecurity.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
include 'db_conn.php';
if(isset($_POST["ip"])){
$ip = $_POST["ip"];
$isp = $_POST["isp"];
$country = $_POST["country"];
$city = $_POST["city"];
$counter_query = "SELECT * FROM tb_data WHERE `ip` = '$ip'";
$counter_result = mysqli_query($conn, $counter_query);
if(!$counter_result){
die("Result error<br>".$counter_query);
}
$total_visitors = mysqli_num_rows($counter_result);
if($total_visitors<1){
$counter_query = "INSERT INTO `tb_data` (`ip`, `isp`, `country`, `city`) VALUES('$ip', '$isp', '$country', '$city')";
$counter_result = mysqli_query($conn, $counter_query);
if ($counter_result)
{
echo '<script> alert("Ma`lumotlar bazaga kiritildi"); </script>';
echo $counter_result;
// header('Location: home.php');
}
else
{
echo '<script> alert("Ma`lumotlar bazaga kiritilmadi"); </script>';
}
}
// $query = "INSERT INTO tb_data VALUES('', '$ip', '$isp', '$country', '$city')";
// mysqli_query($conn, $query);
}
?>