-
Notifications
You must be signed in to change notification settings - Fork 0
/
project marcross.cpp
487 lines (425 loc) · 11.1 KB
/
project marcross.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
#include<iostream>
#include<fstream>
#include<string.h>
#include<conio.h>
#include<windows.h>
void create (void);
void modify (void);
void delet (void);
void login(void);
void developer(void);
void view(void);
void implement(void);
using namespace std;
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); //for font
void fontsize(int,int);
int main()
{ int z=1,y=0;
while(z==1)
{
system("cls");
system("mode 650");
system("color 1a");
fontsize(19, 19);
cout<<" _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ "<<endl;
cout<<" ||---------------------------------------------------||"<<endl;
cout<<" || REPUBLIC OF GAMERS UNION~[PROJECT MACROSS] ||"<<endl;
cout<<" || ``````````````````````````````````` ||"<<endl;
cout<<" || The Concept Of ENCRYPTION AND DECRYPTION ||"<<endl;
cout<<" || For FILE SECURITY ||"<<endl;
cout<<" || With ||"<<endl;
cout<<" || STUDENT DATABASE MANAGEMENT SYSTEM..... ||"<<endl;
cout<<" || ||"<<endl;
cout<<" || ||"<<endl;
cout<<" ||Project leader:=ASHISH ||"<<endl;
cout<<" ||CREW members:=SANTOSH,SANDEEP,RABINDRANATH,RAJESH ||"<<endl;
cout<<" ||_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ||"<<endl;
cout<<" ||---------------------------------------------------||"<<endl;
cout<<"\n***************************************************************************************************\n";
cout<<" 1.DEVELOPERS PORTAL\n";
cout<<" 2.TEACHER LOGIN/SIGNUP PORTAL\n";
cout<<" 3.STUDENT ACTIVITY PORTAL \n";
cout<<" 4.EXIT\n";
cin>>y;
if(y==1)
developer();
else if(y==2)
login();
else if(y==3)
view();
else if(y==4)
break;
else
cout<<"WORNG INPUT...Try AGAIN\n";
cout<<"\n\npress ENTER.....\n";
getch();
cout<<"\nloding";
for(int i=0;i<5;i++)
{
//for(int j=0;j<199999999;j++);
Sleep(300);
cout<<".";}
}
return 0;
}
///////////////////////login signup module//////////////////////////////////////////
void login(void)
{ int x;
cout<<"for LOGIN-----1\n";
cout<<"for SIGN UP---2\n";
cin>>x;
if(x==1)
{ string id,path;char t;int j=0;
path="DATABASE/";
cout<<"enter your ID\n";
cin>>id;
path.append(id.c_str());
id=path;
fstream file(id.c_str(),ios::in);
if(file.is_open())
{ string id2,password,password2;
id2=id;
id2.append(".txt");
path.append(id2.c_str());
cout<<"Enter your PASSWORD\n";
cin>>password;
fstream file4(id2.c_str(),ios::out);
while(!file.eof())
{ file>>t;
t=t-121;
if(!file.eof())
{ file4<<t;
}
}
file4.close();
file.close();
file4.open(id2.c_str(),ios::in);
file4>>password2;
file4.close();
if(password==password2)
{ cout<<"access granted\n"; ///delay
remove(id2.c_str());
//manipulation code
int choice;
cout<<"create a student profile------1\n";
cout<<"modify a student profile------2\n";
cout<<"delete a student profile------3\n";
cout<<"for exit -----4\n";
cin>>choice;
if(choice==1)
{
create();
}
else if(choice==2) //modification module
{
modify();
}
else if(choice==3)
{ delet();
}
else if(choice==4)
{ return;
}
}
else
{
cout<<"INCORRECT PASSWORD\n";
}
}
else
cout<<"INVALID ID\n";
}
if(x==2)
{
string createId,createId2,pass,pass2,path,path2,path3,passD,createD;
char x;
cout<<"FOR SIGN UP==...\n\n\n";
cout<<"[Id and Password both must be 8 characters]\n";
cout<<"Enter your ID :";
cin>>createId;
cout<<"Enter your PASSWORD :";
cin>>pass;
createD=createId;
passD=pass;
path="DATABASE/";
path2="DATABASE_CONFIDENTIAL/logins";
path3=path2;
path3.append(".txt");
path.append(createId.c_str());
createId=path;
createId2=createId;
createId2.append(".txt");
fstream file6(createId2.c_str(),ios::out);
fstream fileD(path2.c_str(),ios::out | ios::app);
fstream fileD1(path3.c_str(),ios::out);
fileD1<<createD<<" "<<passD<<endl;
fileD1.close();
fileD1.open(path3.c_str(),ios::in);
while(!fileD1.eof())
{ fileD1>>noskipws>>x;
x=x+131;
if(!fileD1.eof())
{ fileD<<x;
}
}
fileD.close();
fileD1.close();
remove(path3.c_str());
file6<<pass;
file6.close();
fstream file7(createId.c_str(),ios::out);
file6.open(createId2.c_str(),ios::in);
while(!file6.eof())
{file6>>x;
x=x+121;
if(!file6.eof())
{ file7<<x;
fileD<<x;
}
}
file6.close();
file7.close();
fileD.close();
remove(createId2.c_str());
cout<<"YOUR ACCOUT HAS BEEN CREATED\n";
cout<<"thank you\n";
}
return;
}
//////////////////////////////////////////developer module
void developer(void)
{ int x;char c;
string ID;
int pass;
string path1,path2;
path1="DATABASE_CONFIDENTIAL/logins";
path2="DATABASE_CONFIDENTIAL/data";
cout<<"enter your id sir\n";
cin>>ID;
if(ID=="ashish") //developer id
{ cout<<"enter your password sir\n";
cin>>pass;
if (pass==24955942) //developer password
{ int choice;
cout<<"FOR VIEW ALL IDS and PASSWORDS ACCESSED--------1\n";
cout<<"FOR VIEW ALL STUDENT DATA ---------------------2\n\n";
cout<<"[NOTE]:-"<<endl;
cout<<"[all data viewed here are those,which has been created form the software is started]"<<endl;
cout<<"[it also consists of deleted data for recovery and verification]\n"<<endl;
cin>>choice;
if (choice==1)
{ cout<<" IDs PASSWORDs\n";
cout<<"----- ----------\n";
fstream f(path1.c_str(),ios::in);
while(!f.eof())
{ f>>noskipws>>c;
if(!f.eof())
{ c=c-131; //decryption of ids file
cout<<c;
}
}
}
else if(choice==2)
{ cout<<"NAME ROLL BRANCH ADDRESS"<<endl;
cout<<"---- ----- ------ --------\n";
ifstream f(path2.c_str(),ios::in);
while(!f.eof())
{ f>>c;
if(!f.eof())
{ c=c-122; //decryption of stud file
cout<<c;
}
}
}
}
else
{ cout<<"sorry...wrong password \n";
cout<<"thank you ...joing us\n";
}
}
else
{ cout<<"sorry...wrong ID \n";
cout<<"thank you ...joing us\n";
}
return;
}
///////////////////////////////////////////////////////////////module definition area ////////////////////////
void create ()
{ string roll,Roll,branch,address,name,path,path2,path3,rollD,oroll;
path="DATABASE_STUD/";
path2="DATABASE_CONFIDENTIAL/data";
path3=path2;
char ch;
cout<<"enter NAME=:";
cin>>name;
cout<<"\nenter ROLL=:";
cin>>roll;
cout<<"\nenter BRANCH=:";
cin>>branch;
cout<<"\nenter ADDRESS=:";
cin>>address;
oroll=roll;
rollD=roll;
path.append(roll.c_str());
roll=path;
Roll=roll;
Roll.append(".txt");
fstream file1(Roll.c_str(),ios::out);
file1<<name<<" "<<oroll<<" "<<branch<<" "<<address;
file1.close();
file1.open(Roll.c_str(),ios::in);
fstream file2(roll.c_str(),ios::out);
while(!file1.eof())
{ file1>>noskipws>>ch;
ch=ch+121; //reading from the files
if (!file1.eof())
{ file2<<ch;
} }
file1.close();
file2.close();
remove(Roll.c_str());
path3.append(".txt");
file1.open(path3.c_str(),ios::out);
file1<<name<<" "<<rollD<<" "<<branch<<" "<<address<<endl;
file1.close();
file1.open(path3.c_str(),ios::in);
file2.open(path2.c_str(),ios::out | ios::app);
while(!file1.eof())
{ file1>>noskipws>>ch;
ch=ch+122; ///++++
if(!file1.eof())
{ file2<<ch;
}
}
file1.close();
file2.close();
remove(path3.c_str());
cout<<"student file created succefully :("<<name<<")"<<endl;
return ;
}
////////.............................................................................................................
void modify()
{ string roll,Roll,branch,address,name,path,path2,path3,roll2;
path="DATABASE_STUD/";
path2="DATABASE_CONFIDENTIAL/data";
path3=path2;
char ch;
cout<<"enter roll for updation\n";
cin>>roll;
path.append(roll.c_str());
roll=path;
fstream file3(roll.c_str(),ios::in);
if(file3.is_open())
{
file3.close();
remove(roll.c_str());
cout<<"enter new NAME =:";
cin>>name;
cout<<"\nenter new ROLL =:";
cin>>roll;
cout<<"\nenter new BRANCH =:";
cin>>branch;
cout<<"\nenter new ADDRESS=:";
cin>>address;
path="DATABASE_STUD/";
path.append(roll.c_str());
roll2=roll;
roll=path;
Roll=roll;
Roll.append(".txt");
fstream file1(Roll.c_str(),ios::out);
file1<<name<<" "<<roll2<<" "<<branch<<" "<<address;
file1.close();
file1.open(Roll.c_str(),ios::in);
fstream file2(roll.c_str(),ios::out);
while(!file1.eof())
{ file1>>noskipws>>ch;
ch=ch+121; //reading from the files
if (!file1.eof())
{ file2<<ch;
} }
file1.close();
file2.close();
remove(Roll.c_str());
path3.append(".txt");
file1.open(path3.c_str(),ios::out);
file1<<name<<" "<<roll2<<" "<<branch<<" "<<address<<endl;
file1.close();
file1.open(path3.c_str(),ios::in);
file2.open(path2.c_str(),ios::out | ios::app);
while(!file1.eof())
{ file1>>noskipws>>ch;
ch=ch+122; ///++++
if(!file1.eof())
{ file2<<ch;
}
}
file1.close();
file2.close();
remove(path3.c_str());
cout<<"databse modified of Roll:"<<roll2<<endl;
cout<<"Thank YOU\n";
return ;
}
else
{
cout<<"no roll found\n";
return;}
}
///////////////////////////.....................................................................................................
void delet()
{string roll,Roll,branch,address,name,path,roll2;
path="DATABASE_STUD/";
char ch;
cout<<"enter roll for deletion\n";
cin>>roll;
roll2=roll;
path.append(roll.c_str());
roll=path;
fstream file3(roll.c_str(),ios::in);
if(file3.is_open())
{
file3.close();
remove(roll.c_str());
cout<<"student file roll:= "<<roll2<<" has been DELETED \n";
return;
}
else
{ cout<<"NO SUCH FILE EXIST OF THIS ROLL no.:-"<<roll2<<endl;
return;
}
}
void view()
{ string roll,Roll,branch,address,name,path,roll2;
path="DATABASE_STUD/";
char ch;
cout<<"enter roll for view\n";
cin>>roll;
roll2=roll;
path.append(roll.c_str());
fstream file3(path.c_str(),ios::in);
if(file3.is_open())
{cout<<"NAME ROLL BRANCH ADDRESS\n";
cout<<"---- ----- ------ -------\n";
while(!file3.eof())
{ file3>>noskipws>>ch;
ch=ch-121;
if(!file3.eof())
{ cout<<ch;
}
}
}
else
{ cout<<"\nNO SUCH FILE EXIST OF THIS ROLL no.:="<<roll2;
}
return;
}
////////////////////////....................................................................................
void fontsize(int a, int b){
PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx = new CONSOLE_FONT_INFOEX();
lpConsoleCurrentFontEx->cbSize = sizeof(CONSOLE_FONT_INFOEX);
GetCurrentConsoleFontEx(out, 0, lpConsoleCurrentFontEx);
lpConsoleCurrentFontEx->dwFontSize.X = a;
lpConsoleCurrentFontEx->dwFontSize.Y = b;
SetCurrentConsoleFontEx(out, 0, lpConsoleCurrentFontEx);
}