1) ; if (($errstr = SaveConfig($configFileName, $tmpcfg)) || ($errstr = (@include $configFileName) ? '' : "Can not include $configFileName")) { echo $errstr ; exit ; } } if (isset($hCfg) && !isset($cfgPars)) $cfgPars = $hCfg ; # compatibility with the version 1.00 $cfgPars['InstallDir'] = $installDir ; # Get the urls $cfgPars = $cfgPars + Urls(); $cfgPars['ProgNameHtml'] = 'asRep MySQL Version '. MYVERSION .' Administration' ; # Get the cgi inputs $cgiPars = getInputs(); # Check for the admin name if (!strlen($cfgPars['AdminName']) || !strlen($cfgPars['AdminPassEnc'])) { if (isset($cgiPars['state']) && $cgiPars['state'] == 'adminname') { $errstr = SaveAdminName($configFileName, $cfgPars, $cgiPars) ; $errstr ? DispAdminName($cfgPars, $errstr) : header("Location: $cfgPars[Url]") ; }else { DispAdminName($cfgPars, '') ; } exit ; } # verify the user if(!VerifyUserLogin($cfgPars, $cgiPars)) exit() ; # Test mysql connection $dbh = DBConnect($cfgPars['DbHost'], $cfgPars['DbPort'], $cfgPars['DbUser'], $cfgPars['DbPass'], true) ; if (!$dbh || !DBSelect($dbh, $cfgPars['DbName'], true)) { if (isset($cgiPars['state']) && $cgiPars['state'] == 'dbsettings') { $errstr = SaveDBSettings($configFileName, $cfgPars, $cgiPars) ; strlen($errstr) ? DispDBSettings($cfgPars, $errstr) : header("Location: $cfgPars[Url]") ; }else { DispDBSettings($cfgPars, mysql_error()) ; } exit ; } # Create tables if (empty($cgiPars['VersionUpgrade'])){ list ($tables) = DBQueryInArrays($dbh, "SHOW TABLES"); $tfields = TableFields() ; while (list($k,$v) = each($cfgPars['Tbl'])) { $isin = in_array($v, $tables) ; if (!$isin) { $isin = in_array(strtolower($v), $tables) ; if (!$isin) DBQuery($dbh, "CREATE TABLE $v ($tfields[$k])") ; } } } # Version upgrade if ($cfgPars['Version'] < MYVERSION) { if ($cfgPars['Version'] == '1.25'){ $errstr = version125Upgrade($dbh, $configFileName, $cfgPars, $cgiPars) ; }elseif ($cfgPars['Version'] == '1.30'){ $errstr = version130Upgrade($dbh, $configFileName, $cfgPars, $cgiPars) ; }else{ $errstr = "This version of asRep (v." . MYVERSION . ") is not compatible with your version (v." . $cfgPars['Version'] . ")" . "

Still you can make a fresh installation by deleting the 'settings.php' file from the install directory.". " However this will forget your current tracking data since it will open new database tables." . "

To upgrade your data tables also, you need a previous version of asRep." . " For this, please contact us via" . " this form.". " Do not forget to mention your registration key, your current version number and your script type (PHP or Perl)" ; } if (strlen($errstr)) { echo ($errstr) ; }else{ $url = SelfUrl($cfgPars, $cgiPars) ; header("Location: $url") ; } exit ; } # do tasks $errorstr = '' ; if(!isset($cgiPars['state'])) $cgiPars['state']='' ; if (empty($cgiPars['state']) || $cgiPars['state'] == 'login') DispSetup($cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'dbBackup') $errorstr = DbBackup($dbh, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'dbRestore') $errorstr = DbRestore($dbh, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'dbRepair') $errorstr = DbRepair($dbh, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'dbOptimize') $errorstr = DbOptimize($dbh, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'timezone') $errorstr = SaveTimeZone($configFileName, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'email') $errorstr = SaveEmail($configFileName, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'ipcc' && $cgiPars['update']) $errorstr = GetIpCc($dbh, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'mapip2cc') $errorstr = MapIp2Cc($dbh, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'cnotify') $errorstr = SaveClickNotify($configFileName, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'blockIPrange') $errorstr = SaveBlockedIPs($configFileName, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'regkey') $errorstr = SaveRegKey($configFileName, $cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'dbmaintenance' || $cgiPars['state'] == 'dbBackup' || $cgiPars['state'] == 'dbRestore' || $cgiPars['state'] == 'dbRepair' || $cgiPars['state'] == 'dbOptimize') DispDbMaintenance($dbh, $cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'vtimezone' || $cgiPars['state'] == 'timezone') DispTimeZone($cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'vemail' || $cgiPars['state'] == 'email') DispEmail($cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'vipcc' || $cgiPars['state'] == 'ipcc' || $cgiPars['state'] == 'mapip2cc') DispIp2Country($cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'vcnotify' || $cgiPars['state'] == 'cnotify') DispClickNotify($cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'vtrackcode' || $cgiPars['state'] == 'trackcode') DispTrackCode($cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'vblocktracking' || $cgiPars['state'] == 'blockIPrange' || $cgiPars['state'] == 'blocksetcookie' || $cgiPars['state'] == 'blockdelcookie') DispBlockTracking($cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'vupdate' || $cgiPars['state'] == 'regkey') DispUpdate($cfgPars, $cgiPars, $errorstr) ; if ($cgiPars['state'] == 'update') DispDownloadUpdates($cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'fview') DispFileView($cfgPars, $cgiPars); if ($cgiPars['state'] == 'factivate') DispFileAct($cfgPars, $cgiPars) ; if ($cgiPars['state'] == 'vlogout') Logout($cfgPars); mysql_close($dbh) ; ###################################################### function SelfUrl(&$cfg, &$pars){ $url = $cfg['Url'] ; $sep = '?' ; foreach ($pars as $k => $v){ $url .= $sep . $k . '=' . urlencode($v) ; $sep = '&' ; } return $url ; } #--------- Escape the string for single quotation mark -------------- function Esc ($str){ return addcslashes($str, '\'\\') ; } ###################################################### #--------- Table fields -------------- function TableFields() { return array( 'Logs' => ' vTime INT UNSIGNED NOT NULL' . ', Id TINYINT UNSIGNED NOT NULL' . ', cTime TINYINT UNSIGNED NOT NULL' . ', auInfo1 TINYINT UNSIGNED NOT NULL' . ', auInfo2 TINYINT UNSIGNED NOT NULL' . ', Ip INT UNSIGNED NOT NULL' . ', cCode CHAR(2) BINARY NOT NULL' . ', piId INT UNSIGNED NOT NULL' . ', rpagId INT UNSIGNED NOT NULL' . ', adId INT UNSIGNED NOT NULL' . ', PRIMARY KEY (vTime, Id)' , 'PageInfo' => 'Id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' . ', pagId INT UNSIGNED NOT NULL' . ', domId SMALLINT UNSIGNED NOT NULL' . ', asId0 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0' . ', asId1 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0' . ', asId2 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0' . ', asId3 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0' . # for Ad Link ', wsChId0 SMALLINT UNSIGNED NOT NULL DEFAULT 0' . ', wsChId1 SMALLINT UNSIGNED NOT NULL DEFAULT 0' . ', INDEX (pagId)' , 'Domains' => 'Id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' . ', FP SMALLINT UNSIGNED NOT NULL' . ', Value VARCHAR(255) NOT NULL' . ', INDEX (FP)' , 'Pages' => 'Id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' . ', FP SMALLINT UNSIGNED NOT NULL' . ', Value BLOB NOT NULL' . ', INDEX (FP)' , 'Dirs' => ' pagId INT UNSIGNED NOT NULL' . ', offset TINYINT UNSIGNED NOT NULL' . ', leaf CHAR(0)' . ', INDEX (pagId)' , 'AdSense' => 'Id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' . ', FP SMALLINT UNSIGNED NOT NULL' . ', chId SMALLINT UNSIGNED NOT NULL' . ', format CHAR(16) NOT NULL' . ', fb CHAR(1) NOT NULL' . ', color_bg CHAR(6) NOT NULL' . ', color_text CHAR(6) NOT NULL' . ', color_link CHAR(6) NOT NULL' . ', color_url CHAR(6) NOT NULL' . ', color_border CHAR(6) NOT NULL' . ', color_line CHAR(6) NOT NULL' . ', INDEX (FP)' , 'Channels' => 'Id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' . ', ws CHAR(0) DEFAULT NULL' . ', channel CHAR(12) NOT NULL' . ', name CHAR(32) NOT NULL' . ', INDEX (channel)', 'rDomains' => 'Id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' . ', FP SMALLINT UNSIGNED NOT NULL' . ', Value VARCHAR(255) NOT NULL' . ', INDEX (FP)' , 'rPages' => 'Id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' . ', rdomId MEDIUMINT UNSIGNED NOT NULL' . ', FP SMALLINT UNSIGNED NOT NULL' . ', Value BLOB NOT NULL' . ', INDEX (FP)' , 'AdUrls' => 'Id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' . ', FP SMALLINT UNSIGNED NOT NULL' . ', Value VARCHAR(255) NOT NULL' . ', INDEX (FP)' , 'IpRangeNames' => 'Code CHAR(2) BINARY NOT NULL PRIMARY KEY' . ', Name VARCHAR(64) NOT NULL' , 'IpRanges' => 'Type TINYINT UNSIGNED NOT NULL' . ', Code CHAR(2) BINARY NOT NULL' . ', IpSeg SMALLINT UNSIGNED NOT NULL' . ', StartIp INT UNSIGNED NOT NULL' . ', EndIp INT UNSIGNED NOT NULL' . ', INDEX (IpSeg)' , ) ; } #--------- version upgrade tasks -------------- function vuRedir(&$cfg, &$pars) { if (empty($pars['VersionUpgrade'])) { $pars['VersionUpgrade'] = 0; if ($filedesc = @fopen(FullPath("vustep.txt", $cfg['InstallDir']), 'rb')) { $pars['VersionUpgrade'] = 0+fread($filedesc,1024) ; fclose($filedesc) ; } $pars['VersionUpgrade']++ ; $url = SelfUrl($cfg, $pars) ; echo "" . "asRep is going to start a database upgrade procedure (from v.".$cfg['Version']." to v.".MYVERSION.").
" . "This may take several minutes.
" . "

