"; if (! $selected_language) $selected_language="en"; // select a language // get the exchange rate from the database $dbh=mysql_connect($host, $user, $password); $res=mysql_db_query($database, "select currency, rate, $selected_language from currency order by currency"); // do we have a selected currency? By reading cookie or by click if (! $currency_selected && $HTTP_COOKIE_VARS["cookiecurrency"]) $currency_selected=$HTTP_COOKIE_VARS["cookiecurrency"]; // my own URL, to call myself back after selecting currency $this_uri="http://$SERVER_NAME$REQUEST_URI"; $this_uri=preg_replace("/(\?|\&)currency_selected=[A-Z]{3}/", "", $this_uri); if (preg_match("/\?/", $this_uri)) { $this_uri.="¤cy_selected="; } else { $this_uri.="?currency_selected="; } $i=0; $currency_menu="\n"; // build the menu and save the rates in the varialble cuurency_rate while ($line=mysql_fetch_row($res)) { $currency[$i]=$line[0]; $currency_rate[$currency[$i]]=$line[1]; $text[$i]=$line[2]; $currency_menu.="