(file) Return to Copy of func_mysqlinc.php CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / mysqlinks / lib

 1 rizwank 1.1 <?php
 2             //get set
 3             $set = $mysqlinks_path . "config.php";
 4             include($set);
 5             
 6             // get connected
 7             $connect = $mysqlinks_path . "database.php";
 8             include($connect);
 9             
10             ?>
11             <?php
12             
13             	// no security? game's over!	
14             	if ((!$mysqlinks_security) || ($mysqlinks_security != $mysqvars['incpw'])) {
15             		echo "<span style=\"color: red; background: transparent;\">Uh-Oh! <strong>MySQLinks</strong> error: You gave MySQL<em>inc</em> a wrong security code or no security code.</span>\n"; 
16             		exit;
17             	}
18             
19             	// no category? better set one.
20             	if (!$mysqlinks_category) {
21             		$mysqlinks_category = $mysqvars['default_category'];
22 rizwank 1.1 	}
23             	
24             	// no before? better set one.
25             	if (!$mysqlinks_before) {
26             		$mysqlinks_before = "";
27             	}		
28             
29             	// no after? better set one.
30             	if (!$mysqlinks_after) {
31             		$mysqlinks_after = "<br />\n";
32             	}	
33             
34             	// build comparison array for recently updated blog checking
35             	      $classxml = $mysqvars['path'] . "lib/class.xml.php";
36             				require_once($classxml);
37                     $file = $mysqvars['xml'];
38             				$android = file($file) or die("MySQLinc says: couldn't open recently updated list.");
39             				$data = implode("",$android);
40                     $obj = new xml($data,"xml");
41             	     	for($i = 0; $i < count($xml["weblogUpdates_weblog"]); $i++) {
42               			    	$updated[$i] = $xml["weblogUpdates_weblog"][$i]->attributes[0]["url"];
43 rizwank 1.1 	       	}
44                     $updated = implode(' ',$updated);
45             
46             	// grab links from the specified category that are marked public
47               $query = "select * from `$mysqlinks_category` where `status` = '1' order by `title`";
48               $results = mysql_query($query) or die("Invalid query: " . mysql_error());
49               while ($row = mysql_fetch_array($results)) {
50              				$links[] = array('url' => $row[1],'title' => $row[2],'extras' => $row[3], 'status' => $row[4]);
51               }
52             	
53             	// check and display
54             		for ($l = 0; $l < count($links); $l++) {
55             								if (isset($links[$l])) {
56             										// assign nicer variable names to link components	
57             								   			$url = $links[$l]['url'];
58             									 			$extras = $links[$l]['extras'];
59             								   			$title = $links[$l]['title'];
60             								   			$status = $links[$l]['status'];
61             										// strip url to it's birthday suit to account for variations i.e. http://gazpachosoup.net vs http://www.gazpachosoup.net
62             									 			$naked = str_replace('http://www.','',$url);
63             							     			$naked = str_replace('http://','',$naked);
64 rizwank 1.1 										// check if naked url exists in recently updated list
65             					        			$check = strpos($updated,$naked);
66             												
67             								// depending on whether or not it's recently updated, print it plain or peanut										
68             									   if ($check === false) {
69             										 		// plain - not recently updated
70             												print "$mysqlinks_before<a href=\"$url\" title=\"$extras\">$title</a>$mysqlinks_after";
71                   			  			} else {
72             												// peanut - recently updated
73             												print "$mysqlinks_before<a href=\"$url\" title=\"$extras\" class=\"updated\">$title</a>$mysqlinks_after";											
74             			        			}
75             							}
76             					}
77             					
78             					print "<br />";
79             					
80             					print "<a href=\"http://freebies.wiccked.com/mysqlinks/\"><img src=\"" . $mysqvars['url'] . "mysqlinks_button.png\" alt=\"powered by MySQLinks\" title=\"powered by MySQLinks\" width=\"80\" height=\"15\" border=\"0\" /></a>";
81             
82             
83             ?>

Rizwan Kassim
Powered by
ViewCVS 0.9.2