Skip to content
Snippets Groups Projects
Commit bf72e030 authored by Anqi Chen's avatar Anqi Chen
Browse files

logic redo upload

parent 9e8a1563
No related branches found
No related tags found
No related merge requests found
Pipeline #1787 canceled
...@@ -333,7 +333,7 @@ static bool handle_http_request(int sockfd, struct User* user_arr[]) ...@@ -333,7 +333,7 @@ static bool handle_http_request(int sockfd, struct User* user_arr[])
} }
else if (method == POST){ else if (method == POST){
if(strstr(buff, "quit=Quit") != NULL) if(strstr(buff, "quit=") != NULL)
{ {
simple_load_html("7_gameover.html",sockfd,buff,n,curr_user); simple_load_html("7_gameover.html",sockfd,buff,n,curr_user);
...@@ -341,7 +341,40 @@ static bool handle_http_request(int sockfd, struct User* user_arr[]) ...@@ -341,7 +341,40 @@ static bool handle_http_request(int sockfd, struct User* user_arr[])
} }
else if(curr_user->isOnline == 0) else if(curr_user->isOnline == 0)
{ {
char* username = strstr(buff, "user=")+5;
char u[MAX_BUFF];
strcpy(u,"<br>");
strcat(u, username);
u[strlen(username)]='\0';
curr_user->isOnline = 1;
edit_load_html("2_start.html", sockfd,buff,username,curr_user);
}
else if (curr_user->isOnline == 2 ||curr_user->isOnline == 1 ) {
curr_user->isOnline = 2;
if (the_other_user(curr_user, user_arr)->stage==0 || the_other_user(curr_user, user_arr)->stage == 4)
{
simple_load_html("5_discarded.html",sockfd,buff,n,curr_user);
}
else if (the_other_user(curr_user, user_arr)->stage==3){
simple_load_html("7_gameover.html",sockfd,buff,n,curr_user);
curr_user->stage = 3;
}
else if (curr_user->stage == 2|| curr_user->stage == 4){
simple_load_html("6_endgame.html",sockfd,buff,n,curr_user);
if (curr_user->stage == 4){
curr_user->stage = 1;
curr_user->isOnline = 1;
}
else{
curr_user->stage = 2;
}
}
else {
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment