Archive for July, 2008

Alert: Oracle Weblogic 0-day

Tuesday, July 29th, 2008

Read the advisory here:

https://support.bea.com/application_content/product_portlets/securityadvisories/2793.html

It appears that without a username and password that a remote user can exploit a buffer overflow in the Weblogic plugin for Apache, potentially exposing confidential information.   Time for everyone to patch their Oracle Weblogic installations!

Adventures in iPhone Land

Sunday, July 27th, 2008

When the iPhone launched last year, I promised myself that I would wait until the 3G version came out before I took the plunge. You see, I use a pda (Palm Pilot TX) on a daily basis for such things as checking email, reading ebooks (a lot), watching the occasional video, tracking todos and maintaining a large list of text files (think ‘memos’ on steroids) Besides the pda, I also carry around a 20GB ipod photo for listening to music and podcasts during my daily commute, which can end up being nearly two hours round trip on very bad days. And of course, I always always always have my cellphone with me no matter what.

So there is a certain logic in yearning for a convergent device that rolls all of the necessary functionality into just one, shiny little object. I wouldn’t need to lug around three different devices (all with separate charging needs, no less) and lighten my load, so to speak. I’ve kept a close eye on the iPhone developments over the past year (including the whole ‘jailbreak’ thing) but after seeing how quickly the new 3G version sold out, I realized it would probably be a few months before I finally got my hands on one.

(more…)

Displaying an HTML table from MySQL data

Wednesday, July 23rd, 2008

Here’s one from the 2003 archives:

Did you know that PHP could interface with a MySQL database? Well it can, and here’s how! The code below illustrates just how easy it is to produce a nice table with headers populated with data culled from a database. One little trick I like to use (and have used for a very long time) when displaying table data is to alternate the background color. This makes it a bit easier to read the data (at least it does for me) Notice that when the table is initialized (<table><tr bgcolor=\”#afafaf\”>), I define the background color. Later as the code iterates through the lines of data, I test to see what the current backgound color is, and then reverse it. Not rocket science, but it spruces things up just a bit. I have been using a heavily modified version of this code in several places, whether it is for displaying log files or pulling intrusion reports from a Snort database and it has worked quite well. Any comments or improvements are always welcome!

<?php
$link = mysql_connect("database_host", "user", "password");

mysql_select_db("database_name", $link);

$qry = mysql_query("SELECT * FROM table_name", $link);
echo <table><tr bgcolor=\"#afafaf\">;
if (mysql_num_rows($qry) > 0) {

for ($i = 0; $i<mysql_num_fields($qry); $i++) {

echo "<td><b>" . mysql_field_name($qry, $i) . "</b></td>";

}

}else{

echo "<td>No entries found in the database</td>";

}
echo "</tr>\n";
if (mysql_num_rows($qry) > 0) {

for ($j = 0; $j<mysql_num_rows($qry); $j++) {

if ($bgcolor == "#ffffff"){

$bgcolor="#cccccc";

}else{

$bgcolor="#ffffff";

}

echo "<tr bgcolor=\"$bgcolor\">";

for ($k = 0; $k<mysql_num_fields($qry); $k++) {

echo "<td>" . mysql_result($qry,$j, $k) . "</td>";

}

echo "</tr>\n";

}

echo "</table>";

}
?>