1 rizwank 1.1 <?php
2 //get set
3 include('./config.php');
4
5 // get authorised
6 include('./validate.php');
7
8 // get connected
9 include('./database.php');
10
11 ?>
12 <?php
13
14 // fix for IE catching or PHP bug issue
15 header("Pragma: public");
16 header("Expires: 0"); // set expiration time
17 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
18 // browser must download file from server instead of cache
19
20 // force download dialog
21 header("Content-Type: application/force-download");
22 rizwank 1.1 header("Content-Type: application/octet-stream");
23 header("Content-Type: application/download");
24 header("Content-Type: text/plain");
25
26 // use the Content-Disposition header to supply a recommended filename and
27 // force the browser to display the save dialog.
28 header("Content-Disposition: attachment; filename=mysqlinks.txt;");
29
30 /*
31 The Content-transfer-encoding header should be binary, since the file will be read
32 directly from the disk and the raw bytes passed to the downloading computer.
33 The Content-length header is useful to set for downloads. The browser will be able to
34 show a progress meter as a file downloads. The content-lenght can be determines by
35 filesize function returns the size of a file.
36 */
37 header("Content-Transfer-Encoding: binary");
38 #header("Content-Length: ".filesize($filename));
39
40 // get category list
41 $results = mysql_list_tables($mysqdb['name']) or die("Invalid request: " . mysql_error());
42
43 rizwank 1.1 while ($row = mysql_fetch_row($results)) {
44 $cats[] = $row[0];
45 }
46
47 // output category names and descriptions
48 print "***BEGIN CATEGORY INFO***\n";
49 foreach ($cats as $catname) {
50 $query = "SHOW TABLE STATUS LIKE '$catname'";
51
52 $results = mysql_query($query) or die("Invalid query: " . mysql_error());
53
54 while ($row2 = mysql_fetch_array($results)) {
55 print $catname . "|" . $row2['Comment'] . "\n";
56 }
57 }
58 print "***END CATEGORY INFO***\n";
59
60 // output all the links
61 print "***BEGIN LINKS LIST***\n";
62 foreach ($cats as $catname) {
63 $query = "SELECT * FROM `$catname` ORDER BY `title`";
64 rizwank 1.1
65 $results = mysql_query($query) or die("Invalid query: " . mysql_error());
66
67 while ($row3 = mysql_fetch_array($results)) {
68 print $catname . "|" . $row3[0] . "|" . $row3[1] . "|" . $row3[2] . "|" . $row3[3] . "|" . $row3[4] . "\n";
69 }
70 }
71 print "***END LINKS LIST***\n";
72
73 exit();
74
75 ?>
|