00001
00034
00035
00036 #define GTK_ENABLE_BROKEN
00037 #define BUFFER 4096
00038
00039 #include <gtk/gtk.h>
00040 #include <glib.h>
00041
00042 #include <stdlib.h>
00043 #include <stdio.h>
00044 #include <string.h>
00045
00046 #include "01-connect.h"
00047 #include <mysql/mysql.h>
00048
00049 #include<sys/types.h>
00050 #include<sys/socket.h>
00051 #include<netinet/in.h>
00052 #include<arpa/inet.h>
00053
00054 #define SERV_TCP_PORT 9999
00055 #define BUFSIZE 1024
00056
00057
00058 MYSQL *connection1;
00059 MYSQL_RES *result1;
00060 MYSQL_ROW sqlrow;
00061
00062
00063 static void send_mail();
00064 static void create_report();
00065 static void updated_password_record();
00066 static void updated_transfer_account();
00067 static void transfer_money ();
00068 static void insert_report();
00069 static void updated_record();
00070 static void display_row1 ();
00071 static void count_withdrawal ();
00072 static void count_deposit ();
00073 static void enter_callback( GtkWidget *entry, GdkEventKey *event, gpointer data );
00074 static gboolean close_application( GtkWidget *widget,GdkEvent *event);
00075 static gboolean get_focus_click (GtkButton *button, gpointer data);
00076 static gboolean enter_function (GtkButton *button_Enter, gpointer data);
00077 static gboolean balance_function (GtkButton *button_Balance, gpointer data);
00078 static gboolean withdraw_function (GtkButton *button_Withdraw, gpointer entry1);
00079 static gboolean deposit_function (GtkButton *button_Deposit, gpointer entry1);
00080 static gboolean transfer_function (GtkButton *button_Transfer, gpointer entry1);
00081 static gboolean changePass_function (GtkButton *button_ChangePass, gpointer entry1);
00082 static gboolean cancel_function( GtkButton *button, gpointer data);
00083 static gboolean clear_function( GtkButton *button, gpointer data);
00084
00085
00086
00087 gchar message[1000];
00088 gchar message1[1000];
00089 gchar message2[1000];
00090 gchar message3[1000];
00091 gchar message4[1000];
00092 gchar record_user[1000];
00093 gchar record_transaction[1000];
00094 gchar new_user_pin[1000];
00095 gchar trans_type[1000];
00096 gchar trans_status[1000];
00097 gchar trans_balance[1000];
00098 gint transfer_account1=0;
00099 gint index_report;
00100 gchar value[1000];
00101 gchar value2[1000];
00102 gchar value3[1000];
00103 gchar value4[1000];
00104 gchar value5[1000];
00105 gchar value6[1000];
00106 gchar value7[1000];
00107 gchar password[1000];
00108 gchar newPass[1000];
00109 gchar confirmPass[1000];
00110 gint counterPass=0;
00111 gint flags_password=1;
00112 gfloat withdraw_amount1=0.0;
00113 gint counterWithdraw = 0;
00114 gint flags_Withdraw=0;
00115 gint flags_enter=1;
00116 gfloat total_amount1=0.0;
00117 gint flags_balance=1;
00118 gint flags_deposit =0;
00119 gint counterDeposit=0;
00120 gchar deposit_amount[1000];
00121 gfloat deposit_amount1=0.0;
00122 gchar account_no[1000];
00123 gint flags_changesPass=0;
00124 gint counterChangePass=0;
00125 gint counterConfirmPass=0;
00126 gint counterCheck=0;
00127 gint i =0;
00128 gint flags_transfer=0;
00129 gint counterTransfer=0;
00130 gchar account_no[1000];
00131 gchar trans_amount[1000];
00132 gfloat trans_amount1=0.0;
00133 gint counterAmountTrans=0;
00134 gint index_enter=0;
00135 gchar balance[1000];
00136 gfloat trans_balance1=0.0;
00137 gint flags;
00138 gint confirmPass1=0;
00139 gint first_click=0;
00140 gint index_record=0;
00141 gint record_no=0;
00142 gint record_bil=0;
00143
00144
00145 FILE *report_user;
00146 FILE *report_transaction;
00147 char command_statement[BUFFER];
00148
00149
00150 const char *user_pin;
00151 const char *withdraw_value;
00152 const char *deposit_value;
00153 const char *total_amount_new;
00154 const char *transfer_account;
00155 const char *transfer_amount;
00156 const char *new_password;
00157 const char *confirm_password;
00158
00159
00160
00161 GtkWidget *window;
00162 GtkWidget *box_A;
00163 GtkWidget *box_A1;
00164 GtkWidget *box_A2;
00165 GtkWidget *box_A3;
00166 GtkWidget *box_B;
00167 GtkWidget *box_B1;
00168 GtkWidget *button;
00169 GtkWidget *entry;
00170 GtkWidget *entry1;
00171 GtkWidget *label1;
00172 GtkWidget *label2;
00173 GtkWidget *label3;
00174 GtkWidget *separator;
00175 GtkWidget *separator1;
00176 GtkWidget *separator2;
00177 GtkWidget *table;
00178 GtkWidget *table1;
00179 GtkWidget *button_Balance;
00180 GtkWidget *button_Withdraw;
00181 GtkWidget *button_Deposit;
00182 GtkWidget *button_Transfer;
00183 GtkWidget *button_ChangePass;
00184 GtkWidget *button_Enter;
00185
00186
00187 struct sockaddr_in server_address;
00188
00189
00190 struct myparam
00191 {
00192
00193 GtkWidget *entry;
00194 };
00195
00204
00205 int main( int argc, char *argv[] )
00206 {
00207 int socket1;
00208
00209 struct myparam mp;
00210
00211 if(argc != 2)
00212 {
00213 fprintf(stderr, "%s: usage: %s <server_ip_address>\n", argv[0], argv[0]);
00214 exit(1);
00215 }
00216 printf("\n");
00217
00218 bzero ((char *) &server_address, sizeof(server_address));
00219 server_address.sin_family = AF_INET;
00220 server_address.sin_port = htons (SERV_TCP_PORT);
00221 inet_pton (AF_INET, argv[1], &server_address.sin_addr);
00222
00223 if( (socket1 = socket(AF_INET, SOCK_STREAM, 0) ) < 0) perror("Client: socket()error\n");
00224
00225 if(connect(socket1,(struct sockaddr *)&server_address,sizeof(server_address)) < 0)
00226 {
00227 perror("Client: error connect() \n");
00228 }
00229 else
00230 {
00231 printf("___________________ATM Machine______________________\n\n");
00232 printf("Connection success with SBH Bank Server \n");
00233 printf("IP Address: %s \n",inet_ntoa(server_address.sin_addr));
00234
00235
00236 connection1 = mysql_init (NULL);
00237 if (!connection1)
00238 {
00239 fprintf (stderr, "MySQL initialization failed\n");
00240 exit(EXIT_FAILURE);
00241 }
00242
00243 connection1 = mysql_real_connect (connection1, "localhost","ain", "ain151", "atm", 0, NULL, 0);
00244
00245 if (connection1)
00246 {
00247 printf ("Connection successful\n");
00248 }
00249 else
00250 {
00251 printf ("Connection failed\n");
00252 }
00253
00254
00255
00256 gtk_init (&argc, &argv);
00257
00258 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
00259
00260 g_signal_connect (G_OBJECT (window), "delete_event",G_CALLBACK (close_application),NULL);
00261
00262 gtk_window_set_title (GTK_WINDOW (window), "ATM Machine");
00263 gtk_container_set_border_width (GTK_CONTAINER (window), 0);
00264 gtk_window_set_default_size(GTK_WINDOW(window),230,350);
00265
00266
00267
00268 box_A = gtk_vbox_new (FALSE, 0);
00269 gtk_container_add (GTK_CONTAINER (window), box_A);
00270 gtk_widget_show (box_A);
00271
00272 box_A2 = gtk_vbox_new (FALSE, 5);
00273 gtk_container_set_border_width (GTK_CONTAINER (box_A2), 5);
00274 gtk_box_pack_start (GTK_BOX (box_A), box_A2, TRUE, TRUE, 0);
00275 gtk_widget_show (box_A2);
00276
00277 box_A3 = gtk_vbox_new (FALSE, 5);
00278 gtk_container_set_border_width (GTK_CONTAINER (box_A3), 5);
00279 gtk_box_pack_start (GTK_BOX (box_A), box_A3, TRUE, TRUE, 0);
00280 gtk_widget_show (box_A3);
00281
00282 box_A1 = gtk_vbox_new (FALSE, 5);
00283 gtk_container_set_border_width (GTK_CONTAINER (box_A1), 5);
00284 gtk_box_pack_start (GTK_BOX (box_A2), box_A1, TRUE, TRUE, 0);
00285 gtk_widget_show (box_A1);
00286
00287 box_B1 = gtk_vbox_new (FALSE, 5);
00288 gtk_container_set_border_width (GTK_CONTAINER (box_B1), 5);
00289 gtk_box_pack_start (GTK_BOX (box_A), box_B1, TRUE, TRUE, 0);
00290 gtk_widget_show (box_B1);
00291
00292
00293 box_B = gtk_vbox_new (FALSE, 5);
00294 gtk_container_set_border_width (GTK_CONTAINER (box_B), 5);
00295 gtk_box_pack_start (GTK_BOX (box_B1), box_B, TRUE, TRUE, 0);
00296 gtk_widget_show (box_B);
00297
00298 label1 = gtk_label_new ("State of Hyderabad Bank ATM");
00299 gtk_box_pack_start (GTK_BOX (box_A1), label1, TRUE, TRUE, 0);
00300 gtk_widget_show (label1);
00301
00302 label2 = gtk_label_new (" ");
00303 gtk_box_pack_start (GTK_BOX (box_A2), label2, TRUE, TRUE, 0);
00304 gtk_widget_show (label2);
00305
00306 label3 = gtk_label_new (" ");
00307 gtk_box_pack_start (GTK_BOX (box_A3), label3, TRUE, TRUE, 0);
00308 gtk_widget_show (label3);
00309
00310
00311 entry1 = gtk_entry_new ();
00312 gtk_widget_set_size_request (GTK_WIDGET (entry1), 100, 150);
00313 gtk_editable_set_editable(GTK_EDITABLE (entry1),FALSE);
00314 gtk_entry_set_max_length (GTK_ENTRY (entry1), 100);
00315 gtk_entry_set_text (GTK_ENTRY (entry1), "Please enter pin number");
00316 g_signal_connect (G_OBJECT (entry1), "key-release-event", G_CALLBACK (enter_callback), (gpointer) entry1);
00317 gtk_box_pack_start (GTK_BOX (box_A1), entry1, TRUE, TRUE, 0);
00318 gtk_widget_grab_focus(entry1);
00319 gtk_widget_show (entry1);
00320
00321 separator1 = gtk_hseparator_new ();
00322 gtk_box_pack_start (GTK_BOX (box_A1), separator1, FALSE, TRUE, 0);
00323 gtk_widget_show (separator1);
00324
00325 mp.entry = gtk_entry_new ();
00326 gtk_widget_set_size_request (GTK_WIDGET (mp.entry), 10, 30);
00327 gtk_entry_set_max_length (GTK_ENTRY (mp.entry), 100);
00328 g_signal_connect (G_OBJECT (mp.entry), "key-release-event", G_CALLBACK (enter_callback), (gpointer) &mp);
00329 gtk_box_pack_start (GTK_BOX (box_B1), mp.entry, TRUE, TRUE, 0);
00330 gtk_widget_grab_focus(mp.entry);
00331 gtk_widget_show (mp.entry);
00332
00333 separator = gtk_hseparator_new ();
00334 gtk_box_pack_start (GTK_BOX (box_A), separator, FALSE, TRUE, 0);
00335 gtk_widget_show (separator);
00336
00337 table1 = gtk_table_new (1, 4, TRUE);
00338 gtk_container_set_border_width (GTK_CONTAINER ( table1), 10);
00339 gtk_box_pack_start (GTK_BOX (box_A), table1, FALSE, TRUE, 0);
00340 gtk_widget_show (table1);
00341
00342 button_Balance = gtk_toggle_button_new_with_label ("Balance");
00343
00344 gtk_table_attach_defaults (GTK_TABLE (table1), button_Balance, 0, 1, 0, 1);
00345 g_signal_connect (G_OBJECT (button_Balance), "clicked",G_CALLBACK(balance_function), (gpointer) &mp);
00346 gtk_widget_show (button_Balance);
00347
00348 button_Withdraw = gtk_toggle_button_new_with_label ("Withdraw");
00349 gtk_table_attach_defaults (GTK_TABLE (table1), button_Withdraw, 1, 2, 0, 1);
00350 g_signal_connect (G_OBJECT (button_Withdraw), "clicked",GTK_SIGNAL_FUNC(withdraw_function), (gpointer) entry1);
00351 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_Withdraw), FALSE);
00352 gtk_widget_show (button_Withdraw);
00353
00354 button_Deposit = gtk_toggle_button_new_with_label ("Deposit");
00355 gtk_table_attach_defaults (GTK_TABLE (table1), button_Deposit, 2, 3, 0, 1);
00356 g_signal_connect (G_OBJECT (button_Deposit), "clicked",G_CALLBACK(deposit_function), (gpointer) entry1);
00357 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (button_Deposit),FALSE);
00358 gtk_widget_show (button_Deposit);
00359
00360 button_Transfer = gtk_toggle_button_new_with_label ("Transfer");
00361 gtk_table_attach_defaults (GTK_TABLE (table1), button_Transfer, 3, 4, 0, 1);
00362 g_signal_connect (G_OBJECT (button_Transfer), "clicked",GTK_SIGNAL_FUNC(transfer_function), (gpointer) entry1);
00363 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (button_Transfer),FALSE);
00364 gtk_widget_show (button_Transfer);
00365
00366
00367 separator2 = gtk_hseparator_new ();
00368 gtk_box_pack_start (GTK_BOX (box_A), separator2, FALSE, TRUE, 0);
00369 gtk_widget_show (separator2);
00370
00371
00372 box_B = gtk_vbox_new (FALSE, 10);
00373 gtk_container_set_border_width (GTK_CONTAINER (box_B), 10);
00374 gtk_box_pack_start (GTK_BOX (box_A), box_B, FALSE, TRUE, 0);
00375 gtk_widget_show (box_B);
00376
00377 table = gtk_table_new (4, 4, TRUE);
00378 gtk_container_set_border_width (GTK_CONTAINER ( table), 10);
00379 gtk_box_pack_start (GTK_BOX (box_B), table, FALSE, TRUE, 0);
00380 gtk_widget_show (table);
00381
00382 button = gtk_toggle_button_new_with_label ("7");
00383
00384 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 1);
00385 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00386 gtk_widget_grab_focus(button);
00387 gtk_widget_show (button);
00388
00389 button = gtk_button_new_with_label ("8");
00390 gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 0, 1);
00391 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00392 gtk_widget_show (button);
00393
00394 button = gtk_button_new_with_label ("9");
00395 gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 0, 1);
00396 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00397 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
00398 gtk_widget_show (button);
00399
00400
00401 button_Enter = gtk_toggle_button_new_with_label ("Enter");
00402 gtk_table_attach_defaults (GTK_TABLE (table), button_Enter, 3, 4, 0, 1);
00403 g_signal_connect (G_OBJECT (button_Enter), "clicked",G_CALLBACK(enter_function), (gpointer) &mp);
00404 gtk_widget_show (button_Enter);
00405
00406 button = gtk_button_new_with_label ("4");
00407 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 1, 2);
00408 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00409 gtk_widget_show (button);
00410
00411 button = gtk_button_new_with_label ("5");
00412 gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 1, 2);
00413 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00414 gtk_widget_show (button);
00415
00416 button = gtk_button_new_with_label ("6");
00417 gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 1, 2);
00418 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00419 gtk_widget_show (button);
00420
00421
00422 button = gtk_button_new_with_label ("Clear");
00423 gtk_table_attach_defaults (GTK_TABLE (table), button, 3, 4, 1, 2);
00424 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(clear_function), (gpointer) &mp);
00425 gtk_widget_show (button);
00426
00427 button = gtk_button_new_with_label ("1");
00428 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 2, 3);
00429 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00430 gtk_widget_show (button);
00431
00432 button = gtk_button_new_with_label ("2");
00433 gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 2, 3);
00434 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00435 gtk_widget_show (button);
00436
00437 button = gtk_button_new_with_label ("3");
00438 gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 2, 3);
00439 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00440 gtk_widget_show (button);
00441
00442 button = gtk_button_new_with_label ("Cancel");
00443 gtk_table_attach_defaults (GTK_TABLE (table), button, 3, 4, 2, 3);
00444 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(cancel_function), (gpointer) &mp);
00445 gtk_widget_show (button);
00446
00447 button = gtk_button_new_with_label ("0");
00448 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 3, 4);
00449 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00450
00451
00452 button = gtk_button_new_with_label ("0");
00453 gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 3, 4);
00454 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00455 gtk_widget_show (button);
00456
00457 button = gtk_button_new_with_label ("=");
00458 gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 3, 4);
00459 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(get_focus_click), (gpointer) &mp);
00460
00461
00462 button = gtk_button_new_with_label ("Exit");
00463 gtk_table_attach_defaults (GTK_TABLE (table), button, 3, 4, 3, 4);
00464 g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK(close_application), (gpointer) entry1);
00465 gtk_widget_show (button);
00466
00467 gtk_widget_show (table);
00468
00469 separator = gtk_hseparator_new ();
00470 gtk_box_pack_start (GTK_BOX (box_A), separator, FALSE, TRUE, 0);
00471 gtk_widget_show (separator);
00472
00473 box_B = gtk_vbox_new (FALSE, 10);
00474 gtk_container_set_border_width (GTK_CONTAINER (box_B), 10);
00475 gtk_box_pack_start (GTK_BOX (box_A), box_B, FALSE, TRUE, 0);
00476 gtk_widget_show (box_B);
00477
00478 button_ChangePass= gtk_toggle_button_new_with_label ("Change Password");
00479 g_signal_connect(G_OBJECT(button_ChangePass),"clicked", GTK_SIGNAL_FUNC(changePass_function),(gpointer) entry1);
00480 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (button_ChangePass),FALSE);
00481 gtk_widget_set_size_request(button_ChangePass, 20, 30);
00482 gtk_box_pack_start (GTK_BOX (box_B), button_ChangePass, TRUE, TRUE, 0);
00483 GTK_WIDGET_SET_FLAGS (button_ChangePass, GTK_CAN_DEFAULT);
00484 gtk_widget_grab_default (button_ChangePass);
00485 gtk_widget_show (button_ChangePass);
00486
00487 gtk_widget_show (window);
00488 gtk_main ();
00489
00490 send (socket1,"Report sent to SBH mailing list. End of ATM System.", BUFSIZE,0);
00491 }
00492
00493 mysql_close (connection1);
00494
00495 exit(EXIT_SUCCESS);
00496
00497 close (socket1);
00498
00499 return 0;
00500 }
00501
00508 static void enter_callback( GtkWidget *entry, GdkEventKey *event, gpointer data)
00509 {
00510
00511 const gchar *entry_text;
00512
00513
00514 entry_text=gtk_entry_get_text (GTK_ENTRY ( entry));
00515 gtk_entry_append_text(GTK_ENTRY(data),entry_text);
00516
00517 }
00518
00519
00526 static gboolean close_application( GtkWidget *widget,GdkEvent *event)
00527 {
00528 gtk_main_quit ();
00529 return FALSE;
00530 }
00531
00532
00538 static gboolean cancel_function( GtkButton *button, gpointer data)
00539 {
00540
00541 struct myparam *mp=data;
00542
00543 gtk_entry_set_text (GTK_ENTRY (entry1), "Out of System.Thank You");
00544 gtk_label_set_text(GTK_LABEL(label3),"");
00545 gtk_label_set_text(GTK_LABEL(label2),"");
00546 first_click=0;
00547 flags_enter=1;
00548 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
00549 gtk_entry_set_visibility(GTK_ENTRY (mp->entry), FALSE);
00550 return TRUE;
00551 }
00552
00553
00559 static gboolean clear_function( GtkButton *button, gpointer data)
00560 {
00561
00562 struct myparam *mp=data;
00563
00564
00565 first_click=0;
00566 flags_enter=1;
00567 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
00568 counterPass=0;
00569 counterWithdraw=0;
00570 counterDeposit=0;
00571 counterChangePass=0;
00572 counterConfirmPass=0;
00573 counterTransfer=0;
00574 counterAmountTrans=0;
00575
00576 return TRUE;
00577 }
00578
00579
00590 static gboolean get_focus_click (GtkButton *button, gpointer data)
00591 {
00592 struct myparam *mp = data;
00593
00594
00595 if (counterPass <4 && flags_password==1)
00596 {
00597
00598
00599 strcpy(value,gtk_button_get_label(button));
00600 gtk_entry_set_visibility(GTK_ENTRY (mp->entry), FALSE);
00601
00602 if(strcmp(value,"1")==0)
00603 {
00604
00605 gtk_entry_append_text(GTK_ENTRY(mp->entry),"1");
00606 }
00607
00608 else if(strcmp(value,"2")==0)
00609 {
00610 gtk_entry_append_text(GTK_ENTRY(mp->entry),"2");
00611 }
00612
00613 else if(strcmp(value,"3")==0)
00614 {
00615 gtk_entry_append_text(GTK_ENTRY(mp->entry),"3");
00616 }
00617
00618 else if(strcmp(value,"4")==0)
00619 {
00620 gtk_entry_append_text(GTK_ENTRY(mp->entry),"4");
00621 }
00622 else if(strcmp(value,"5")==0)
00623 {
00624 gtk_entry_append_text(GTK_ENTRY(mp->entry),"5");
00625 }
00626
00627 else if(strcmp(value,"6")==0)
00628 {
00629 gtk_entry_append_text(GTK_ENTRY(mp->entry),"6");
00630 }
00631 else if(strcmp(value,"7")==0)
00632 {
00633 gtk_entry_append_text(GTK_ENTRY(mp->entry),"7");
00634 }
00635 else if(strcmp(value,"8")==0)
00636 {
00637 gtk_entry_append_text(GTK_ENTRY(mp->entry),"8");
00638 }
00639 else if(strcmp(value,"9")==0)
00640 {
00641 gtk_entry_append_text(GTK_ENTRY(mp->entry),"9");
00642 }
00643 else if(strcmp(value,"0")==0)
00644 {
00645 gtk_entry_append_text(GTK_ENTRY(mp->entry),"0");
00646 }
00647
00648 counterPass++;
00649 }
00650
00651
00652 if (counterWithdraw <= 5 && flags_Withdraw==1)
00653 {
00654 flags_enter=2;
00655 strcpy(value2,gtk_button_get_label(button));
00656 gtk_entry_set_visibility(GTK_ENTRY (mp->entry), TRUE);
00657
00658 if(strcmp(value2,"1")==0)
00659 {
00660
00661 gtk_entry_append_text(GTK_ENTRY(mp->entry),"1");
00662 }
00663
00664 else if(strcmp(value2,"2")==0)
00665 {
00666 gtk_entry_append_text(GTK_ENTRY(mp->entry),"2");
00667 }
00668
00669 else if(strcmp(value2,"3")==0)
00670 {
00671 gtk_entry_append_text(GTK_ENTRY(mp->entry),"3");
00672 }
00673
00674 else if(strcmp(value2,"4")==0)
00675 {
00676 gtk_entry_append_text(GTK_ENTRY(mp->entry),"4");
00677 }
00678 else if(strcmp(value2,"5")==0)
00679 {
00680 gtk_entry_append_text(GTK_ENTRY(mp->entry),"5");
00681 }
00682
00683 else if(strcmp(value2,"6")==0)
00684 {
00685 gtk_entry_append_text(GTK_ENTRY(mp->entry),"6");
00686 }
00687
00688
00689 else if(strcmp(value2,"7")==0)
00690 {
00691 gtk_entry_append_text(GTK_ENTRY(mp->entry),"7");
00692 }
00693 else if(strcmp(value2,"8")==0)
00694 {
00695 gtk_entry_append_text(GTK_ENTRY(mp->entry),"8");
00696 }
00697 else if(strcmp(value2,"9")==0)
00698 {
00699 gtk_entry_append_text(GTK_ENTRY(mp->entry),"9");
00700 }
00701 else if(strcmp(value2,"0")==0)
00702 {
00703 gtk_entry_append_text(GTK_ENTRY(mp->entry),"0");
00704 }
00705 counterWithdraw++;
00706 }
00707
00708
00709 if (counterDeposit <= 5 && flags_deposit==1)
00710 {
00711 flags_enter=3;
00712 strcpy(value3,gtk_button_get_label(button));
00713 gtk_entry_set_visibility(GTK_ENTRY (mp->entry), TRUE);
00714
00715 if(strcmp(value3,"1")==0)
00716 {
00717
00718 gtk_entry_append_text(GTK_ENTRY(mp->entry),"1");
00719 }
00720
00721 else if(strcmp(value3,"2")==0)
00722 {
00723 gtk_entry_append_text(GTK_ENTRY(mp->entry),"2");
00724 }
00725
00726 else if(strcmp(value3,"3")==0)
00727 {
00728 gtk_entry_append_text(GTK_ENTRY(mp->entry),"3");
00729 }
00730
00731 else if(strcmp(value3,"4")==0)
00732 {
00733 gtk_entry_append_text(GTK_ENTRY(mp->entry),"4");
00734 }
00735 else if(strcmp(value3,"5")==0)
00736 {
00737 gtk_entry_append_text(GTK_ENTRY(mp->entry),"5");
00738 }
00739
00740 else if(strcmp(value3,"6")==0)
00741 {
00742 gtk_entry_append_text(GTK_ENTRY(mp->entry),"6");
00743 }
00744
00745
00746 else if(strcmp(value3,"7")==0)
00747 {
00748 gtk_entry_append_text(GTK_ENTRY(mp->entry),"7");
00749 }
00750 else if(strcmp(value3,"8")==0)
00751 {
00752 gtk_entry_append_text(GTK_ENTRY(mp->entry),"8");
00753 }
00754 else if(strcmp(value3,"9")==0)
00755 {
00756 gtk_entry_append_text(GTK_ENTRY(mp->entry),"9");
00757 }
00758 else if(strcmp(value3,"0")==0)
00759 {
00760 gtk_entry_append_text(GTK_ENTRY(mp->entry),"0");
00761 }
00762 counterDeposit++;
00763 }
00764
00765
00766 if (counterChangePass <4 && flags_changesPass==1)
00767 {
00768 flags_enter=6;
00769
00770 strcpy(value6,gtk_button_get_label(button));
00771 gtk_entry_set_visibility(GTK_ENTRY (mp->entry), FALSE);
00772
00773 if(strcmp(value6,"1")==0)
00774 {
00775
00776 gtk_entry_append_text(GTK_ENTRY(mp->entry),"1");
00777
00778
00779 strcat(newPass,"1");
00780 }
00781
00782 else if(strcmp(value6,"2")==0)
00783 {
00784 gtk_entry_append_text(GTK_ENTRY(mp->entry),"2");
00785
00786 strcat(newPass,"2");
00787 }
00788
00789 else if(strcmp(value6,"3")==0)
00790 {
00791 gtk_entry_append_text(GTK_ENTRY(mp->entry),"3");
00792
00793 strcat(newPass,"3");
00794 }
00795
00796 else if(strcmp(value6,"4")==0)
00797 {
00798 gtk_entry_append_text(GTK_ENTRY(mp->entry),"4");
00799
00800 strcat(newPass,"4");
00801 }
00802 else if(strcmp(value6,"5")==0)
00803 {
00804 gtk_entry_append_text(GTK_ENTRY(mp->entry),"5");
00805
00806 strcat(newPass,"5");
00807
00808 }
00809
00810 else if(strcmp(value6,"6")==0)
00811 {
00812 gtk_entry_append_text(GTK_ENTRY(mp->entry),"6");
00813
00814 strcat(newPass,"6");
00815 }
00816 else if(strcmp(value6,"7")==0)
00817 {
00818 gtk_entry_append_text(GTK_ENTRY(mp->entry),"7");
00819
00820 strcat(newPass,"7");
00821
00822 }
00823 else if(strcmp(value6,"8")==0)
00824 {
00825 gtk_entry_append_text(GTK_ENTRY(mp->entry),"8");
00826
00827 strcat(newPass,"8");
00828 }
00829 else if(strcmp(value6,"9")==0)
00830 {
00831 gtk_entry_append_text(GTK_ENTRY(mp->entry),"9");
00832
00833 strcat(newPass,"9");
00834 }
00835 else if(strcmp(value6,"0")==0)
00836 {
00837 gtk_entry_append_text(GTK_ENTRY(mp->entry),"0");
00838
00839 strcat(newPass,"0");
00840 }
00841
00842 counterChangePass++;
00843 }
00844
00845
00846
00847
00848 if (counterConfirmPass <4 && flags_changesPass==2)
00849 {
00850 flags_enter=7;
00851
00852 strcpy(value7,gtk_button_get_label(button));
00853 gtk_entry_set_visibility(GTK_ENTRY (mp->entry), FALSE);
00854
00855 if(strcmp(value7,"1")==0)
00856 {
00857
00858 gtk_entry_append_text(GTK_ENTRY(mp->entry),"1");
00859
00860
00861 strcat(confirmPass,"1");
00862 }
00863
00864 else if(strcmp(value7,"2")==0)
00865 {
00866 gtk_entry_append_text(GTK_ENTRY(mp->entry),"2");
00867
00868 strcat(confirmPass,"2");
00869 }
00870
00871 else if(strcmp(value7,"3")==0)
00872 {
00873 gtk_entry_append_text(GTK_ENTRY(mp->entry),"3");
00874
00875 strcat(confirmPass,"3");
00876 }
00877
00878 else if(strcmp(value7,"4")==0)
00879 {
00880 gtk_entry_append_text(GTK_ENTRY(mp->entry),"4");
00881
00882 strcat(confirmPass,"4");
00883 }
00884 else if(strcmp(value7,"5")==0)
00885 {
00886 gtk_entry_append_text(GTK_ENTRY(mp->entry),"5");
00887
00888 strcat(confirmPass,"5");
00889
00890 }
00891
00892 else if(strcmp(value7,"6")==0)
00893 {
00894 gtk_entry_append_text(GTK_ENTRY(mp->entry),"6");
00895
00896 strcat(confirmPass,"6");
00897 }
00898 else if(strcmp(value7,"7")==0)
00899 {
00900 gtk_entry_append_text(GTK_ENTRY(mp->entry),"7");
00901
00902 strcat(confirmPass,"7");
00903
00904 }
00905 else if(strcmp(value7,"8")==0)
00906 {
00907 gtk_entry_append_text(GTK_ENTRY(mp->entry),"8");
00908
00909 strcat(confirmPass,"8");
00910 }
00911 else if(strcmp(value7,"9")==0)
00912 {
00913 gtk_entry_append_text(GTK_ENTRY(mp->entry),"9");
00914
00915 strcat(confirmPass,"9");
00916 }
00917 else if(strcmp(value7,"0")==0)
00918 {
00919 gtk_entry_append_text(GTK_ENTRY(mp->entry),"0");
00920
00921 strcat(confirmPass,"0");
00922 }
00923
00924 counterConfirmPass++;
00925 }
00926
00927
00928 if (counterTransfer <7 && flags_transfer==1)
00929 {
00930 flags_enter=4;
00931 strcpy(value4,gtk_button_get_label(button));
00932 gtk_entry_set_visibility(GTK_ENTRY (mp->entry), TRUE);
00933
00934 if(strcmp(value4,"1")==0)
00935 {
00936
00937 gtk_entry_append_text(GTK_ENTRY(mp->entry),"1");
00938
00939 }
00940
00941 else if(strcmp(value4,"2")==0)
00942 {
00943 gtk_entry_append_text(GTK_ENTRY(mp->entry),"2");
00944
00945 }
00946
00947 else if(strcmp(value4,"3")==0)
00948 {
00949 gtk_entry_append_text(GTK_ENTRY(mp->entry),"3");
00950 }
00951
00952 else if(strcmp(value4,"4")==0)
00953 {
00954 gtk_entry_append_text(GTK_ENTRY(mp->entry),"4");
00955 }
00956 else if(strcmp(value4,"5")==0)
00957 {
00958 gtk_entry_append_text(GTK_ENTRY(mp->entry),"5");
00959
00960 }
00961
00962 else if(strcmp(value4,"6")==0)
00963 {
00964 gtk_entry_append_text(GTK_ENTRY(mp->entry),"6");
00965
00966 }
00967
00968
00969 else if(strcmp(value4,"7")==0)
00970 {
00971 gtk_entry_append_text(GTK_ENTRY(mp->entry),"7");
00972
00973 }
00974 else if(strcmp(value4,"8")==0)
00975 {
00976 gtk_entry_append_text(GTK_ENTRY(mp->entry),"8");
00977
00978 }
00979 else if(strcmp(value4,"9")==0)
00980 {
00981 gtk_entry_append_text(GTK_ENTRY(mp->entry),"9");
00982
00983 }
00984 else if(strcmp(value4,"0")==0)
00985 {
00986 gtk_entry_append_text(GTK_ENTRY(mp->entry),"0");
00987
00988 }
00989 counterTransfer++;
00990 }
00991
00992
00993 if (counterAmountTrans <5 && flags_transfer==2)
00994 {
00995 flags_enter=5;
00996 strcpy(value5,gtk_button_get_label(button));
00997 gtk_entry_set_visibility(GTK_ENTRY (mp->entry), TRUE);
00998
00999 if(strcmp(value5,"1")==0)
01000 {
01001
01002 gtk_entry_append_text(GTK_ENTRY(mp->entry),"1");
01003 }
01004
01005 else if(strcmp(value5,"2")==0)
01006 {
01007 gtk_entry_append_text(GTK_ENTRY(mp->entry),"2");
01008
01009 }
01010
01011 else if(strcmp(value5,"3")==0)
01012 {
01013 gtk_entry_append_text(GTK_ENTRY(mp->entry),"3");
01014 }
01015
01016 else if(strcmp(value5,"4")==0)
01017 {
01018 gtk_entry_append_text(GTK_ENTRY(mp->entry),"4");
01019
01020 }
01021 else if(strcmp(value5,"5")==0)
01022 {
01023 gtk_entry_append_text(GTK_ENTRY(mp->entry),"5");
01024
01025 }
01026
01027 else if(strcmp(value5,"6")==0)
01028 {
01029 gtk_entry_append_text(GTK_ENTRY(mp->entry),"6");
01030
01031 }
01032
01033
01034 else if(strcmp(value5,"7")==0)
01035 {
01036 gtk_entry_append_text(GTK_ENTRY(mp->entry),"7");
01037
01038 }
01039 else if(strcmp(value5,"8")==0)
01040 {
01041 gtk_entry_append_text(GTK_ENTRY(mp->entry),"8");
01042 }
01043 else if(strcmp(value5,"9")==0)
01044 {
01045 gtk_entry_append_text(GTK_ENTRY(mp->entry),"9");
01046 }
01047 else if(strcmp(value5,"0")==0)
01048 {
01049 gtk_entry_append_text(GTK_ENTRY(mp->entry),"0");
01050 }
01051 counterAmountTrans++;
01052 }
01053
01054
01055 return TRUE;
01056 }
01057
01066 static gboolean enter_function (GtkButton *button_Enter, gpointer data)
01067 {
01068 struct myparam *mp = data;
01069 char sql_statement[4096];
01070 int result_value;
01071 unsigned int field_count;
01072
01073 field_count = 0;
01074
01075
01076 user_pin =gtk_entry_get_text(GTK_ENTRY((GtkWidget *)mp->entry));
01077
01078 withdraw_value =gtk_entry_get_text(GTK_ENTRY((GtkWidget *)mp->entry));
01079
01080 deposit_value =gtk_entry_get_text(GTK_ENTRY((GtkWidget *)mp->entry));
01081
01082 transfer_account =gtk_entry_get_text(GTK_ENTRY((GtkWidget *)mp->entry));
01083
01084 transfer_amount =gtk_entry_get_text(GTK_ENTRY((GtkWidget *)mp->entry));
01085
01086 new_password =gtk_entry_get_text(GTK_ENTRY((GtkWidget *)mp->entry));
01087
01088 confirm_password=gtk_entry_get_text(GTK_ENTRY((GtkWidget *)mp->entry));
01089
01090
01091 if(flags_enter==1)
01092 {
01093
01094 sprintf(sql_statement,"select name from user where user_pin = '%s' ",user_pin);
01095
01096 result_value = mysql_query (connection1, sql_statement);
01097
01098 if (result_value)
01099 {
01100 printf ("select failed as : %s\n", mysql_error (connection1));
01101 printf ("Pin Incorrect\n");
01102 gtk_entry_set_text (GTK_ENTRY (entry1), "Invalid pin number. Try Again");
01103 }
01104 else
01105 {
01106
01107 result1 = mysql_use_result (connection1);
01108 index_enter=1;
01109 if (result1)
01110 {
01111 while ((sqlrow = mysql_fetch_row (result1)))
01112 display_row1 ();
01113
01114
01115 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01116
01117 if (mysql_errno (connection1))
01118 {
01119 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01120 }
01121 }
01122 else if (result1)
01123 {
01124 printf ("select failed as : %s\n", mysql_error (connection1));
01125 gtk_entry_set_text (GTK_ENTRY (entry1), "Invalid pin number. Try Again");
01126 printf ("Pin Incorrect\n");
01127 }
01128
01129
01130 mysql_free_result(result1);
01131
01132 }
01133
01134 sprintf(sql_statement,"select user_pin from user where name = '%s' ",message);
01135
01136 result_value = mysql_query (connection1, sql_statement);
01137
01138 if (result_value)
01139 {
01140 printf ("select failed as : %s\n", mysql_error (connection1));
01141
01142 }
01143 else
01144 {
01145 result1 = mysql_use_result (connection1);
01146 index_enter=2;
01147 if (result1)
01148 {
01149 while ((sqlrow = mysql_fetch_row (result1)))
01150 display_row1 ();
01151 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01152
01153 if (mysql_errno (connection1))
01154 {
01155 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01156 }
01157 }
01158 else if (result1)
01159 {
01160 printf ("select failed as : %s\n", mysql_error (connection1));
01161
01162 }
01163
01164 mysql_free_result(result1);
01165 }
01166
01167 sprintf(sql_statement,"select no_account from user where user_pin = '%s' ",message1);
01168
01169 result_value = mysql_query (connection1, sql_statement);
01170
01171 if (result_value)
01172 {
01173 printf ("select failed as : %s\n", mysql_error (connection1));
01174
01175 }
01176 else
01177 {
01178 result1 = mysql_use_result (connection1);
01179 index_enter=4;
01180 if (result1)
01181 {
01182 while ((sqlrow = mysql_fetch_row (result1)))
01183 display_row1 ();
01184 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01185
01186 if (mysql_errno (connection1))
01187 {
01188 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01189 }
01190 }
01191 else if (result1)
01192 {
01193 printf ("select failed as : %s\n", mysql_error (connection1));
01194
01195 }
01196
01197 mysql_free_result(result1);
01198 }
01199
01200 }
01201
01202 else if(flags_enter==2)
01203 {
01204
01205 sprintf(sql_statement,"select balance from user where user_pin = '%s' ",message1);
01206
01207 result_value = mysql_query (connection1, sql_statement);
01208
01209 if (result_value)
01210 {
01211 printf ("select failed as : %s\n", mysql_error (connection1));
01212
01213 }
01214 else
01215 {
01216 result1 = mysql_use_result (connection1);
01217
01218 if (result1)
01219 {
01220 while ((sqlrow = mysql_fetch_row (result1)))
01221 count_withdrawal ();
01222 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01223
01224
01225 if (mysql_errno (connection1))
01226 {
01227 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01228 }
01229
01230 }
01231 else if (result1)
01232 {
01233 printf ("select failed as : %s\n", mysql_error (connection1));
01234
01235 }
01236 updated_record();
01237 insert_report();
01238 mysql_free_result(result1);
01239
01240 }
01241
01242 sprintf(sql_statement,"select name, no_account,balance from user where user_pin = '%s' ",message1);
01243
01244 result_value = mysql_query (connection1, sql_statement);
01245
01246 if (result_value)
01247 {
01248 printf ("select failed as : %s\n", mysql_error (connection1));
01249
01250 }
01251 else
01252 {
01253 result1 = mysql_use_result (connection1);
01254 index_record=1;
01255 if (result1)
01256 {
01257 while ((sqlrow = mysql_fetch_row (result1)))
01258 create_report();
01259 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01260
01261 if (mysql_errno (connection1))
01262 {
01263 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01264 }
01265 }
01266 else if (result1)
01267 {
01268 printf ("select failed as : %s\n", mysql_error (connection1));
01269
01270 }
01271
01272 mysql_free_result(result1);
01273 }
01274
01275 sprintf(sql_statement,"select transaction, amount, remark from report where no_id = '%d' ",record_no);
01276
01277 result_value = mysql_query (connection1, sql_statement);
01278
01279 if (result_value)
01280 {
01281 printf ("select failed as : %s\n", mysql_error (connection1));
01282
01283 }
01284 else
01285 {
01286 result1 = mysql_use_result (connection1);
01287 index_record=2;
01288 if (result1)
01289 {
01290 while ((sqlrow = mysql_fetch_row (result1)))
01291 create_report();
01292 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01293
01294 if (mysql_errno (connection1))
01295 {
01296 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01297 }
01298 }
01299 else if (result1)
01300 {
01301 printf ("select failed as : %s\n", mysql_error (connection1));
01302
01303 }
01304 send_mail();
01305 mysql_free_result(result1);
01306 }
01307
01308 }
01309
01310 else if(flags_enter==3)
01311 {
01312
01313 sprintf(sql_statement,"select balance from user where user_pin = '%s' ",message1);
01314
01315 result_value = mysql_query (connection1, sql_statement);
01316
01317 if (result_value)
01318 {
01319 printf ("select failed as : %s\n", mysql_error (connection1));
01320
01321 }
01322 else
01323 {
01324 result1 = mysql_use_result (connection1);
01325
01326 if (result1)
01327 {
01328 while ((sqlrow = mysql_fetch_row (result1)))
01329 count_deposit ();
01330 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01331
01332
01333 if (mysql_errno (connection1))
01334 {
01335 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01336 }
01337
01338 }
01339 else if (result1)
01340 {
01341 printf ("select failed as : %s\n", mysql_error (connection1));
01342
01343 }
01344
01345 updated_record();
01346 insert_report();
01347 mysql_free_result(result1);
01348
01349 }
01350
01351 sprintf(sql_statement,"select name, no_account,balance from user where user_pin = '%s' ",message1);
01352
01353 result_value = mysql_query (connection1, sql_statement);
01354
01355 if (result_value)
01356 {
01357 printf ("select failed as : %s\n", mysql_error (connection1));
01358
01359 }
01360 else
01361 {
01362 result1 = mysql_use_result (connection1);
01363 index_record=1;
01364 if (result1)
01365 {
01366 while ((sqlrow = mysql_fetch_row (result1)))
01367 create_report();
01368 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01369
01370 if (mysql_errno (connection1))
01371 {
01372 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01373 }
01374 }
01375 else if (result1)
01376 {
01377 printf ("select failed as : %s\n", mysql_error (connection1));
01378
01379 }
01380
01381 mysql_free_result(result1);
01382 }
01383
01384 sprintf(sql_statement,"select transaction, amount, remark from report where no_id = '%d' ",record_no);
01385
01386 result_value = mysql_query (connection1, sql_statement);
01387
01388 if (result_value)
01389 {
01390 printf ("select failed as : %s\n", mysql_error (connection1));
01391
01392 }
01393 else
01394 {
01395 result1 = mysql_use_result (connection1);
01396 index_record=2;
01397 if (result1)
01398 {
01399 while ((sqlrow = mysql_fetch_row (result1)))
01400 create_report();
01401 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01402
01403 if (mysql_errno (connection1))
01404 {
01405 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01406 }
01407 }
01408 else if (result1)
01409 {
01410 printf ("select failed as : %s\n", mysql_error (connection1));
01411
01412 }
01413 send_mail();
01414 mysql_free_result(result1);
01415 }
01416
01417 }
01418
01419 else if(flags_enter==4)
01420 {
01421
01422
01423 sprintf(sql_statement,"select no_account from user where no_account = '%s' ",transfer_account);
01424
01425 result_value = mysql_query (connection1, sql_statement);
01426
01427 if (result_value)
01428 {
01429 printf ("select failed as : %s\n", mysql_error (connection1));
01430
01431 }
01432 else
01433 {
01434 result1 = mysql_use_result (connection1);
01435
01436 if (result1)
01437 {
01438 while ((sqlrow = mysql_fetch_row (result1)))
01439 display_row1 ();
01440
01441 if (mysql_errno (connection1))
01442 {
01443 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01444 }
01445
01446 }
01447 else if (result1)
01448 {
01449 printf ("select failed as : %s\n", mysql_error (connection1));
01450
01451 }
01452
01453 mysql_free_result(result1);
01454
01455 }
01456
01457 sprintf(sql_statement,"select balance from user where no_account = '%s' ",transfer_account);
01458
01459 result_value = mysql_query (connection1, sql_statement);
01460
01461 if (result_value)
01462 {
01463 printf ("select failed as : %s\n", mysql_error (connection1));
01464 }
01465 else
01466 {
01467 result1 = mysql_use_result (connection1);
01468 flags_transfer=2;
01469 if (result1)
01470 {
01471 while ((sqlrow = mysql_fetch_row (result1)))
01472 display_row1 ();
01473 gtk_entry_set_text (GTK_ENTRY (entry1), "Enter amount to transfer:");
01474 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01475
01476
01477 if (mysql_errno (connection1))
01478 {
01479 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01480 }
01481
01482 }
01483 else if (result1)
01484 {
01485 printf ("select failed as : %s\n", mysql_error (connection1));
01486
01487 }
01488
01489 mysql_free_result(result1);
01490
01491 }
01492
01493
01494 }
01495
01496
01497 else if(flags_enter==5)
01498 {
01499
01500
01501 sprintf(sql_statement,"select balance from user where user_pin = '%s' ",message1);
01502
01503 result_value = mysql_query (connection1, sql_statement);
01504
01505 if (result_value)
01506 {
01507 printf ("select failed as : %s\n", mysql_error (connection1));
01508
01509 }
01510 else
01511 {
01512 result1 = mysql_use_result (connection1);
01513
01514 if (result1)
01515 {
01516 while ((sqlrow = mysql_fetch_row (result1)))
01517 transfer_money ();
01518 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01519
01520
01521 if (mysql_errno (connection1))
01522 {
01523 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01524 }
01525
01526 }
01527 else if (result1)
01528 {
01529 printf ("select failed as : %s\n", mysql_error (connection1));
01530
01531 }
01532 updated_record();
01533 insert_report();
01534 updated_transfer_account();
01535 mysql_free_result(result1);
01536
01537 }
01538 sprintf(sql_statement,"select name, no_account,balance from user where user_pin = '%s' ",message1);
01539
01540 result_value = mysql_query (connection1, sql_statement);
01541
01542 if (result_value)
01543 {
01544 printf ("select failed as : %s\n", mysql_error (connection1));
01545
01546 }
01547 else
01548 {
01549 result1 = mysql_use_result (connection1);
01550 index_record=1;
01551 if (result1)
01552 {
01553 while ((sqlrow = mysql_fetch_row (result1)))
01554 create_report();
01555 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01556
01557 if (mysql_errno (connection1))
01558 {
01559 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01560 }
01561 }
01562 else if (result1)
01563 {
01564 printf ("select failed as : %s\n", mysql_error (connection1));
01565
01566 }
01567
01568 mysql_free_result(result1);
01569 }
01570
01571 sprintf(sql_statement,"select transaction, amount, remark from report where no_id = '%d' ",record_no);
01572
01573 result_value = mysql_query (connection1, sql_statement);
01574
01575 if (result_value)
01576 {
01577 printf ("select failed as : %s\n", mysql_error (connection1));
01578
01579 }
01580 else
01581 {
01582 result1 = mysql_use_result (connection1);
01583 index_record=2;
01584 if (result1)
01585 {
01586 while ((sqlrow = mysql_fetch_row (result1)))
01587 create_report();
01588 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01589
01590 if (mysql_errno (connection1))
01591 {
01592 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01593 }
01594 }
01595 else if (result1)
01596 {
01597 printf ("select failed as : %s\n", mysql_error (connection1));
01598
01599 }
01600 send_mail();
01601 mysql_free_result(result1);
01602 }
01603
01604
01605 }
01606
01607 else if(flags_enter==6)
01608 {
01609
01610 gtk_entry_set_text (GTK_ENTRY (entry1), "Enter confirm new password");
01611 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01612 flags_changesPass=2;
01613 }
01614
01615 else if(flags_enter==7)
01616 {
01617 while (counterCheck !=4)
01618 {
01619 if (strcmp(newPass,confirmPass)==0)
01620 {
01621 flags=1;
01622 }
01623 else
01624 {
01625 gtk_entry_set_text (GTK_ENTRY (entry1), "Invalid new password. Try Again");
01626 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01627 flags=0;
01628
01629 }
01630 i++;
01631 counterCheck++;
01632 }
01633
01634 if(flags==1)
01635 {
01636
01637 sprintf(sql_statement,"select user_pin from user where user_pin = '%s' ",message1);
01638
01639 result_value = mysql_query (connection1, sql_statement);
01640
01641 if (result_value)
01642 {
01643 printf ("select failed as : %s\n", mysql_error (connection1));
01644 }
01645 else
01646 {
01647 result1 = mysql_use_result (connection1);
01648 if (result1)
01649 {
01650 while ((sqlrow = mysql_fetch_row (result1)))
01651 display_row1 ();
01652
01653 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01654
01655
01656 if (mysql_errno (connection1))
01657 {
01658 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01659 }
01660
01661 }
01662 else if (result1)
01663 {
01664 printf ("select failed as : %s\n", mysql_error (connection1));
01665
01666 }
01667 updated_password_record();
01668 insert_report();
01669 mysql_free_result(result1);
01670
01671 }
01672
01673 sprintf(sql_statement,"select name, no_account,balance from user where user_pin = '%s' ",message1);
01674
01675 result_value = mysql_query (connection1, sql_statement);
01676
01677 if (result_value)
01678 {
01679 printf ("select failed as : %s\n", mysql_error (connection1));
01680
01681 }
01682 else
01683 {
01684 result1 = mysql_use_result (connection1);
01685 index_record=1;
01686 if (result1)
01687 {
01688 while ((sqlrow = mysql_fetch_row (result1)))
01689 create_report();
01690 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01691
01692 if (mysql_errno (connection1))
01693 {
01694 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01695 }
01696 }
01697 else if (result1)
01698 {
01699 printf ("select failed as : %s\n", mysql_error (connection1));
01700
01701 }
01702
01703 mysql_free_result(result1);
01704 }
01705
01706 sprintf(sql_statement,"select transaction, amount, remark from report where no_id = '%d' ",record_no);
01707
01708 result_value = mysql_query (connection1, sql_statement);
01709
01710 if (result_value)
01711 {
01712 printf ("select failed as : %s\n", mysql_error (connection1));
01713
01714 }
01715 else
01716 {
01717 result1 = mysql_use_result (connection1);
01718 index_record=2;
01719 if (result1)
01720 {
01721 while ((sqlrow = mysql_fetch_row (result1)))
01722 create_report();
01723 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01724
01725 if (mysql_errno (connection1))
01726 {
01727 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
01728 }
01729 }
01730 else if (result1)
01731 {
01732 printf ("select failed as : %s\n", mysql_error (connection1));
01733
01734 }
01735 send_mail();
01736 mysql_free_result(result1);
01737 }
01738 }
01739 else if(flags==0)
01740 {
01741 gtk_entry_set_text (GTK_ENTRY (entry1), "Invalid new password. Try Again");
01742 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
01743 }
01744
01745 }
01746 return TRUE;
01747 }
01748
01749
01754 void display_row1 ()
01755 {
01756
01757 unsigned int field_count;
01758
01759 field_count = 0;
01760
01761 if ( flags_enter==1 && index_enter==1)
01762 {
01763 while (field_count < mysql_field_count (connection1))
01764 {
01765 printf ("Welcome %s ", sqlrow[field_count]);
01766 sprintf(message, "%s",sqlrow[field_count]);
01767 field_count++;
01768 }
01769 first_click =1;
01770 gtk_label_set_text(GTK_LABEL(label2),message);
01771 gtk_entry_set_text(GTK_ENTRY(entry1),"Please select menu transaction");
01772 printf ("\n");
01773 }
01774
01775 else if (flags_enter ==1 && index_enter==2)
01776 {
01777 while (field_count < mysql_field_count (connection1))
01778 {
01779 sprintf(message1, "%s",sqlrow[field_count]);
01780 field_count++;
01781 }
01782 printf ("\n");
01783 }
01784
01785 else if (flags_enter ==1 && index_enter==4)
01786 {
01787 while (field_count < mysql_field_count (connection1))
01788 {
01789 sprintf(message4, "Account No: %s",sqlrow[field_count]);
01790 field_count++;
01791 }
01792 gtk_entry_set_text(GTK_ENTRY(entry1),"Please select menu transaction");
01793 gtk_label_set_text(GTK_LABEL(label3),message4);
01794 printf ("\n");
01795 }
01796
01797 else if (flags_balance ==1 && index_enter==3)
01798 {
01799 while (field_count < mysql_field_count (connection1))
01800 {
01801 printf ("From database Balance Available: %s ", sqlrow[field_count]);
01802 sprintf(message2, "%s",sqlrow[field_count]);
01803 field_count++;
01804 }
01805 gtk_entry_set_text(GTK_ENTRY(entry1),message2);
01806 printf ("\n");
01807 }
01808
01809 else if (flags_transfer==1 && flags_enter==4)
01810 {
01811 while (field_count < mysql_field_count (connection1))
01812 {
01813 printf ("transfer account: %s ", sqlrow[field_count]);
01814 sprintf(message3, "%s",sqlrow[field_count]);
01815 field_count++;
01816 }
01817 printf ("\n");
01818 }
01819
01820 else if (flags_transfer==2 && flags_enter==4)
01821 {
01822 while (field_count < mysql_field_count (connection1))
01823 {
01824 printf ("transfer balance: %s ", sqlrow[field_count]);
01825 sprintf(trans_balance, "%s",sqlrow[field_count]);
01826 field_count++;
01827 }
01828 printf ("\n");
01829 }
01830
01831 else if (flags==1 && flags_enter==7)
01832 {
01833 while (field_count < mysql_field_count (connection1))
01834 {
01835 printf ("User pin: %s ", sqlrow[field_count]);
01836 sprintf(new_user_pin, "%s",sqlrow[field_count]);
01837 field_count++;
01838 }
01839 printf ("\n");
01840 }
01841 }
01842
01843
01850 void create_report()
01851 {
01852
01853 unsigned int field_count;
01854
01855 field_count = 0;
01856
01857 if (index_record==1)
01858 {
01859 report_user=fopen("report_user.txt", "w");
01860 if(report_user==NULL)
01861 {
01862 fprintf(stderr, "Cant open file '%s' for writing\n", "report_user.txt");
01863 perror("");
01864 exit(EXIT_FAILURE);
01865 }
01866
01867 while (field_count < mysql_field_count (connection1))
01868 {
01869 printf ("Report: %s ", sqlrow[field_count]);
01870 sprintf(record_user, "%s",sqlrow[field_count]);
01871 fprintf(report_user, " %s ", record_user);
01872 field_count++;
01873 }
01874 printf ("\n");
01875 fclose(report_user);
01876 printf("Closed file '%s'\n", "report_user.txt");
01877 }
01878
01879 else if (index_record==2)
01880 {
01881 report_transaction=fopen("report_transaction.txt", "w");
01882 if(report_transaction==NULL)
01883 {
01884 fprintf(stderr, "Cant open file '%s' for writing\n", "report_transaction.txt");
01885 perror("");
01886 exit(EXIT_FAILURE);
01887 }
01888
01889 while (field_count < mysql_field_count (connection1))
01890 {
01891 printf ("Report: %s ", sqlrow[field_count]);
01892 sprintf(record_transaction, "%s",sqlrow[field_count]);
01893 fprintf(report_transaction, " %s ", record_transaction);
01894 field_count++;
01895 }
01896 printf ("\n");
01897 fclose(report_transaction);
01898 printf("Closed file '%s'\n", "report_transaction.txt");
01899 }
01900 }
01901
01907 void send_mail()
01908 {
01909 sprintf(command_statement, "mutt -s Report SBH -a /home/ain/st/project/report_user.txt hamidon.bt@students.iiit.ac.in < /home/ain/st/project/record.txt");
01910 system(command_statement);
01911
01912 sprintf(command_statement, "mutt -s Report SBH -a /home/ain/st/project/report_transaction.txt hamidon.bt@students.iiit.ac.in < /home/ain/st/project/record.txt");
01913 system(command_statement);
01914
01915 printf("report file sent to mail succesfully");
01916 printf ("\n");
01917 }
01918
01919
01924 void transfer_money ()
01925 {
01926
01927 unsigned int field_count;
01928
01929 field_count = 0;
01930
01931 strcat(trans_type,"transfer money");
01932 printf ("Transfer Account: %d ", transfer_account1);
01933
01934 while (field_count < mysql_field_count (connection1))
01935 {
01936 sprintf(message2, "%s",sqlrow[field_count]);
01937
01938
01939 trans_amount1=atof(transfer_amount);
01940 total_amount1=atof(message2);
01941
01942 printf ("Transfer Amount from user: %.2f ", trans_amount1);
01943 printf ("take Amount from dtbase: %.2f ", total_amount1);
01944
01945
01946 if (trans_amount1 < 50000)
01947 {
01948 total_amount1 = total_amount1 - trans_amount1;
01949 printf ("New balance %.2f ", total_amount1);
01950
01951 gtk_entry_set_text(GTK_ENTRY(entry1),"Transfer amount process is succesfully");
01952 strcat(trans_status,"succesfully");
01953
01954 }
01955
01956 else
01957 {
01958 gtk_entry_set_text (GTK_ENTRY (entry1), "Invalid Value. Check your balance");
01959 strcat(trans_status,"failed");
01960
01961 }
01962
01963 field_count++;
01964
01965 }
01966
01967 }
01968
01974 void count_withdrawal ()
01975 {
01976
01977 unsigned int field_count;
01978
01979 field_count = 0;
01980 strcat(trans_type,"withdrawal");
01981
01982
01983
01984 while (field_count < mysql_field_count (connection1))
01985 {
01986 sprintf(message2, "%s",sqlrow[field_count]);
01987
01988 withdraw_amount1=atof(withdraw_value);
01989 total_amount1=atof(message2);
01990
01991 printf ("Withdrawal Amount from user: %.2f ", withdraw_amount1);
01992 printf ("take Amount from dtbase: %.2f ", total_amount1);
01993
01994
01995 if (total_amount1 > withdraw_amount1)
01996 {
01997 total_amount1 = total_amount1 - withdraw_amount1;
01998 printf ("New balance %.2f ", total_amount1);
01999
02000 gtk_entry_set_text(GTK_ENTRY(entry1),"Withdrawal process is succesfully");
02001 strcat(trans_status,"succesfully");
02002
02003 }
02004
02005 else
02006 {
02007 gtk_entry_set_text (GTK_ENTRY (entry1), "Invalid Value. Check your balance");
02008 strcat(trans_status,"failed");
02009
02010 }
02011
02012 field_count++;
02013
02014 }
02015
02016 }
02017
02018
02023 void count_deposit ()
02024 {
02025
02026 unsigned int field_count;
02027
02028 field_count = 0;
02029 strcat(trans_type,"deposit");
02030
02031 while (field_count < mysql_field_count (connection1))
02032 {
02033
02034 sprintf(message2, "%s",sqlrow[field_count]);
02035
02036 deposit_amount1=atof(deposit_value);
02037 total_amount1=atof(message2);
02038
02039 printf ("Deposit Amount from user: %.2f ", deposit_amount1);
02040 printf ("Take amount from dtbase: %.2f ", total_amount1);
02041
02042
02043 if (deposit_amount1 < 50000)
02044 {
02045 total_amount1 = total_amount1 + deposit_amount1;
02046 printf ("New balance %.2f ", total_amount1);
02047 gtk_entry_set_text(GTK_ENTRY(entry1),"Deposit process is succesfully");
02048 strcat(trans_status,"succesfully");
02049 }
02050
02051 else
02052 {
02053 gtk_entry_set_text (GTK_ENTRY (entry1), "Invalid Value. Check your balance");
02054 strcat(trans_status,"failed");
02055 }
02056
02057 field_count++;
02058
02059 }
02060
02061 }
02062
02063
02066 void updated_password_record()
02067 {
02068 char sql_statement[4096];
02069
02070 strcat(trans_type,"change password");
02071
02072 int result;
02073
02074 sprintf(sql_statement, "update user set user_pin='%s' where user_pin=%s",confirmPass,new_user_pin);
02075 result = mysql_query (connection1, sql_statement);
02076
02077 if (!result)
02078 {
02079 gtk_entry_set_text (GTK_ENTRY (entry1), "Change password process is succesfully");
02080 printf ("Updated %lu rows\n", (unsigned long) mysql_affected_rows (connection1));
02081 strcat(trans_status,"succesfully");
02082 }
02083 else
02084 {
02085 fprintf (stderr, "Updated failed as %d: %s\n", mysql_errno (connection1), mysql_error (connection1));
02086 strcat(trans_status,"failed");
02087 }
02088 }
02089
02090
02091
02095 void updated_transfer_account()
02096 {
02097 char sql_statement[4096];
02098 int result;
02099
02100 trans_balance1=atof(trans_balance);
02101 trans_balance1 = trans_balance1 + trans_amount1;
02102
02103 sprintf(sql_statement, "update user set balance='%.2f' where no_account=%s",trans_balance1,message3);
02104 result = mysql_query (connection1, sql_statement);
02105
02106 if (!result)
02107 {
02108 printf ("Updated %lu rows\n", (unsigned long) mysql_affected_rows (connection1));
02109 }
02110 else
02111 {
02112 fprintf (stderr, "Updated failed as %d: %s\n", mysql_errno (connection1), mysql_error (connection1));
02113 }
02114 }
02115
02116
02119 void updated_record()
02120 {
02121 char sql_statement[4096];
02122 int result;
02123
02124 sprintf(sql_statement, "update user set balance='%.2f' where user_pin=%s",total_amount1,message1);
02125 result = mysql_query (connection1, sql_statement);
02126
02127 if (!result)
02128 {
02129 printf ("Updated %lu rows\n", (unsigned long) mysql_affected_rows (connection1));
02130 }
02131 else
02132 {
02133 fprintf (stderr, "Updated failed as %d: %s\n", mysql_errno (connection1), mysql_error (connection1));
02134 }
02135 }
02136
02137
02141 void insert_report()
02142 {
02143 char sql_statement[4096];
02144 int result;
02145
02146 record_no=record_bil+1;
02147
02148 if(strcmp(trans_type,"withdrawal")==0)
02149 {
02150 sprintf(sql_statement,"INSERT into report values('%d','%s','%s','%.2f','%s')",record_no,message1,trans_type,withdraw_amount1,trans_status);
02151 result = mysql_query (connection1, sql_statement);
02152
02153 if (result==0)
02154 {
02155 printf ("New record inserted successfully.\n");
02156 }
02157 else
02158 {
02159 fprintf (stderr, "Could not insert data as %d: %s\n",mysql_errno (connection1),mysql_error (connection1));
02160 printf("Please try again\n");
02161 }
02162
02163 }
02164
02165 else if(strcmp(trans_type,"deposit")==0)
02166 {
02167 sprintf(sql_statement, "INSERT into report values('%d','%s','%s','%.2f','%s')",record_no,message1,trans_type,deposit_amount1,trans_status);
02168 result = mysql_query (connection1, sql_statement);
02169
02170 if (result==0)
02171 {
02172 printf ("New record inserted successfully.\n");
02173 }
02174 else
02175 {
02176 fprintf (stderr, "Could not insert data as %d: %s\n",mysql_errno (connection1),mysql_error (connection1));
02177 printf("Please try again\n");
02178 }
02179
02180 }
02181
02182 else if(strcmp(trans_type,"transfer money")==0)
02183 {
02184 sprintf(sql_statement, "INSERT into report values('%d','%s','%s','%.2f','%s')",record_no,message1,trans_type,trans_amount1,message3);
02185 result = mysql_query (connection1, sql_statement);
02186
02187 if (result==0)
02188 {
02189 printf ("New record inserted successfully.\n");
02190 }
02191 else
02192 {
02193 fprintf (stderr, "Could not insert data as %d: %s\n",mysql_errno (connection1),mysql_error (connection1));
02194 printf("Please try again\n");
02195 }
02196
02197 }
02198
02199 else if(strcmp(trans_type,"change password")==0)
02200 {
02201 sprintf(sql_statement, "INSERT into report values('%d','%s','%s','%s','%s')",record_no,message1,trans_type,confirmPass,trans_status);
02202 result = mysql_query (connection1, sql_statement);
02203
02204 if (result==0)
02205 {
02206 printf ("New record inserted successfully.\n");
02207 }
02208 else
02209 {
02210 fprintf (stderr, "Could not insert data as %d: %s\n",mysql_errno (connection1),mysql_error (connection1));
02211 printf("Please try again\n");
02212 }
02213
02214 }
02215 }
02216
02217
02222 static gboolean balance_function (GtkButton *button_Balance, gpointer data)
02223 {
02224
02225 struct myparam *mp = data;
02226 char sql_statement[4096];
02227 int result_value;
02228
02229 if (first_click ==0)
02230 {
02231 gtk_entry_set_text (GTK_ENTRY (entry1), "Please enter pin number");
02232 }
02233 else if (first_click ==1)
02234
02235
02236 {
02237
02238 sprintf(sql_statement,"select balance from user where user_pin = '%s' ",message1);
02239
02240 result_value = mysql_query (connection1, sql_statement);
02241
02242 if (result_value)
02243 {
02244 printf ("select failed as : %s\n", mysql_error (connection1));
02245 }
02246 else
02247 {
02248 result1 = mysql_use_result (connection1);
02249 index_enter=3;
02250 if (result1)
02251 {
02252 while ((sqlrow = mysql_fetch_row (result1)))
02253
02254 display_row1 ();
02255 gtk_entry_set_text(GTK_ENTRY(mp->entry),"");
02256 if (mysql_errno (connection1))
02257 {
02258 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
02259 }
02260 }
02261 mysql_free_result(result1);
02262 }
02263 }
02264
02265 return TRUE;
02266 }
02267
02268
02273 static gboolean deposit_function (GtkButton *button_Deposit, gpointer entry1)
02274 {
02275
02276 if (first_click ==0)
02277 {
02278 gtk_entry_set_text (GTK_ENTRY (entry1), "Please enter pin number");
02279 }
02280 else if (first_click ==1)
02281 {
02282
02283 flags_deposit=1;
02284 gtk_entry_set_text (GTK_ENTRY (entry1), "Enter deposit amount:");
02285 }
02286
02287 return TRUE;
02288 }
02289
02290
02295 static gboolean transfer_function (GtkButton *button_Transfer, gpointer entry1)
02296 {
02297
02298 if (first_click ==0)
02299 {
02300 gtk_entry_set_text (GTK_ENTRY (entry1), "Please enter pin number");
02301 }
02302 else if (first_click ==1)
02303 {
02304
02305 flags_transfer=1;
02306 gtk_entry_set_text (GTK_ENTRY (entry1), "Enter account no:");
02307 }
02308
02309 return TRUE;
02310 }
02311
02312
02317 static gboolean changePass_function (GtkButton *button_ChangePass, gpointer entry1)
02318 {
02319
02320 if (first_click ==0)
02321 {
02322 gtk_entry_set_text (GTK_ENTRY (entry1), "Please enter pin number");
02323 }
02324 else if (first_click ==1)
02325 {
02326 flags_changesPass=1;
02327 gtk_entry_set_text (GTK_ENTRY (entry1), "Enter new password:");
02328 }
02329
02330 return TRUE;
02331 }
02332
02333
02338 static gboolean withdraw_function (GtkButton *button_Withdraw, gpointer entry1)
02339 {
02340 if (first_click ==0)
02341 {
02342 gtk_entry_set_text (GTK_ENTRY (entry1), "Please enter pin number");
02343 }
02344 else if (first_click ==1)
02345 {
02346 gtk_entry_set_text (GTK_ENTRY (entry1), "Enter withdraw amount:");
02347 flags_Withdraw=1;
02348 }
02349
02350 return TRUE;
02351 }
02352
02353
02354
02355
02356
02357
02358