Here's a copy of the flat file funtion of the scripts:
if ($Action == "F" or $Action == "EF" or $Action == "DF"){
while (list ($key, $val) = each ($_FILE))
{
if ($key != "Settings" and $key != "Refresh")
{
$val = stripslashes($val);
$val = str_replace('"','"',$val);
$val = strip_tags($val);
$key = ucfirst($key);
$key = str_replace("_"," ",$key);
$FileData .= "$key: $val\r\n";
}
}
$FileData .= "Received: " . $Time . "\r\nIP: " . $IPAddress . "\r\n" . $FileData . "\r\n========================================\r\n\r\n";
$handle = @fopen($FlatFile,'a');
@flock($handle,LOCK_EX);
@fwrite($handle,$FileData);
@flock($handle,LOCK_UN);
@fclose($handle);
} // END OF ACTION
There is also a second settings.php file for easy manipulation, although not so easy for me. This is what I've done with that portion.
# FLAT-FILE SETTING
$FlatFile = "/mmex/ID.txt"
Also, I CHMOD to 666 for this file.
I am using this script as a form processor. I am attempting to generate a unique Order ID for each form submission. The form is sent in HTML to a specified email address with the Subject line being: Web Order - 1000. A second form submission would be sent to the same email address, although this time the subject line would be: Web Order - 1001. And so on.
I don't need to do anything with the number sequence, other than be certain that the numbers do not duplicate.
These will be in my inbox and I would access these form submissions from there.
>>>>> I have had marginal success with a flatfile. I have the information being sent to the file, although nothing yet on how to get the code to read that last number it generated and forcing it to generate the next incremental number.
I almost there, please help me get over this hump.
php random vs sequential numbers
Moderator: General Moderators