"); _e("Invalid Directory"); print ("

"); } } function metakis_conf() { global $wpdb, $table_prefix; if ($_POST['DownloadDatabase']) { if(reloadDatabase()) { set_metakis_option('database_created', 1); } } if ($_POST['SaveWhite']){ metakis_save_white(); } if ($_POST['UpdateTMPDir']) { metakis_update_tempdir(); } $dzaspam_options = get_option('dzaspam_options'); if (!$dzaspam_options) { $myTmp = ini_get('session.save_path'); if (!$myTmp) $myTmp = '/tmp/'; set_metakis_option('temp_dir', $myTmp); $dzaspam_options = get_option('dzaspam_options'); } ?>

For example ../tmp/ (tmp dir is subdir of the main public html directory)

">
get_results($sql); if ($ok) { ?>

">
".$msg."

"); return 0; } function reloadDatabase() { /* downloading and ungzipping bazed on free script at software77.net probably by Georg Jordt there is no copyright or author file with the original .php */ global $wpdb, $table_prefix; $dzaspam_options = get_option('dzaspam_options'); if ($dzaspam_options && $dzaspam_options['temp_dir']) { $tmpDir = $dzaspam_options['temp_dir']; } else { $tmpDir = ini_get('upload_tmp_dir'); if (!$tmpDir) $tmpDir = '/tmp/'; } if (!is_writable($tmpDir) || !($file2 = @fopen ($tmpDir."IpToCountry.csv","w"))) { return metakis_dienice(__("Unable to create temp file in dir $tmpDir")); } if (!($file1 = @fopen("compress.zlib://http://software77.net/cgi-bin/ip-country/geo-ip.pl?action=download", "r"))) { return metakis_dienice(__('Unable to download database or compress.zlib not installed.')); } $tofind = array("\"", "\n"); $toreplace = array("", ""); while (!gzeof($file1)) { $buffer = gzgets($file1, 4096); $pos = strpos($buffer, '#'); if ($pos === false) { $buffer = str_replace($tofind, $toreplace, $buffer); if ($buffer != "") { $data = explode(",", $buffer); $line = "\"" . $data[0] . "\",\"" . $data[1] . "\",\"" . $data[5] . "\"\r\n"; fwrite($file2, $line); } } } gzclose($file1); fclose($file2); $sql = "CREATE TABLE IF NOT EXISTS ".$table_prefix."iptocountry (start_ip int(4) unsigned, end_ip int(4) unsigned, country char(3))"; $wpdb->query($sql); $sql = "TRUNCATE TABLE ".$table_prefix."iptocountry"; $wpdb->query($sql); $file = fopen($tmpDir."/IpToCountry.csv", "r"); while ( $line = fgets($file, 1024) ) { $ar = explode(",",$line); if (3 == count($ar)) { $sql = "INSERT INTO ".$table_prefix."iptocountry (start_ip, end_ip, country) VALUES ('". substr( $ar[0], 1, -1 ) ."','". substr( $ar[1], 1, -1 ) ."', '". substr( $ar[2], 1, -1 ) ."' )"; $wpdb->query($sql); } } unlink($tmpDir."/IpToCountry.csv"); // Creating indexes on table iptocountry $sql = "SHOW INDEXES FROM ".$table_prefix."iptocountry"; $ok = $wpdb->get_results($sql); if (!$ok) { $sql = "create index ix_s on ".$table_prefix."iptocountry (start_ip)"; $wpdb->query($sql); $sql = "create index ix_e on ".$table_prefix."iptocountry (end_ip)"; $wpdb->query($sql); $sql = "create index ix_c on ".$table_prefix."iptocountry (country)"; $wpdb->query($sql); } return 1; } function set_metakis_option($optname = '', $optvalue) { if ($optname) { $dzaspam_options = get_option('dzaspam_options'); if (!is_array($dzaspam_options)) { $dzaspam_options = array ( 'database_created' => 0, 'temp_dir' => '/tmp/', 'whitelist_countries' => array(), 'blackwords' => array() ); } $dzaspam_options[$optname]=$optvalue; update_option('dzaspam_options', $dzaspam_options); } } function metakis_show_whereami() { global $wpdb, $table_prefix; $sql = "select country from ".$table_prefix."iptocountry where inet_aton('".$_SERVER['REMOTE_ADDR']."') between start_ip and end_ip"; $results=$wpdb->get_results($sql); if ($results) { ?>
country; } ?>
get_results($sql); if (!$results) { if ($possible_spambot) { die(__('You are matching some of our anti-spam criteria. If you are a human, try to contact me at 30194509.')); //$approved = 'spam'; //It is possible to add this in spam list of akismet } else $approved = 0; } } // } return $approved; } function dzaspam_blackwords_form() { if ($_POST['SaveBlackWord']) { $BlackWord = str_replace(array("|", "'"), "", $_POST['AddBlackWord']); $dzaspam_options=get_option('dzaspam_options'); $arnewbw=split("[\r\n]{1,2}",str_replace(array("|", "'"), "", $_POST['delblw'])); set_metakis_option('blackwords', $arnewbw); } ?>

regular expressions :-) "); ?>

">