function translitIt($str)
{
$tr = array(
""=>"a","b=>"b","¢=>"v","â=>"g",
"Ģ=>"d","Ţ=>"e","Ƣ=>"j","Ǣ=>"z","Ȣ=>"i",
"ɢ=>"y","ʢ=>"k","ˢ=>"l","̢=>"m","͢=>"n",
"=>"o","Ϣ=>"p","Т=>"r","Ѣ=>"s","Ң=>"t",
"Ӣ=>"u","Ԣ=>"f","բ=>"h","֢=>"ts","ע=>"ch",
"آ=>"sh","٢=>"sch","ڢ=>"","ۢ=>"yi","ܢ=>"",
"ݢ=>"e","ޢ=>"yu","ߢ=>"ya","ࢽ>"a","ᢽ>"b",
"⢽>"v","㢽>"g","䢽>"d","墽>"e","梽>"j",
"碽>"z","袽>"i","颽>"y","ꢽ>"k","뢽>"l",
"좽>"m",">"n",">"o",">"p","ࢽ>"r",
"ᢽ>"s","⢽>"t","㢽>"u","䢽>"f","墽>"h",
"梽>"ts","碽>"ch","袽>"sh","颽>"sch","ꢽ>"y",
"뢽>"yi","좽>"",">"e",">"yu",">"ya",
" "=> "-", "."=> "", "/"=> "-"
);
return strtr($str,$tr);
}
if (preg_match('/[^A-Za-z0-9_\-]/', $urlstr)) {
$urlstr = translitIt($urlstr);
$urlstr = preg_replace('/[^A-Za-z0-9_\-]/', '', $urlstr);
}
$db=mysql_connect ("localhost","root","");
mysql_select_db ("111",$db);
$sql="select * from 111 where `usedin`='' limit 1";
$res=mysql_query($sql) or die (mysql_error());
$row=mysql_fetch_array($res);
$sql="update 111 set usedin='111' where id='$row[id]'";
$res1=mysql_query($sql) or die (mysql_error());
var_dump ($row);
if ($row["category"]=='1')
$catid=45;
if ($row["category"]=='2')
$catid=46;
if ($row["category"]=='3')
$catid=47;
if ($row["category"]=='4')
$catid=48;
if ($row["category"]=='5')
$catid=49;
$db=mysql_connect ("111","111","111");
mysql_select_db ("111",$db);
$sql="insert into jos_content set
title='".mysql_real_escape_string ($row[title])."',
alias='".mysql_real_escape_string (translitIt($row[title]))."',
`introtext`='".mysql_real_escape_string ($row[body])."',
`fulltext`='".mysql_real_escape_string ($row[body])."',
state=1,
sectionid=1,
mask=0,
catid='$catid',
created='".date("Y-m-d H:i:s")."',
created_by=62,
modified='".date("Y-m-d H:i:s")."',
modified_by=62,
publish_up='".date("Y-m-d H:i:s")."',
version=1,
parentid=0,
ordering=1";
$res=mysql_query($sql) or die (mysql_error());