Jak zmienić zapytania bo teraz jest coś nie tak że nic nie znajduje

<?php
function getVideos($category = 1) {
$category = (isset($_GET['c'])) ?
$_GET['c'] : $category;
switch($category) {
case 1: $cat = 'http://www.redtube.com/new?page='; break;
case 2: $cat = 'http://www.redtube.com/top?page='; break;
case 3: $cat = 'http://www.redtube.com/redtube/bigtits?page='; break;
case 4: $cat = 'http://www.redtube.com/redtube/teens?page='; break;
case 5: $cat = 'http://www.redtube.com/redtube/lesbian?page='; break;
case 6: $cat = 'http://www.redtube.com/redtube/blowjob?page='; break;
case 7: $cat = 'http://www.redtube.com/redtube/anal?page='; break;
case 8: $cat = 'http://www.redtube.com/redtube/amateur?page='; break;
case 9: $cat = 'http://www.redtube.com/redtube/fun?page='; break;
case 10: $cat = 'http://www.redtube.com/redtube/wildcrazy?page='; break;
case 11: $cat = 'http://www.redtube.com/redtube/asian?page='; break;
case 12: $cat = 'http://www.redtube.com/redtube/gay?page='; break;
case 13: $cat = 'http://www.redtube.com/redtube/public?page='; break;
case 14: $cat = 'http://www.redtube.com/?search='.$_GET['q'].'&page='; break;
default: $cat = 'http://www.redtube.com/new?page='; break;
}
preg_match_all('#<a class=s.*?href=.*?redtube\.com/(.*?)\'>(.*?)</a>#sie', $code, $tmp); $html['linki'] = $tmp[1];
$html['opisy'] = $tmp[2];
preg_match_all('#<img.*?class=t width=160 height=120 src=\'.*?/_thumbs/([0-9]{7})/([0-9]{7})/([0-9]{7}_[0-9]{3}\.jpg)\'.*?>#sie', $code, $tmp); $html['obrazy'][0] = $tmp[1];
$html['obrazy'][1] = $tmp[2];
$html['obrazy'][2] = $tmp[3];
preg_match_all('#<td><span class=d>([0-9\:]*)</span></td><td align=right>([0-9\.]{4})</td>#sie', $code, $tmp); $html['czas'] = $tmp[1];
$c = count($html['linki'])-1; if($c == -1) {
return array('<p id="err1">Brak wyników pod podaną frazą</p>'); }
$code[0] .= '<ol id="lista">'."\n";
for($i=0; $i<=$c; $i++) {
$item = ($i%2 == 0)?'w1':'w2';
$code[0].= "\t\t". '<li class="'.$item.'">'.
'<a class="link" href="/item'.$html['linki'][$i].'/'.del($html['opisy'][$i]).'/">'.
'<img class="img" id="img'.$html['obrazy'][1][$i].'" src="/'.$cfg['imgPrefix'].$html['obrazy'][0][$i].'/'.$html['obrazy'][1][$i].'/'.$html['obrazy'][2][$i].'" alt="'.$html['opisy'][$i].'">'.
'</a>'.
'<p class="time"><strong class="label">czas: </strong>'.$html['czas'][$i].'</p>'.
'</li>'."\n";
} $code[0].= "\t".'</ol>'."\n";
$code[1] = '';
$del = array(' ' => '+'); $_GET['p'] = (empty($_GET['p'])) ? 1
: $_GET['p']; $i = (empty($_GET['p'])) ? 1
: $_GET['p']-10; $i = ($i <= 0) ? 1 : $i;
$c = ceil($tmp[1
][0
]/20
); $j = $i;
$x = $i + 12;
$x = ($x > $c) ? $c : $x;
for($i; $i<=$x; $i++) {
if($category == 14) {
$link = '/search.php?q='.strtr($_GET['q'], $del).'&p='.$i; $code[1].= ($i == $_GET['p']) ? "\t\t".'<li><a class="this" href="'.$link.'">'.$i.'</a></li>'."\n" : "\t\t".'<li><a href="'.$link.'">'.$i.'</a></li>'."\n";
} else {
$link = (empty($_GET['c'])) ?
'/'.$i.'/' : '/cat'.$_GET['c'].'-'.$_GET['t'].'/'.$i.'/'; $code[1].= ($i == $_GET['p']) ? "\t\t".'<li><a class="this" href="'.$link.'">'.$i.'</a></li>'."\n" : "\t\t".'<li><a href="'.$link.'">'.$i.'</a></li>'."\n";
}
if($j === $x) break;
$j++;
}
return $code;
}
function watch($id, $t) {
$str = '<div id="player">'.
'<a href="/'.$cfg['downPrefix'].$id.'/'.$t.'.flv">DOWNLOAD</a>'.
'<object height="344" width="434" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">'.
'<param name="movie" value="http://embed.redtube.com/player/">'.
'<param name="FlashVars" value="id='.$id.'&style=redtube">'.
'<embed src="http://embed.redtube.com/player/?id='.$id.'&style=redtube" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="344" width="434">'.
'</object>'.
'</div>';
$str .= makeTags($t);
return $str;
}
function makeTags($str) {
if($c == -1)
return '';
$str = '<ol id="tags"><li class="title">Tagi:</li>';
for($i=0; $i<=$c; $i++) {
$str .= '<li><a href="/tag-'.$tmp[$i].'/">'.$tmp[$i].'</a></li>';
}
$str .= '</ol>';
return $str;
}
function del($str) {
$del = array(' ' => '_', ',' => '_', '!' => '', '\'' => '');
$str = strtr($str, $del);
return $str;
}
?>