/*Description- When this function is called it prints a menu for * the developer. The developer is supposed to type 1 or 2 * which calls other functions.*/ void admin_menu() { int opt; system("clear"); printf("Select an option\n"); printf("1. Get user info in a csv file\n"); printf("2. Logout\n"); scanf("%d", &opt); switch(opt) { case 1: /*create csv*/ create_csv(); admin_menu(); break; case 2: menu(); break; default: admin_menu(); break; } }
/*Description- When this function is called it asks the developer for his admin password. *The admin passwword is stored over here. It then checks the password and calls the * admin_menu() function if the password is correct */ void admin_login() { char adminpass[7] = "arsenal"; adminpass[7] = '\0'; system("clear"); gotoxy(20, 5); printf("PASSWORD : "); if(password(adminpass) == 1) { admin_menu(); } else { menu(); } }
/*********************************************************************************************** MAIN MENU FOR RETAIL ***********************************************************************************************/ int main (void) { struct tm intim; int Ret_val; double amount; unsigned char str[100] = ""; pthread_t syncT; pthread_attr_t attr; int newprio; struct sched_param param; int ret; //fp = fopen (logFile, "w+"); fp = stdout; fprintf(fp,"Begun main()"); fflush(fp); lk_open (); prn_open (); mscr_open (); lk_dispinit (); lk_dispclr(); strcpy(DATABASE,"/mnt/jffs2/fps.sqlite"); initialize_db (); open_sqlite (DATABASE); strcpy(CONFIG_FILE, get_config("CONFIG_FILE",tmpbuf,"0")); //Need OFFICE ID From config file before init_globals read_config (CONFIG_FILE); strcpy(OFFICE_ID,getVal("office_id")); // Get from config file strcpy(SESSION_ID,""); fprintf(fp,"office_id:",OFFICE_ID); fflush(fp); init_globals(); strcpy(IP,getVal("remote_url")); strcpy(shop_id,getVal("shop")); strcpy(terminal,getVal("terminal")); strcpy(tempFile,"/mnt/jffs2/dat"); strcpy(svr_username,getVal("server_user")); strcpy(svr_password,getVal("server_pwd")); setAuthType(); if(strcmp(toUpper(getVal("show_splash")),"TRUE")==0) { lk_disptext (1, 0, " PDS ", 1); lk_disptext (3, 0, " Govt of AP", 0); lk_disptext (4, 0, " Version:0.9", 0); lk_disptext (5, 0, " Enter to continue", 0); lk_getkey (); lk_dispclr (); } if(strcmp(toUpper(getVal("commMode")),"ETHERNET") == 0) ip_setup (); strcpy(background,getVal("background")); pthread_attr_init(&attr); pthread_attr_setschedpolicy(&attr, SCHED_OTHER); newprio = 1; param.sched_priority = newprio; pthread_attr_setschedparam(&attr,¶m); if(strcmp(background,"true")==0) { fprintf(fp,"Starting a background thread"); fflush(fp); if (pthread_create (&syncT, &attr, syncThread, NULL) != 0) fprintf (stderr, "Error creating the thread"); } while(1) { ret = login(); printFlag = FALSE; if(ret==USER) main_menu(); else if(ret == ADMIN) admin_menu(); else { lk_dispclr(); lk_disptext (2, 0, "Invalid credentials", 0); lk_getkey (); lk_dispclr (); } } prn_close (); // closing printer lk_close (); // closing pinpad mscr_close (); // closing magnetic swipe close_sqlite (); fprintf(fp,"Ended main()"); fflush(fp); return SUCCESS; }
/*-----------------------------------------------------------------*/ int welcome_screen () { int i,j; char choice,animation_array[14]="Login Portals"; clrscr(); textbackground(0); textcolor(7); for(i=20,j=58; i<59; i++,j--) { delay(50); gotoxy(i,3); cprintf("."); gotoxy(j,7); cprintf("."); } for(i=3,j=6; i<7; i++,j--) { delay(50); gotoxy(20,i); cprintf("."); gotoxy(58,j); cprintf("."); } delay(200); gotoxy(23,5); cout<<"Welcome to Intellisoft Job Portal"; delay(500); gotoxy(33,13); for(i=0; i<14; i++) { delay(100); cout<<animation_array[i]; } delay(200); textbackground(3); for (i=4; i<24; i++) { for(j=15; j<20; j++) { gotoxy(i,j); cprintf(" "); } } textcolor(0); gotoxy(10,17); cprintf("[1] Admin"); delay(200); textbackground(4); for (i=29; i<49; i++) { for(j=15; j<20; j++) { gotoxy(i,j); cprintf(" "); } } gotoxy(33,17); cprintf("[2] Applicant"); delay(200); textbackground(6); for (i=54; i<74; i++) { for(j=15; j<20; j++) { gotoxy(i,j); cprintf(" "); } } gotoxy(59,17); cprintf("[3] Employer"); delay(200); textbackground(7); for (i=35; i<45; i++) { gotoxy(i,21); cprintf(" "); } gotoxy(35,21); cprintf("[4] Exit"); delay(200); textattr(8<<0); gotoxy(20,23); cprintf("Enter choice : "); cin>>choice; cin.ignore(); switch (choice) { case '1' : admin_menu(); break; case '2' : applicant_menu(); break; case '3' : employer_menu(); break; case '4' : splash_screen(4); break; default : error(0); break; } return 0; }