Please do NOT interrupt the upgrade process since it may cause loss of data." . "

If this task fails (displays an error), " . "please note the URL in the browser's address bar and contact www.asrep.com for assistance." . "

Click here once to start the database upgrade.
" . "" ; }elseif ($pars['VersionUpgrade'] == 'end') { $fname = FullPath("vustep.txt", $cfg['InstallDir']) ; if (file_exists($fname)) unlink($fname) ; }else{ if ($filedesc = @fopen(FullPath("vustep.txt", $cfg['InstallDir']), 'wb')) { fwrite($filedesc, $pars['VersionUpgrade']) ; fclose($filedesc) ; } $pars['VersionUpgrade']++; $url = SelfUrl($cfg, $pars) ; echo "" . "". "" . "asRep database upgrade is in progress.
" . "Finished task# " . ($pars['VersionUpgrade']-1) . ".
" . "Requesting task# " . $pars['VersionUpgrade'] . ".
" . "

Some tasks may take long time to complete. Please do not interrupt the upgrade process since it may cause loss of data." . "

If this task fails (displays an error), " . "please note the URL in the browser's address bar and contact www.asrep.com for assistance." . "" ; } } #--------- version upgrade tasks -------------- function version125Upgrade($dbh, $fname, $ocfg, &$pars) { eval(getConfigStr($ocfg)) ; $ncfg = $cfgPars ; $tfields = TableFields() ; if (empty($pars['VersionUpgrade'])) { vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 1){ # change name of the db tables. DBQuery($dbh, "REPAIR TABLE" . " {$ocfg['Tbl']['Logs']}" . ", {$ocfg['Tbl']['PageInfo']}" . ", {$ocfg['Tbl']['Domains']}" . ", {$ocfg['Tbl']['Pages']}" . ", {$ocfg['Tbl']['Dirs']}" . ", {$ocfg['Tbl']['rDomains']}" . ", {$ocfg['Tbl']['rPages']}" . ", {$ocfg['Tbl']['AdUrls']}" . ", {$ocfg['Tbl']['AdSense']}" . ", {$ocfg['Tbl']['ChannelDef']}" . ", {$ocfg['Tbl']['IpRangeNames']}" . ", {$ocfg['Tbl']['IpRanges']}" ) ; DBQuery($dbh, "RENAME TABLE" . " {$ocfg['Tbl']['Logs']} TO {$ncfg['Tbl']['Logs']}" . ", {$ocfg['Tbl']['PageInfo']} TO {$ncfg['Tbl']['PageInfo']}" . ", {$ocfg['Tbl']['Domains']} TO {$ncfg['Tbl']['Domains']}" . ", {$ocfg['Tbl']['Pages']} TO {$ncfg['Tbl']['Pages']}" . ", {$ocfg['Tbl']['Dirs']} TO {$ncfg['Tbl']['Dirs']}" . ", {$ocfg['Tbl']['rDomains']} TO {$ncfg['Tbl']['rDomains']}" . ", {$ocfg['Tbl']['rPages']} TO {$ncfg['Tbl']['rPages']}" . ", {$ocfg['Tbl']['AdUrls']} TO {$ncfg['Tbl']['AdUrls']}" . ", {$ocfg['Tbl']['AdSense']} TO {$ncfg['Tbl']['AdSense']}" . ", {$ocfg['Tbl']['ChannelDef']} TO {$ncfg['Tbl']['Channels']}" . ", {$ocfg['Tbl']['IpRangeNames']} TO {$ncfg['Tbl']['IpRangeNames']}" # ", {$ocfg['Tbl']['IpRanges']} TO {$ncfg['Tbl']['IpRanges']}" ) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['Logs']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['PageInfo']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['Domains']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['Pages']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['Dirs']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['rDomains']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['rPages']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['AdUrls']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['AdSense']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['ChannelDef']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['IpRangeNames']}", true) ; # DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['IpRanges']}", true) ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 2){ # Change The Channels table DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['Channels']} DROP PRIMARY KEY") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['Channels']} ADD Id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['Channels']} ADD ws CHAR(0) DEFAULT NULL") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['Channels']} ADD INDEX (channel)") ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 3){ # Insert the channels into Channels table from AdSense table $sth = DBQuery($dbh, "SELECT ast.channel" . " FROM {$ncfg['Tbl']['AdSense']} AS ast LEFT JOIN {$ncfg['Tbl']['Channels']} AS cdt ON ast.channel=cdt.channel" . " WHERE ISNULL(cdt.channel)>0" . " GROUP BY ast.channel") ; while($rec_r = mysql_fetch_row($sth)) { DBQuery($dbh, "INSERT INTO {$ncfg['Tbl']['Channels']} (Id,ws,channel,name) VALUES(NULL,NULL,". DBQuote($rec_r[0]).",'')") ; } mysql_free_result($sth); vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 4){ # Insert the Id's of the channels into AdSense table DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['AdSense']} ADD chId SMALLINT UNSIGNED NOT NULL") ; $sth = DBQuery($dbh, "SELECT Id,channel FROM {$ncfg['Tbl']['Channels']}") ; while($rec_r = mysql_fetch_row($sth)) { DBQuery($dbh, "UPDATE {$ncfg['Tbl']['AdSense']} SET chId=".DBQuote($rec_r[0])." WHERE channel=". DBQuote($rec_r[1])) ; } mysql_free_result($sth); DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['AdSense']} DROP INDEX channel") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['AdSense']} DROP channel") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['AdSense']} DROP hl") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['AdSense']} ADD color_line CHAR(6) NOT NULL") ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 5){ # update the FP field $sth = DBQuery($dbh, "SELECT Id,chId,format,fb,color_bg,color_text,color_link,color_url,color_border,color_line". " FROM {$ncfg['Tbl']['AdSense']}") ; while($rec_r = mysql_fetch_row($sth)) { $fp = FingerPrint($rec_r[1].$rec_r[2].$rec_r[3].$rec_r[4].$rec_r[5].$rec_r[6].$rec_r[7].$rec_r[8].$rec_r[9], 2); DBQuery($dbh, "UPDATE {$ncfg['Tbl']['AdSense']} SET FP=$fp WHERE Id=$rec_r[0]") ; } mysql_free_result($sth); vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 6){ # Add websearch channels to PageInfo DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['PageInfo']} CHANGE asId0 asId0 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['PageInfo']} CHANGE asId1 asId1 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['PageInfo']} CHANGE asId2 asId2 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['PageInfo']} ADD wsChId0 SMALLINT UNSIGNED NOT NULL DEFAULT 0") ; DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['PageInfo']} ADD wsChId1 SMALLINT UNSIGNED NOT NULL DEFAULT 0") ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 7){ # remove '-' from AdUrls table and set adId in Logs table to 0 for non-clicked records DBQuery($dbh, "UPDATE {$ncfg['Tbl']['Logs']} SET adId=0 WHERE cTime=0") ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 8){ # Insert an Ip Segment into IpRange table DBQuery($dbh, "CREATE TABLE {$ncfg['Tbl']['IpRanges']} ({$tfields['IpRanges']})") ; $sth = DBQuery($dbh, "SELECT Type, Code, StartIp, EndIp FROM {$ocfg['Tbl']['IpRanges']}") ; while($rec_r = mysql_fetch_row($sth)) { $sseg = (int)($rec_r[2] / 65536) ; $eseg = (int)($rec_r[3] / 65536) ; while($sseg <= $eseg) { DBQuery($dbh, "INSERT INTO {$ncfg['Tbl']['IpRanges']} (Type,Code,IpSeg,StartIp,EndIp)". " VALUES($rec_r[0],". DBQuote($rec_r[1]).",$sseg, $rec_r[2], $rec_r[3])") ; $sseg ++ ; } } mysql_free_result($sth); DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['IpRanges']}", true) ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 9){ # v.1.30 # add a new field for AdLinks into PageInfo table DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['PageInfo']} ADD asId3 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0") ; vuRedir($ocfg, $pars) ; exit(); } $errstr = SaveConfig($fname, $ocfg) ; $pars['VersionUpgrade'] = 'end' ; vuRedir($ocfg, $pars) ; return $errstr ; } #--------- version upgrade tasks -------------- function version130Upgrade($dbh, $fname, $ocfg, &$pars) { eval(getConfigStr($ocfg)) ; $ncfg = $cfgPars ; $tfields = TableFields() ; if (empty($pars['VersionUpgrade'])) { vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 1){ DBQuery($dbh, "REPAIR TABLE" . " {$ocfg['Tbl']['Logs']}" . ", {$ocfg['Tbl']['PageInfo']}" . ", {$ocfg['Tbl']['Domains']}" . ", {$ocfg['Tbl']['Pages']}" . ", {$ocfg['Tbl']['Dirs']}" . ", {$ocfg['Tbl']['rDomains']}" . ", {$ocfg['Tbl']['rPages']}" . ", {$ocfg['Tbl']['AdUrls']}" . ", {$ocfg['Tbl']['AdSense']}" . ", {$ocfg['Tbl']['Channels']}" . ", {$ocfg['Tbl']['IpRangeNames']}" . ", {$ocfg['Tbl']['IpRanges']}" ) ; # change name of the db tables. DBQuery($dbh, "RENAME TABLE" . " {$ocfg['Tbl']['Logs']} TO {$ncfg['Tbl']['Logs']}" . ", {$ocfg['Tbl']['PageInfo']} TO {$ncfg['Tbl']['PageInfo']}" . ", {$ocfg['Tbl']['Domains']} TO {$ncfg['Tbl']['Domains']}" . ", {$ocfg['Tbl']['Pages']} TO {$ncfg['Tbl']['Pages']}" . ", {$ocfg['Tbl']['Dirs']} TO {$ncfg['Tbl']['Dirs']}" . ", {$ocfg['Tbl']['rDomains']} TO {$ncfg['Tbl']['rDomains']}" . ", {$ocfg['Tbl']['rPages']} TO {$ncfg['Tbl']['rPages']}" . ", {$ocfg['Tbl']['AdUrls']} TO {$ncfg['Tbl']['AdUrls']}" . ", {$ocfg['Tbl']['AdSense']} TO {$ncfg['Tbl']['AdSense']}" . ", {$ocfg['Tbl']['Channels']} TO {$ncfg['Tbl']['Channels']}" . ", {$ocfg['Tbl']['IpRangeNames']} TO {$ncfg['Tbl']['IpRangeNames']}" . ", {$ocfg['Tbl']['IpRanges']} TO {$ncfg['Tbl']['IpRanges']}" ) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['Logs']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['PageInfo']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['Domains']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['Pages']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['Dirs']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['rDomains']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['rPages']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['AdUrls']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['AdSense']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['ChannelDef']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['IpRangeNames']}", true) ; DBQuery($dbh, "DROP TABLE {$ocfg['Tbl']['IpRanges']}", true) ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 2){ # add a new field for AdLinks into PageInfo table DBQuery($dbh, "ALTER TABLE {$ncfg['Tbl']['PageInfo']} ADD asId3 MEDIUMINT UNSIGNED NOT NULL DEFAULT 0") ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 3){ # do we need to shrink Channels table? $sth = DBQuery($dbh, "SELECT COUNT(DISTINCT ISNULL(ws)>0, channel) FROM {$ncfg['Tbl']['Channels']}") ; list($dcc) = mysql_fetch_row($sth) ; mysql_free_result($sth); $sth = DBQuery($dbh, "SELECT COUNT(*) FROM {$ncfg['Tbl']['Channels']}") ; list($cc) = mysql_fetch_row($sth) ; mysql_free_result($sth); if ($cc>$dcc) { # Oops! DBQuery($dbh, "CREATE TABLE {$ncfg['Tbl']['Channels']}tmp ({$tfields['Channels']})") ; DBQuery($dbh, "INSERT INTO {$ncfg['Tbl']['Channels']}tmp (Id,ws,channel,name)" . " SELECT NULL,ws,channel,'' FROM {$ncfg['Tbl']['Channels']}". " GROUP BY IFNULL(ws,1),channel") ; DBQuery($dbh, "REPAIR TABLE {$ncfg['Tbl']['Channels']}, {$ncfg['Tbl']['Channels']}tmp" ) ; DBQuery($dbh, "RENAME TABLE {$ncfg['Tbl']['Channels']} TO orichannels" . ", {$ncfg['Tbl']['Channels']}tmp TO {$ncfg['Tbl']['Channels']}" ) ; $sth = DBQuery($dbh, "SELECT cht.Id, ocht.Id, ISNULL(cht.ws)>0" . " FROM {$ncfg['Tbl']['Channels']} AS cht, orichannels AS ocht". " WHERE cht.channel=ocht.channel AND IFNULL(cht.ws,1)=IFNULL(ocht.ws,1)") ; while($rec = mysql_fetch_row($sth)) { if ($rec[2]) { DBQuery($dbh, "UPDATE {$ncfg['Tbl']['AdSense']} SET chId=$rec[0] WHERE chId=$rec[1]") ; }else{ DBQuery($dbh, "UPDATE {$ncfg['Tbl']['PageInfo']} SET wsChId0=$rec[0] WHERE wsChId0=$rec[1]") ; DBQuery($dbh, "UPDATE {$ncfg['Tbl']['PageInfo']} SET wsChId1=$rec[0] WHERE wsChId1=$rec[1]") ; } } mysql_free_result($sth); DBQuery($dbh, "DROP TABLE orichannels", true) ; vuRedir($ocfg, $pars) ; exit(); } } if ($pars['VersionUpgrade'] == 4){ # shrink AdSense table DBQuery($dbh, "CREATE TABLE {$ncfg['Tbl']['AdSense']}tmp ({$tfields['AdSense']})") ; DBQuery($dbh, "INSERT INTO {$ncfg['Tbl']['AdSense']}tmp (Id,FP,chId,format,fb,color_bg,color_text,color_link,color_url,color_border,color_line)" . " SELECT NULL,FP,chId,format,fb,color_bg,color_text,color_link,color_url,color_border,color_line" . " FROM {$ncfg['Tbl']['AdSense']}". " GROUP BY chId,format,fb,color_bg,color_text,color_link,color_url,color_border,color_line") ; $sth = DBQuery($dbh, " SELECT Id, CONCAT(chId,format,fb,color_bg,color_text,color_link,color_url,color_border,color_line)" . " FROM {$ncfg['Tbl']['AdSense']}tmp") ; while($rec = mysql_fetch_row($sth)) { $fp = FingerPrint($rec[1], 2) ; DBQuery($dbh, "UPDATE {$ncfg['Tbl']['AdSense']}tmp SET FP=$fp WHERE Id=$rec[0]") ; } mysql_free_result($sth); DBQuery($dbh, "REPAIR TABLE {$ncfg['Tbl']['AdSense']}, {$ncfg['Tbl']['AdSense']}tmp" ) ; DBQuery($dbh, "RENAME TABLE {$ncfg['Tbl']['AdSense']} TO oriadsense" . ", {$ncfg['Tbl']['AdSense']}tmp TO {$ncfg['Tbl']['AdSense']}" ) ; $sth = DBQuery($dbh, "SELECT ast.Id, oast.Id" . " FROM {$ncfg['Tbl']['AdSense']} AS ast, oriadsense AS oast". " WHERE ast.chId=oast.chId AND ast.format=oast.format AND ast.fb=oast.fb AND ast.color_bg=oast.color_bg" . " AND ast.color_text=oast.color_text AND ast.color_link=oast.color_link AND ast.color_url=oast.color_url" . " AND ast.color_border=oast.color_border AND ast.color_line=oast.color_line" ) ; while($rec = mysql_fetch_row($sth)) { DBQuery($dbh, "UPDATE {$ncfg['Tbl']['PageInfo']} SET asId0=$rec[0] WHERE asId0=$rec[1]") ; DBQuery($dbh, "UPDATE {$ncfg['Tbl']['PageInfo']} SET asId1=$rec[0] WHERE asId1=$rec[1]") ; DBQuery($dbh, "UPDATE {$ncfg['Tbl']['PageInfo']} SET asId2=$rec[0] WHERE asId2=$rec[1]") ; } mysql_free_result($sth); DBQuery($dbh, "DROP TABLE oriadsense", true) ; vuRedir($ocfg, $pars) ; exit(); } if ($pars['VersionUpgrade'] == 5){ # shrink PageInfo table DBQuery($dbh, "CREATE TABLE {$ncfg['Tbl']['PageInfo']}tmp ({$tfields['PageInfo']})") ; DBQuery($dbh, "INSERT INTO {$ncfg['Tbl']['PageInfo']}tmp (Id,pagId,domId,asId0,asId1,asId2,asId3,wsChId0,wsChId1)" . " SELECT NULL,pagId,domId,asId0,asId1,asId2,asId3,wsChId0,wsChId1" . " FROM {$ncfg['Tbl']['PageInfo']}". " GROUP BY pagId,domId,asId0,asId1,asId2,asId3,wsChId0,wsChId1") ; DBQuery($dbh, "REPAIR TABLE {$ncfg['Tbl']['PageInfo']}, {$ncfg['Tbl']['PageInfo']}tmp" ) ; DBQuery($dbh, "RENAME TABLE {$ncfg['Tbl']['PageInfo']} TO oripageinfo" . ", {$ncfg['Tbl']['PageInfo']}tmp TO {$ncfg['Tbl']['PageInfo']}" ) ; $sth = DBQuery($dbh, "SELECT pit.Id, opit.Id" . " FROM {$ncfg['Tbl']['PageInfo']} AS pit, oripageinfo AS opit". " WHERE pit.pagId=opit.pagId AND pit.domId=opit.domId AND pit.asId0=opit.asId0 AND pit.asId1=opit.asId1" . " AND pit.asId2=opit.asId2 AND pit.asId3=opit.asId3 AND pit.wsChId0=opit.wsChId0 AND pit.wsChId1=opit.wsChId1" ) ; while($rec = mysql_fetch_row($sth)) { DBQuery($dbh, "UPDATE {$ncfg['Tbl']['Logs']} SET piId=$rec[0] WHERE piId=$rec[1]") ; } mysql_free_result($sth); DBQuery($dbh, "DROP TABLE oripageinfo", true) ; vuRedir($ocfg, $pars) ; exit(); } $errstr = SaveConfig($fname, $ocfg) ; $pars['VersionUpgrade'] = 'end' ; vuRedir($ocfg, $pars) ; return $errstr ; } #--------- get Configuration Data -------------- function getConfigStr (&$cfg){ ob_start() ; ?> # Please make all changes to configuration variables via admin program. $cfgPars = array( 'Version' => '', 'rKey' => '', 'DbHost' => '', 'DbPort' => '', 'DbUser' => '', 'DbPass' => '', 'DbName' => '', 'AdminName' => '', 'AdminPassEnc' => '', 'UTZone' => , 'UTName' => '', 'EMailTo' => '', 'EMailFrom' => '', 'crImg' => , 'crPop' => , 'crCookie' => , 'crCookieDur' => , 'Tbl' => array( 'Logs' => 'asrep140Logs', 'PageInfo'=> 'asrep140PageInfo', 'Domains' => 'asrep140Domains', 'Pages' => 'asrep140Pages', 'Dirs' => 'asrep140Dirs', 'rDomains' => 'asrep140rDomains', 'rPages' => 'asrep140rPages', 'AdUrls' => 'asrep140AdUrls', 'AdSense' => 'asrep140AdSense', 'Channels' => 'asrep140Channels', 'IpRangeNames' => 'asrep140IpRangeNames', 'IpRanges' => 'asrep140IpRanges', ), 'blockedIps' => array( array(,), ), ) ; " ; if ($filedesc = @fopen($fname, 'wb')) { fwrite($filedesc, $configstr) ; fclose($filedesc) ; if ($filedesc = @fopen($fname, 'rb')) { $readstr = '' ; while(strlen($line = fread($filedesc,1024))) $readstr .= $line ; fclose($filedesc) ; if ($configstr != $readstr) { return "Can not read just created configuration file $fname" ; } }else{ return "Can not open the just created configuration file $fname" ; } }else{ return "Can not create configuration file $fname" ; } return '' ; } #--------- Save Admin name password -------------- function SaveAdminName ($fname, &$cfg, &$pars){ $cfg['AdminName'] = $pars['name'] ; $cfg['AdminPass'] = $pars['pass'] ; $cfg['AdminPassEnc'] = EncryptPassword($pars['pass']) ; return SaveConfig($fname, $cfg) ; } #------------------------------------ function SaveDBSettings ($fname, &$cfg, &$pars){ $cfg['DbHost'] = $pars['host'] ; $cfg['DbPort'] = $pars['port'] ; $cfg['DbUser'] = $pars['user'] ; $cfg['DbPass'] = $pars['pass'] ; $cfg['DbName'] = $pars['name'] ; return SaveConfig($fname, $cfg) ; } #------------------------------------ function SaveTimeZone ($fname, &$cfg, &$pars){ $cfg['UTZone'] = $pars['UTZone'] * 60*60 ; $cfg['UTName'] = $pars['UTName'] ; return SaveConfig($fname, $cfg) ; } #------------------------------------ function SaveEmail ($fname, &$cfg, &$pars){ $cfg['EMailTo'] = $pars['EMailTo'] ; $cfg['EMailFrom'] = $pars['EMailFrom'] ; $errstr = SaveConfig($fname, $cfg) ; if (!$errstr && isset($pars['EMailTest'])) { if (IsValidEMail($pars['EMailTo'])) { $from = empty($cfg['EMailFrom']) ? 'asrep@asrep.com':$cfg['EMailFrom'] ; $msg = 'If you read this message, then the e-mail interface is working properly.' ; @SendEMail($pars['EMailTo'], $from, 'asRep e-mail Interface Test Message', 0, $msg) ? ($errstr = 'Test message has been sent to '.$pars['EMailTo'].'') : ($errstr = 'function mail did not accept the message for delivery') ; }else { $errstr = 'You must enter a valid e-mail address to send the test message' ; } } return $errstr ; } #------------------------------------ function GetIpCc ($dbh, &$cfg, &$pars){ if (!empty($pars['forceAll'])) { $updates = array() ; WriteRirUpdates($updates, $cfg['InstallDir']) ; } $errstr = UpdateIpCc($dbh, $cfg, $pars) ; return $errstr ? $errstr : "Ip-to-Country database updated" ; } #------------------------------------ function SaveClickNotify ($fname, &$cfg, &$pars){ @$cfg['crImg'] = $pars['crImg'] ; @$cfg['crPop'] = $pars['crPop'] ; @$cfg['crCookie'] = $pars['crCookie'] ; @$cfg['crCookieDur'] = 0+$pars['crCookieDur'] ; return SaveConfig($fname, $cfg) ; } #------------------------------------ function SaveBlockedIPs ($fname, &$cfg, &$pars){ $cfg['blockedIps'] = array() ; $i=0 ; while (isset($pars["blockedIpsStart$i"]) && isset($pars["blockedIpsCount$i"])){ if (strlen($pars["blockedIpsStart$i"]) && strpos($pars["blockedIpsStart$i"],'.')!==false && $pars["blockedIpsCount$i"]>0) { $cfg['blockedIps'][] = array(0+IPstr2num($pars["blockedIpsStart$i"]), 0+$pars["blockedIpsCount$i"]) ; } $i++ ; } return SaveConfig($fname, $cfg) ; } #------------------------------------ function SaveRegKey ($fname, &$cfg, &$pars){ $cfg['rKey'] = $pars['rKey'] ; return SaveConfig($fname, $cfg) ; } #------------------------------------ function VerifyUserLogin (&$cfg, &$pars){ if (isset($pars['state']) && $pars['state'] == 'login') { if (EncryptPassword($pars['pass'], $cfg['AdminPassEnc']) == $cfg['AdminPassEnc'] && $pars['name'] == $cfg['AdminName']) {# True login setcookie ('UserNameEnc', EncryptPassword($cfg['AdminName']), 0, $cfg['PathUrl']) ; return 1 ; }else { DispLogin($cfg, $pars['name'], "Invalid name or password. Please try again.") ; } }else { $une = isset($_COOKIE['UserNameEnc']) ? $_COOKIE['UserNameEnc'] : '' ; if (EncryptPassword($cfg['AdminName'], $une) == $une) { # Yes you are still login return 1 ; }else { DispLogin($cfg, '', "Please enter your user name and password.") ; } } return 0 ; } #------------------------------------ function Logout(&$cfg) { setcookie ('UserNameEnc', 0, 0, $cfg['PathUrl']) ; DispLogin($cfg, '', "Please enter your user name and password.") ; } #--------- Display User settings -------------- function DispAdminName (&$cfg, $msg){ ?> asRep Admin: User Name and Pass

User Name and Password

Please assign a name and password for the user.

Name of the User:
Password of the User:

Please enter a name and password that you can remember later. Both admin and report scripts will ask for the name and password.

If you can not remember your admin name or password, you can reset it by editing the file settings.php in the installation directory. You must assign an empty string to AdminName. Then admin program will display this screen again.


You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: Login
Login
User Name:
Password:

Login information is stored in a session cookie in your browser. Please enable cookies.

asRep Admin: Database Settings

Database Connectivity Settings

Status: '.$msg : '')?>

Please enter the info about the MySql database to be used.

MySQL Server (Host) Name: Enter the name or IP of the database host server. Leave blank for the default server name, 'localhost'.
MySQL Server Port: Enter the port number of the database server. Leave blank for the default server port, '3306'.
MySQL Database Name: Enter the name of the MySQL database where the tables will reside. You must create this database by using the database administration program provided by your hosting provider such as via your hosting control panel. Consult to your hosting provider if you do not know how to do it.
MySQL Database User Name: Enter the name of the user having access right to the database server.
MySQL Database User Password: Enter the password of the user accessing the database server

If you see this screen repeatedly, this means that the script can not connect to the database. Please enter correct settings.


You can re-start the setup process, by deleting the file settings.php in the installation directory. Database  |  IP to Country  |  Time Zone  |  E-Mail  |  Click Reporting  |  Tracking Code  |  Block Tracking  |  Updates  |  Reports  |  Exit END_OF_MENU; } #--------- Display Setup Screen -------------- function DispSetup (&$cfg, &$pars, $msg){ ?> asRep Admin: Other Settings
Status: '.$msg : '')?>

