3 # $Id: register.cgi,v 1.3 2000-03-03 05:29:24 ivan Exp $
6 use vars qw( #$freeside_bin $freeside_test $freeside_conf
7 $datasrc $user $pass $x
15 #use CGI::Carp qw(fatalsToBrowser);
21 $ENV{'PATH'} ='/usr/local/bin:/usr/bin:/usr/ucb:/bin';
22 $ENV{'SHELL'} = '/bin/sh';
23 $ENV{'IFS'} = " \t\n";
26 $ENV{'BASH_ENV'} = '';
28 #$freeside_bin = '/home/freeside/bin/';
29 #$freeside_test = '/home/freeside/test/';
30 #$freeside_conf = '/usr/local/etc/freeside/';
32 $datasrc = 'DBI:mysql:http_auth';
36 ##my(@pw_set)= ( 'a'..'z', 'A'..'Z', '0'..'9', '(', ')', '#', '!', '.', ',' );
37 ##my(@pw_set)= ( 'a'..'z', 'A'..'Z', '0'..'9' );
38 #@pw_set = ( 'a'..'z', '0'..'9' );
39 #@saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' );
45 $username = $cgi->param('username');
46 $username =~ /^\s*([a-z][\w]{0,15})\s*$/i
47 or &idiot("Illegal username. Please use 1-16 alphanumeric characters, and start your username with a letter.");
50 $email = $cgi->param('email');
51 $email =~ /^([\w\-\.\+]+\@[\w\-\.]+)$/
52 or &idiot("Illegal email address.");
57 #$user_pw = join('',map($pw_set[ int(rand $#pw_set) ], (0..7) ) );
58 #$crypt_pw = crypt($user_pw,$saltset[int(rand(64))].$saltset[int(rand(64))]);
62 local $SIG{HUP} = 'IGNORE';
63 local $SIG{INT} = 'IGNORE';
64 local $SIG{QUIT} = 'IGNORE';
65 local $SIG{TERM} = 'IGNORE';
66 local $SIG{TSTP} = 'IGNORE';
67 local $SIG{PIPE} = 'IGNORE';
71 $dbh = DBI->connect( $datasrc, $user, $pass, {
72 'AutoCommit' => 'true',
73 } ) or die "DBI->connect error: $DBI::errstr\n";
74 $x = $DBI::errstr; #silly; to avoid "used only once" warning
76 $sth = $dbh->prepare("INSERT INTO mysql_auth VALUES (". join(", ",
77 $dbh->quote($username),
79 # $dbh->quote($crypt_pw),
81 $dbh->quote('freeside'),
82 $dbh->quote('unconfigured'),
85 $sth->execute or &idiot("Username in use: ". $sth->errstr);
87 $dbh->disconnect or die $dbh->errstr;
96 <TITLE>Freeside demo registration successful</TITLE>
98 <BODY BGCOLOR="#FFFFFF">
102 <img border=0 alt="Silicon Interactive Software Design" src="http://www.sisd.com/freeside/small-logo.gif">
104 <center><font color="#ff0000" size=7>freeside demo registration successful</font></center>
107 <P>Your sample database has been setup. Your password and the URL for the
108 Freeside demo have been emailed to you.
117 print $cgi->header, <<END;
120 <TITLE>Registration error</TITLE>
122 <BODY BGCOLOR="#FFFFFF">
124 <H4>Registration error</H4>
127 <P>Hit the <I>Back</I> button in your web browser, correct this mistake,
128 and submit the form again.