yes Diego25 I did try your code...
The_Igel i am sure its an error with the new lines of code, because everything else was working exactly the way i wanted it to until put the new code in. Plus if i comment it out it works fine...
See i would attach the full code so you guys can see it all but just wont fit on here.... Ahhh what the hell here goes.....
This is the second page after the form....
<?PHP
/********************************************************************************************************
* *
* testnote2new.php *
* *
* Called from: ./extranet.php *
* *
* Logic: *
* 1. get addresses and store in $to *
* 2. write all form data to file *
* 3. put the form data into another file with ^ at the beginning of each line *
* 4. pipe that file into aspell *
* 5. process the results: *
* if * - spelled correctly *
* if & - spelled wrong, there is suggestions *
* if # - spelled wrong, no suggestions *
* 6. call send.php and pass all relevent information *
* *
* Special requirements: aspell / pspell must be installed in /usr/local/bin *
* *
* *
********************************************************************************************************/
/***************************DECLARE SOME (SCRIPT) GLOBAL VARIABLES**************************************/
$COUNTER = 0; //this variable holds the number of hidden text boxes that correspond to the corrections.
//build the actual form array, to be used later
$formarray = array( "Issue", "Impact", "Start Time", "End Time", "Work Around", "Resolution", "Ticket", "Contact" );
$filename = "/space/webstuff/finaltest/temp.txt"; //name of file that does not have the carrats
$filename2 = "/space/webstuff/finaltest/testfile2.txt"; //name of file that gets the carrats
$my_message = ""; //holds the actual body of the message that is goign to be sent.
/***************************************GET THE ADDRESSES***********************************************/
//GET THE ADDRESSES SELECTED IN THE ADDRESS BOX
@$address = $HTTP_POST_VARS['address'];
if( isset($address) && $address != "" ){
// check for the array
$i=0;
$to = "";
while($i<count($address)){
if( $i == count($address) - 1 ){
$to .= "$address[$i]";
}else{
$to .= "$address[$i], ";
}
$i=$i+1;
}
}else{
//didn't select any addresses!
echo "Need to select at least one address! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
/************************************WRITE THE DATA TO FILE********************************************/
//DO SOME ERROR CHECKING AND DO NOT PROCEED IF ALL FIELDS ARE NOT FILLED IN
@$issue = $HTTP_POST_VARS['issue'];
if( ! isset($issue) || $issue == "" ){
echo "Please fill in the ISSUE field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
@$impact = $HTTP_POST_VARS['impact'];
if( ! isset($impact) || $impact == "" ){
echo "Please fill in the IMPACT field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
@$starttime = $HTTP_POST_VARS['starttime'];
if( ! isset($starttime) || $starttime == "" ){
echo "Please fill in the START TIME field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
@$endtime = $HTTP_POST_VARS['endtime'];
if( ! isset($endtime) || $endtime == "" ){
echo "Please fill in the END TIME field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
@$workaround = $HTTP_POST_VARS['workaround'];
if( ! isset($issue) || $issue == "" ){
echo "Please fill in the WORKAROUND field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
@$resolution = $HTTP_POST_VARS['resolution'];
if( ! isset($resolution) || $resolution == "" ){
echo "Please fill in the RESOLUTION field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
@$ticket = $HTTP_POST_VARS['ticket'];
if( ! isset($ticket) || $ticket == "" ){
echo "Please fill in the TICKET field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
@$contact = $HTTP_POST_VARS['contact'];
if( ! isset($contact) || $contact == "" ){
echo "Please fill in the TICKET field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
@$agent = $HTTP_POST_VARS['agent'];
if( ! isset($agent) || $agent == "" ){
echo "Please fill in the AGENT field! <FORM>
<INPUT TYPE=\"BUTTON\" NAME=\"GOBACK\" VALUE=\"Go Back\" OnClick=\"history.go(-1)\">
</FORM>";
die();
}
//Make sure file exists. If not, create it (later...)
if( ! file_exists( $filename ) ){
die( "$filename does not exist. Aborting." );
}
//WRITE THE FORM DATA TO FILE
$fp = fopen( $filename, 'w');
fwrite( $fp, $issue . "\n" );
fwrite( $fp, $impact . "\n" );
fwrite( $fp, $starttime . "\n" );
fwrite( $fp, $endtime . "\n" );
fwrite( $fp, $workaround . "\n" );
fwrite( $fp, $resolution . "\n" );
fwrite( $fp, $ticket . "\n" );
fwrite( $fp, $contact );
fclose( $fp);
/****************************APPEND A CARRAT TO THE BEGINNING OF EACH LINE****************************/
//APPEND A ^ TO EACH LINE (ASPELL SPECIFIC)
unset($fp);
//Make sure file exists. If not, create it (later...)
if( ! file_exists( $filename2 ) ){
die( "$filename2 does not exist. Aborting." );
}
$fp = fopen( $filename2, 'w');
fwrite( $fp, "^" . $issue . "\n" );
fwrite( $fp, "^" . $impact . "\n" );
fwrite( $fp, "^" . $starttime . "\n" );
fwrite( $fp, "^" . $endtime . "\n" );
fwrite( $fp, "^" . $workaround . "\n" );
fwrite( $fp, "^" . $resolution . "\n" );
fwrite( $fp, "^" . $ticket . "\n" );
fwrite( $fp, "^" . $contact );
fclose( $fp);
/***************************RUN THE ASPELL COMMAND ON $FILENAME2************************************/
$aspellcommand= "cat $filename2 | /usr/local/bin/aspell -a -H";
$return= shell_exec($aspellcommand);
/****************************PROCESS THE OUTPUT OF ASPELL*******************************************/
$textarray = array( $issue, $impact, $starttime, $endtime, $workaround, $resolution, $ticket, $contact );
$returnarray= explode("\n",$return); //explode the output of aspell
//build the beginning and end of the body
$body_beg = "
<html>
<head>
<title>S3 Outage Notification</title>
</head>
<body>
<form action=\"send.php\" Method=\"POST\">
<table align=center bgcolor=\"#FFFFFF\" width=\"600\" border=\"0\">
<tr>
<td><div align=center><img src=\"extranet-outage.gif\" width=\"560\" height=\"200\" alt=\"\" border=\"0\"><br><br>
</td>
</tr>
<tr>
<td>
//issue resolved feild
$check = @$HTTP_POST_VARS["resolved"];
if ( ! isset($check) || $check == "" ){
$body_beg . = "Issue Has Been Resolved";
}
</td>
</tr>
<tr>
<td>";
$my_message .= $body_beg;
$return_count = count( $returnarray );
$text_count = count( $textarray ); //textarray is actually the array with the LINES
$current_line = 0; //intidcated what line in text array we ar looking at
//tokenize the first line of $textarray
$tokens = explode( " ", $textarray[$current_line] );
$previous_word = ""; //holds the previous correction,if any.
$my_message .= "<b><i><font color=#0368C6>";
$my_message .= $formarray[$current_line];
$my_message .= "</font></i></b><br>";
for( $i = 1; $i < $return_count - 2; $i++ ){ //begin at 1 because we will ignore line 0
if( $returnarray[$i] == "*" ){
//word is spelled correctly, do nothing and continue.
continue;
}
if( substr( $returnarray[$i], 0, 1 ) == "&" ){
//echo "word is misspelled and there are corrections.<br>";
$correction= explode(" ",$returnarray[$i] ); //the array where the corrections are kept
$correction_count = count( $correction );
//strip the commas off the suggestions...
for( $j = 4; $j < $correction_count - 1; $j++ ){
$correction[$j] = trim( $correction[$j], "," );
}