Location: PHPKode > projects > SQLite PHP Admin > spa/lic.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

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

require_once('include.php');

if(isset($_POST['name'])) {
	$tar = $_POST;
	$tar['errn'] = $tar['errl'] = $tar['errs'] = '';
	while(true) {
		if(strlen($_POST['name']) < 2) { $tar['errn'] = 1; break; }
		if(strlen($_POST['loc']) < 2) { $tar['errl'] = 1; break; }
		$tar['errs'] = SaveLicence();
		break;
	}
}
die(design_render('misc/lic',$tar));

function SaveLicence() {
	$licar = array('data'=> date('Y-m-d'),'lic'=>1,'name'=>$_POST['name'],'loc'=>$_POST['loc']);
	$fstr = $licar['data'].$licar['lic'].$licar['name'].$licar['loc'];
	$licar['crc32'] = crc32($fstr);
	$sar = serialize($licar);
	$sar = gzcompress($sar);
	$fp = fopen(LIC_FILE,'wb');
	if(!fwrite($fp,$sar)) return 'Error writing '.LIC_FILE.'! Please check write permissions for the current directory';
	fclose($fp);
	$tar['file'] = LIC_FILE;
	die(design_render('misc/licent',$tar));
}
Return current item: SQLite PHP Admin