Select the option from the menu.

















You can re-start the setup process, by deleting the file settings.php in the installation directory. \n" ; } if ($sth2) mysql_free_result($sth2); } mysql_free_result($sth); return $str ; } #--------- Optimize Database Tables -------------- function DbOptimize($dbh, &$cfg, &$pars){ $str = "" ; $sth = DBQuery($dbh, "SHOW TABLE STATUS") ; while($rec = mysql_fetch_assoc($sth)) { $sth2 = DBQuery($dbh, "OPTIMIZE TABLE {$rec['Name']}", true) ; while($sth2 && ($rec = mysql_fetch_row($sth2))) { $str .= implode(' : ', $rec) . "
\n" ; } if ($sth2) mysql_free_result($sth2); } mysql_free_result($sth); return $str ; } #--------- Display DB Maintenance Screen -------------- function DispDbMaintenance($dbh, &$cfg, &$pars, $msg){ ?> asRep Admin: Database Maintenance Settings
Status: '.$msg : '')?>

Database Maintenance

List of tables in the database
TableNumber of RowsAvg. Row SizeData SizeIndex Size

Make a backup of the database in the script directory.
> Create compressed backups to save disk space. (You must have Zlib compression library enabled in your PHP configuration as described here)
This operation takes time! Please click to the button only once.

