int main() { myseed(); checkCorrect (); timeIt (); return 0; }
int main(){ int n; file = fopen("users.txt","rt"); char *token, *inputString = NULL; printf("Content-Type:text/html\n\n"); printf("<html>"); printf("<body>"); if(CONTENT_LENGTH != NULL){//parses incoming POST form n = atoi(CONTENT_LENGTH); char manString[n]; if((inputString = malloc(sizeof(char) * (n+1))) != NULL){ if((fread(inputString, sizeof(char), n, stdin)) == n){ strcpy(manString, inputString); //printf("str length: %d and string is: %s.<br />",n, manString); token = strtok(manString, "&"); while(token != NULL){ if(checkCorrect(token)){ token = strtok(NULL, "&"); } else{ printf("<b>Error: Incorrect Username or Password</b><br /><br />"); printf("Retry logging in?"); printf("<form action=\"login.html\">"); printf("<input type=\"submit\" value=\"Login\">"); printf("</form>"); printf("or going back to the home screen?"); printf("<form action=\"index.html\">"); printf("<input type=\"submit\" value=\"Home\">"); printf("</form>"); return 1; }//username does not exist } printf("Login Succesful!"); printf("<form action=\"http://cs.mcgill.ca/~mlabra2/dashboard.py\" method=\"post\" id=\"login\">"); //printf("<form action=\"dashboard.py\" method=\"post\" id=\"login\">"); printf("<input type=\"hidden\" name=\"currentUser\" value=\"%s\">", user);//pass on current user printf("Go to <input type=\"submit\" value=\"Dashboard\">"); printf("</form>"); return 0;//password is right to the username } } } printf("</body>"); printf("</html>"); return 0; }
void MastermindGame::startGuessing() { while (numberOfGuesses < MAX_GUESSES) { printf("Code Breaker, you have %i guesses left!\n", MAX_GUESSES - numberOfGuesses++); Code guess; cin >> guess; if (checkCorrect(guess)) { printCode(true); return; } else respondToGuess(guess); } printCode(false); }