Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Proszę o sprawdzenie funkcji :
Forum PHP.pl > Forum > Przedszkole
skunk80
Jak zmienić zapytania bo teraz jest coś nie tak że nic nie znajduje sad.gif
  1. <?php
  2. function getVideos($category = 1) {
  3. global $cfg;
  4. $category = (isset($_GET['c'])) ? $_GET['c'] : $category;
  5.  
  6. switch($category) {
  7. case 1: $cat = 'http://www.redtube.com/new?page='; break;
  8. case 2: $cat = 'http://www.redtube.com/top?page='; break;
  9. case 3: $cat = 'http://www.redtube.com/redtube/bigtits?page='; break;
  10. case 4: $cat = 'http://www.redtube.com/redtube/teens?page='; break;
  11. case 5: $cat = 'http://www.redtube.com/redtube/lesbian?page='; break;
  12. case 6: $cat = 'http://www.redtube.com/redtube/blowjob?page='; break;
  13. case 7: $cat = 'http://www.redtube.com/redtube/anal?page='; break;
  14. case 8: $cat = 'http://www.redtube.com/redtube/amateur?page='; break;
  15. case 9: $cat = 'http://www.redtube.com/redtube/fun?page='; break;
  16. case 10: $cat = 'http://www.redtube.com/redtube/wildcrazy?page='; break;
  17. case 11: $cat = 'http://www.redtube.com/redtube/asian?page='; break;
  18. case 12: $cat = 'http://www.redtube.com/redtube/gay?page='; break;
  19. case 13: $cat = 'http://www.redtube.com/redtube/public?page='; break;
  20. case 14: $cat = 'http://www.redtube.com/?search='.$_GET['q'].'&page='; break;
  21. default: $cat = 'http://www.redtube.com/new?page='; break;
  22. }
  23.  
  24. $code = @file_get_contents($cat.$_GET['p']);
  25.  
  26. preg_match_all('#<a class=s.*?href=.*?redtube\.com/(.*?)\'>(.*?)</a>#sie', $code, $tmp);
  27. $html['linki'] = $tmp[1];
  28. $html['opisy'] = $tmp[2];
  29. 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);
  30. $html['obrazy'][0] = $tmp[1];
  31. $html['obrazy'][1] = $tmp[2];
  32. $html['obrazy'][2] = $tmp[3];
  33. preg_match_all('#<td><span class=d>([0-9\:]*)</span></td><td align=right>([0-9\.]{4})</td>#sie', $code, $tmp);
  34. $html['czas'] = $tmp[1];
  35. preg_match_all('#of ([0-9]*) videos#sie', $code, $tmp);
  36.  
  37. $c = count($html['linki'])-1;
  38. $code = array();
  39. if($c == -1) {
  40. return array('<p id="err1">Brak wyników pod podaną frazą</p>');
  41. }
  42.  
  43. $code[0] .= '<ol id="lista">'."\n";
  44. for($i=0; $i<=$c; $i++) {
  45. $item = ($i%2 == 0)?'w1':'w2';
  46. $code[0].= "\t\t". '<li class="'.$item.'">'.
  47. '<a class="link" href="/item'.$html['linki'][$i].'/'.del($html['opisy'][$i]).'/">'.
  48. '<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].'">'.
  49. '</a>'.
  50. '<p class="time"><strong class="label">czas: </strong>'.$html['czas'][$i].'</p>'.
  51. '</li>'."\n";
  52. } $code[0].= "\t".'</ol>'."\n";
  53.  
  54. $code[1] = '';
  55. $del = array(' ' => '+');
  56. $_GET['p'] = (empty($_GET['p'])) ? 1 : $_GET['p'];
  57. $i = (empty($_GET['p'])) ? 1 : $_GET['p']-10;
  58. $i = ($i <= 0) ? 1 : $i;
  59. $c = ceil($tmp[1][0]/20);
  60. $j = $i;
  61. $x = $i + 12;
  62. $x = ($x > $c) ? $c : $x;
  63. for($i; $i<=$x; $i++) {
  64. if($category == 14) {
  65. $link = '/search.php?q='.strtr($_GET['q'], $del).'&p='.$i;
  66. $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";
  67. } else {
  68. $link = (empty($_GET['c'])) ? '/'.$i.'/' : '/cat'.$_GET['c'].'-'.$_GET['t'].'/'.$i.'/';
  69. $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";
  70. }
  71. if($j === $x) break;
  72. $j++;
  73. }
  74.  
  75. return $code;
  76. }
  77.  
  78. function watch($id, $t) {
  79. global $cfg;
  80.  
  81. $str = '<div id="player">'.
  82. '<a href="/'.$cfg['downPrefix'].$id.'/'.$t.'.flv">DOWNLOAD</a>'.
  83. '<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">'.
  84. '<param name="movie" value="http://embed.redtube.com/player/">'.
  85. '<param name="FlashVars" value="id='.$id.'&style=redtube">'.
  86. '<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">'.
  87. '</object>'.
  88. '</div>';
  89. $str .= makeTags($t);
  90.  
  91. return $str;
  92. }
  93.  
  94. function makeTags($str) {
  95. $tmp = explode('_', $str);
  96. $c = count($tmp)-1;
  97. if($c == -1)
  98. return '';
  99.  
  100. $str = '<ol id="tags"><li class="title">Tagi:</li>';
  101. for($i=0; $i<=$c; $i++) {
  102. $str .= '<li><a href="/tag-'.$tmp[$i].'/">'.$tmp[$i].'</a></li>';
  103. }
  104. $str .= '</ol>';
  105.  
  106. return $str;
  107. }
  108.  
  109. function del($str) {
  110. $del = array(' ' => '_', ',' => '_', '!' => '', '\'' => '');
  111.  
  112. $str = strtr($str, $del);
  113. $str = preg_replace('#[_]{1,}#', '_', $str);
  114.  
  115. return $str;
  116. }
  117. ?>

freak
A coś więcej? Za dużo informacji to nie podałeś.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.