Restore database from a backup:

This operation takes time! Please click to the button only once.
Any database backup was not found.
Optimize the tables in the database: This feature will execute "OPTIMIZE TABLE xxx" on the tables to gain free space etc.
This operation takes time! Please click to the button only once.

Repair the tables in the database: It will execute "REPAIR TABLE xxx" on the tables to attempt to fix corrupted tables. Use this feature only if you encounter table errors.
This operation takes time! Please click to the button only once.


You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: Time Zone Settings
Status: '.$msg : '')?>

Time Zone Settings

Specify the time zone you prefer the reports should use. The specified time zone is only used when displaying (retrieving) time values to (from) the user. The actual times are always stored in the database as universal GMT time.

Date/Time in GMT:
Date/Time in user time zone:
Time Zone in hours: This value is the time difference between your local time and the Greenwich Mean Time (GMT or UTC). The software saves and uses all time values in terms of GMT. This setting will be used to convert the saved time values into your preferred time zone (and vice versa) while displaying time values. Some sample values are:
Sydney-Australia...+10, Tokyo-Japan...+9, Hong Kong...+8, Moskow-Russia...+3, Istanbul-Turkey...+2, Paris-France...+1, London-England...0, Buenos Aires-Argentina...-3, Atlantic Time-Canada...-4, Eastern Time-US...-5, Central Time-US...-6, Mountain Time-US...-7, Pacific Time-US...-8
Time Zone Name: Please enter a descriptive name for the time zone you entered. This value is displayed on some reports and on admin panel.



