<?php


$host = "localhost";
$user = "root";
$db = "portale";
$password = "";

$db2 = "portale2";



$i = 1;
?>
<?php
echo("<body bgcolor=\"#F8F8F8\" topmargin=\"0\" leftmargin=\"0\"><div align=\"center\"><table width=\"70%\" height=\"30\" border=\"0\">");
$connection=mysql_connect($host,$user,$password) or die("non riesco a connettermi al server mysql");
$select_db=mysql_select_db($db,$connection) or die ("Non riesco a selezionare il db");
$query=("SELECT sid, title,time,bodytext,counter FROM nuke_stories WHERE topic=3 and time > '2008-8-1' order by sid desc ");
$result=mysql_query($query);
while ($row = mysql_fetch_array($result)){


echo($row[title] . "</br>");
$testo=$row[bodytext];
$tempo=$row[time];
$quante=$row[counter];

$select_db2=mysql_select_db($db2,$connection) or die ("Non riesco a selezionare il db joomla");

$query2=("insert into 'joomla'.'jos_content' ('id','title','alias','title_alias','introtext','f ulltext','state','sectionid','mask','catid',`creat ed`, `created_by`, `created_by_alias`, `modified`, `modified_by`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `images`, `urls`, `attribs`, `version`, `parentid`, `ordering`, `metakey`, `metadesc`, `access`, `hits`, `metadata`) VALUES ($i,$titolos, $titolo,'','',$testo,'1','1','0',$tempo,'62','0',$ tempo,'0','0','0000-00-00 00:00:00',$tempo,'0000-00-00 00:00:00','','','','1'.'0','1','','','0',$quante,' ')");

$result2=mysql_query($query2);

echo("</br>".$result2."</br>");
$i = $i +1;

echo($i);

}
mysql_close($connection);
?>