#!/usr/bin/perl
# EasyHost
# Built by CyberScript
# Website: http://www.cyberscript.net
# Email: rcampbell@cyberscript.net
# (C) Copyright 2001, All Rights Reserved.
#####################################################
# The following code may not be modified            #
# or redistributed by anyone other then CyberScript #
#####################################################

$pwd = ($0 =~ /^(.+)[\/\\]/)[0] || '.';
require ("$pwd/cs-lib.pl");

&prepare() if ($ENV{REQUEST_METHOD} eq 'POST');

print &ct("text/html").&display("payment");

exit (0);

sub prepare {
	&error("The username field is required","name") if (! ( $tokens{name}=lc($tokens{name}) ) );
	&error("The username field contains invalid characters","name") if ($tokens{name} !~ /^[\w\-]+$/);
	&error("The username you entered wasn't found in our database","name") if (!&user_exist($tokens{name}));

	&error("The package field is required","package") if (!$tokens{package});
	&error("The package field contains invalid characters","package") if ($tokens{package} !~ /^[\w\-\_]+$/);
	&error("The package you entered wasn't found in our database","package") if (!-f "$tokens{data_dir}/packages/$tokens{package}");

	&error("The interval field is required","interval") if (!$tokens{interval});
	&error("The interval field contains invalid characters","interval") if ($tokens{interval} !~ /^\d+$/);

	if (!$tokens{error_message}) {
		$tokens{c} = 'done';
	}
}