You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: E-Mail Settings
Status: '.$msg : '')?>

E-Mail Settings

Set the e-mail interface available on your system. The scipt will use these settings to send report e-mails

To e-mail address: Enter the e-mail address that will receive the report or test e-mails sent by the script.
From e-mail address: Enter the e-mail address that will appear on the From field of the emails sent by the script.
This script uses PHP mail function to send e-mails. If it is not configured properly on your system, plase see your PHP documentation or ask to your hosting provider to configure mail properly.



You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: IP to Country Database Download
Status: '.$msg : '')?>

IP to Country Management

Download IP to Country mapping database. This database is used in reports to identify the country of visitors from IP address.

No database download has been done yet

$val) { if ($key != 'country' && $val[0]+0 > 0) { ?>
Downloaded ItemLast updateNumber of Lines
Country List
Region Countries
> Force download of all data


This operation may take time! Please click to the button only once.

Map the IPs to Countries in report database. IP-to-Country mapping is done while saving the records. If you have records saved before downloading the IP-to-Country database, or you simply want to refresh the IP-to-Country associations, you can remap the IPs in the database.

Map only the IPs that are not already assigned a country.
Map all IPs again.


This operation may take time! Please click to the button only once.



You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: Click/Search Reporting Settings
Status: '.$msg : '')?>

Click/Search Reporting

Please specify how the clicks and searches will be reported. You can specify multiple methods in order to increase the chance the click/search is reported. Since every click/search is given a unique id, multiple reporting of the same click/search is recorded only once. If you un-check all methods, then there will be no click/search tracking. Impression tracking is not affected from these settings.

> Report clicks/searches via an invisible IMG tag element just before loading the new page.

This method is transparent to the visitor. After a click/search is detected, the image is activated to notify the server about the click/search.

> Report clicks/searches via a hidden pop-under window. The window closes itself automatically.

This method opens a pop-under window to notify the server about the click/search. The pop-under window is closed automatically once the click/search is reported. The window is invisible on some browsers like Internet Explorer. Only an icon in the task bar is displayed.

> Report clicks/searches via cookies. Store the cookies for days.

The click/search information is stored in a cookie on the visitor's browser. Next time the visitor comes to your site, the previous click/search info is reported.





You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: Tracking Code
Status: '.$msg : '')?>

AdSense Tracking Code

Copy and paste the following tracking code to your web pages.




You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: Tracking Exceptions
Status: '.$msg : '')?>

Block Tracking

Some webmasters request that asRep should not track the impressions, clicks and searches during certain cases. For example, a webmaster visiting his/her site a lot may want that the tracking be blocked for his/her activity on the site, since the extra impressions he/she creates mess up the results in asRep reports by increasing the views and decreasing the CTR.

Block tracking via a cookie

By setting a cookie in your browser, you can block tracking of impressions, clicks and searches from this browser.

A cookie is set in this browser to block tracking. Any activity on your web sites with this browser will not be tracked by asRep.

Erase the cookie to allow tracking from this browser.

No cookie is currently set in this browser to block tracking. All activity with this browser will be tracked by asRep.

Set a cookie to block tracking from this browser.

Block tracking via IP list

By entering a list of IP address ranges, you can block tracking of impressions, clicks and searches from these IPs.

Blocked IP Ranges
Starting IPNumber of IPs
 

Example-1: to ban IP 165.146.254.233, enter 165.146.254.233 into Starting IP and 1 into Number of IPs.
Example-2: to ban all IPs in the range (165.146.254.0, 165.146.254.255) inclusive, enter 165.146.254.0 into Starting IP and 256 into Number of IPs.

To remove an IP range from the list, either delete the Starting IP box or enter 0 (zero) into the corresponding Number of IPs box.



You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: Upgrading
Status: '.$msg : '')?>

Registration Key

Obtain your registration key and enter it here

Available Updates

ERROR: Can not verify the integrity of data from asRep update server!

$v) { if (!(isset($su_r[$f]) && ($u_r[$f]['date'] <= $su_r[$f]['date']))) { if (!$anyupdate) { ?>
File NameDescription

When you download the files, they will be saved in the installation directory with a new_ prefix added to the file names.
No file or code will be executed without your control.

No new update is available




You can re-start the setup process, by deleting the file settings.php in the installation directory. $u_r[$f]['desc'], 'date'=>$u_r[$f]['date']) ; $du[$f] = array('desc'=>$u_r[$f]['desc'], 'date'=>$u_r[$f]['date'], 'tf'=>"new_$f") ; } } } WriteUpdates($su_r, $cfg['InstallDir']) ; ?> asRep Admin: Upgrading

Downloaded Updates

No update has been done

has been downloaded as

You must click to the Activate the Downloaded Files button in order to make the new files active. After the activation, the old script files are still available with a .back appended to the file name.
You can inspect the file contents before activating them.

If you like, you can rename the downloaded files by yourself via your shell access client or FTP client.


You can re-start the setup process, by deleting the file settings.php in the installation directory. asRep Admin: Content of <?php echo $pars['file']?>


asRep Admin: file activation

Activated Downloads

The file was renamed as and the old was renamed as .

The file was not found.

Return to the Updates page

ravished teens

ravished teens

nose mature all natural mellons

mature all natural mellons

poem tiava handjob movies

tiava handjob movies

area logtech webcam free download

logtech webcam free download

nine erotic captured women stories

erotic captured women stories

dictionary hanging milk jugs

hanging milk jugs

mix tongue xxx

tongue xxx

look very heavy sex

very heavy sex

fat paparazzi britney spears breasts

paparazzi britney spears breasts

quotient mondays suck video

mondays suck video

give fine sex pictures

fine sex pictures

down sexy teens exercising

sexy teens exercising

house shemale abuse

shemale abuse

round veilige sex pijpen sperma

veilige sex pijpen sperma

four fisting lessons shayna

fisting lessons shayna

dog escorts required in surrey

escorts required in surrey

wood portugese breakfast xxx

portugese breakfast xxx

drive gfe escort tarrytown ny

gfe escort tarrytown ny

seem moms wearing thongs gallery

moms wearing thongs gallery

month desirae nude free

desirae nude free

shine woman nipple torture stuff

woman nipple torture stuff

else ritualistic sex

ritualistic sex

cover nude young little boys

nude young little boys

few kif naked futurama unsensered

kif naked futurama unsensered

color tight crotch panties pussy

tight crotch panties pussy

paragraph dating salalah

dating salalah

fast dirty tamed teens

dirty tamed teens

dictionary nudists body art

nudists body art

usual sudbury dating services

sudbury dating services

chord hobart singles

hobart singles

slow adult sex bog

adult sex bog

match breasts movies

breasts movies

connect jenny ross porn

jenny ross porn

me sonic ring cock ring

sonic ring cock ring

quiet naked latia chicks

naked latia chicks

side spy chix directions

spy chix directions

cloud women giving handjobs

women giving handjobs

group xxx kinky women

xxx kinky women

original superheroines hard fucked

superheroines hard fucked

night breast cancer arimidex

breast cancer arimidex

earth papanicolau stain and sperm

papanicolau stain and sperm

list bdsm jewellery

bdsm jewellery

buy alaina kalanj nude

alaina kalanj nude

skill kiss doll online

kiss doll online

and art that sucks

art that sucks

remember persona counseling solutions

persona counseling solutions

strong kinky fetish bdsm

kinky fetish bdsm

record hot gamer chicks

hot gamer chicks

ever human sexuality urinating

human sexuality urinating

sense tommy sax xxx

tommy sax xxx

began true love wedding cake

true love wedding cake

system calm and erotic midi

calm and erotic midi

phrase muscle underwear

muscle underwear

arrange thick nude

thick nude

men pussy cam

pussy cam

grass 3d hentai mp4

3d hentai mp4

plant webcam recorder capture

webcam recorder capture

certain try teens kianna

try teens kianna

some singles in tn

singles in tn

three desi girls porn free

desi girls porn free

finish lesbian bedtime stories

lesbian bedtime stories

surprise phim hentai

phim hentai

store cassandra rocks hardcore

cassandra rocks hardcore

fig teen site reviews

teen site reviews

mile horse cock free password

horse cock free password

earth male nude in shower

male nude in shower

reason big booty jazzmin

big booty jazzmin

act hulk hogan dick size

hulk hogan dick size

voice acupuncture orgasm

