1 rizwank 1.1 <?php
2 //get set
3 include('lib/config.php');
4
5 // get authorised
6 include('lib/validate.php');
7
8 // get connected
9 include('lib/database.php');
10 ?>
11
12 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
13 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
14 <head>
15 <title>MySQLinks | Logged In: <?php echo $_SESSION['valid']['name']; ?></title>
16 <link rel="stylesheet" type="text/css" href="mysqlinks.css" media="all" name="default" />
17 <meta http-equiv="imagetoolbar" content="no" />
18 <meta http-equiv="cache-control" content="no-cache" />
19 <meta http-equiv="pragmas" content="no-cache" />
20 <meta http-equiv="robots" content="noindex,nofollow,noarchive,nocache" />
21 <meta http-equiv="Content-type" content='text/html; charset="utf-8"' />
22 rizwank 1.1 <meta http-equiv="Content-Language" content="en-au" />
23 </head>
24 <body>
25
26
27
28 <div id="header">
29
30 </div>
31
32
33
34 <div id="menu">
35 <span class="menu-pad"> <?php echo $mysqvars['version']; ?></span>
36 <a href="<?php echo $mysqvars['url']; ?>">Main</a> · <a href="<?php echo $mysqvars['url']; ?>tools.php">Tools</a> · <a href="<?php echo $mysqvars['url']; ?>admin.php">Admin</a> · <a href="<?php echo $mysqvars['url']; ?>logout.php">Logout</a> · <a href="<?php echo $mysqvars['url']; ?>help.php">Help</a>
37 </div>
38
39
40 <div id="title">
41 <a href="http://freebies.wiccked.com/mysqlinks/"><img src="mysqlinks_maintitle.png" width="301" height="64" title="MySQLinks" alt="MySQLinks" border="0" /></a><br />
42 </div>
43 rizwank 1.1
44 <div id="categories">
45 <?php
46 $categorylist = $mysqvars['path'] . "lib/share_categories.php";
47 include($categorylist);
48 ?>
49 </div>
50
51 <div id="links">
52
53 <h1>
54 <?php
55
56 // getting the category description
57
58 $query = "SHOW TABLE STATUS LIKE '$cat'";
59
60 $results = mysql_query($query) or die("Invalid query: " . mysql_error());
61
62 while ($row = mysql_fetch_array($results)) {
63 print $row['Comment'];
64 rizwank 1.1 }
65
66 mysql_free_result($results);
67
68 // getting the links from the db
69
70 $query = "SELECT * FROM `$cat` ORDER BY `title`";
71
72 $results = mysql_query($query) or die("Invalid query: " . mysql_error());
73
74 while ($row = mysql_fetch_array($results)) {
75 $links[] = array('url' => $row[1],'title' => $row[2],'extras' => $row[3], 'status' => $row[4]);
76 }
77
78 $many = count($links);
79 $each = ceil($many / $mysqvars['columns']);
80
81 print " <span class=\"count\">(" . $many . " links)</span>";
82
83 ?>
84 </h1>
85 rizwank 1.1
86 <?php
87
88 // build comparison array for recently updated blog checking
89 require('lib/class.xml.php');
90 $file = $mysqvars['xml'];
91 $data = implode("",file($file)) or die("could not open XML input file");
92 $obj = new xml($data,"xml");
93 for($i = 0; $i < count($xml["weblogUpdates_weblog"]); $i++) {
94 $updated[] = $xml["weblogUpdates_weblog"][$i]->attributes[0]["url"];
95 }
96 $updated = implode(' ',$updated);
97
98 // displaying the links in the specified number of columns
99
100 for ($c = 0; $c < $mysqvars['columns']; $c++) {
101 print "<p class=\"columns\">\n";
102 $done = $each * $c;
103 for ($l = $done; $l < ($each * ($c + 1)); $l++) {
104 if (isset($links[$l])) {
105 // assign nicer variable names to link components
106 rizwank 1.1 $url = $links[$l]['url'];
107 $extras = $links[$l]['extras'];
108 $title = $links[$l]['title'];
109 $status = $links[$l]['status'];
110 // strip url to it's birthday suit to account for variations i.e. http://gazpachosoup.net vs http://www.gazpachosoup.net
111 $naked = str_replace('http://www.','',$url);
112 $naked = str_replace('http://','',$naked);
113 // check if naked url exists in recently updated list
114 $check = strpos($updated,$naked);
115
116 // depending on whether or not it's recently updated, print it plain or peanut
117 if ($check === false) {
118 // plain - not recently updated
119 //also, check if it's a public or private link and display private in italic
120 if ($status == "0") {
121 print "• <a href=\"$url\" title=\"$extras\"><em>$title</em></a><br />\n";
122 } else {
123 print "• <a href=\"$url\" title=\"$extras\">$title</a><br />\n";
124 }
125 } else {
126 // peanut - recently updated
127 rizwank 1.1 //also, check if it's a public or private link and display private in italic
128 if ($status == "0") {
129 print "<strong>• <a href=\"$url\" title=\"$extras\"><em>$title</em></a></strong><br />\n";
130 } else {
131 print "<strong>• <a href=\"$url\" title=\"$extras\">$title</a></strong><br />\n";
132 }
133 }
134 }
135 }
136 print "</p>\n";
137 }
138
139 mysql_free_result($results);
140
141 ?>
142
143 </div>
144
145
146 </body>
147 </html>
|