- {registration_date}
- сообщений: {posts}
- {tel_link}
вот остальная часть кода
1 | ----------------------------------------------------------------- |
2 | Принимаем данные, выводим форму поиска |
3 | ----------------------------------------------------------------- |
4 | */ |
5 | $search_post = isset( $_POST [ 'search' ]) ? trim( $_POST [ 'search' ]) : false; |
6 | $search_get = isset( $_GET [ 'search' ]) ? rawurldecode(trim( $_GET [ 'search' ])) : false; |
7 | $search = $search_post ? $search_post : $search_get ; |
8 | //$search = preg_replace("/[^\w\x7F-\xFF\s]/", " ", $search); |
9 | $search_n = isset( $_REQUEST [ 'n' ]); |
10 | echo '<div class=""phdr""></div>' . $lng_stars [ 'stars' ] . ' | ' . $lng_stars [ 'search_stars' ] . ' ' . |
11 | // '<div class=""topmenu""></div>' . $lng_stars['search_info'] . ' ' . |
12 | '<div class=""gmenu""></div> ' . |
13 | '' . |
14 | // ' |
15 | ' . |
16 | // ' ' . $lng_stars['search_name'] . |
17 | ' ' ; |
18 |
19 | /* |
20 | ----------------------------------------------------------------- |
21 | Проверям на ошибки |
22 | ----------------------------------------------------------------- |
23 | */ |
24 | $error = false; |
25 | if ( $search && (mb_strlen( $search ) 64)) |
26 | $error = $lng [ 'error_search_length' ]; |
27 |
28 | if ( $search && ! $error ) { |
29 | /* |
30 | ----------------------------------------------------------------- |
31 | Выводим результаты запроса |
32 | ----------------------------------------------------------------- |
33 | */ |
34 | $array = explode ( ' ' , $search ); |
35 | $count = count ( $array ); |
36 | $query = mysql_real_escape_string( $search ); |
37 | $total = mysql_result(mysql_query(" |
38 | SELECT COUNT (*) FROM `stars` |
39 | WHERE MATCH ( " . ($search_n ? '`name`' : '`films`') . " ) AGAINST ( '$query' IN BOOLEAN MODE) |
40 | AND `type` = '1' |
41 | "), 0); |
42 | echo '<div class=""phdr""></div>' . $lng [ 'search_results' ] . ' ' ; |
43 | if ( $total > $kmess ) |
44 | echo '<div class=""topmenu""></div>' . functions::display_pagination( 'films.php?' . ( $search_n ? 'n=1&' : '' ) . 'search=' . urlencode( $search ) . '&' , $start , $total , $kmess ) . ' ' ; |
45 | if ( $total ) { |
46 | $req = mysql_query(" |
47 | SELECT * |
48 | FROM `stars` |
49 | WHERE MATCH ( " . ($search_n ? '`name`' : '`films`') . " ) AGAINST ( '$query' IN BOOLEAN MODE) |
50 | AND `type` = '1' |
51 | LIMIT $start , $kmess |
52 | "); |
53 | $i = 0; |
54 | $razm = $agent_web == 'web' ? '64' : '32' ; |
55 | while (( $res = mysql_fetch_assoc( $req )) !== false) { |
56 | echo $i % 2 ? '<div class=""list2""></div>' : '<div class=""list1""></div>' ; |
57 | echo '' ; |
58 | if (! $search_n ) { |
59 | // Поиск только в фильмах |
60 | $req_t = mysql_query( "SELECT * FROM `stars` WHERE `id` = '" . $res ['id '] . "' "); |
61 | $res_t = mysql_fetch_assoc( $req_t ); |
62 | if ( file_exists ( 'photo/' . $res [ 'id' ] . '.jpg' )) |
63 | echo ' ' ; |
64 | elseif ( file_exists ( 'photo/' . $res [ 'id' ] . '.jpeg' )) |
65 | echo ' ' ; |
66 | elseif ( file_exists ( 'photo/' . $res [ 'id' ] . '.bmp' )) |
67 | echo ' ' ; |
68 | elseif ( file_exists ( 'photo/' . $res [ 'id' ] . '.png' )) |
69 | echo ' ' ; |
70 | elseif ( file_exists ( 'photo/' . $res [ 'id' ] . '.gif' )) |
71 | echo ' ' ; |
72 | echo ( $agent_web == 'web' ? '' : '' ) . '' . $res_t [ 'name' ] . ' |
73 | '; |
74 | } else { |
75 | // Поиск в именах |
76 | $req_p = mysql_query( "SELECT * FROM `stars` WHERE `id` = '" . $res ['id '] . "' "); |
77 | $res_p = mysql_fetch_assoc( $req_p ); |
78 | foreach ( $array as $val ){ |
79 | $res [ 'name' ] = ReplaceKeywords( $val , $res [ 'name' ]); |
80 | } |
81 | if ( file_exists ( 'photo/' . $res_p [ 'id' ] . '.jpg' )) |
82 | echo ' ' ; |
83 | elseif ( file_exists ( 'photo/' . $res_p [ 'id' ] . '.jpeg' )) |
84 | echo ' ' ; |
85 | elseif ( file_exists ( 'photo/' . $res_p [ 'id' ] . '.bmp' )) |
86 | echo ' ' ; |
87 | elseif ( file_exists ( 'photo/' . $res_p [ 'id' ] . '.png' )) |
88 | echo ' ' ; |
89 | elseif ( file_exists ( 'photo/' . $res_p [ 'id' ] . '.gif' )) |
90 | echo ' ' ; |
91 | echo ( $agent_web == 'web' ? '' : '' ) . '' . $res_p [ 'name' ] . ' |
92 | '; |
93 | } |
94 | $text = null; |
95 | if ( $search_n ) |
96 | { |
97 | $films = explode ( ';' , $res_p [ 'films' ]); |
98 | foreach ( $films as $key ) |
99 | { |
100 | $key = trim( $key ); |
101 | $text .= '' . $key . ', ' ; |
102 | } |
103 | } |
104 | else |
105 | { |
106 | $films = explode ( ';' , $res [ 'films' ]); |
107 | foreach ( $films as $key ) |
108 | { |
109 | $key = trim( $key ); |
110 | $text .= '' . $key . ', ' ; |
111 | } |
112 | } |
113 | //$text = $search_n ? $res_p['films'] : $res['name']; |
114 | foreach ( $array as $srch ) if (( $pos = mb_strpos( strtolower ( $res [ 'name' ]), strtolower ( str_replace ( '*' , '' , $srch )))) !== false) break ; |
115 | if (!isset( $pos ) || $pos < 100) $pos = 100; |
116 | //$text = preg_replace('#\[c\](.*?)\[/c\]#si', '<div class=""quote""></div>\1 ', $text); |
117 | //$text = functions::checkout(mb_substr($text, ($pos - 100), 400), 1); |
118 | if (! $search_t ) { |
119 | foreach ( $array as $val ){ |
120 | $text = ReplaceKeywords( $val , $text ); |
121 | } |
122 | } |
123 | if (! empty ( $res [ 'films' ])) |
124 | { |
125 | $text2 = explode ( ',' , $text ); |
126 | unset( $text2 [ end ( $text2 )]); |
127 | unset( $text2 [ count ( $text2 )-1]); |
128 | |
129 | $texts = array (); |
130 | //$text2 = implode(',', $text2); |
131 | foreach ( $text2 as $keys ) |
132 | { |
133 | if ( $keys != end ( $text2 )) |
134 | $pref = ',' ; |
135 | else |
136 | $pref = '' ; |
137 | $texts [] = $keys . $pref ; |
138 | } |
139 | echo $lng_stars [ 'films' ] . ': <span class=""phpcode"">' . implode( '' , $texts ) . '</span>' ; |
140 | } |
141 | echo ' ' ; |
142 | ++ $i ; |
143 | } |
144 | } else { |
145 | echo '<div class=""rmenu""></div> ' . $lng [ 'search_results_empty' ] . ' ' ; |
146 | } |
147 | echo '<div class=""phdr""></div>' . $lng [ 'total' ] . ': ' . $total . ' ' ; |
148 | if ( $total > $kmess ) { |
149 | echo '<div class=""topmenu""></div>' . functions::display_pagination( 'films.php?' . ( $search_t ? 't=1&' : '' ) . 'search=' . urlencode( $search ) . '&' , $start , $total , $kmess ) . ' ' . |
150 | ' ' . |
151 | '' . |
152 | '' . |
153 | ' ' ; |
154 | } |
155 | } else { |
156 | if ( $error ) echo functions::display_error( $error ); |
157 | echo '<div class=""phdr""></div>' . $lng_stars [ 'search_help' ] . ' ' ; |
158 | } |
159 | echo ' ' . ( $search ? '' . $lng [ 'search_new' ] . ' |
160 | ' : ' ') . ' ' . $lng_stars[' stars '] . ' '; |
ответ опубликован:
Рейтинг: 5
голосов: 2
- 5
- 1
- 2
- 3
- 4
- 5