<?php
require_once "includes/common.inc.php";

if(checksubmit('postlink')) {
		$linksite=trim($linksite);
		$email = trim($email);
		$linkurl = trim($linkurl);
		if(empty($linksite)){
			msg('link_sitename_empty');
		}
		if(strlen($linksite) > 15) {
			msg('nachen_too_long');
		}


		if(empty($linkurl)  ||  !isurl($linkurl)) {
			msg('link_url_empty');
		}
		if(!empty($linklogo) &&  !isurl($linklogo)) {
			msg('link_logo_unaccepted');
		}

		if(strlen($linknote) >80){
			msg('link_note_too_long');
		}
		$linksite=htmlconvert($linksite);
		//$linkurl=htmlconvert($linkurl);
		$linknote=htmlconvert($linknote);
		//$logo=htmlconvert($logo);
		$db -> query("INSERT INTO {$tablepre}links  (linksite, linkurl, linknote, logo, postime) VALUES ('$linksite', '$linkurl', '$linknote', '$logo', '$time')");
		msg('thanks', mreferer());
}else{
	$useseccode && $seccode = random(4, 1);	
	$referer = mreferer();
	include theme('link');
}
?>