[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Coposys-dev] Et bien sûr...
From: |
Francois TOURDE |
Subject: |
[Coposys-dev] Et bien sûr... |
Date: |
Wed, 25 Jul 2001 03:01:34 +0200 |
... comme d'habitude, j'ai oublié de mettre le fichier joint !!!
Pffff
--
François TOURDE - tourde.org - 23 rue Bernard GANTE - 93250 VILLEMOMBLE
Tél: 01 49 35 96 69 - Mob: 06 81 01 81 80
eMail: mailto:address@hidden - URL: http://francois.tourde.org/
*** coposys.in Wed Jul 25 02:48:20 2001
--- coposys.in.new Wed Jul 25 02:45:49 2001
***************
*** 58,79 ****
start_form,
" Full Name ", textfield('name'), "\n ", p,
"Password ",
! password_field(-name=>'password',-size=>'8',-maxlength=>8), "\n ", p,
! "Password (again) ",
! password_field(-name=>'password2',-size=>8,-maxlength=>8), "\n ", p,
"Latitude ", textfield('latitude'), "\n ", p,
"Longitude ", textfield('longitude'), "\n ", p,
! hidden(-name=>'community'), "\n ",
! hidden(-name=>'date',-default=>$date), "\n",
" Email", textfield('email'), "\n ", p,
! submit(-name=>'add'), "\n",
end_form, "\n\n";
}
sub display_list_form {
print start_form, "\n ",
! hidden(-name=>'community'), "\n ",
! submit(-name=>'refresh'), "\n",
end_form, "\n";
}
--- 58,80 ----
start_form,
" Full Name ", textfield('name'), "\n ", p,
"Password ",
! password_field({name=>'password',size=>'8',maxlength=>8}), "\n ", p,
! "Password (again for add, blank for update) ",
! password_field({name=>'password2',size=>8,maxlength=>8}), "\n ", p,
"Latitude ", textfield('latitude'), "\n ", p,
"Longitude ", textfield('longitude'), "\n ", p,
! hidden({name=>'community'}), "\n ",
! hidden({name=>'date',default=>$date}), "\n",
" Email", textfield('email'), "\n ", p,
! submit({name=>'add'}), "\n",
! submit({name=>'update'}), "\n",
end_form, "\n\n";
}
sub display_list_form {
print start_form, "\n ",
! hidden({name=>'community'}), "\n ",
! submit({name=>'refresh'}), "\n",
end_form, "\n";
}
***************
*** 95,105 ****
--- 96,195 ----
html_error('Missing argument !');
}
}
+ if ( param('update') ) {
+ if (
+ param('name') &&
+ param('password') &&
+ !param('password2') &&
+ param('latitude') &&
+ param('longitude') &&
+ param('email') &&
+ param('community')
+ )
+ {
+ update_name();
+ }
+ else {
+ html_error('Missing argument or password entered twice for update
!');
+ }
+ }
elsif ( param('delete') ) {
delete_name();
}
}
+ sub update_name {
+ my ($latitude, $longitude, $name, $password, $date, $email);
+
+ load_config();
+
+ # check if the name already exists..
+ if (!defined $people{param('name')} ) {
+ html_error(param('name') . ' I don\'t know you. Please register
first.');
+ }
+
+ # Check if password is correct...
+ my $crypted_passwd = (split /,/ , $people{param('name')})[3];
+
+ # get the salt from crypted_passwd
+ my $salt = $crypted_passwd;
+ $salt =~ s/^(..).*/$1/;
+
+ # and check for good pass...
+ if (crypt (param('password'), $salt) ne $crypted_passwd) {
+ html_error('Incorrect password !');
+ return;
+ }
+
+ # check if latitude is valid
+ unless ( param('latitude') =~ /^[\d\+\-\.]+$/ ) {
+ html_error('Invalid latitude: The format is +-DDD.DDDDDDDDDDDDDDD. ' .
+ 'This is the format programs like xearth use and the ' .
+ 'format that many positioning web sites use. However ' .
+ 'typically the precision is limited to 4 or 5 decimals.');
+ return;
+ }
+
+ # check if longitude is valid
+ unless ( param('longitude') =~ /^[\d\+\-\.]+$/ ) {
+ html_error('Invalid longitude: The format is +-DDD.DDDDDDDDDDDDDDD. ' .
+ 'This is the format programs like xearth use and the ' .
+ 'format that many positioning web sites use. However ' .
+ 'typically the precision is limited to 4 or 5 decimals.');
+ return;
+ }
+
+ # Now, write marker file with modifications
+ unless (open (CFG, ">$filename")) {
+ html_error("Unable to open marker file ($filename) !");
+ print end_html;
+ die;
+ }
+
+ foreach my $name (keys %people) {
+
+ if ($name eq param('name')) {
+ # the new value... No check is made, but it's not a good idea...
+ print CFG param('latitude') . ' ' . param('longitude') .' "' .
$name . '" #' .
+ $crypted_passwd . ',' . localtime() . ',' . param('email') . "\n";
+ next;
+ }
+
+ ($latitude, $longitude, $crypted_passwd, $date, $email) =
+ (split /,/ , $people{$name})[0,1,3,4,5];
+
+ print CFG $latitude . ' '
+ . $longitude . ' "'
+ . $name . '" #' .
+ $crypted_passwd . ',' .
+ $date . ',' .
+ $email . "\n";
+
+ }
+ close CFG;
+
+ }
+
sub add_name {
load_config();
***************
*** 190,199 ****
print " <td>\n " . start_form, " ",
"password: ",
! password_field(-name=>'del_password',-size=>8,-maxlength=>8), "\n ",
! hidden(-name=>'community'), "\n ",
! hidden(-name=>'name', -default=>$key), "\n ",
! submit(-name=>'delete'), "\n ",
end_form, "\n </td>\n";
print " </tr>\n";
--- 280,289 ----
print " <td>\n " . start_form, " ",
"password: ",
! password_field({name=>'del_password',size=>8,maxlength=>8}), "\n ",
! hidden({name=>'community'}), "\n ",
! hidden({name=>'name', default=>$key}), "\n ",
! submit({name=>'delete'}), "\n ",
end_form, "\n </td>\n";
print " </tr>\n";
- [Coposys-dev] Et bien sûr...,
Francois TOURDE <=