Azt nemértem ez miért működik??? Ráadásul php 5.6- alatt...
<?php
$url1 = 'http://';
$url2 = 'http://';
$url3 = 'http://';
$url4 = 'http://';
$url5 = 'http://';
$url6 = 'http://';
$url7 = 'http://';
$url8 = 'http://';
$array = get_headers($url1);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url1, null, 302);
}
else
{
$array = get_headers($url2);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url2, null, 302);
}
else
{
$array = get_headers($url3);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url3, null, 302);
}
else
{
$array = get_headers($url4);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url4, null, 302);
}
else
{
$array = get_headers($url5);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url5, null, 302);
}
else
{
$array = get_headers($url6);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url6, null, 302);
}
else
{
$array = get_headers($url7);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url7, null, 302);
}
else
{
$array = get_headers($url8);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url8, null, 302);
}
else
{
$array = get_headers($url0);
}
}
}
}
}
}
}
}
?>`
E pedig a mostani próba és semmi..:
`$code = strip_tags($_GET['code']);{
$db = new MySQLi($config['mysql_host'], $config['mysql_user'], $config['mysql_password'], $config['mysql_db']);
$db->set_charset('utf8');
$escapedCode = $db->real_escape_string($code);
$redirectResult = $db->query("SELECT `source`,`source2`,`source3`,`source4` FROM `channelList` WHERE `key` = '$escapedCode'");
$result = $redirectResult->fetch_object();
$url1 = $result->source;
$url2 = $result->source2;
$url3 = $result->source3;
$url4 = $result->source4;
$array = get_headers($url1);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url1, null, 302);
exit();
$db->close();
}
else
{
$array = get_headers($url2);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url2, null, 302);
exit();
$db->close();
}
else
{
$array = get_headers($url3);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url3, null, 302);
exit();
$db->close();
}
else
{
$array = get_headers($url4);
$string = $array[0];
if(strpos($string,"200"))
{
header('Location: ' . $uri . $url4, null, 302);
exit();
$db->close();
}
else
{
http_response_code("204");die("Nincs találat");
exit();
$db->close();
}
$db->close();
}
}
}
}
?>