- open(CONF, "+<$memberfile") or $self->error("$memberfile : $!");
-
- @config = <CONF>;
-
- seek(CONF, 0, 0);
- truncate(CONF, 0);
-
- while ($line = shift @config) {
- if ($line =~ /^\[$self->{login}\]/) {
- $newmember = 0;
- last;
- }
- print CONF $line;
- }
-
- # remove everything up to next login or EOF
- while ($line = shift @config) {
- last if ($line =~ /^\[/);
- }
-
- # this one is either the next login or EOF
- print CONF $line;
-
- while ($line = shift @config) {
- print CONF $line;
- }
-
- print CONF qq|[$self->{login}]\n|;
-
- if ((($self->{dbpasswd} ne $self->{old_dbpasswd}) || $newmember)
- && $self->{root}) {
- $self->{dbpasswd} = pack 'u', $self->{dbpasswd};
- chop $self->{dbpasswd};
- }
- if (defined($self->{new_password})) {
- if ($self->{new_password} ne $self->{old_password}) {
- $self->{password} = crypt $self->{new_password},
- substr($self->{login}, 0, 2)
- if $self->{new_password};
- }
- } else {
- if ($self->{password} ne $self->{old_password}) {
- $self->{password} = crypt $self->{password}, substr($self->{login}, 0, 2)
- if $self->{password};
- }
- }
-
- if ($self->{'root login'}) {
- @config = ("password");
- } else {
- @config = &config_vars;
- }
-
- # replace \r\n with \n
- map { $self->{$_} =~ s/\r\n/\\n/g } qw(address signature);
- foreach $key (sort @config) {
- print CONF qq|$key=$self->{$key}\n|;
+ if (!$login) {
+ my $query = qq|INSERT INTO employee (login, name, workphone, role) VALUES (?, ?, ?, ?)|;
+ do_query($form, $dbh, $query, ($self->{login}, $myconfig->{name}, $myconfig->{tel}, "user"));