|
| A R C H I V E D M E S S A G E |
|
Subject: Datafile named others.dat not written to |
| Posted: 11/06/2003 at 11:47:23 pm |
| By: loh |
| Hi there,
everything works wondefully but just 1 problem :
i'musing the same script for few different forms and I need each form to write to its own datafile .. eg 1.dat, 2.dat, 3.dat
I placed these 3 ?.dat into my cgi-bin and insert the hidden tag <input type="hidden" name="datafile" value="?.dat"> on the respective forms (with ? representing the correct filename). But i cannot get the sript to write the results to it.
How should I configure the sript (not the form)? uncomment the $datafile{"1"} = "bizmail.dat"; $datafile{"2"} = ""; ?? Or what should I be doing?
| |
|
|
Subject: Re: Datafile named others.dat not written to |
| Posted: 11/07/2003 at 7:55:36 am |
| By: Seth Knorr |
| YOUR bizmail.dat file should look like:
$datafile{"1"} = "?.dat";
$datafile{"2"} = "?.dat";
$datafile{"3"} = "?.dat";
NO UN-COMMENTING NEEDED.
HOWEVER, all three data files ?.dat need to be chmoded to 777. or all read, write and executable.
This is the most common problem of why the data file is not written to properly.
This can sometimes also be a problem on Windows servers, due to non useablitity. If you are on a Windows server check with your host.
Seth | |
|
|
Subject: Re: Datafile named others.dat not written to |
| Posted: 11/07/2003 at 8:07:42 am |
| By: Seth Knorr |
| Actualy now that I think about this the easiest way to fix this problem is by using the "outputfile" hidden field for making sure that all data is added to the data file and "sort" to make sure all data in your form is emailed to you:
<input type="hidden" name="outputfile" value="field1,field2,field3,field4,etc">
<input type="hidden" name="sort" value="field1,field2,field3,field4,etc">
These fields should contain all data you want sent respectively.
Seth | |
|
|
Subject: Re: Datafile named others.dat not written to |
| Posted: 11/09/2003 at 2:51:07 pm |
| By: loh |
| I ran across the same issue - and found the culprit. The code is expecting an index to an array of .dat filenames, rather then an actual filename.
FIX #1 (my preference)
in bizmail.cgi change:
if ($formdata{'datafile'}) {
$FORM_datafile = "$formdata{'datafile'}";
$ctrfile=$datafile{"$FORM_datafile"}; ## choosing an index in an array ##
}else{
$ctrfile=$datafile{"1"};
}
to:
if ($formdata{'datafile'}) {
$ctrfile = $formdata{'datafile'};
}else{
$ctrfile=$datafile{"1"};
}
This fix offers the flexibility of creating new .dat files as they become necessary, without the need to change the .cgi code. Multiple .dat files, all exportable into ACT, provide a huge advantage of bizmail over comparable scripts.
FIX #2
add other .dat filenames to the array
$datafile{"1"} = "bizmail.dat";
$datafile{"2"} = "more.dat";
$datafile{"3"} = "foo.dat";
$datafile{"4"} = "spam.dat";
and use
<input type="hidden" name="datafile" value="2"> ## or 3, or 4, etc. ##
Sincerely,
Drew Burns
General Manager (and still IT geek)
Goblin Fern Press, Inc.
www.GoblinFernPress.com | |
|
|
Subject: Re: Datafile named others.dat not written to |
| Posted: 11/11/2003 at 7:41:07 am |
| By: Seth Knorr |
| The previous post will work, however the problem with that is that visitors will know where your data file is
located which could be bad if you don't want hackers attempting to hack at it.
The "DATA FILE" field works as it is supposed to it was just not updated on the readme file for version 9. This was an oversight on my behalf.
If you read the new updated readme file on this web site, you will see the instructions of how it works.
However to re-explain below is that portion of the readme file.
#######################
# IN BIZMAIL.CGI EDIT
#######################
# $datafile{""}
# Simply enter all the posible datafiles you want to send form data to.
# Example Config:
$datafile{"1"} = "bizmail.dat";
$datafile{"2"} = "secondfile.dat";
$datafile{"3"} = "etc.dat";
# Example: if you want to use bizmail.dat as your data file:
# Then format the "datafile" field on the form as follows:
# <input name="datafile" type="hidden" value="1">
# -OR- if you want to use secondfile.dat as your data file:
# Then format the "datafile" field on the form as follows:
# <input name="datafile" type="hidden" value="2">
# Note, you can have as many datafile entries as you would like in bizmail.cgi
#######################
ON YOUR FORM CONFIGURE
-----------------------
<!----- "datafile" is another optional field and only needs to be in the form if
you don't want your data to be added to the bizmail.dat file. If you want your data
sent to another file simply enter the file name ex: to write to file datafile.dat
enter value="datafile.dat" In this scenario you would need to create a blank file
named datafile.dat and upload to the same directory as bizmail.dat ----->
<input type="hidden" name="datafile" value="1">
-OR-
<input type="hidden" name="datafile" value="2">
-OR-
<input type="hidden" name="datafile" value="3">
etc...
-----------------------
Thanks, For the notice of error.
Seth | |
|
|