This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
OK - more details for the CGI/cygwin problem (doesn't print all my HTML & Javascript to screen)
- From: "John McAllister" <john dot mcallister at castlewebsolutions dot com>
- To: <cygwin at cygwin dot com>
- Date: Tue, 18 Feb 2003 13:38:32 -0000
- Subject: OK - more details for the CGI/cygwin problem (doesn't print all my HTML & Javascript to screen)
Hello again,
I guess my earlier message was either ignored or people didn't know what I
was talking about. I didn't want to post all my code, because I don't think
the problem lies within the code (the exact same cgi program works on the
Red Hat UNIX client/server enviroment that it was created in). I was just
trying to find out if it was a common problem ie. that an application that
works perfectly well on UNIX does not when transferred to cygwin.
I'll try to keep this brief:
<---
if (strcmp(cgi_request, "h")==0)
{ insert_js("/home/John
McAllister/website/javascript/js_validation.txt");
populate_fields();
}
--->
OK - I simply call two functions if the correct request type is posted.
--->
void insert_js(char *file_name)
{ FILE *fp;
char buffer[65536];
int res;
fp = fopen(file_name, "r");
if(fp == NULL)
{ printf("Unable to open file for input\n<BR>");
exit(1);
}
res = fread(buffer, 1, 65536, fp);
buffer[res] = '\0';
fclose(fp);
strcpy(global_buff, buffer);
}
-->
So, the js_validation.txt javasript file (which contains the necessary
<SCRIPT> tags) is read into a file. It is then copied to a global buffer
variable - (char global_buff[65536];).
The populate_fields function popualtes select boxes from a mysql database.
The headers are printed using the printe_headers function, which takes in a
buffer (the js_validation.txt - javascript), the footers also have a
function. There are 11 select boxes to populate, but I'll only show you
one - becuase the others are all the same.
<--
void populate_fields(void)
{
int i;
player_item *pi;
void print_headers(char *js_buff);
void print_footers(void);
print_headers(global_buff);
printf("<TABLE WIDTH='100%' BORDER='0'>");
printf("<FORM NAME='ff_player_lists' METHOD='POST'
ACTION='http://www.john.com/cgi-bin/f
fl'>");
pi = populate_linked_list(); -- takes values from mysql table and
inserts in linked-list --
printf("<TR><TD COLSPAN=10 ALIGN='CENTER'><H2>Pick Your
Team</H2></TD></TR>");
/* GK Row */
printf("<TR><TD COLSPAN=10 ALIGN='CENTER'>");
printf("<SELECT NAME='gk'>");
printf("<OPTION VALUE='0'>Choose a Goalkeeper</OPTION>");
for(pi=player_1; pi != NULL; pi=pi->next)
{ if(strcmp(pi->position, "GK") == 0)
{ printf("<OPTION VALUE='%d'>%s (%s) %s</OPTION>", pi->id, pi->name,
pi->club, pi->v
alue);
}
}
printf("</SELECT>");
printf("</TD></TR>");
--continues in this vain ---
--- end of table ---
printf("</TABLE>");
printf("<P>");
printf("<INPUT TYPE='Hidden' NAME='cgi_req'>");
printf("<INPUT TYPE='SUBMIT' VALUE='Submit'
ONCLICK='return(retrieve_values_selected(thi
s.form));'>");
printf("</FORM>");
print_footers();
-->
Thats basically it. The only code I haven't inclued is the code that is used
to popualte the linked list from the mysql table - but this works, so theres
no point in including it.
The result I get back is this:
<---
<HTML>
<HEAD>
<TITLE>
</TITLE>
<SCRIPT LANGUAGE='JAVASCRIPT'>
<!--
function roundFloat(number,noOfPlaces)
{
if(isNaN(number))
{ alert("Error calculating totals has occurred")
number = 0;
}
val =
(Math.round(number*Math.pow(10,noOfPlaces)))/Math.pow(10,noOfPlaces);
return(val);
}
function check_selected_fields(idx, field)
{ var temp_str, position;
temp_str = field.options[idx].value;
pos = field.name;
switch (pos)
{ case 'gk': position = 'Goalkeeper'; break;
case 'fb_1': position = 'Fullback'; break;
case 'fb_2': position = 'Fullback'; break;
case 'cb_1': position = 'Centre-Back'; break;
case 'cb_2': position = 'Centre-Back'; break;
case 'mf_1': position = 'Midfielder'; break;
case 'mf_2': position = 'Midfielder'; break;
case 'mf_3': position = 'Midfielder'; break;
case 'st_1': position = 'Striker'; break;
case 'st_2': position = 'Striker'; break;
case 'st_3': position = 'Striker'; break;
}
if(temp_str == '0')
{ alert('You have not selected a player for position ' + '\''
+position+'\'');
return(false);
}
return(true);
}
function parse_players(idx, field)
{
var temp_str;
var stringArray = new Array;
var double_name;
var double_club;
var index_pos;
var temp_sub;
var temp_str_len, sub_length, sub_length_2;
var temp_char_pos;
var ch;
temp_str = field.options[idx].text;
temp_str_len = temp_str.length;
/* Search for ' ' */
if(temp_str.indexOf(' ') != -1)
{ index_pos = temp_str.indexOf(' ')+1;
if(temp_str.charAt(index_pos) == '(')
{ double_name = false;
}
else
{ double_name = true;
}
}
sub_length = temp_str_len - index_pos;
temp_sub = temp_str.substr(index_pos+1, sub_length);
if(temp_sub.indexOf(' ') != -1)
{ temp_char_pos = temp_sub.indexOf(' ')+1;
ch = temp_sub.charAt(temp_char_pos);
if(( ch < '0') || (ch > '9'))
{ double_club = true;
}
if((( ch < 'a') || (ch > 'z')) &&
(( ch < 'A') || (ch > 'Z')))
{ double_club = false;
}
if(( ch == '('))
{ sub_length_2 = temp_str_len - temp_char_pos;
temp_sub_2 = temp_sub.substr(temp_char_pos, sub_length_2);
if(temp_sub_2.indexOf(' ') != -1)
{ temp_char_pos_2 = temp_sub_2.indexOf(' ')+1;
ch_2 = temp_sub_2.charAt(temp_char_pos_2);
if(( ch_2 < '0') || (ch_2 > '9'))
{ double_club = true;
}
if((( ch_2 < 'a') || (ch_2 > 'z')) &&
(( ch_2 < 'A') || (ch_2 > 'Z')))
{ double_club = false;
}
}
}
}
var separator = ' ';
temp_str = temp_str.replace("(", "");
temp_str = temp_str.replace(")", "");
stringArray = temp_str.split(separator);
if((double_name == true)&&(double_club == true))
{ stringArray[0] = stringArray[0] + ' ' + stringArray[1];
stringArray[1] = stringArray[2] + ' ' + stringArray[3];
stringArray[2] = stringArray[4];
stringArray[3] = "empty";
stringArray[4] = "empty";
}
if((double_name == true) && (double_club == false))
{ stringArray[0] = stringArray[0] + ' ' + stringArray[1];
stringArray[1] = stringArray[2];
stringArray[2] = stringArray[3];
stringArray[3] = "empty";
}
if((double_name == false) && (double_club == true))
{ stringArray[0] = stringArray[0];
stringArray[1] = stringArray[1] + ' ' + stringArray[2];
stringArray[2] = stringArray[3];
stringArray[3] = "empty";
}
return(stringArray);
}
function check_total_spent(total)
{ if(total > 50)
{ alert('You have spent too much!');
return(false);
}
return(true);
}
function check_clubs(club_count, club)
{ if(club_count > 2)
{ alert('You have selected more than 2 players from ' + club);
return(false);
}
return(true);
}
function check_clubs_rule(clubsArray)
{ var flag = 0;
var arsenal_count = 0;
var chelsea_count = 0;
var leeds_count = 0;
var manutd_count = 0;
var liverpool_count = 0;
var newcastle_count = 0;
for(i=0; i < 11; i++)
{ if(clubsArray[i] == 'Arsenal')
{ arsenal_count++; }
if(clubsArray[i] == 'Chelsea')
{ chelsea_count++; }
if(clubsArray[i] == 'Leeds')
{ leeds_count++; }
if(clubsArray[i] == 'Manchester United')
{ manutd_count++; }
if(clubsArray[i] == 'Liverpool')
{ liverpool_count++; }
if(clubsArray[i] == 'Newcastle')
{ newcastle_count++; }
}
if(!check_clubs(arsenal_count, 'Arsenal'))
{ return(false);
}
if(!check_clubs(chelsea_count, 'Chelsea'))
{ return(false);
}
if(!check_clubs(leeds_count, 'Leeds'))
{ return(false);
}
if(!check_clubs(manutd_count, 'Manchester United'))
{ return(false);
}
if(!check_clubs(liverpool_count, 'Liverpool'))
{ return(false);
}
if(!check_clubs(newcastle_count, 'Newcastle'))
{ return(false);
}
return(true);
}
function check_player_rule(playersArray)
{ for(i=0; i < 11; i++)
{ for(j=i+1; j < 11; j++)
{ if(playersArray[i] == playersArray[j])
{ alert('You can only select ' +playersArray[i]+ ' once!');
return(false);
}
}
}
return(true);
}
function retrieve_values_selected(myForm)
{ gk_select_idx = document.ff_player_lists.gk.selectedIndex;
fb_1_select_idx = document.ff_player_lists.fb_1.selectedIndex;
fb_2_select_idx = document.ff_player_lists.fb_2.selectedIndex;
cb_1_select_idx = document.ff_player_lists.cb_1.selectedIndex;
cb_2_select_idx = document.ff_player_lists.cb_2.selectedIndex;
mf_1_select_idx = document.ff_player_lists.mf_1.selectedIndex;
mf_2_select_idx = document.ff_player_lists.mf_2.selectedIndex;
mf_3_select_idx = document.ff_player_lists.mf_3.selectedIndex;
st_1_select_idx = document.ff_player_lists.st_1.selectedIndex;
st_2_select_idx = document.ff_player_lists.st_2.selectedIndex;
st_3_select_idx = document.ff_player_lists.st_3.selectedIndex;
idx_array = new Array (gk_select_idx, fb_1_select_idx, cb_1_select_idx,
cb_2_select_idx, fb_2_select_idx, mf_1_select_idx, mf_2_select_idx,
mf_3_select_idx, st_1_select_idx, st_2_select_idx, st_3_select_idx);
field_array = new Array (document.ff_player_lists.gk,
document.ff_player_lists.fb_1,
document.ff_player_lists.cb_1, document.ff_player_lists.cb_2,
document.ff_player_lists.fb_2, document.ff_player_lists.mf_1,
document.ff_player_lists.mf_2, document.ff_player_lists.mf_3,
document.ff_player_lists.st_1, document.ff_player_lists.st_2,
document.ff_player_lists.st_3);
var temp_gk = new Array;
var temp_fb_1 = new Array;
var temp_fb_2 = new Array;
var temp_cb_1 = new Array;
var temp_cb_2 = new Array;
var temp_mf_1 = new Array;
var temp_mf_2 = new Array;
var temp_mf_3 = new Array;
var temp_st_1 = new Array;
var temp_st_2 = new Array;
var temp_st_3 = new Array;
var valuesArray = new Array;
var clubsArray = new Array;
var playersArray = new Array;
var count;
var selected_ok = true;
myForm = document.ff_player_lists;
for (i=0; i <= idx_array.length; i++)
{ count = 1;
count = count + i;
if(count == 1)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_gk = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 2)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_fb_1 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 3)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_cb_1 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 4)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_cb_2 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 5)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_fb_2 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 6)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_mf_1 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 7)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_mf_2 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 8)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_mf_3 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 9)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_st_1 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 10)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_st_2 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 11)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_st_3 = parse_players(idx_array[i], field_array[i]);
}
}
}
valuesArray[0] = temp_gk[2];
valuesArray[1] = temp_fb_1[2];
valuesArray[2] = temp_cb_1[2];
valuesArray[3] = temp_cb_2[2];
valuesArray[4] = temp_fb_2[2];
valuesArray[5] = temp_mf_1[2];
valuesArray[6] = temp_mf_2[2];
valuesArray[7] = temp_mf_3[2];
valuesArray[8] = temp_st_1[2];
valuesArray[9] = temp_st_2[2];
valuesArray[10] = temp_st_3[2];
clubsArray[0] = temp_gk[1];
clubsArray[1] = temp_fb_1[1];
clubsArray[2] = temp_cb_1[1];
clubsArray[3] = temp_cb_2[1];
clubsArray[4] = temp_fb_2[1];
clubsArray[5] = temp_mf_1[1];
clubsArray[6] = temp_mf_2[1];
clubsArray[7] = temp_mf_3[1];
clubsArray[8] = temp_st_1[1];
clubsArray[9] = temp_st_2[1];
clubsArray[10] = temp_st_3[1];
playersArray[0] = temp_gk[0];
playersArray[1] = temp_fb_1[0];
playersArray[2] = temp_cb_1[0];
playersArray[3] = temp_cb_2[0];
playersArray[4] = temp_fb_2[0];
playersArray[5] = temp_mf_1[0];
playersArray[6] = temp_mf_2[0];
playersArray[7] = temp_mf_3[0];
playersArray[8] = temp_st_1[0];
playersArray[9] = temp_st_2[0];
playersArray[10] = temp_st_3[0];
total = 0.0;
//adds player values
for(i=0; i< 11; i++)
{ temp_value = parseFloat(valuesArray[i]);
total = total + temp_value;
}
total_1 = roundFloat(total,
--> (end of the output)
But on the UNIX environment I get the desired result:
<--
<HTML>
<HEAD>
<TITLE>
</TITLE>
<SCRIPT LANGUAGE='JAVASCRIPT'>
<!--
function roundFloat(number,noOfPlaces)
{
if(isNaN(number))
{ alert("Error calculating totals has occurred")
number = 0;
}
val =
(Math.round(number*Math.pow(10,noOfPlaces)))/Math.pow(10,noOfPlaces);
return(val);
}
function check_selected_fields(idx, field)
{ var temp_str, position;
temp_str = field.options[idx].value;
pos = field.name;
switch (pos)
{ case 'gk': position = 'Goalkeeper'; break;
case 'fb_1': position = 'Fullback'; break;
case 'fb_2': position = 'Fullback'; break;
case 'cb_1': position = 'Centre-Back'; break;
case 'cb_2': position = 'Centre-Back'; break;
case 'mf_1': position = 'Midfielder'; break;
case 'mf_2': position = 'Midfielder'; break;
case 'mf_3': position = 'Midfielder'; break;
case 'st_1': position = 'Striker'; break;
case 'st_2': position = 'Striker'; break;
case 'st_3': position = 'Striker'; break;
}
if(temp_str == '0')
{ alert('You have not selected a player for position ' + '\''
+position+'\'');
return(false);
}
return(true);
}
function parse_players(idx, field)
{
var temp_str;
var stringArray = new Array;
var double_name;
var double_club;
var index_pos;
var temp_sub;
var temp_str_len, sub_length, sub_length_2;
var temp_char_pos;
var ch;
temp_str = field.options[idx].text;
temp_str_len = temp_str.length;
/* Search for ' ' */
if(temp_str.indexOf(' ') != -1)
{ index_pos = temp_str.indexOf(' ')+1;
if(temp_str.charAt(index_pos) == '(')
{ double_name = false;
}
else
{ double_name = true;
}
}
sub_length = temp_str_len - index_pos;
temp_sub = temp_str.substr(index_pos+1, sub_length);
if(temp_sub.indexOf(' ') != -1)
{ temp_char_pos = temp_sub.indexOf(' ')+1;
ch = temp_sub.charAt(temp_char_pos);
if(( ch < '0') || (ch > '9'))
{ double_club = true;
}
if((( ch < 'a') || (ch > 'z')) &&
(( ch < 'A') || (ch > 'Z')))
{ double_club = false;
}
if(( ch == '('))
{ sub_length_2 = temp_str_len - temp_char_pos;
temp_sub_2 = temp_sub.substr(temp_char_pos, sub_length_2);
if(temp_sub_2.indexOf(' ') != -1)
{ temp_char_pos_2 = temp_sub_2.indexOf(' ')+1;
ch_2 = temp_sub_2.charAt(temp_char_pos_2);
if(( ch_2 < '0') || (ch_2 > '9'))
{ double_club = true;
}
if((( ch_2 < 'a') || (ch_2 > 'z')) &&
(( ch_2 < 'A') || (ch_2 > 'Z')))
{ double_club = false;
}
}
}
}
var separator = ' ';
temp_str = temp_str.replace("(", "");
temp_str = temp_str.replace(")", "");
stringArray = temp_str.split(separator);
if((double_name == true)&&(double_club == true))
{ stringArray[0] = stringArray[0] + ' ' + stringArray[1];
stringArray[1] = stringArray[2] + ' ' + stringArray[3];
stringArray[2] = stringArray[4];
stringArray[3] = "empty";
stringArray[4] = "empty";
}
if((double_name == true) && (double_club == false))
{ stringArray[0] = stringArray[0] + ' ' + stringArray[1];
stringArray[1] = stringArray[2];
stringArray[2] = stringArray[3];
stringArray[3] = "empty";
}
if((double_name == false) && (double_club == true))
{ stringArray[0] = stringArray[0];
stringArray[1] = stringArray[1] + ' ' + stringArray[2];
stringArray[2] = stringArray[3];
stringArray[3] = "empty";
}
return(stringArray);
}
function check_total_spent(total)
{ if(total > 50)
{ alert('You have spent too much!');
return(false);
}
return(true);
}
function check_clubs(club_count, club)
{ if(club_count > 2)
{ alert('You have selected more than 2 players from ' + club);
return(false);
}
return(true);
}
function check_clubs_rule(clubsArray)
{ var flag = 0;
var arsenal_count = 0;
var chelsea_count = 0;
var leeds_count = 0;
var manutd_count = 0;
var liverpool_count = 0;
var newcastle_count = 0;
for(i=0; i < 11; i++)
{ if(clubsArray[i] == 'Arsenal')
{ arsenal_count++; }
if(clubsArray[i] == 'Chelsea')
{ chelsea_count++; }
if(clubsArray[i] == 'Leeds')
{ leeds_count++; }
if(clubsArray[i] == 'Manchester United')
{ manutd_count++; }
if(clubsArray[i] == 'Liverpool')
{ liverpool_count++; }
if(clubsArray[i] == 'Newcastle')
{ newcastle_count++; }
}
if(!check_clubs(arsenal_count, 'Arsenal'))
{ return(false);
}
if(!check_clubs(chelsea_count, 'Chelsea'))
{ return(false);
}
if(!check_clubs(leeds_count, 'Leeds'))
{ return(false);
}
if(!check_clubs(manutd_count, 'Manchester United'))
{ return(false);
}
if(!check_clubs(liverpool_count, 'Liverpool'))
{ return(false);
}
if(!check_clubs(newcastle_count, 'Newcastle'))
{ return(false);
}
return(true);
}
function check_player_rule(playersArray)
{ for(i=0; i < 11; i++)
{ for(j=i+1; j < 11; j++)
{ if(playersArray[i] == playersArray[j])
{ alert('You can only select ' +playersArray[i]+ ' once!');
return(false);
}
}
}
return(true);
}
function retrieve_values_selected(myForm)
{ gk_select_idx = document.ff_player_lists.gk.selectedIndex;
fb_1_select_idx = document.ff_player_lists.fb_1.selectedIndex;
fb_2_select_idx = document.ff_player_lists.fb_2.selectedIndex;
cb_1_select_idx = document.ff_player_lists.cb_1.selectedIndex;
cb_2_select_idx = document.ff_player_lists.cb_2.selectedIndex;
mf_1_select_idx = document.ff_player_lists.mf_1.selectedIndex;
mf_2_select_idx = document.ff_player_lists.mf_2.selectedIndex;
mf_3_select_idx = document.ff_player_lists.mf_3.selectedIndex;
st_1_select_idx = document.ff_player_lists.st_1.selectedIndex;
st_2_select_idx = document.ff_player_lists.st_2.selectedIndex;
st_3_select_idx = document.ff_player_lists.st_3.selectedIndex;
idx_array = new Array (gk_select_idx, fb_1_select_idx, cb_1_select_idx,
cb_2_select_idx, fb_2_select_idx, mf_1_select_idx, mf_2_select_idx,
mf_3_select_idx, st_1_select_idx, st_2_select_idx, st_3_select_idx);
field_array = new Array (document.ff_player_lists.gk,
document.ff_player_lists.fb_1,
document.ff_player_lists.cb_1, document.ff_player_lists.cb_2,
document.ff_player_lists.fb_2, document.ff_player_lists.mf_1,
document.ff_player_lists.mf_2, document.ff_player_lists.mf_3,
document.ff_player_lists.st_1, document.ff_player_lists.st_2,
document.ff_player_lists.st_3);
var temp_gk = new Array;
var temp_fb_1 = new Array;
var temp_fb_2 = new Array;
var temp_cb_1 = new Array;
var temp_cb_2 = new Array;
var temp_mf_1 = new Array;
var temp_mf_2 = new Array;
var temp_mf_3 = new Array;
var temp_st_1 = new Array;
var temp_st_2 = new Array;
var temp_st_3 = new Array;
var valuesArray = new Array;
var clubsArray = new Array;
var playersArray = new Array;
var count;
var selected_ok = true;
myForm = document.ff_player_lists;
for (i=0; i <= idx_array.length; i++)
{ count = 1;
count = count + i;
if(count == 1)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_gk = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 2)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_fb_1 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 3)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_cb_1 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 4)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_cb_2 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 5)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_fb_2 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 6)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_mf_1 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 7)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_mf_2 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 8)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_mf_3 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 9)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_st_1 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 10)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_st_2 = parse_players(idx_array[i], field_array[i]);
}
}
if(count == 11)
{ if(!check_selected_fields(idx_array[i], field_array[i]))
{ return(false);
}
else
{ temp_st_3 = parse_players(idx_array[i], field_array[i]);
}
}
}
valuesArray[0] = temp_gk[2];
valuesArray[1] = temp_fb_1[2];
valuesArray[2] = temp_cb_1[2];
valuesArray[3] = temp_cb_2[2];
valuesArray[4] = temp_fb_2[2];
valuesArray[5] = temp_mf_1[2];
valuesArray[6] = temp_mf_2[2];
valuesArray[7] = temp_mf_3[2];
valuesArray[8] = temp_st_1[2];
valuesArray[9] = temp_st_2[2];
valuesArray[10] = temp_st_3[2];
clubsArray[0] = temp_gk[1];
clubsArray[1] = temp_fb_1[1];
clubsArray[2] = temp_cb_1[1];
clubsArray[3] = temp_cb_2[1];
clubsArray[4] = temp_fb_2[1];
clubsArray[5] = temp_mf_1[1];
clubsArray[6] = temp_mf_2[1];
clubsArray[7] = temp_mf_3[1];
clubsArray[8] = temp_st_1[1];
clubsArray[9] = temp_st_2[1];
clubsArray[10] = temp_st_3[1];
playersArray[0] = temp_gk[0];
playersArray[1] = temp_fb_1[0];
playersArray[2] = temp_cb_1[0];
playersArray[3] = temp_cb_2[0];
playersArray[4] = temp_fb_2[0];
playersArray[5] = temp_mf_1[0];
playersArray[6] = temp_mf_2[0];
playersArray[7] = temp_mf_3[0];
playersArray[8] = temp_st_1[0];
playersArray[9] = temp_st_2[0];
playersArray[10] = temp_st_3[0];
total = 0.0;
//adds player values
for(i=0; i< 11; i++)
{ temp_value = parseFloat(valuesArray[i]);
total = total + temp_value;
}
total_1 = roundFloat(total,1);
alert('Total =' + total_1);
if(!check_total_spent(total_1))
{ return(false);
}
if(check_clubs_rule(clubsArray) == false)
{ return(false);
}
if(!check_player_rule(playersArray))
{ return(false);
}
myForm.cgi_req.value = 'i';
myForm.submit();
return(false);
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<TABLE WIDTH='100%' BORDER='0'><FORM NAME='ff_player_lists' METHOD='POST'
ACTION='http://www.john.com/cgi-bin/ffl'><TR><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD></TR><TR><TD COLSPAN=10 ALIGN='CENTER'><H2>Pick
Your Team</H2></TD></TR><TR><TD COLSPAN=10 ALIGN='CENTER'><SELECT
NAME='gk'><OPTION VALUE='0'>Choose a Goalkeeper</OPTION><OPTION
VALUE='1'>Barthez (Manchester United) 5.5</OPTION><OPTION VALUE='2'>Seaman
(Arsenal) 5.5</OPTION><OPTION VALUE='3'>Dudek (Liverpool)
5.5</OPTION><OPTION VALUE='63'>Cudicini (Chelsea) 4.0</OPTION><OPTION
VALUE='64'>Given (Newcastle) 4.0</OPTION><OPTION VALUE='65'>Robinson (Leeds)
3.5</OPTION></SELECT></TD></TR><TR><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD><TD COLSPAN='2' ALIGN='CENTER'><SELECT
NAME='fb_1'><OPTION VALUE='0'>Choose a Fullback</OPTION><OPTION
VALUE='4'>Neville (Manchester United) 3.2</OPTION><OPTION VALUE='5'>Lauren
(Arsenal) 3.5</OPTION><OPTION VALUE='6'>Carragher (Liverpool)
3</OPTION><OPTION VALUE='7'>Silvestre (Manchester United) 4</OPTION><OPTION
VALUE='8'>Cole (Arsenal) 4</OPTION><OPTION VALUE='9'>Riise (Liverpool)
5</OPTION><OPTION VALUE='39'>Melchiot (Chelsea) 3.0</OPTION><OPTION
VALUE='40'>Le Saux (Chelsea) 3.5</OPTION><OPTION VALUE='41'>Hughes
(Newcastle) 2.0</OPTION><OPTION VALUE='42'>Griffin (Newcastle)
2.0</OPTION><OPTION VALUE='43'>Mills (Leeds) 3.5</OPTION><OPTION
VALUE='44'>Harte (Leeds) 4.0</OPTION></SELECT></TD><TD COLSPAN='2'
ALIGN='CENTER'><SELECT NAME='cb_1'><OPTION VALUE='0'>Choose a
Centre-Back</OPTION><OPTION VALUE='10'>Ferdinand (Manchester United)
4.5</OPTION><OPTION VALUE='11'>Keown (Arsenal) 3.5</OPTION><OPTION
VALUE='12'>Hyppia (Liverpool) 4</OPTION><OPTION VALUE='13'>Blanc (Manchester
United) 3.5</OPTION><OPTION VALUE='14'>Cygan (Arsenal) 3.5</OPTION><OPTION
VALUE='15'>Henchoz (Liverpool) 3.5</OPTION><OPTION VALUE='45'>Desailly
(Chelsea) 4.0</OPTION><OPTION VALUE='46'>Gallas (Chelsea)
4.0</OPTION><OPTION VALUE='47'>Bramble (Newcastle) 2.0</OPTION><OPTION
VALUE='48'>Dabizas (Newcastle) 3.0</OPTION><OPTION VALUE='49'>Woodgate
(Leeds) 4.5</OPTION><OPTION VALUE='50'>Matteo (Leeds)
4.0</OPTION></SELECT></TD><TD COLSPAN='2' ALIGN='CENTER'><SELECT
NAME='cb_2'><OPTION VALUE='0'>Choose a Centre-Back</OPTION><OPTION
VALUE='10'>Ferdinand (Manchester United) 4.5</OPTION><OPTION
VALUE='11'>Keown (Arsenal) 3.5</OPTION><OPTION VALUE='12'>Hyppia (Liverpool)
4</OPTION><OPTION VALUE='13'>Blanc (Manchester United) 3.5</OPTION><OPTION
VALUE='14'>Cygan (Arsenal) 3.5</OPTION><OPTION VALUE='15'>Henchoz
(Liverpool) 3.5</OPTION><OPTION VALUE='45'>Desailly (Chelsea)
4.0</OPTION><OPTION VALUE='46'>Gallas (Chelsea) 4.0</OPTION><OPTION
VALUE='47'>Bramble (Newcastle) 2.0</OPTION><OPTION VALUE='48'>Dabizas
(Newcastle) 3.0</OPTION><OPTION VALUE='49'>Woodgate (Leeds)
4.5</OPTION><OPTION VALUE='50'>Matteo (Leeds) 4.0</OPTION></SELECT></TD><TD
COLSPAN='2' ALIGN='CENTER'><SELECT NAME='fb_2'><OPTION VALUE='0'>Choose a
Fullback</OPTION><OPTION VALUE='4'>Neville (Manchester United)
3.2</OPTION><OPTION VALUE='5'>Lauren (Arsenal) 3.5</OPTION><OPTION
VALUE='6'>Carragher (Liverpool) 3</OPTION><OPTION VALUE='7'>Silvestre
(Manchester United) 4</OPTION><OPTION VALUE='8'>Cole (Arsenal)
4</OPTION><OPTION VALUE='9'>Riise (Liverpool) 5</OPTION><OPTION
VALUE='39'>Melchiot (Chelsea) 3.0</OPTION><OPTION VALUE='40'>Le Saux
(Chelsea) 3.5</OPTION><OPTION VALUE='41'>Hughes (Newcastle)
2.0</OPTION><OPTION VALUE='42'>Griffin (Newcastle) 2.0</OPTION><OPTION
VALUE='43'>Mills (Leeds) 3.5</OPTION><OPTION VALUE='44'>Harte (Leeds)
4.0</OPTION></SELECT></TD><TD WIDTH='10%'><IMG
SRC='/images/1pix.gif'></TD></TR><TR><TD COLSPAN='2'><IMG
SRC='/images/1pix.gif'><TD COLSPAN='2' ALIGN='CENTER'><SELECT
NAME='mf_1'><OPTION VALUE='0'>Choose a Midfielder</OPTION><OPTION
VALUE='16'>Beckham (Manchester United) 5.8</OPTION><OPTION
VALUE='17'>Ljungberg (Arsenal) 5.5</OPTION><OPTION VALUE='18'>Murphy
(Liverpool) 4.5</OPTION><OPTION VALUE='19'>Keane (Manchester United)
4</OPTION><OPTION VALUE='20'>Viera (Arsenal) 4</OPTION><OPTION
VALUE='21'>Hamann (Liverpool) 4</OPTION><OPTION VALUE='22'>Scholes
(Manchester United) 5.5</OPTION><OPTION VALUE='23'>Silva (Arsenal)
4</OPTION><OPTION VALUE='24'>Gerrard (Liverpool) 5</OPTION><OPTION
VALUE='25'>Giggs (Manchester United) 5.5</OPTION><OPTION VALUE='26'>Pires
(Arsenal) 5.5</OPTION><OPTION VALUE='27'>Smicer (Liverpool)
4</OPTION><OPTION VALUE='28'>Veron (Manchester United) 5</OPTION><OPTION
VALUE='29'>Parlour (Arsenal) 3.5</OPTION><OPTION VALUE='30'>Diao (Liverpool)
3.5</OPTION><OPTION VALUE='51'>Petit (Chelsea) 3.5</OPTION><OPTION
VALUE='52'>Lampard (Chelsea) 4.0</OPTION><OPTION VALUE='53'>Speed
(Newcastle) 2.0</OPTION><OPTION VALUE='54'>Dyer (Newcastle)
4.5</OPTION><OPTION VALUE='55'>Kewell (Leeds) 5.5</OPTION><OPTION
VALUE='56'>Barmby (Leeds) 3.0</OPTION></SELECT></TD><TD COLSPAN='2'
ALIGN='CENTER'><SELECT NAME='mf_2'><OPTION VALUE='0'>Choose a
Midfielder</OPTION><OPTION VALUE='16'>Beckham (Manchester United)
5.8</OPTION><OPTION VALUE='17'>Ljungberg (Arsenal) 5.5</OPTION><OPTION
VALUE='18'>Murphy (Liverpool) 4.5</OPTION><OPTION VALUE='19'>Keane
(Manchester United) 4</OPTION><OPTION VALUE='20'>Viera (Arsenal)
4</OPTION><OPTION VALUE='21'>Hamann (Liverpool) 4</OPTION><OPTION
VALUE='22'>Scholes (Manchester United) 5.5</OPTION><OPTION VALUE='23'>Silva
(Arsenal) 4</OPTION><OPTION VALUE='24'>Gerrard (Liverpool) 5</OPTION><OPTION
VALUE='25'>Giggs (Manchester United) 5.5</OPTION><OPTION VALUE='26'>Pires
(Arsenal) 5.5</OPTION><OPTION VALUE='27'>Smicer (Liverpool)
4</OPTION><OPTION VALUE='28'>Veron (Manchester United) 5</OPTION><OPTION
VALUE='29'>Parlour (Arsenal) 3.5</OPTION><OPTION VALUE='30'>Diao (Liverpool)
3.5</OPTION><OPTION VALUE='51'>Petit (Chelsea) 3.5</OPTION><OPTION
VALUE='52'>Lampard (Chelsea) 4.0</OPTION><OPTION VALUE='53'>Speed
(Newcastle) 2.0</OPTION><OPTION VALUE='54'>Dyer (Newcastle)
4.5</OPTION><OPTION VALUE='55'>Kewell (Leeds) 5.5</OPTION><OPTION
VALUE='56'>Barmby (Leeds) 3.0</OPTION></SELECT></TD><TD COLSPAN='2'
ALIGN='CENTER'><SELECT NAME='mf_3'><OPTION VALUE='0'>Choose a
Midfielder</OPTION><OPTION VALUE='16'>Beckham (Manchester United)
5.8</OPTION><OPTION VALUE='17'>Ljungberg (Arsenal) 5.5</OPTION><OPTION
VALUE='18'>Murphy (Liverpool) 4.5</OPTION><OPTION VALUE='19'>Keane
(Manchester United) 4</OPTION><OPTION VALUE='20'>Viera (Arsenal)
4</OPTION><OPTION VALUE='21'>Hamann (Liverpool) 4</OPTION><OPTION
VALUE='22'>Scholes (Manchester United) 5.5</OPTION><OPTION VALUE='23'>Silva
(Arsenal) 4</OPTION><OPTION VALUE='24'>Gerrard (Liverpool) 5</OPTION><OPTION
VALUE='25'>Giggs (Manchester United) 5.5</OPTION><OPTION VALUE='26'>Pires
(Arsenal) 5.5</OPTION><OPTION VALUE='27'>Smicer (Liverpool)
4</OPTION><OPTION VALUE='28'>Veron (Manchester United) 5</OPTION><OPTION
VALUE='29'>Parlour (Arsenal) 3.5</OPTION><OPTION VALUE='30'>Diao (Liverpool)
3.5</OPTION><OPTION VALUE='51'>Petit (Chelsea) 3.5</OPTION><OPTION
VALUE='52'>Lampard (Chelsea) 4.0</OPTION><OPTION VALUE='53'>Speed
(Newcastle) 2.0</OPTION><OPTION VALUE='54'>Dyer (Newcastle)
4.5</OPTION><OPTION VALUE='55'>Kewell (Leeds) 5.5</OPTION><OPTION
VALUE='56'>Barmby (Leeds) 3.0</OPTION></SELECT></TD><TD COLSPAN='2'><IMG
SRC='/images/1pix.gif'></TD></TR><TR><TD COLSPAN='2'><IMG
SRC='/images/1pix.gif'><TD COLSPAN='2' ALIGN='CENTER'><SELECT
NAME='st_1'><OPTION VALUE='0'>Choose a Striker</OPTION><OPTION
VALUE='31'>Van Nistelrooy (Manchester United) 9</OPTION><OPTION
VALUE='32'>Henry (Arsenal) 9</OPTION><OPTION VALUE='33'>Owen (Liverpool)
8.5</OPTION><OPTION VALUE='34'>Solskjaer (Manchester United)
7.8</OPTION><OPTION VALUE='35'>Heskey (Liverpool) 7.5</OPTION><OPTION
VALUE='36'>Bergkamp (Arsenal) 7.8</OPTION><OPTION VALUE='57'>Hasselbaink
(Chelsea) 9.0</OPTION><OPTION VALUE='58'>Zola (Chelsea) 5.0</OPTION><OPTION
VALUE='59'>Shearer (Newcastle) 8.5</OPTION><OPTION VALUE='60'>Bellamy
(Newcastle) 7.0</OPTION><OPTION VALUE='61'>Viduka (Leeds)
7.8</OPTION><OPTION VALUE='62'>Smith (Leeds) 7.5</OPTION><OPTION
VALUE='67'>Forlan (Manchester United) 6.5</OPTION></SELECT></TD><TD
COLSPAN='2' ALIGN='CENTER'><SELECT NAME='st_2'><OPTION VALUE='0'>Choose a
Striker</OPTION><OPTION VALUE='31'>Van Nistelrooy (Manchester United)
9</OPTION><OPTION VALUE='32'>Henry (Arsenal) 9</OPTION><OPTION
VALUE='33'>Owen (Liverpool) 8.5</OPTION><OPTION VALUE='34'>Solskjaer
(Manchester United) 7.8</OPTION><OPTION VALUE='35'>Heskey (Liverpool)
7.5</OPTION><OPTION VALUE='36'>Bergkamp (Arsenal) 7.8</OPTION><OPTION
VALUE='57'>Hasselbaink (Chelsea) 9.0</OPTION><OPTION VALUE='58'>Zola
(Chelsea) 5.0</OPTION><OPTION VALUE='59'>Shearer (Newcastle)
8.5</OPTION><OPTION VALUE='60'>Bellamy (Newcastle) 7.0</OPTION><OPTION
VALUE='61'>Viduka (Leeds) 7.8</OPTION><OPTION VALUE='62'>Smith (Leeds)
7.5</OPTION><OPTION VALUE='67'>Forlan (Manchester United)
6.5</OPTION></SELECT></TD><TD COLSPAN='2' ALIGN='CENTER'><SELECT
NAME='st_3'><OPTION VALUE='0'>Choose a Striker</OPTION><OPTION
VALUE='31'>Van Nistelrooy (Manchester United) 9</OPTION><OPTION
VALUE='32'>Henry (Arsenal) 9</OPTION><OPTION VALUE='33'>Owen (Liverpool)
8.5</OPTION><OPTION VALUE='34'>Solskjaer (Manchester United)
7.8</OPTION><OPTION VALUE='35'>Heskey (Liverpool) 7.5</OPTION><OPTION
VALUE='36'>Bergkamp (Arsenal) 7.8</OPTION><OPTION VALUE='57'>Hasselbaink
(Chelsea) 9.0</OPTION><OPTION VALUE='58'>Zola (Chelsea) 5.0</OPTION><OPTION
VALUE='59'>Shearer (Newcastle) 8.5</OPTION><OPTION VALUE='60'>Bellamy
(Newcastle) 7.0</OPTION><OPTION VALUE='61'>Viduka (Leeds)
7.8</OPTION><OPTION VALUE='62'>Smith (Leeds) 7.5</OPTION><OPTION
VALUE='67'>Forlan (Manchester United) 6.5</OPTION></SELECT></TD><TD
COLSPAN='2'><IMG SRC='/images/1pix.gif'></TD></TR></TABLE><P><INPUT
TYPE='Hidden' NAME='cgi_req'><INPUT TYPE='SUBMIT' VALUE='Submit'
ONCLICK='return(retrieve_values_selected(this.form));'></FORM></BODY>
</HTML>
-->
My Apache configuration works ( I can see my webpages) - but the cgi is not
writing all of what it's supposed to be writing. Is this some sort of memory
problem? Is it a sockets problem?
I am using Apache2 and the latest Cygwin release.
I haven't a clue. Hope this helps someone to help me!
Thanks,
John McAllister
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/