Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Problem in script

General discussions related to php

Moderators: macek, egami, gesf

Problem in script

Postby deluxor » Thu Sep 27, 2012 3:26 pm

Hello people could you please explain me or make me look out what is wrong with this code?

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;
      }
   }
}
deluxor
New php-forum User
New php-forum User
 
Posts: 1
Joined: Thu Sep 27, 2012 3:16 pm

Re: Problem in script

Postby seandisanti » Mon Oct 01, 2012 2:35 pm

are you receiving an error? if so, what is the error? what is happening with the code you're currently running?
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.