Page 2 of 2
Posted: Wed Jan 19, 2005 10:41 pm
by feyd
the entire section of code that uses $ID needs to be moved to after $num is set up with the file.. way down the script.
I don't have the energy to walk you through all the changes that may be necessary, mostly because of the volume of code in that script.. which contains zero functions.. I haven't seen code like that in years..
Posted: Wed Jan 19, 2005 11:19 pm
by skydivelouie
I thought I already submitted this...but didn't see it after I rebooted...
This script is designed for newbies like me...I understand you are used to more complicated scripts...although I am not...This script was written into subsections in order for idiots like me to attempt to make simple modifications...You have offered substantial help and I do appreciate it...
I believe there are only 2 sections in this code that are preventing my from accomplishing my sequential numbering code...one of which you have helped SUBSTANTIALLY...Thank You...
This portion seems to tell the $ID where to begin counting...
Code: Select all
#===========================================================
# ADJUST A FEW VARIABLES
#===========================================================
$ID = $num;
for ($x=0;$x<count($EMAIL);$x++){
if ($EMAILї$x]) $SendFrom = $EMAILї$x];}
if (!$SendFrom)
$SendFrom = $Recipient;
$_EMAIL = $_POST;
$_HTML = $_POST;
$_SQL = $_POST;
$_CSV = $_POST;
$_FILE = $_POST;
$_AUTO = $_POST;
$AttachmentField = explode(",",$AttachmentFields);
$x=0;
foreach ($AttachmentField as $ThisAttachment)
{
$ATTACHї$x]ї0] = $_FILESї$ThisAttachment]ї'name'];
$ATTACHї$x]ї1] = $_FILESї$ThisAttachment]ї'tmp_name'];
$x++;
}
if ($SMTPServer)
{
ini_set('SMTP',$SMTPServer);
ini_set('sendfrom_mail',$Recipient);
}
And this is the portion where you helped out substantially...
Code: Select all
#########################################################################
# FLAT-FILE FUNCTIONS #
#########################################################################
if ($Action == "F" or $Action == "EF" or $Action == "DF"){
$seqfile = 'ID.txt';
if(!file_exists($seqfile))
$num = 100;
else
$num = intval(file_get_contents($seqfile)) + 1;
$fp = fopen($seqfile, 'w');
fwrite($fp, $num);
fclose($fp);
// send the form's data
$handle = @fopen($FlatFile,'a');
@flock($handle,LOCK_EX);
@fwrite($handle,$FileData);
@flock($handle,LOCK_UN);
@fclose($handle);
} // END OF ACTION
I believe the answer to what I'm trying to acomplish is within these 2 portions of code...you seem to be the one who has the most consistent and successful answers...
I appreciate your help thusfar...this is so close to being accomplished I can't give up now...If you choose to help me I would truly be grateful...
Posted: Thu Jan 20, 2005 12:07 am
by feyd
roughly, code block 1 needs to come after code block 2.
code blocks 1 and 2 are references to your last post.
Posted: Thu Jan 20, 2005 1:29 am
by skydivelouie
I switched them around in the code...I received the same results...
Posted: Thu Jan 20, 2005 1:49 am
by feyd
k... delete this
Code: Select all
$seqfile = 'ID.txt';
if(!file_exists($seqfile))
$num = 100;
else
$num = intval(file_get_contents($seqfile)) + 1;
$fp = fopen($seqfile, 'w');
fwrite($fp, $num);
fclose($fp);
and put this
Code: Select all
$seqfile = 'ID.txt';
if(!file_exists($seqfile))
$ID = 100;
else
$ID = intval(file_get_contents($seqfile)) + 1;
$fp = fopen($seqfile, 'w');
fwrite($fp, $ID);
fclose($fp);
after the code from "choose action", and before "email functions" section.
I seriously hope that takes care of it..

Posted: Thu Jan 20, 2005 2:39 am
by skydivelouie
Dude...you...are...a...freakin'...GENIUS!!!...
I can't thank you enough...
Your genius far exceeds what I feel I could offer in gratitude...Thank you...Exponentially...!!!...
I am still curious as to why the number continues to grow from 10000...to which is currently at 10022...even though I've changed the beginning number from what I see as a point of reference to 100 and then 1000...it seems to increase in the same increments...
http://www.skydivelouie.com/mmex/ID.txt
I don't know if this is something I did or what...
Ya know...whatever...you have set me leaps and bounds beyond where I was earlier in the day...
I continue to value your advice...
Thank You...
Posted: Thu Jan 20, 2005 2:45 am
by feyd
the part where it adds 1, is what keeps the increment moving at the correct rate, whether you start it at -500000 or 10..
Posted: Thu Jan 20, 2005 2:55 am
by skydivelouie
I am exhausted for the night...I can't think anymore...
I will post again tomorrow AM...quite possibly PM...
I do sincerely appreciate your help...you are a PHP genius...
Thanks again...my personal email is hidden...
Feel free to contact whenever for whatever...
TTYS...
Posted: Fri Jan 21, 2005 2:58 am
by skydivelouie
Thanks again Feyd...
Appreciated...