Location: PHPKode > projects > SQLite PHP Admin > spa/info.php
<?php
/***********************************************************************

		Copyright (c) 2011, Andrew V. Pleshakov	(hide@address.com)
		All rights reserved.

		This file is part of SPA (SQLite PHP Admin)
		See file LICENSE.txt for details

************************************************************************/

if(isset($_POST['newloc'])) { // change localization
	setcookie('spa_loc',$_POST['newloc'],time()+7776000);
	$_COOKIE['spa_loc'] = $_POST['newloc'];
}

require_once('include.php');

//////////////////////////  INFO BODY /////////////////////
if(function_exists('sqlite_libversion')) $tar['sq2ver'] = sqlite_libversion();
else $tar['sq2ver'] = 'not available';
if(doubleval(phpversion()) >= 5.3) {
	$sq3verA = SQLite3::version();
	$tar['sq3ver'] = $sq3verA['versionString'];
}
else $tar['sq3ver'] = 'not available';
$tar['phpver'] = phpversion();
$tar['ip'] = my_ip();
$tar['host'] = gethostbyaddr($tar['ip']);
$tar['path'] = getcwd();
$tar['yip'] = $_SERVER['REMOTE_ADDR'];
$tar['yhost'] = gethostbyaddr($tar['yip']);
$tar['ua'] = $_SERVER['HTTP_USER_AGENT'];

$tar['curloc'] = $LOC_;

FindLicence();
if($LIC['lic'])	$tar['lic'] = design_render('extra/lic',$LIC);
else $tar['lic'] = design_render('extra/nolic');

die(design_render('info',$tar));

function my_ip($dest='64.0.0.0', $port=80) {
	$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
	socket_connect($socket, $dest, $port);
	socket_getsockname($socket, $addr, $port);
	socket_close($socket);
	return $addr;
}

function list_locs($cur_loc) { // list localizations
	clearstatcache();
	$locs = array();
	$s = '';
   $dh = opendir('tpl');
	if(!$dh) return '';
    while (($file = readdir($dh)) !== false)
		if ($file[0] != '.' && is_dir('tpl/'.$file))
			$locs[] = $file;

	if(!count($locs)) return '';
	foreach($locs as $val) {
		$s .= "\t\t\t\t<option value=\"{$val}\"";
		if($cur_loc == $val) $s .= ' selected="selected"';
		$s .= ">{$val}</option>\n";
	}
	$rr['opts'] = $s;
	return design_render('extra/locs',$rr);
}
Return current item: SQLite PHP Admin