run("SELECT cfg, val FROM config"); foreach($query as $res){ $_config[$res['cfg']]=trim($res['val']); } if($_config['maintenance']==1) api_err("under-maintenance"); if(file_exists("tmp/db-update")){ $res=unlink("tmp/db-update"); if($res){ require_once("include/schema.inc.php"); exit; } } if($_config['dbversion']<2) exit; if($_config['testnet']==true) $_config['coin'].="-testnet"; $hostname=(!empty($_SERVER['HTTPS'])?'https':'http')."://".$_SERVER['HTTP_HOST']; if($_SERVER['SERVER_PORT']!=80&&$_SERVER['SERVER_PORT']!=443) $hostname.=":".$_SERVER['SERVER_PORT']; if($hostname!=$_config['hostname']&&$_SERVER['HTTP_HOST']!="localhost"&&$_SERVER['HTTP_HOST']!="127.0.0.1"&&$_SERVER['hostname']!='::1'&&php_sapi_name() !== 'cli'){ $db->run("UPDATE config SET val=:hostname WHERE cfg='hostname' LIMIT 1",array(":hostname"=>$hostname)); $_config['hostname']=$hostname; } if(empty($_config['hostname'])||$_config['hostname']=="http://"||$_config['hostname']=="https://") api_err("Invalid hostname"); $t=time(); if($t-$_config['sanity_last']>$_config['sanity_interval']&& php_sapi_name() !== 'cli') system("php sanity.php &>>/dev/null &"); ?>