acupuncture orgasm

neck horse on woman pron

horse on woman pron

third tivia porn site

tivia porn site

neighbor gun control and teens

gun control and teens

during thong anal nerves

thong anal nerves

picture anton yelchin naked

anton yelchin naked

fraction medical mistresses guide

medical mistresses guide

wrote men licking creampies

men licking creampies

atom brazillian transsexual

brazillian transsexual

past quilt strip design

quilt strip design

match mpg to midi converter

mpg to midi converter

own missiles rockets xxx

missiles rockets xxx

foot leticia cline playboy nude

leticia cline playboy nude

experience teens explain trinity

teens explain trinity

thousand very longchain fatty acids

very longchain fatty acids

follow naked teen gets facials

naked teen gets facials

through swing sets wood

swing sets wood

eight tex nylon 6

tex nylon 6

I erotic nude georgia

erotic nude georgia

slow erotic sroies

erotic sroies

station father daughter sex photos

father daughter sex photos

doctor acting for teen bangadesh

acting for teen bangadesh

govern big bush beavers

big bush beavers

by little asain girl vagina

little asain girl vagina

room young asian sex movies

young asian sex movies

rule sex play ball

sex play ball

there alison angel s pussy

alison angel s pussy

crop stocking mpegs

stocking mpegs

wing naked businesswoman

naked businesswoman

brother mature aunt pic

mature aunt pic

were tori dean love

tori dean love

force kmart underwear catalog

kmart underwear catalog

is teen fine arts photos

teen fine arts photos

neighbor keri bbw

keri bbw

separate gay barcelona

gay barcelona

day myspace gay backgrounds

myspace gay backgrounds

fair jessy schram nude movies

jessy schram nude movies

thus hair color ash blonde

hair color ash blonde

gun pegging crossdress strapon

pegging crossdress strapon

trade homemade female masturbation toy

homemade female masturbation toy

course stockholm escort

stockholm escort

who moby dick image painting

moby dick image painting

all teen substance abuse interview

teen substance abuse interview

had young undressing gallery

young undressing gallery

electric puppy love in french

puppy love in french

captain pepper bond porn actress

pepper bond porn actress

few portugal online dating

portugal online dating

column breast implants financing

breast implants financing

kept redcloud porn

redcloud porn

equate guia gay medellin

guia gay medellin

cotton atlanta s top escorts

atlanta s top escorts

list seahouses sex shop

seahouses sex shop

few megan jones mpgs

megan jones mpgs

like latin mature xxx

latin mature xxx

pair raymond g love

raymond g love

expect naiomi capbell nude

naiomi capbell nude

seed gay and lesbian triathlons

gay and lesbian triathlons

room ladies with no underwear

ladies with no underwear

seven junior naked

junior naked

city kansas city singles scene

kansas city singles scene

body brother sister sexual relationships bible

brother sister sexual relationships bible

ship spanking emoticons

spanking emoticons

moment gay and bjork

gay and bjork

born gemini and scorpio relationships

gemini and scorpio relationships

train nude furries gallery

nude furries gallery

some pin striped shirts

pin striped shirts

every pine knob ski

pine knob ski

very kate townes nude

kate townes nude

front virgin worlds podcasts

virgin worlds podcasts

brown asian female orgasm photography

asian female orgasm photography

watch craven county escorts

craven county escorts

for busty ebony wmv

busty ebony wmv

heat asian lesbians make out

asian lesbians make out

blow fetish fisting gay jpg

fetish fisting gay jpg

there trinity adult porn

trinity adult porn

stick big tits college girls

big tits college girls

fact fisher price bug swing

fisher price bug swing

off medical exam fetish story

medical exam fetish story

better lesbian zazi

lesbian zazi

stick topless older women

topless older women

father adult porn sex photos

adult porn sex photos

after independent erotic american movies

independent erotic american movies

sent virgin vampire pics

virgin vampire pics

past larry birkhead is gay

larry birkhead is gay

reply 54 h tits

54 h tits

cloud nude capoera

nude capoera

joy michelle trachtenburg nipple pics

michelle trachtenburg nipple pics

but mature bbw strapon

mature bbw strapon

do star wars nude slips

star wars nude slips

room porn dump crazy

porn dump crazy

ball gay roommate wanted

gay roommate wanted

answer funny dating contracts

funny dating contracts

year skandar keynes chatroom

skandar keynes chatroom

push ebony bbw xxx video

ebony bbw xxx video

second strapon lesbian videos

strapon lesbian videos

region alan cumming and christmas

alan cumming and christmas

reach 94 ford escort pictures

94 ford escort pictures

direct actresses movie pussy

actresses movie pussy

proper old grannies boobs

old grannies boobs

choose see thru lingerie nude

see thru lingerie nude

happy lesbian teenage

lesbian teenage

fall spread eagle nude naked

spread eagle nude naked

cat cum in her pussy

cum in her pussy

sat leg shaving fetish

leg shaving fetish

last young hot celeb pussy

young hot celeb pussy

appear claudia nn teen model

claudia nn teen model

reach good masturbation technique

good masturbation technique

coat larg tits

larg tits

nose depression due to impotence

depression due to impotence

sat 10 gallon plastic jugs

10 gallon plastic jugs

block his huge cock mutt

his huge cock mutt

flower naked xxx pictures

naked xxx pictures

wife teen clubs boca raton

teen clubs boca raton

other home movies free xxx

home movies free xxx

buy teen banged video

teen banged video

paragraph douglas beaver

douglas beaver

half jessica simpson pictures nude

jessica simpson pictures nude

love hartly porn

hartly porn

since bbw terri

bbw terri

mountain trans passions

trans passions

for remedies for facial warts

remedies for facial warts

sing lesbian fanfic

lesbian fanfic

ten forced sex flash games

forced sex flash games

enough tiny too young pussy

tiny too young pussy

distant podcast femdom humiliation

podcast femdom humiliation

necessary eric fromm love

eric fromm love

look teen woohoo sims 2

teen woohoo sims 2

trouble sondra faas having sex

sondra faas having sex

fit anime love series

anime love series

throw lesbian fanfic

lesbian fanfic

most mature violent sex

mature violent sex

grew children and breast cancer

children and breast cancer

fear femdom kicked balls

femdom kicked balls

sent love one another illustration

love one another illustration

room rumble roses girls naked

rumble roses girls naked

spoke oap porn

oap porn

winter drums of passion cd

drums of passion cd

should easter chick card

easter chick card

continue passion parties northerm ca

passion parties northerm ca

melody lesbian pimps her whore

lesbian pimps her whore

draw mom fucks son stories

mom fucks son stories

dream edible hershey kisses crafts

edible hershey kisses crafts

mount amateur nudes tgp

amateur nudes tgp

present submissive sissy slut

submissive sissy slut

race bangbros password free

bangbros password free

sail hardcore porn vids free

hardcore porn vids free

skill teen girl development

teen girl development

old vivid xxx dvd

vivid xxx dvd

quart juicey tits

juicey tits

middle any fisher sex tape

any fisher sex tape

work cobb county gay 1993

cobb county gay 1993

brown horny amateur wives

horny amateur wives

make cracker coated chicken breast

cracker coated chicken breast

sand boobs sucking videos

boobs sucking videos

main sims dating games onmline

sims dating games onmline

level uk dogging search engines

uk dogging search engines

rope sex video for tennis

sex video for tennis

my clips lesbian

clips lesbian

real asshole film strip international

asshole film strip international

original pendidikan sex

pendidikan sex

rub love lady danielle derek

love lady danielle derek

electric soldier sex

soldier sex

hundred vintage hairy lesbian

vintage hairy lesbian

call trooper stops pornstar

trooper stops pornstar

insect tino gay videos

tino gay videos

by dutch kountry knob noster

dutch kountry knob noster

please young innocent nude gallery

young innocent nude gallery

gas gay bar essen germany

gay bar essen germany

sing amuture lesbian porn

amuture lesbian porn

sense bakini teen

bakini teen

after naked girls vergina

naked girls vergina

ten sex stamina improve

sex stamina improve

yellow naked thin girl

naked thin girl

shape family counseling summerville

family counseling summerville

value hairy ass licking

hairy ass licking

process coronation of the virgin

coronation of the virgin

big cat licking screen

cat licking screen

sing pooltable fuck

pooltable fuck

level hentai disney ursula

hentai disney ursula

store sucking nipple

sucking nipple

interest pornstar and kitty

pornstar and kitty

round tight pussy huge vibrator

tight pussy huge vibrator

chord hentia wallpaper

hentia wallpaper

atom cardiac rthymn strip

cardiac rthymn strip

happy young hardcore forbidden sex

young hardcore forbidden sex

row strangeling gay

strangeling gay

off jizz oline

jizz oline

thousand kelly poon upskirt

kelly poon upskirt

million making dog booties

making dog booties

air love u realty

love u realty

steam stds that teens get

stds that teens get

last sperm maturation process

sperm maturation process

track tera patrick pink pornstars

tera patrick pink pornstars

train pal jobs for teens

pal jobs for teens

engine danny jimenez sex offender

danny jimenez sex offender

syllable teen getting fucked

teen getting fucked

flat interview porn star

interview porn star

hard xtreme booty 5

xtreme booty 5

fruit teen girl sucking cock

teen girl sucking cock

burn cooled singles

cooled singles

division crazy teen clips

crazy teen clips

area characters in swing kids

characters in swing kids

dress family dysfunction article

family dysfunction article

teach sex amateur forums

sex amateur forums

better tokyo beauty products

tokyo beauty products

cent brutal anal insertions

brutal anal insertions

result latina upskirt

