query("
select
id
from
toolovi
where
ime = \"kursnalista\"
");
//and kategorije like '%".PAGEID."%'
if (mysql_num_rows($db->rs) != 0) {
$valute = array(
"EUR" => "Euro",
"AUD" => "Australijski Dolar",
"CAD" => "Kanadski Dolar",
"CHF" => "[SH]vajcarski Franak",
"GBP" => "Britanska Funta",
"USD" => "Ameri[ch]ki Dolar"
);
$odnosi = array(
"EUR" => "1",
"AUD" => "1",
"CAD" => "1",
"CHF" => "1",
"GBP" => "1",
"USD" => "1",
);
$db->query("
select
eur, aud, cad, chf, gbp, usd
from
kursnalista
where datum = NOW()
");
if (mysql_num_rows($db->rs) != 0) {
$row = mysql_fetch_object($db->rs);
$eur = $row->eur;
$aud = $row->aud;
$chf = $row->chf;
$gbp = $row->gbp;
$usd = $row->usd;
}
else
{
ini_set('user_agent', 'Mozilla Firefox');
$datum=date("d.m").".20".date("y");
$dp='http://www.nbs.yu/internet/latinica/scripts/kl.html?datum=';
$dp.=$datum.'&broj=br.&godina=2006&vrsta=1&eksport=html&:langkl:';
$sp = file_get_contents($dp);
$adresa=$sp;
if (!$dp)
{
$db->query("
select
eur, aud, cad, chf, gbp, usd
from
kursnalista
order by
datum desc
limit 1
");
$row = mysql_fetch_object($db->rs);
$eur = $row->eur;
$aud = $row->aud;
$cad = $row->cad;
$chf = $row->chf;
$gbp = $row->gbp;
$usd = $row->usd;
}
else
{
//EUR
$na1='EUR';
$n1=strpos ( $adresa, $na1);
$nadresa=''; $eurk='';$eurp='';$eur='';
for ($i = $n1+87; $i <= $n1+92; $i++) {
$eurk.=$adresa{$i};}
for ($i = $n1+135; $i <= $n1+140; $i++) {
$eur.=$adresa{$i};}
for ($i = $n1+183; $i <= $n1+188; $i++) {
$eurp.=$adresa{$i};}
// USD
$na1='USD';
$n1=strpos ( $adresa, $na1);
$usdk='';$usdp='';$usd='';
for ($i = $n1+87; $i <= $n1+92; $i++) {
$usdk.=$adresa{$i};}
for ($i = $n1+135; $i <= $n1+140; $i++) {
$usd.=$adresa{$i};}
for ($i = $n1+183; $i <= $n1+188; $i++) {
$usdp.=$adresa{$i};}
//CHF
$na1='CHF';
$n1=strpos ( $adresa, $na1);
$nadresa=''; $chkk='';$chf='';$chfp='';
for ($i = $n1+87; $i <= $n1+92; $i++) {
$chfk.=$adresa{$i};}
for ($i = $n1+135; $i <= $n1+140; $i++) {
$chf.=$adresa{$i};}
for ($i = $n1+183; $i <= $n1+188; $i++) {
$chfp.=$adresa{$i};}
//AUD
$na1='AUD';
$n1=strpos ( $adresa, $na1);
$nadresa=''; $audk='';$aud='';$audp='';
for ($i = $n1+87; $i <= $n1+92; $i++) {
$audk.=$adresa{$i};}
for ($i = $n1+135; $i <= $n1+140; $i++) {
$aud.=$adresa{$i};}
for ($i = $n1+183; $i <= $n1+188; $i++) {
$audp.=$adresa{$i};}
// GBP
$na1='GBP';
$n1=strpos ( $adresa, $na1);
$nadresa=''; $gbpk='';$gbp='';$gbpp='';
for ($i = $n1+87; $i <= $n1+92; $i++) {
$gbpk.=$adresa{$i};}
for ($i = $n1+136; $i <= $n1+141; $i++) {
$gbp.=$adresa{$i};}
for ($i = $n1+185; $i <= $n1+190; $i++) {
$gbpp.=$adresa{$i};}
// CAD
$na1='CAD';
$n1=strpos ( $adresa, $na1);
$cadk='';$cadp='';$cad='';
for ($i = $n1+87; $i <= $n1+92; $i++) {
$cadk.=$adresa{$i};}
for ($i = $n1+135; $i <= $n1+140; $i++) {
$cad.=$adresa{$i};}
for ($i = $n1+183; $i <= $n1+188; $i++) {
$cadp.=$adresa{$i};}
}
$eur=80.684;
$aud=48.543;
$chf=52.094;
$cad=49.993;
$gbp=118.82;
$usd=60.587;
$db->query("
insert into
kursnalista
(
id, datum, eur, aud, cad, chf, gbp, usd
)
values
(
NULL,\"".date("Y-n-j")."\", ".$eur.", ".$aud.", ".$cad.",".$chf.", ".$gbp.", ".$usd."
)
");
}
?>
Kursna lista
|
|
Din.
|
|
Din.
|
|
Din.
|
|
Din.
|
|
Din.
|
|
Din.
|
|
>
=