2007-10-11 23:47:13 +00:00
|
|
|
require "functions.pl";
|
2007-10-10 21:48:12 +00:00
|
|
|
|
|
|
|
#initialize session data
|
|
|
|
CGI::Session->name($session_name);
|
|
|
|
$query = new CGI;
|
|
|
|
$session = new CGI::Session;
|
|
|
|
|
2007-10-29 15:00:40 +00:00
|
|
|
@userinfo = get_userinfo_from_sid($session->id);
|
2007-10-27 09:17:30 +00:00
|
|
|
|
2007-10-29 15:00:40 +00:00
|
|
|
@page = get_page_array(@userinfo);
|
2007-10-27 09:17:30 +00:00
|
|
|
|
|
|
|
#check if user is logged in
|
|
|
|
if($username)
|
|
|
|
{
|
|
|
|
$page->{'message'}->{'type'} = "error";
|
|
|
|
$page->{'message'}->{'text'} = "error_already_registered";
|
2007-11-02 12:12:44 +00:00
|
|
|
|
2007-12-17 18:55:33 +00:00
|
|
|
print output_page();
|
2007-10-27 09:17:30 +00:00
|
|
|
}
|
2007-10-10 21:48:12 +00:00
|
|
|
#if username and password are passed put them into the database
|
2007-10-29 08:48:51 +00:00
|
|
|
elsif($query->param('user') and $query->param('pass') and $query->param('pass_repeat'))
|
2007-10-11 17:26:39 +00:00
|
|
|
{
|
2007-10-29 08:48:51 +00:00
|
|
|
if($query->param('pass') eq $query->param('pass_repeat'))
|
|
|
|
{
|
|
|
|
#do query
|
2007-10-29 08:54:16 +00:00
|
|
|
$dbh->do(qq{insert into users (username, password, timestamp, locale) values ( ?, password( ? ), unix_timestamp(), ?)}, undef,
|
2007-10-29 08:48:51 +00:00
|
|
|
$query->param("user"), $query->param("pass"), $page->{'locale'}) or die $dbh->errstr;
|
2007-11-02 12:12:44 +00:00
|
|
|
|
|
|
|
print $query->redirect("index.pl?information=information_registered");
|
2007-10-29 08:48:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$page->{'registerform'} = [''];
|
|
|
|
$page->{'message'}->{'type'} = "error";
|
|
|
|
$page->{'message'}->{'text'} = "error_passwords_do_not_match";
|
2007-11-02 12:12:44 +00:00
|
|
|
|
2007-12-17 18:55:33 +00:00
|
|
|
print output_page();
|
2007-10-29 08:48:51 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-29 15:00:40 +00:00
|
|
|
elsif(not $query->param('user') and ($query->param('pass') or $query->param('pass_repeat')))
|
2007-10-29 08:48:51 +00:00
|
|
|
{
|
|
|
|
$page->{'registerform'} = [''];
|
|
|
|
$page->{'message'}->{'type'} = "error";
|
|
|
|
$page->{'message'}->{'text'} = "error_insert_username";
|
2007-11-02 12:12:44 +00:00
|
|
|
|
2007-12-17 18:55:33 +00:00
|
|
|
print output_page();
|
2007-10-29 08:48:51 +00:00
|
|
|
}
|
2007-10-29 15:00:40 +00:00
|
|
|
elsif(not $query->param('pass') and ($query->param('user') or $query->param('pass_repeat')))
|
2007-10-29 08:48:51 +00:00
|
|
|
{
|
|
|
|
$page->{'registerform'} = [''];
|
|
|
|
$page->{'message'}->{'type'} = "error";
|
|
|
|
$page->{'message'}->{'text'} = "error_insert_password";
|
2007-11-02 12:12:44 +00:00
|
|
|
|
2007-12-17 18:55:33 +00:00
|
|
|
print output_page();
|
2007-10-29 08:48:51 +00:00
|
|
|
}
|
2007-10-29 15:00:40 +00:00
|
|
|
elsif(not $query->param('pass_repeat') and ($query->param('user') or $query->param('pass')))
|
2007-10-29 08:48:51 +00:00
|
|
|
{
|
|
|
|
$page->{'registerform'} = [''];
|
|
|
|
$page->{'message'}->{'type'} = "error";
|
|
|
|
$page->{'message'}->{'text'} = "error_repeat_password";
|
2007-11-02 12:12:44 +00:00
|
|
|
|
2007-12-17 18:55:33 +00:00
|
|
|
print output_page();
|
2007-10-11 17:26:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-10-27 09:17:30 +00:00
|
|
|
$page->{'registerform'} = [''];
|
2007-11-02 12:12:44 +00:00
|
|
|
|
2007-12-17 18:55:33 +00:00
|
|
|
print output_page();
|
2007-11-02 12:12:44 +00:00
|
|
|
}
|