latina upskirt

throw topless teen model topsite

topless teen model topsite

change pubescent sex gallery

pubescent sex gallery

raise girls weeing naked

girls weeing naked

feet cunts pictures

cunts pictures

trade beauty salon algonquin illinois

beauty salon algonquin illinois

oil animated gay color pictures

animated gay color pictures

wing sissy kuhn second life

sissy kuhn second life

count heavyweight cocks

heavyweight cocks

straight webcam teens stripping

webcam teens stripping

plane little naked girls eight

little naked girls eight

led confront in love

confront in love

start american phone sex

american phone sex

branch lesbian group singers

lesbian group singers

reason drunk nude sex

drunk nude sex

current elegant nudes free

elegant nudes free

bird dick gulping

dick gulping

other daddys slut phone sex

daddys slut phone sex

state handjobs intact

handjobs intact

pitch over the kee spankings

over the kee spankings

front sex displays

sex displays

fruit wife post oral sex

wife post oral sex

island crissy moran tit fuck

crissy moran tit fuck

care xxx forced bisex dvds

xxx forced bisex dvds

hot gay co parenting wanted

gay co parenting wanted

weight jackonsville escorts

jackonsville escorts

gave whipping at girls schools

whipping at girls schools

wash porn from isreal

porn from isreal

early teen circumcision videos

teen circumcision videos

look japanese shark mpegs

japanese shark mpegs

necessary nude women flag

nude women flag

spoke first time auditions xxx

first time auditions xxx

fun spanking girls vidio

spanking girls vidio

short counseling sample resume

counseling sample resume

prove teen s body hair

teen s body hair

again escorts of las vages

escorts of las vages

pitch dare to nude

dare to nude

plural animal fuck sample

animal fuck sample

seven
Daily crossword puzzle web gadget.MOM website containing information pertaining to labour Mom.Autos - Find used bmw 325.Offers new and used jdm.Now in its third generation, themx5.Gadizmo is your news source for the latest gadgets gizmos.The Best Web Monitor for Logging mom.Welcome to the all new and improved car dealers.All rights are reserved by new suzuki.Web gadgets and applications from Smart web gadgets.The Official site for all new 2009 chevy trucks.Thousands of new and used motorcycles.Topics Related to stages of pregnancy.Honda recalls 200000 quads.Information on fitness man s health.In the United States, an antique cars.Jeep classifieds including Jeep parts used jeeps for sale.The Ford 2001 thunderbird.Click on any new bmw.A discussion forum dedicated to all generations of the Honda prelude.Welcome to Airport travel agency.The official bmw.In the mid-1990s the mercurys.Search a large range of new & used bikes.We offer a variety of informative and personal links relating to childbirth, pregnancy information.Find cheap airline travel tickets.Chrysler introduced the Dodge caravan.Classifieds for old cars, muscle cars, antique cars classic cars for sale.The Mazda mx6.The CJ-5 was influenced by new corporate owne cj5.Honda VTX custom chopper parts vtx.Description of the 2002 thunderbird.The 2006 BMW 3-Series will be offered as the 2006 bmw 325i.Find new Nissan cars and 2009 2010 nissan cars.Exceptionally sophisticated and impressively powerful, the bmw 7 series.Even in markets where the car is sold as a hyundai tuscani.Nissan Maxima Enthusiasts Site nissan maxima.Intelligent Spy Electronic gadget store

good view

wide range

preconstruction investing

the term to

started pumping

should always

literally means

good London

healthy diet

gave way

system parts

soaking wet

web site

little Beckys

video games

went back

regular basis

carpal tunnel

job edge sign

anti virus

which point

side effects

came home

external territories

get over

quickly pulled

Truth is defined

Port Douglas

would need

scuba diving

full size

found myself

Auto Parts

lose weight

best use

Australian literature

stop now

commercial dog

Westminster system

of this actual

new baby

asked him

Study Abroad

hosting provider

sports utility

market study

or life needs

online business

online dating

iPod music

World War

take over

of typical laser

Sony Ericsson

Travel based

goals usually

continually repeated

well worth

business opportunity

rabbit vibrator

great deal

daily basis

electromagnetic radiation

new home

cum inside

said Now

over million

in their single

The islands' human

Great Barrier

chest heaving

single electorate

wide variety

felt him

blood glucose

video files

good idea

back towards

sexual desire

single stem

good way

dessert indulge

electric motor

gonna find after joining

Chief Executive

vacation rentals

could smell

body builder

folic acid

cities such

make love

search engine

should never

skilled people

wide range

black bra
Daily crossword puzzle web gadget.MOM website containing information pertaining to labour Mom.Autos - Find used bmw 325.Offers new and used jdm.Now in its third generation, themx5.Gadizmo is your news source for the latest gadgets gizmos.The Best Web Monitor for Logging mom.Welcome to the all new and improved car dealers.All rights are reserved by new suzuki.Web gadgets and applications from Smart web gadgets.The Official site for all new 2009 chevy trucks.Thousands of new and used motorcycles.Topics Related to stages of pregnancy.Honda recalls 200000 quads.Information on fitness man s health.In the United States, an antique cars.Jeep classifieds including Jeep parts used jeeps for sale.The Ford 2001 thunderbird.Click on any new bmw.A discussion forum dedicated to all generations of the Honda prelude.Welcome to Airport travel agency.The official bmw.In the mid-1990s the mercurys.Search a large range of new & used bikes.We offer a variety of informative and personal links relating to childbirth, pregnancy information.Find cheap airline travel tickets.Chrysler introduced the Dodge caravan.Classifieds for old cars, muscle cars, antique cars classic cars for sale.The Mazda mx6.The CJ-5 was influenced by new corporate owne cj5.Honda VTX custom chopper parts vtx.Description of the 2002 thunderbird.The 2006 BMW 3-Series will be offered as the 2006 bmw 325i.Find new Nissan cars and 2009 2010 nissan cars.Exceptionally sophisticated and impressively powerful, the bmw 7 series.Even in markets where the car is sold as a hyundai tuscani.Nissan Maxima Enthusiasts Site nissan maxima.Intelligent Spy Electronic gadget store

don kent artist

sentiment without

sauder curio cabinets

bottom line

colostomy bag photos

investigate religion's

300 black women and 3 strippers

moment scale loud

old fart new tart

bicameral Parliament

murder of melissa walbridge

world cup

fisher and pycal

London plumber

svetlana young model

sisters hot

transcript to forest gump

Musical composition

mastrabating for girls

complete ice

annabel chong pictures

ceasing to be

the holy city song

epistemically justified

lego stores in canada

daily basis

katsuya ventura blvd

Australian culture

idiom cooking with gas

short sale

aztec double headed serpent

high quality

florida keys bonefishing guides

walked over

lite 101 9fm radio station

two men

history of the gilly suit

Aboriginal people

big buttwomen

folic acid

real8teens abby

hundred miles

medieval scone recipe

name bio

stamford ct apts

use the theme

wieson drivers

air pollution

danielle wallace

for on are with as I his they

mounting antlers how to

occupy your mind

mitchell musso fan mail

stop now

aldi nederland

credit card

boy bibcam

federal elections

hp photosmart 2610 driver downloads

contact lenses

vixenval gets oiled

Intelligent Urbanism

steamer bags cooking

pubic hair

ralph petey green youtube

fatty acids

wrbcam delux b16 driver

reproduction Davion

tom licas

competitive advantage

jollibee food corp

remain intact

defloraton clips

color contact

ginis world records

commercial dog

vivica coxx

James believed

minnow identification ontario

freely reprinted

visayas folk dances

entitled Dear Diary

foto belinda desnuda

would love

opiate potentiators

make laws

diseno de unas acrilicas

weight loss

imgboards loli

weight gain

oakdale iowa penitentiary

older dog

2200 calorie ada diet

high school

hungarian baby bathtub planters

exhaust system

aspca fresno ca

hybrid vehicle

japanese lolikon

casino gambling

bargin finder alberta canada

website links

harpys dead end street gang

Google Adwords

sopaipilla recipe

always try

cooking with fan assisted oven

half inches

capilano mall edmonton ab

Big Ticket

saging titts

get back

foods with lots of iron

didnt see

i want more by ragg

start off with

kneading fingers 2000

soul mate

windows vista drivers for lexmark z53

erectile dysfunction

mcdonalds style chicken nuggets recipe

These philosophies

chicka philippines text

help keep

glucon

watched him

bfg 315 75 r16 inches

last year

storno 6000

take advantage

remote alaska interior cabins for sale

certified car

relatos gay chicos

fucking good

live cams of amsterdam prostitutes

gas mileage

nesterj installation instructions

vitamin supplements

rooter router

a tendency to present

actress molly heartbreaker

get back

bashment granny play

well worth

alejandra ford models

dry dog

apology clarissa lyrics

buyers agent

kashwere

last longer

saynoto0845

comprehensive schools

arlanas corner

two ways

o hare to milwaukee bus

of absolute certainty

neopolitan cake recipe

little bit

tatty teddy ecards

whose symphonies

stacey pfeiffer centennial high school

unsecured loans

savage mako rifle

from black comedy

itouch instructions

truck parts

stephanie larimore bikini pictures

