I have a database with IDs, username, password, site description, etc...
What I want is to according to a user entry modify his information. I tried the following code:
$found = 0;
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = split(/\|/,$_);
if ($data[1] eq "$in{'usuario'}") {
if ($data[6] eq "$in{'senha'}") {
$temp_data = join ("\|",$data[0],$data[1],$in{'url'},$in{'banner'},$in{'nome'},$in{'email'},$data[6],$data[7],$in{'descricao'},$data[9],$data[10],$data[11]);
$temp_data .= "\n"; $found = '1'; $new_data .= $temp_data;}
else { &site_html_add_failure ("Senha incorreta"); exit; }
}
else { $new_data .= @data; }
if ($found) { last LINE; }
}
close DB;
But with this, when the routine find the username, it modifies it but all the information that comes after this line is lost.
What to do know???
What I want is to according to a user entry modify his information. I tried the following code:
Code:
open (DB, "<$arq_membros") or &cgierr("Erro em modificar em cadastrar.cgi. Impossível abrir arquivos db: $arq_membros. Motivo: $!"); $found = 0;
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = split(/\|/,$_);
if ($data[1] eq "$in{'usuario'}") {
if ($data[6] eq "$in{'senha'}") {
$temp_data = join ("\|",$data[0],$data[1],$in{'url'},$in{'banner'},$in{'nome'},$in{'email'},$data[6],$data[7],$in{'descricao'},$data[9],$data[10],$data[11]);
$temp_data .= "\n"; $found = '1'; $new_data .= $temp_data;}
else { &site_html_add_failure ("Senha incorreta"); exit; }
}
else { $new_data .= @data; }
if ($found) { last LINE; }
}
close DB;
But with this, when the routine find the username, it modifies it but all the information that comes after this line is lost.
What to do know???