Gossamer Forum
Home : Products : DBMan : Installation :

Error when opening a file

Quote Reply
Error when opening a file
Hello,

Here is my problem...
In db.cgi I have added the following in the signup sub:

At the end of the sub (before the &html_signup_success call)

Code:
open (SAVEPASS, ">>$save_password") &cgierr ("unable to open: $save_password. \n Reason: $!");
if ($db_use_flock) {
flock(SAVEPASS, 2) or &cgierr("unable to get exclusive lock on $save_password.\nReason: $!");
}
print SAVEPASS "Userid: $in{'userid'}\n";
print SAVEPASS "Pass: $in{'pw'}\n";
print SAVEPASS "Email: $in{'e-mail'}\n\n";
close SAVEPASS;
$save_password is a variable in the .cfg file containing the name of the file where I want to store the username, unencrypted password and e-mail.

The error I get is this:

Code:
CGI ERROR
==========================================
Error Message : unable to open: d:\Web\fasttrack\scripts\dbman\save_password.pass.
Reason: No such file or directory
Script Location : d:/Web/fasttrack/scripts/dbman/db.pl
Perl Version : 5.00502
Setup File : Jaime.cfg

Form Variables
-------------------------------------------
db : Jaime
e-mail :
pw : edddd
signup : Create
uid :
userid : test

Environment Variables
-------------------------------------------
CONTENT_LENGTH : 58
CONTENT_TYPE : application/x-www-form-urlencoded
GATEWAY_INTERFACE : CGI/1.1
HTTPS : OFF
HTTP_ACCEPT : image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
HTTP_ACCEPT_CHARSET : iso-8859-1,*,utf-8
HTTP_ACCEPT_LANGUAGE: en
HTTP_CONNECTION : Keep-Alive
HTTP_COOKIE : SITESERVER=ID=84c2ca6a9236ce4246b27013ffb4ddd0
HTTP_HOST : sepjora.sep.domain.se
HTTP_REFERER : http://sepjora.sep.domain.se/scripts/dbman\db.pl
HTTP_USER_AGENT : Mozilla/4.01 [en] (WinNT; I)
PATH : d:\web\perl\bin;C:\WINNT\system32;C:\WINNT;C:\Dmi\Win32\Bin;C:\WINNT\system32\nls\ENGLISH;m:\sqlbase
REMOTE_ADDR : 164.48.111.21
REMOTE_HOST : 164.48.111.21
REQUEST_METHOD : POST
SCRIPT_NAME : /scripts/dbman/db.pl
SERVER_NAME : sepjora.sep.domain.se
SERVER_PORT : 80
SERVER_PROTOCOL : HTTP/1.0
SERVER_SOFTWARE : Netscape-FastTrack/3.01
SERVER_URL : http://sepjora.sep.domain.se
SYSTEMROOT : C:\WINNT

No such file or directory??? Why??? The code right above it does exactly the same thing but with the regular password file.

What am I missing...?

Cheers
-JO
Quote Reply
Re: Error when opening a file In reply to
How did you define $save_password?

Also, try creating a 0 byte file as append may not create the file for you..

Cheers,

Alex
Quote Reply
Re: Error when opening a file In reply to
Could it be as simple as the difference between the / and the \ ?


------------------
JPD
Quote Reply
Re: Error when opening a file In reply to
Hi JPD, Alex

Thanks for your help...

This morning I found out what was wrong with my code...

I am missing an or in my OPEN line...

open (SAVEPASS, ">>$save_password") or &cgierr ("unable to open: $save_password.\nReason: $!");

It is always a small thing...

Thanks again...

-JO