fairy tale
>16)=irt.IpSeg AND lgt.Ip>=irt.StartIp AND lgt.Ip<=irt.EndIp" ; DBQuery($dbh, $qstr) ; DBQuery($dbh, "REPAIR TABLE {$cfg['Tbl']['Logs']}, $tmpTable") ; DBQuery($dbh, "RENAME TABLE {$cfg['Tbl']['Logs']} TO orilogs, $tmpTable TO {$cfg['Tbl']['Logs']}") ; DBQuery($dbh, "DROP TABLE orilogs", true) ; return "IP-to-Country remapping was done" ; } ###################################################### #--------- function UpdateIpCc ($dbh, &$cfg, &$pars){ # $IpCcServ = "http://www.robusthost.com/cgi-bin/dapipcc/ipccserv.pl" ; $dt = getdate(time()) ; $date = sprintf('%04u/%02u/%02u %02u:%02u:%02u', $dt['year'],$dt['mon'],$dt['mday'],$dt['hours'],$dt['minutes'],$dt['seconds']); $anyupdatedone = 0 ; $lupdates = ReadRirUpdates($cfg['InstallDir']) ; $rupdates = GetRirUpdates($IpCcServ, $cfg['Url']) ; $rkey = 'country' ; if (!isset($lupdates[$rkey]) || $lupdates[$rkey][1] < $rupdates[$rkey][1]) { $lcnt = GetCountry($dbh, $cfg, $IpCcServ, $cfg['Url']) ; if ($lcnt) { $lupdates[$rkey][0] = $rupdates[$rkey][0]+0 ; $lupdates[$rkey][1] = ($date < $rupdates[$rkey][1]) ? $rupdates[$rkey][1] : $date ; $lupdates[$rkey][2] = $lcnt ; $anyupdatedone = 1 ; } } foreach ($rupdates as $rkey => $rval) { if (!isset($lupdates[$rkey]) || $lupdates[$rkey][1] < $rupdates[$rkey][1]) { if ($rkey != 'country' && $rupdates[$rkey][0]+0 > 0) { $lcnt = GetRir($dbh, $cfg, $IpCcServ, $rkey, $rupdates[$rkey][0], $cfg['Url']) ; if ($lcnt) { $lupdates[$rkey][0] = $rupdates[$rkey][0]+0 ; $lupdates[$rkey][1] = ($date < $rupdates[$rkey][1]) ? $rupdates[$rkey][1] : $date ; $lupdates[$rkey][2] = $lcnt ; $anyupdatedone = 1 ; } } } if ($anyupdatedone) break ; } if (!isset($pars['prevupdate'])) $pars['prevupdate'] = 0 ; if ($anyupdatedone) { WriteRirUpdates($lupdates, $cfg['InstallDir']) ; if ($pars['prevupdate'] < 15) { header("Location: " . $cfg['Url'] . "?state=ipcc&update=t&prevupdate=" . (1+$pars['prevupdate'])) ; exit ; } } return $pars['prevupdate'] ? '' : "No new IP-to-Country update found" ; } #--------- function GetRir ($dbh, &$cfg, $ipccserv, $rir, $rirtype, $ldom){ $url = $ipccserv . "?get=$rir&dom=$ldom" ; list($content) = GetHttpPage($url) ; $qstr = "LOCK TABLES {$cfg['Tbl']['IpRanges']} WRITE" ; DBQuery($dbh, $qstr, true) ; $linecount = 0 ; for ($i=0 ; $i < strlen($content) ; $i+=10) { $line = substr($content, $i, 10) ; $fields = unpack("A2cc/N2ip", $line) ; if ($fields['ip1'] < 0) $fields['ip1'] = 0xFFFFFFFF + $fields['ip1'] + 1 ; if ($fields['ip2'] < 0) $fields['ip2'] = 0xFFFFFFFF + $fields['ip2'] + 1 ; # Here do the database store thing if ($linecount == 0) { $qstr = "DELETE FROM {$cfg['Tbl']['IpRanges']} WHERE Type=" . DBQuote($rirtype) ; DBQuery($dbh, $qstr) ; } $sseg = (int)($fields['ip1'] / 65536) ; $eseg = (int)($fields['ip2'] / 65536) ; while($sseg <= $eseg) { $qstr = "INSERT INTO {$cfg['Tbl']['IpRanges']} (Type, Code, IpSeg, StartIp, EndIp)" . " VALUES(" . DBQuote($rirtype) . "," . DBQuote($fields['cc']) . "," . DBQuote($sseg) . "," . DBQuote($fields['ip1']) . "," . DBQuote($fields['ip2']) . ")" ; DBQuery($dbh, $qstr) ; $linecount ++ ; $sseg ++ ; } } $qstr = "UNLOCK TABLES" ; DBQuery($dbh, $qstr, true) ; if ($linecount) { $qstr = "OPTIMIZE TABLE {$cfg['Tbl']['IpRanges']}" ; DBQuery($dbh, $qstr) ; } return $linecount ; } #--------- function GetCountry ($dbh, &$cfg, $ipccserv, $ldom){ $url = $ipccserv . "?get=country&dom=$ldom" ; list($content) = GetHttpPage($url) ; $qstr = "LOCK TABLES {$cfg['Tbl']['IpRangeNames']} WRITE" ; DBQuery($dbh, $qstr, true) ; $linecount = 0 ; foreach (explode("\n", $content) as $line) { $fields = explode ("|", $line) ; if ($fields[0] == '***Translate***') break ; if (count($fields)<2 || strlen($fields[0]) != 2) continue ; # Here do the database store thing if ($linecount == 0) { $qstr = "DELETE FROM {$cfg['Tbl']['IpRangeNames']}" . " WHERE STRCMP(Code,'AA')>=0 AND STRCMP(Code,'ZZ')<=0" ; DBQuery($dbh, $qstr) ; } list($cname) = explode(",", $fields[1]) ; $qstr = "INSERT INTO {$cfg['Tbl']['IpRangeNames']} (Code, Name)" . " VALUES(" . DBQuote(strtoupper($fields[0])) . "," . DBQuote($cname) . ")" ; DBQuery($dbh, $qstr) ; $linecount ++ ; } $qstr = "UNLOCK TABLES" ; DBQuery($dbh, $qstr, true) ; if ($linecount) { $qstr = "OPTIMIZE TABLE {$cfg['Tbl']['IpRangeNames']}" ; DBQuery($dbh, $qstr) ; } return $linecount ; } #--------- function GetRirUpdates ($ipccserv, $ldom){ $url = $ipccserv . "?get=items&dom=$ldom" ; list($content) = GetHttpPage($url) ; $updates = array() ; foreach (explode("\n", $content) as $val) { $fields = explode("|", $val) ; if (count($fields) >= 3) $updates[$fields[0]] = array($fields[1], $fields[2], 0) ; } return $updates ; } #--------- function ReadRirUpdates ($instdir){ $updates = array() ; $fname = FullPath('rirupdates.txt', $instdir) ; if ($fdesc = @fopen($fname, 'rt')) { while($line = fgets($fdesc,1024)) { $line = rtrim($line) ; $fields = explode("|", $line) ; if (count($fields) >= 3) $updates[$fields[0]] = array($fields[1], $fields[2], $fields[3]) ; } fclose($fdesc) ; } return $updates ; } #--------- function WriteRirUpdates (&$updates, $instdir){ $fname = FullPath('rirupdates.txt', $instdir) ; if ($fdesc = @fopen($fname, 'wt') ) { foreach ($updates as $key => $value) { fwrite($fdesc, "$key|$value[0]|$value[1]|$value[2]\n") ; } fclose($fdesc) ; } } #--------- function ReadUpdates ($instdir){ $fchunk = '' ; $fname = FullPath('updates.txt', $instdir) ; if ($fdesc = @fopen($fname, 'rb')) { while(strlen($line = fread($fdesc,1024))) $fchunk .= $line ; fclose($fdesc) ; } return parseUpdateChunk ($fchunk) ; } #--------- function WriteUpdates (&$updates, $instdir){ $update_field_sep = '#%' ; $update_rec_sep = '%#' ; $fname = FullPath('updates.txt', $instdir) ; if ($fdesc = @fopen($fname, 'wt') ) { foreach ($updates as $key => $value) { fwrite($fdesc, implode($update_field_sep, array($key, $value['desc'], $value['date']))) ; fwrite($fdesc, $update_rec_sep) ; } fclose($fdesc) ; } } #--------- function parseUpdateChunk ($ustr){ $update_field_sep = '#%' ; $update_rec_sep = '%#' ; if (strpos($ustr, $update_rec_sep) === false) { return array() ; }else { $updates = array() ; foreach (explode($update_rec_sep, $ustr) as $urec ) { $fields = explode($update_field_sep, $urec) ; if (count($fields)>=3) $updates[$fields[0]] = array('desc' => $fields[1] , 'date' => $fields[2]) ; } return $updates ; } } #--------- function getAsrepUpdate ($url) { $i=0 ; do{ list($resp, $respheader) = GetHttpPage($url) ; $asrep_md5h = '' ; $asrep_satus = '' ; if (isset($respheader) && is_array($respheader)){ foreach ($respheader as $h) { if (substr(strtolower($h), 0, 21) == 'asrep-update-status: ') $asrep_satus = substr(strtolower($h), 21) ; if (substr(strtolower($h), 0, 18) == 'asrep-update-md5: ') $asrep_md5h = substr(strtolower($h), 18) ; } } $md5h = strtolower(md5($resp)) ; } while ((strlen($asrep_satus)==0 || $md5h != $asrep_md5h) && ++$i < 5) ; return array($resp, $asrep_satus, $md5h == $asrep_md5h) ; } #--------- function updateURL ($k, $d, $v, $f=NULL){ return "http://www.asrep.com/cgi-bin/s/updateserv.pl" . "?k=" . urlencode($k) . "&d=" . urlencode($d) . "&v=" . urlencode($v) . "&s=php" . ($f ? "&f=" . urlencode($f) : '') ; } #--------- End of admin.php -------------- ?>