} ?> " required="required" /> </p> <input type="submit" value="Hinzufügen"> <?php if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["country"]) && isset($_POST["abbreviation"])) { //global $country, $abbreviation; $country = filterfunktion($_POST["country"]); $abbreviation = filterfunktion($_POST["abbreviation"]); if (preg_match("/^[a-zA-Z ]*\$/", $abbreviation) && preg_match("/^[a-zA-Z ]*\$/", $country)) { if ($_POST["country"] != "" && $_POST["abbreviation"] != "") { try { addCountry($abbreviation, $country); } catch (Exception $e) { echo "Fehler beim Datenbankzugriff. Bitte dem Administrator Bescheid geben."; } } } else { $countryErr = "Bitte nur Buchstaben und Leerzeichen verwenden."; echo $countryErr; } } ?> </form> </div> <!-- DELETE PRODUCT --> <div class="columns five">
function loadCountryCSVToTable($connection) { //Open the csv $file_handle = fopen("countries.csv", "r"); //While there are lines add the country to tblCountries while (!feof($file_handle)) { $line_of_text = fgetcsv($file_handle, 1024); addCountry($line_of_text[0], $line_of_text[1], $line_of_text[2], $line_of_text[3], $connection); } //close the csv fclose($file_handle); }
function globetype() { listCountry(); echo "<br>"; addCountry(); }
/** * @author Sebastien Piraux <*****@*****.**> * @desc uses $TABLETRACK_OPEN to split recorded information, to count occurences (for os, provider,...) and to increment the number of occurrences of each different element into the corresponding tables */ function decodeOpenInfos() { global $TABLETRACK_OPEN; // record initial value of ignore_user_abort $ignore = ignore_user_abort(); // prevent script from being stopped while executing, the following can be considered // as a transaction ignore_user_abort(1) ; // we take the last event id to prevent miss of some recorded event // only processed record have to be cleaned $sql = "SELECT open_id FROM $TABLETRACK_OPEN WHERE open_date <= NOW() ORDER BY open_id DESC LIMIT 1"; //$processBegin = getOneResult($sql); $query = Database::query($sql); $res = @Database::fetch_array($query); $processBegin = $res[0]; // process //--Providers And Countries-------------------------------------------// $sql = "SELECT open_remote_host FROM $TABLETRACK_OPEN WHERE open_remote_host != '' AND open_id <= '".$processBegin."' "; $query = Database::query($sql); if(Database::num_rows($query) != 0) { // load list of countries $list_countries = loadCountries(); while ($row = Database::fetch_row ($query)) { $remote_host = $row[0]; /*****Provider*****/ //extract provider $provider = extractProvider( $remote_host ); // add or increment provider in the providers array $providers_array = addProvider( $provider,$providers_array ); /*****Countries*****/ // extract country $country = extractCountry( $remote_host, $list_countries ); // increment country in the countries table $countries_array = addCountry( $country, $countries_array ); } // update tables fillProvidersTable( $providers_array ); fillCountriesTable( $countries_array ); } // provider and countries done //--Browsers and OS---------------------------------------------------// $sql = "SELECT open_agent FROM $TABLETRACK_OPEN WHERE open_remote_host != '' AND open_id <= '".$processBegin."' "; $query =Database::query( $sql ); if(Database::num_rows($query) != 0) { // load lists // of browsers $list_browsers = loadBrowsers(); // of OS $list_os = loadOs(); while ($row = Database::fetch_row ($query)) { $agent = $row[0]; /*****Browser and OS*****/ // extract browser and OS list( $browser,$os ) = split( "[|]",extractAgent( $agent , $list_browsers , $list_os ) ); // increment browser and OS in the corresponding arrays $browsers_array = addBrowser( $browser , $browsers_array ); $os_array = addOs( $os , $os_array ); } fillBrowsersTable( $browsers_array ); fillOsTable( $os_array ); } // browsers and OS done //--Referers----------------------------------------------------------// $sql = "SELECT open_referer FROM $TABLETRACK_OPEN WHERE open_referer != '' AND open_id <= '".$processBegin."' "; $query = Database::query( $sql ); if(Database::num_rows($query) != 0) { $i=0; while ($row = Database::fetch_row ($query)) { $ref = $row[0]; $referers_array = addReferer( $ref , $referers_array ); } fillReferersTable( $referers_array ); } // referers done //-------------------------------------------------------------------// // end of process // cleaning of $TABLETRACK_OPEN table cleanProcessedRecords($processBegin); // reset to the initial value ignore_user_abort($ignore); }