function convert_datetime($datestamp, $format) { if ($datestamp!=0) { list($date, $time)=split(" ", $datestamp); list($year, $month, $day)=split("-", $date); list($hour, $minute, $second)=split(":", $time); $stampeddate = mktime($hour,$minute,$second,$month,$day,$year); $datestamp = date($format,$stampeddate); return $datestamp; } } $data = mktime (date("H"),date("i"),date("s"), date("m"), date("d"), date("Y")); $data = date ("Y-m-d H:i:s", $data); $data = convert_datetime($data, "l"); if (!preg_match ("/Sunday/", $data)){ if (!preg_match ("/Saturday/", $data)){ function bnr(){ $file = file ("http://www.bnro.ro/Ro/Info/", "r"); $tmp = TRUE; for ($i=0; $i if (strstr ($file[$i], '')) if ($tmp) { $dolar = substr ($file[$i], 18, 6); $tmp = FALSE; } else { $euro = substr ($file[$i], 18, 6); break; } $ret = array ($dolar, $euro); return $ret; } $valuta = bnr(); $dolar = str_replace(" ","",$valuta[0]); $euro = str_replace(" ","",$valuta[1]); $db = mysql_connect($host, $utilizator,$parola); mysql_select_db($bazadate,$db); $del_val_curs = "DELETE FROM curs_valutar where dataV < DATE_ADD(NOW(), INTERVAL -31 DAY)"; mysql_query($del_val_curs); $val_curs = "INSERT INTO curs_valutar (usd,eur,dataV) VALUES ('$dolar','$euro',NOW())"; $result = mysql_query($val_curs); } } ?> old : http://www.bnro.ro/Ro/Info/ new: http://www.bnro.ro/nbrfxrates.xml i need to modify this to extract the curency and export to a data base then extract from the database and show on the website
Damn and I was thinking I opened the php forum by accident. Two queries within a lot of lines PHP( phucked Home Pages) language. Shouldn't this be in the php forum?