#!/usr/bin/perl -w

use strict;
use DBI;

#################################################
# Edit the following values:

# Set this next value to zero or this won't work.
my $lame = 0;

# Joomla/Mambo information
my $db_joom			= 'damogne_mambo';
my $host_joom		= 'damog.net';
my $user_joom		= 'damogne_damog';
my $passwd_joom 	= 'damog';
my $preffix_joom	= '';

# WordPress information
my $db_wp			= 'damogne_wordpress';
my $host_wp			= 'damog.net';
my $user_wp			= 'damogne_damog';
my $passwd_wp		= 'damog';
my $preffix_wp		= '';

#################################################

### DO NOT EDIT ANYTHING AFTER THIS LINE OR BURN IN HELL

## Some fun :)
die("You are too lame to use this script: Edit it.\n") if $lame;

## Firing Joomla connection
print "Making the Joomla/Mambo connection first... ";
my $joomla = DBI->connect("DBI:mysql:database=$db_joom;host=$host_joom", $user_joom, $passwd_joom)
	or die "Couldn't connect to Joomla/Mambo database: " . DBI->errstr;
print "[OK!]\n" if $joomla;

## Now the WordPress connection
print "Making the WordPress connection now... ";
my $wordpress = DBI->connect("DBI:mysql:database=$db_wp;host=$host_wp", $user_wp, $passwd_wp)
	or die "Couldn't connect to WordPress database: " . DBI->errstr;
print "[OK!]\n" if $wordpress;

print "Querying the Joomla/Mambo database...\n";

my $query = "SELECT id, title, introtext, created FROM ".$preffix_joom."content";

my $sth = $joomla->prepare($query);
$sth->execute();
while(my $ref = $sth->fetchrow_hashref()) {
	print "Found: id = $ref->{'id'}, title = ".$ref->{'title'}.", created = ".$ref->{'created'}."\n";
}

$sth->finish();

$joomla->disconnect();
$wordpress->disconnect();

	
	
