Basically I have a table with some domains, after a query I split them by "," then I want to check if the referer is one of those domains in the DB, if true nothing happens, if not they got redirected to a new page, I can't figure out what is wrong, can someone please help me?
Thanks in advance!
- Code: Select all
$streama= preg_replace("/[^a-zA-Z0-9\s]/", "", $_GET['ch']);
mysql_select_db($database_ovcast, $ovcast);
$query_Recordset1 = "SELECT nome, visitas, ban, password, dominio FROM CANAIS WHERE nome = '".$streama."'";
$Recordset1 = mysql_query($query_Recordset1, $ovcast) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if ($row_Recordset1['dominio'] != "n/a"){
$parts = split (",",$row_Recordset1['dominio']);
$urlInfo = parse_url($_SERVER['HTTP_REFERER']);
$domain = $urlInfo['host'];
$conta = count($parts);
for ($i = 0; $i < $conta; $i++) {
//echo $parts[$i]."\n";
if ($parts[$i] <> $domain)
{
header("Location: http://#");
//exit;
}
}
}


