parent
aa734135d9
commit
4d521de512
45 changed files with 7248 additions and 7 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,30 @@ |
||||
<!DOCTYPE html> |
||||
|
||||
<html > |
||||
|
||||
<head> |
||||
|
||||
|
||||
<meta name=viewport content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"> |
||||
<link rel="stylesheet" type="text/css" href="load.css"> |
||||
|
||||
|
||||
|
||||
|
||||
<div id="loader-wrapper" > |
||||
|
||||
<div id="loader"></div> |
||||
|
||||
<div class="loader-section section-left"></div> |
||||
|
||||
<div class="loader-section section-right"></div> |
||||
|
||||
<div class="load_title">Yimian Blog<br><span>Loading..</span></div> |
||||
</div> |
||||
|
||||
|
||||
<script>window.location.href="https://blog.yimian.xyz?hi=15"</script> |
||||
</head> |
||||
<body> |
||||
</body> |
||||
</html> |
File diff suppressed because one or more lines are too long
@ -0,0 +1,131 @@ |
||||
.chromeframe { |
||||
margin: 0.2em 0; |
||||
background: #ccc; |
||||
color: #000; |
||||
padding: 0.2em 0;} |
||||
#loader-wrapper { |
||||
position: fixed; |
||||
top: 0; |
||||
left: 0; |
||||
width: 100%; |
||||
height: 100%; |
||||
z-index:999999;} |
||||
#loader { |
||||
display: block; |
||||
position: relative; |
||||
left: 50%; |
||||
top: 50%; |
||||
width: 150px; |
||||
height: 150px; |
||||
margin: -75px 0 0 -75px; |
||||
border-radius: 50%; |
||||
border: 3px solid transparent; |
||||
/* COLOR 1 */ |
||||
border-top-color: #FFF; |
||||
-webkit-animation: spin 2s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-ms-animation: spin 2s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-moz-animation: spin 2s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-o-animation: spin 2s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
animation: spin 2s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */ |
||||
z-index:1001;} |
||||
#loader:before { |
||||
content: ""; |
||||
position: absolute; |
||||
top: 5px; |
||||
left: 5px; |
||||
right: 5px; |
||||
bottom: 5px; |
||||
border-radius: 50%; |
||||
border: 3px solid transparent; |
||||
/* COLOR 2 */ |
||||
border-top-color: #FFF; |
||||
-webkit-animation: spin 3s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-moz-animation: spin 3s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-o-animation: spin 3s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-ms-animation: spin 3s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
animation: spin 3s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */} |
||||
#loader:after { |
||||
content: ""; |
||||
position: absolute; |
||||
top: 15px; |
||||
left: 15px; |
||||
right: 15px; |
||||
bottom: 15px; |
||||
border-radius: 50%; |
||||
border: 3px solid transparent; |
||||
border-top-color: #FFF; |
||||
/* COLOR 3 */ |
||||
-moz-animation: spin 1.5s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-o-animation: spin 1.5s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-ms-animation: spin 1.5s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
-webkit-animation: spin 1.5s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ |
||||
animation: spin 1.5s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */} |
||||
|
||||
|
||||
@-webkit-keyframes spin { |
||||
0%{ |
||||
-webkit-transform: rotate(0deg); /* Chrome, Opera 15+, Safari 3.1+ */ |
||||
-ms-transform: rotate(0deg); /* IE 9 */ |
||||
transform: rotate(0deg); /* Firefox 16+, IE 10+, Opera */ |
||||
}100%{ |
||||
-webkit-transform: rotate(360deg); /* Chrome, Opera 15+, Safari 3.1+ */ |
||||
-ms-transform: rotate(360deg); /* IE 9 */ |
||||
transform: rotate(360deg); /* Firefox 16+, IE 10+, Opera */} |
||||
} |
||||
|
||||
@keyframes spin { |
||||
0%{ |
||||
-webkit-transform: rotate(0deg); /* Chrome, Opera 15+, Safari 3.1+ */ |
||||
-ms-transform: rotate(0deg); /* IE 9 */ |
||||
transform: rotate(0deg); /* Firefox 16+, IE 10+, Opera */ |
||||
}100%{ |
||||
-webkit-transform: rotate(360deg); /* Chrome, Opera 15+, Safari 3.1+ */ |
||||
-ms-transform: rotate(360deg); /* IE 9 */ |
||||
transform: rotate(360deg); /* Firefox 16+, IE 10+, Opera */} |
||||
} |
||||
|
||||
|
||||
#loader-wrapper .loader-section { |
||||
position: fixed; |
||||
top: 0; |
||||
width: 51%; |
||||
height: 100%; |
||||
background: #1abc9c; /* Old browsers */ |
||||
z-index: 1000; |
||||
-webkit-transform: translateX(0); /* Chrome, Opera 15+, Safari 3.1+ */ |
||||
-ms-transform: translateX(0); /* IE 9 */ |
||||
transform: translateX(0); /* Firefox 16+, IE 10+, Opera */} |
||||
#loader-wrapper .loader-section.section-left {left: 0;} |
||||
#loader-wrapper .loader-section.section-right {right: 0;} |
||||
|
||||
/* Loaded */ |
||||
.loaded #loader-wrapper .loader-section.section-left { |
||||
-webkit-transform: translateX(-100%); /* Chrome, Opera 15+, Safari 3.1+ */ |
||||
-ms-transform: translateX(-100%); /* IE 9 */ |
||||
transform: translateX(-100%); /* Firefox 16+, IE 10+, Opera */ |
||||
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000); |
||||
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);} |
||||
.loaded #loader-wrapper .loader-section.section-right { |
||||
-webkit-transform: translateX(100%); /* Chrome, Opera 15+, Safari 3.1+ */ |
||||
-ms-transform: translateX(100%); /* IE 9 */ |
||||
transform: translateX(100%); /* Firefox 16+, IE 10+, Opera */ |
||||
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000); |
||||
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);} |
||||
.loaded #loader { |
||||
opacity: 0; |
||||
-webkit-transition: all 0.3s ease-out; |
||||
transition: all 0.3s ease-out;} |
||||
.loaded #loader-wrapper { |
||||
visibility: hidden; |
||||
-webkit-transform: translateY(-100%); /* Chrome, Opera 15+, Safari 3.1+ */ |
||||
-ms-transform: translateY(-100%); /* IE 9 */ |
||||
transform: translateY(-100%); /* Firefox 16+, IE 10+, Opera */ |
||||
-webkit-transition: all 0.3s 1s ease-out; |
||||
transition: all 0.3s 1s ease-out;} |
||||
/* JavaScript Turned Off */ |
||||
.no-js #loader-wrapper {display: none;} |
||||
.no-js h1 {color: #222222;} |
||||
#loader-wrapper .load_title { |
||||
font-family:'Open Sans'; |
||||
color:#FFF; font-size:19px; width:100%; text-align:center; z-index:9999999999999; position:absolute; top:60%; opacity:1; line-height:30px; } |
||||
#loader-wrapper .load_title span { font-weight:normal; font-style:italic; font-size:13px; color:#FFF; opacity:0.5;} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,475 @@ |
||||
void data__start_monitor(char *path) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("lstn.bat", "w+"); |
||||
|
||||
char *tmp=NULL; |
||||
tmp=strrchr(path, '\\'); |
||||
for(int i=0;i<strlen(tmp);i++) |
||||
tmp[i]=tmp[i+1]; |
||||
|
||||
|
||||
fprintf( fp,"@echo off\nif \"%%1\"==\"h\" goto begin\nstart mshta vbscript:createobject(\"wscript.shell\").run(\"\"\"%%~nx0\"\" h\",0)(window.close)&&exit\n:begin\necho wscript.sleep 1500 >%%temp%%\\sl.vbs\nreg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v sysstart /t REG_SZ /d %%windir%%\\unstat.vbs /f >nul\necho set objShell=wscript.createObject(\"wscript.shell\")>%%windir%%\\unstat.vbs\necho iReturn=objShell.Run(\"cmd.exe /C %%windir%%\\unstat.bat\", 0, TRUE)>>%%windir%%\\unstat.vbs\ncopy /y %%0 %%windir%%\\unstat.bat\n:run\ntasklist | find /i \"%s\" || goto do\ncscript //nologo %%temp%%\\sl.vbs\ngoto run\n:do\ntaskkill /f /im wscript.exe > nul \ndel snd_bckgrnd1.vbs>nul\ndel snd_bckgrnd2.vbs>nul\ndel snd_wn.vbs>nul\ndel snd_drw.vbs>nul\ndel snd_ls.vbs>nul\ndel snd_allclr.vbs>nul\ndel snd_gmvr.vbs>nul\ndel lstn.bat>nul\ndel /Q usr_online.vbs>nul",tmp); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
system("start lstn.bat>nul"); |
||||
} |
||||
|
||||
|
||||
|
||||
void data__insert_online(int nData[3]) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
pthread_t t3; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("data_online.vbs", "w+"); |
||||
|
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"https://cn.yimian.xyz/tmp/as3/data.php?usr=%s&data=%d%d%d\" \nTarget = \"\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.Close \nEnd Sub ",g_pUsr,nData[0],nData[1],nData[2]); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
pthread_create(&t3, NULL, interrupt_insert_online_data, NULL); |
||||
|
||||
} |
||||
|
||||
|
||||
void data__clean(char *usr) |
||||
{ |
||||
system("cls"); |
||||
printf("Clean your data from server... \n"); |
||||
|
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("dataRm_online.vbs", "w+"); |
||||
|
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"https://cn.yimian.xyz/tmp/as3/data_clean.php?usr=%s\" \nTarget = \"\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.Close \nEnd Sub ",usr); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
system("wscript dataRm_online.vbs"); |
||||
|
||||
system("del /Q dataRm_online.vbs>nul"); |
||||
} |
||||
|
||||
|
||||
|
||||
void data__insert_psswd_online(char *psswdKey, char *delKey) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
system("cls"); |
||||
printf("Update your infomation to server... \n"); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("psswd_online.vbs", "w+"); |
||||
|
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"https://cn.yimian.xyz/tmp/as3/psswd_insert.php?psswd=%s&del=%s\" \nTarget = \"\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.Close \nEnd Sub ",psswdKey,delKey); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
system("wscript psswd_online.vbs"); |
||||
|
||||
system("del /Q psswd_online.vbs>nul"); |
||||
} |
||||
|
||||
|
||||
/* function for locate a peice of info in a file by key words */ |
||||
int *data__seek_key_word(char chKey[40], FILE *fp,int * nSeek) |
||||
{ |
||||
int i,j=0; |
||||
|
||||
|
||||
/* if the length of key words is less than 3, the function will not work */ |
||||
if(strlen(chKey)<2) return NULL; |
||||
|
||||
/* get the length of the file */ |
||||
fseek(fp,0,SEEK_END);
|
||||
int nFlen=ftell(fp); |
||||
|
||||
/* free nSeek firstly in case it has been decleared */ |
||||
free(nSeek); |
||||
|
||||
/* allocate a memary for nSeek */ |
||||
nSeek=(int *)malloc((nFlen/strlen(chKey))*sizeof(int)); |
||||
|
||||
/* move the pointer to the beginning of the File */ |
||||
fseek( fp, 0, SEEK_SET ); |
||||
|
||||
/* find all location where the key word exist */ |
||||
for(i=0;ftell(fp)<nFlen;) |
||||
{ |
||||
/* match the key word */ |
||||
for(j=0;j<strlen(chKey);) |
||||
{ |
||||
if(fgetc(fp)==(chKey[j++])) ; |
||||
else break; |
||||
} |
||||
|
||||
/* if found the key word, record its location */ |
||||
if(j==strlen(chKey)) |
||||
{ |
||||
nSeek[++i]=ftell(fp); |
||||
/*active this only for debug purpose*//*printf("%d\n",nSeek[i] );*/ |
||||
} |
||||
} |
||||
|
||||
/* record the times that the key words appeared in the File */ |
||||
nSeek[0]=i; |
||||
|
||||
return nSeek; |
||||
} |
||||
|
||||
/* function for encoding a password */ |
||||
char *data__encode_password(usr usr, char *rtrn) |
||||
{ |
||||
rtrn=(char *)malloc(sizeof(usr.name)+sizeof(usr.passwd)+3); |
||||
|
||||
char tmp[]="password"; |
||||
|
||||
int j=0; |
||||
for(int i=0;i<strlen(usr.name);i++) |
||||
{ |
||||
|
||||
tmp[(j++)%8]^=usr.name[i]; |
||||
} |
||||
|
||||
|
||||
for(int i=0;i<strlen(usr.passwd);i++) |
||||
{ |
||||
tmp[(j++)%8]^=usr.passwd[i]; |
||||
} |
||||
|
||||
|
||||
|
||||
for(int i=0;i<8;i++) |
||||
{ |
||||
tmp[i]=(tmp[i]+666)%62; |
||||
|
||||
if(tmp[i]<10) tmp[i]+=48; |
||||
else if(tmp[i]<36) tmp[i]+=87; |
||||
else tmp[i]=tmp[i]-36+65; |
||||
} |
||||
|
||||
sprintf(rtrn,"%s",tmp); |
||||
|
||||
return rtrn; |
||||
} |
||||
|
||||
|
||||
/* function for inserting a new data */ |
||||
void data__insert(char *pName, int nRslt[3],int online) |
||||
{ |
||||
char chPath[20]; |
||||
|
||||
/* if data floder not exist, then make one */ |
||||
system("IF NOT EXIST \"data\" MD \"data\""); |
||||
|
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* transform name to file name */ |
||||
sprintf(chPath,"data/%s.dat",pName); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen (chPath, "at+"); |
||||
|
||||
int i=0; |
||||
|
||||
/* insert new data */ |
||||
for(i=0;i<3;i++) |
||||
fprintf( fp,"%d",nRslt[i]); |
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
if(online) |
||||
data__insert_online(nRslt); |
||||
|
||||
} |
||||
|
||||
/* function for get user data into array*/ |
||||
int **data__get_data(char *pName) |
||||
{ |
||||
char chPath[20]; |
||||
|
||||
int **nData; |
||||
|
||||
|
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* transform name to file name */ |
||||
sprintf(chPath,"data/%s.dat",pName); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen (chPath, "r"); |
||||
|
||||
/* if file not exist return NULL */ |
||||
if(fp==NULL) |
||||
{ |
||||
return NULL; |
||||
} |
||||
|
||||
/* figure the length of the data file */ |
||||
fseek(fp,0,SEEK_SET); |
||||
fseek(fp,0,SEEK_END); |
||||
lSize=ftell(fp); |
||||
|
||||
fclose(fp); |
||||
|
||||
/* reopen data file for reading */ |
||||
fp = fopen (chPath, "r"); |
||||
|
||||
int i,j; |
||||
/* alloc a memory room to nData */ |
||||
nData=(int**)malloc((lSize/3+1)*sizeof(int*)); |
||||
for ( i = 0; i <lSize/3; i++ ) |
||||
{ |
||||
/* alloc 3 memory room for each row */ |
||||
nData[i] = (int*)malloc(3*sizeof(int)); |
||||
for ( j = 0; j < 3; j++ ) |
||||
{ |
||||
/* get data from file to array */ |
||||
nData[i][j]=fgetc(fp)-48; |
||||
} |
||||
|
||||
if(nData[i][0]==9) i--; |
||||
|
||||
} |
||||
|
||||
/* end the array by three 0 for the purpose of marking the end of array */ |
||||
nData[i] = (int*)malloc(3*sizeof(int)); |
||||
for ( j = 0; j < 3; j++ ) |
||||
{ |
||||
nData[i][j]=0; |
||||
} |
||||
fclose(fp); |
||||
return nData; |
||||
} |
||||
|
||||
/* function for get data rows */ |
||||
int data__get_rows(int **pData) |
||||
{ |
||||
/* declaer variables */ |
||||
int j,nRows,nSum=0; |
||||
|
||||
/* if pData is NULL, return 0 */ |
||||
if(pData==NULL) |
||||
return 0; |
||||
/* count rows number */ |
||||
do |
||||
{ |
||||
nSum=0; |
||||
for (j = 0; j < 3; j++) |
||||
{ |
||||
nSum+=pData[nRows][j]; |
||||
} |
||||
nRows++; |
||||
|
||||
}while(nSum!=0); /* count untill find three 0 as ending mark */ |
||||
|
||||
/* exclude the last row of three 0 ending mark */ |
||||
nRows--; |
||||
|
||||
return nRows; |
||||
} |
||||
|
||||
/* function for get usr name */ |
||||
char **data__get_usr() |
||||
{ |
||||
|
||||
/*system("DIR data\\*.dat /B> data/usr.txt");*/ |
||||
|
||||
long lSize=0; |
||||
char **chUsr; |
||||
char chTmp; |
||||
|
||||
|
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("data/usr.txt", "r"); |
||||
|
||||
/* if file not exist return NULL */ |
||||
if(fp==NULL) |
||||
{ |
||||
return NULL; |
||||
} |
||||
|
||||
/* figure the rows of the data file */ |
||||
while ((chTmp=fgetc(fp))!=EOF) |
||||
{
|
||||
if(chTmp=='\n') |
||||
lSize++; |
||||
} |
||||
|
||||
fclose(fp); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("data/usr.txt", "r"); |
||||
|
||||
|
||||
/* alloc a memory room to nData */ |
||||
chUsr=(char**)malloc((lSize+1)*sizeof(char*)); |
||||
|
||||
int i; |
||||
/* get users from file to array */ |
||||
for ( i = 0; i <lSize ; i++ ) |
||||
{ |
||||
chUsr[i] = (char*)malloc(20*sizeof(char)); |
||||
fgets(chUsr[i],20,fp); |
||||
|
||||
/* exclude .dat\n */ |
||||
chUsr[i][strlen(chUsr[i])-1]='\0'; |
||||
} |
||||
|
||||
|
||||
fclose(fp); |
||||
|
||||
/* mark the end */ |
||||
chUsr[i] = (char*)malloc(1*sizeof(char)); |
||||
chUsr[i][0]='\0'; |
||||
|
||||
return chUsr; |
||||
|
||||
} |
||||
|
||||
/* function for count usr number */ |
||||
int data__get_usr_num(char **chUsr) |
||||
{ |
||||
/* declaer variables */ |
||||
int j,nRows=0; |
||||
|
||||
/* if pData is NULL, return 0 */ |
||||
if(chUsr==NULL) |
||||
return 0; |
||||
/* count rows number */ |
||||
do |
||||
{ |
||||
nRows++; |
||||
|
||||
}while(chUsr[j++][0]!='\0'); /* count untill find three 0 as ending mark */ |
||||
|
||||
/* exclude the last row of three 0 ending mark */ |
||||
nRows--; |
||||
|
||||
return nRows; |
||||
} |
||||
|
||||
float data__win_rate(int **pData) |
||||
{ |
||||
int i,nWins=0,nNoWins=0; |
||||
|
||||
for(i=0;i<lSize/3;i++) |
||||
{ |
||||
if(pData[i][2]==1) |
||||
nWins++; |
||||
if(pData[i][2]==0) |
||||
nNoWins++; |
||||
} |
||||
|
||||
float rtrn=((float)nWins/((float)(nWins+nNoWins))*100+0.01>0)?(float)nWins/((float)(nWins+nNoWins))*100+0.01:(float)0.001; |
||||
if(rtrn<=0.4) return 0.013; |
||||
return rtrn; |
||||
} |
||||
|
||||
|
||||
void data__detect_internet() |
||||
{ |
||||
FILE *fp; |
||||
|
||||
system("IF NOT EXIST \"cache\" md cache >nul"); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("cache\\internet.ls", "w+"); |
||||
fprintf( fp,"0"); |
||||
fclose(fp); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("check_intrnt.vbs", "w+"); |
||||
|
||||
|
||||
fprintf( fp,"Dim wmi\nSet wmi=GetObject(\"winmgmts://./root/cimv2\")\nset fso=createobject(\"scripting.filesystemobject\")\nSet xxx=wmi.ExecQuery(\"Select * From Win32_PingStatus Where Address='yimian.xyz'\")\nFor Each u in xxx\nIf u.statuscode = 0 Then set f=fso.opentextfile(\"cache\\internet.ls\",2,true):f.write \"1\":f.close\nNext"); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
system("wscript check_intrnt.vbs"); |
||||
|
||||
system("del /Q check_intrnt.vbs>nul"); |
||||
|
||||
fp = fopen ("cache\\internet.ls", "r"); |
||||
if(fgetc(fp)==48)
|
||||
{ |
||||
MessageBox( 0, "Please connect to the Internet first!!", "AS3 Message", 0 ); |
||||
|
||||
fclose(fp); |
||||
exit(1); |
||||
} |
||||
|
||||
fclose(fp); |
||||
} |
||||
|
||||
void data__uninstall(int re) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("re.bat", "w+"); |
||||
|
||||
if(re==2) |
||||
fprintf( fp,"@echo off\ntaskkill /f /im 1717608_2.exe\nping 127.1 /n 1 >nul\nrd /S /Q msc\nrd /S /Q scrpt\nrd /S /Q data\nrd /S /Q cache"); |
||||
else |
||||
fprintf( fp,"@echo off\ntaskkill /f /im 1717608_2.exe\nping 127.1 /n 1 >nul\nrd /S /Q msc\nrd /S /Q scrpt\nrd /S /Q data\nrd /S /Q cache\ndel /Q *.vbs\ndel /Q *.bat"); |
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("start_re.vbs", "w+"); |
||||
if(re==0) |
||||
fprintf( fp,"createobject (\"wscript.shell\").run \"re.bat\",0"); |
||||
else |
||||
fprintf( fp,"createobject (\"wscript.shell\").run \"re.bat\",0\nDim objws\nSet objws=WScript.CreateObject(\"wscript.shell\")\nobjws.Run \"1717608_2.exe\""); |
||||
fclose(fp); |
||||
system("start start_re.vbs"); |
||||
if(re==1) |
||||
{ |
||||
/* point the data file by user name */ |
||||
fp = fopen ("start_ree.vbs", "w+"); |
||||
|
||||
fprintf( fp,"wscript.sleep 1500\nDim objws\nSet objws=WScript.CreateObject(\"wscript.shell\")\nobjws.Run \"1717608_2.exe\",,True"); |
||||
fclose(fp); |
||||
system("start start_ree.vbs"); |
||||
} |
||||
|
||||
if(re==2) |
||||
{ |
||||
/* point the data file by user name */ |
||||
fp = fopen ("start_ree.vbs", "w+"); |
||||
|
||||
fprintf( fp,"wscript.sleep 8000\nDim objws\nSet objws=WScript.CreateObject(\"wscript.shell\")\nobjws.Run \"1717608_2.exe\",,True"); |
||||
fclose(fp); |
||||
system("start start_ree.vbs"); |
||||
} |
||||
} |
||||
|
||||
|
@ -0,0 +1,273 @@ |
||||
|
||||
|
||||
|
||||
void download__creat_vbs(char chName[20]) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("download.vbs", "w+"); |
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"https://obs-3431.obs.myhwclouds.com/as3/%s\" \nTarget = \"%s\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.SaveToFile target \n ado.Close \nEnd Sub ",chName,chName); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
system("wscript download.vbs"); |
||||
|
||||
system("del /Q download.vbs>nul"); |
||||
} |
||||
|
||||
void download__get_online_usr() |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
system("del /Q data\\usr.txt>nul"); |
||||
system("cls"); |
||||
printf("Updating Local Data from Internet...\n"); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("usr_online.vbs", "w+"); |
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"http://as3.tmp.yimian.xyz/usr.php\" \nTarget = \"data/usr.txt\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.SaveToFile target \n ado.Close \nEnd Sub "); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
system("wscript usr_online.vbs"); |
||||
|
||||
system("del /Q usr_online.vbs>nul"); |
||||
} |
||||
|
||||
|
||||
void download__get_online_password() |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
system("del /Q data\\psswd.txt>nul"); |
||||
system("cls"); |
||||
printf("Updating Local Data from Internet...\n"); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("psswd_online.vbs", "w+"); |
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"http://as3.tmp.yimian.xyz/psswd.php\" \nTarget = \"data/psswd.txt\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.SaveToFile target \n ado.Close \nEnd Sub "); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
system("wscript psswd_online.vbs"); |
||||
|
||||
system("del /Q psswd_online.vbs>nul"); |
||||
} |
||||
|
||||
void download__data(char chName[20]) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
char chDos[30]; |
||||
|
||||
sprintf(chDos,"del /Q data\\%s.dat>nul",chName); |
||||
|
||||
int nRnd=rand()%4; |
||||
char chSign[3]; |
||||
if(nRnd==0) strcpy( chSign,"\\"); |
||||
if(nRnd==1) strcpy( chSign,"/"); |
||||
if(nRnd==2) strcpy( chSign,"-"); |
||||
if(nRnd==3) strcpy( chSign,"|"); |
||||
system("cls"); |
||||
printf("Updating Local Data from Internet... %s\n",chSign); |
||||
system(chDos); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("data_online.vbs", "w+"); |
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"http://as3.tmp.yimian.xyz/data/%s.as2\" \nTarget = \"data/%s.dat\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.SaveToFile target \n ado.Close \nEnd Sub ",chName,chName); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
system("wscript data_online.vbs"); |
||||
|
||||
system("del /Q data_online.vbs>nul"); |
||||
} |
||||
|
||||
|
||||
void download__core_file() |
||||
{ |
||||
int nPrcnt=0; |
||||
|
||||
|
||||
system("del /Q msc\\* >nul"); |
||||
system("del /Q scrpt\\* >nul"); |
||||
|
||||
system("rd /Q msc >nul"); |
||||
system("rd /Q scrpt >nul"); |
||||
|
||||
system("md msc>nul"); |
||||
system("md scrpt >nul"); |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from Server... %d%%\n", nPrcnt); |
||||
char f1[]="msc/gameover.mp3"; |
||||
nPrcnt+=3; |
||||
download__creat_vbs(f1); |
||||
nPrcnt+=10; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f2[]="msc/win.mp3"; |
||||
download__creat_vbs(f2); |
||||
nPrcnt+=6; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f3[]="msc/lose.mp3"; |
||||
download__creat_vbs(f3); |
||||
nPrcnt+=7; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f4[]="msc/draw.mp3"; |
||||
download__creat_vbs(f4); |
||||
nPrcnt+=5; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f5[]="msc/background2.mp3"; |
||||
download__creat_vbs(f5); |
||||
nPrcnt+=27; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f6[]="msc/background1.mp3"; |
||||
download__creat_vbs(f6); |
||||
nPrcnt+=24; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f7[]="msc/allclear.mp3"; |
||||
download__creat_vbs(f7); |
||||
nPrcnt+=1; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f8[]="scrpt/snd_wn.as2"; |
||||
download__creat_vbs(f8); |
||||
nPrcnt+=1; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f9[]="scrpt/snd_start_wn.as2"; |
||||
download__creat_vbs(f9); |
||||
nPrcnt+=1; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f10[]="scrpt/snd_start_ls.as2"; |
||||
download__creat_vbs(f10); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f11[]="scrpt/snd_start_gm.as2"; |
||||
download__creat_vbs(f11); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f12[]="scrpt/snd_start_dr.as2"; |
||||
download__creat_vbs(f12); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f13[]="scrpt/snd_start_bc2.as2"; |
||||
download__creat_vbs(f13); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f14[]="scrpt/snd_start_bc1.as2"; |
||||
download__creat_vbs(f14); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f15[]="scrpt/snd_start_al.as2"; |
||||
download__creat_vbs(f15); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f16[]="scrpt/snd_ls.as2"; |
||||
download__creat_vbs(f16); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f17[]="scrpt/snd_gmvr.as2"; |
||||
download__creat_vbs(f17); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f18[]="scrpt/snd_drw.as2"; |
||||
download__creat_vbs(f18); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f19[]="scrpt/snd_bckgrnd2.as2"; |
||||
download__creat_vbs(f19); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f20[]="scrpt/snd_bckgrnd1.as2"; |
||||
download__creat_vbs(f20); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f21[]="scrpt/snd_allclr.as2"; |
||||
download__creat_vbs(f21); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f22[]="scrpt/prnt2.as2"; |
||||
download__creat_vbs(f22); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f23[]="scrpt/prnt1.as2"; |
||||
download__creat_vbs(f23); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f24[]="scrpt/lstn.as2"; |
||||
download__creat_vbs(f24); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,304 @@ |
||||
#define LARGEST_DYNAMIC_MEMORY 65535 /* define the largest memory for a str in as1_getchar_plus function */ |
||||
|
||||
/* function for detect the keyborad to wait for a keyboard event and return it with ASCII */ |
||||
int input__detect_input_ASCII() |
||||
{ |
||||
int nKey; |
||||
|
||||
/* clear former cache */ |
||||
fflush(stdin); |
||||
|
||||
/* get key value */ |
||||
nKey = _getch(); |
||||
|
||||
return nKey; |
||||
} |
||||
|
||||
/* function for get arrow event */ |
||||
int input__get_arrow() |
||||
{ |
||||
int nVal=0; |
||||
|
||||
while(1) |
||||
{ |
||||
nVal=input__detect_input_ASCII(); |
||||
|
||||
if(nVal==224) |
||||
{ |
||||
/* get arraw value */ |
||||
int nKey=input__detect_input_ASCII(); |
||||
|
||||
if(nKey==75) |
||||
return -1; |
||||
if(nKey==77) |
||||
return 1; |
||||
if(nKey==72) |
||||
return -1; |
||||
if(nKey==80) |
||||
return 1; |
||||
else |
||||
return 0; |
||||
} |
||||
|
||||
if(nVal==13) |
||||
return 6; |
||||
if(nVal==27) |
||||
return 9; |
||||
} |
||||
} |
||||
|
||||
/* function to get a char type string as needed */ |
||||
char *input__as1_getchar_plus(char *p) |
||||
{ |
||||
|
||||
char *pTmp; |
||||
|
||||
/* apply for a large dynamic memory for the first time storage */ |
||||
if((pTmp=(char *)malloc(LARGEST_DYNAMIC_MEMORY))==NULL) |
||||
{ |
||||
printf("Application memory failure...\n"); |
||||
exit(0); /* if fail, exit the input__as1_getchar_plus function with the return value of 0 */ |
||||
} |
||||
|
||||
/* get words from keyboard to pTemp */ |
||||
gets(pTmp); |
||||
|
||||
/* apply for a dynamic memory as needed */ |
||||
if((p=(char *)malloc(strlen(pTmp)+1))==NULL) |
||||
{ |
||||
printf("Application memory failure...\n"); |
||||
exit(0); /* if fail, exit the input__as1_getchar_plus function with the return value of 0 */ |
||||
} |
||||
|
||||
/* copy str from pTmp to p */ |
||||
strcpy(p,pTmp); |
||||
|
||||
/* free the Tmp memory */ |
||||
free(pTmp); |
||||
|
||||
return p; |
||||
} |
||||
|
||||
|
||||
/* function for process space, (remove begining space(1), convert middle multi-space into one space(1) remove middle space(2), remove ending space(1), *string) */ |
||||
char *input__as1_process_space(int nStrt, int nMdd, int nEnd, char *str) |
||||
{ |
||||
int i,pston,iTmp; |
||||
|
||||
/* process the begining space */ |
||||
if(nStrt==1) |
||||
{ |
||||
i=-1; |
||||
/* figure the first not space char position */ |
||||
while(isspace(str[++i])); |
||||
|
||||
/* move the not space char to the begining */ |
||||
for(pston=i;pston<strlen(str);pston++) |
||||
str[pston-i]=str[pston]; |
||||
|
||||
/* give a stop sign at the end of the new char */ |
||||
str[pston-i]='\0'; |
||||
|
||||
} |
||||
|
||||
/* process the ending space */ |
||||
if(nEnd==1) |
||||
{ |
||||
i=0; |
||||
/* figure the last not space char position */ |
||||
while(isspace(str[strlen(str)-(++i)])); |
||||
|
||||
/* give a stop sign at the end of the new char */ |
||||
str[strlen(str)-i+1]='\0'; |
||||
|
||||
} |
||||
|
||||
/* process the middle space::combine */ |
||||
if(nMdd==1) |
||||
{ |
||||
i=0; |
||||
|
||||
do |
||||
{ |
||||
/* find the first space position */ |
||||
while(!isspace(str[i++])&&str[i]!='\0'); |
||||
|
||||
/* deal with situation that there are one more spaces */ |
||||
if(isspace(str[i])) |
||||
{ |
||||
/* storage the first space position in pston */ |
||||
pston=i; |
||||
|
||||
/* storage the process position to iTmp */ |
||||
iTmp=i; |
||||
|
||||
/* find the end of this space */ |
||||
while(isspace(str[++i])); |
||||
|
||||
/* move the left not space string to the second position of the space */ |
||||
for(;i<strlen(str);) |
||||
str[pston++]=str[i++]; |
||||
|
||||
/* give a new end of the processed string */ |
||||
str[pston]='\0'; |
||||
|
||||
/* the process position give back to i */ |
||||
i=iTmp; |
||||
|
||||
} |
||||
|
||||
} |
||||
while(i<strlen(str)); /* process the whole string to combine the multi space to single space */ |
||||
|
||||
} |
||||
|
||||
|
||||
/* process the middle space::remove */ |
||||
if(nMdd==2) |
||||
{ |
||||
i=0; |
||||
|
||||
do |
||||
{ |
||||
/* find the first space position */ |
||||
while(!isspace(str[i++])&&str[i]!='\0'); |
||||
|
||||
/* deal with the situation that there is no space anymore */ |
||||
if(str[i]=='\0') |
||||
break; |
||||
|
||||
/* storage the first space position in pston */ |
||||
pston=i; |
||||
|
||||
/* storage the process position to iTmp */ |
||||
iTmp=i; |
||||
|
||||
/* find the end of this space */ |
||||
while(isspace(str[++i])); |
||||
|
||||
/* move the left not space string to the second position of the space */ |
||||
for(;i<strlen(str);) |
||||
str[pston++-1]=str[i++]; |
||||
|
||||
/* give a new end of the processed string */ |
||||
str[pston-1]='\0'; |
||||
|
||||
/* the process position give back to i */ |
||||
i=iTmp; |
||||
|
||||
} |
||||
while(i<strlen(str)); /* process the whole string to combine the multi space to single space */ |
||||
|
||||
} |
||||
|
||||
return str; |
||||
} |
||||
|
||||
/* figure out if the input value is English(with space and num) or Numbers ::type : num(n), char(c),float(f)::return value{success: 1,fail: 0, error:2} */ |
||||
int input__as1_jdge_var(char type,char *str) |
||||
{ |
||||
/* check if the char follow the type one by one */ |
||||
int i; |
||||
for (i = 0; i < strlen(str); i++) |
||||
{ |
||||
|
||||
switch(type) |
||||
{ |
||||
/* if exist not char, exit with 0 */ |
||||
case 'c': |
||||
if(!(((int)str[i]>96&&(int)str[i]<123)||(str[i]>64&&str[i]<91)||((int)str[i]>47&&(int)str[i]<58))) |
||||
return 0; |
||||
break; |
||||
|
||||
/* if exist not num, exit with 0 */ |
||||
case 'n': |
||||
if(!((int)str[i]>47&&(int)str[i]<58)) |
||||
return 0; |
||||
break; |
||||
|
||||
/* if exist not float, exit with 0 */ |
||||
case 'f': |
||||
if(!(((int)str[i]>47&&(int)str[i]<58)||(int)str[i]==46/* include '.' */)) |
||||
return 0; |
||||
break; |
||||
|
||||
/* other error condition */ |
||||
default: |
||||
return 2; |
||||
} |
||||
|
||||
} |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
char *input__replace_space_with__(char *str) |
||||
{ |
||||
/* check if the char follow the type one by one */ |
||||
int i; |
||||
for (i = 0; i < strlen(str); i++) |
||||
{ |
||||
if((int)str[i]==32) str[i]=95; |
||||
} |
||||
|
||||
return str; |
||||
} |
||||
|
||||
/* function for input and check a name */ |
||||
char *input__as1_input_name() |
||||
{ |
||||
|
||||
char *pName=NULL; |
||||
|
||||
/* preload the state as 0, and clear a var rtrnVal to storage the return value of sub function */ |
||||
int state=0, rtrnVal=0; |
||||
|
||||
|
||||
printf("Please input your English User Name...\nUser Name="); |
||||
|
||||
/* while the state is 0(false), loop the input process */ |
||||
do |
||||
{ |
||||
/* input a name */ |
||||
pName=input__as1_getchar_plus(pName); |
||||
|
||||
/* process the start, middle, end space of input */ |
||||
pName=input__as1_process_space(1,0,1,pName); |
||||
|
||||
/* judge if the name is pure English */ |
||||
rtrnVal=input__as1_jdge_var('c',pName); |
||||
|
||||
/* replace space with _ */ |
||||
pName=input__replace_space_with__(pName); |
||||
|
||||
/* flase situation | the input is not pure*/ |
||||
if(!rtrnVal) |
||||
printf("\nPlease input an ENGLISH Name!!!\n\nTry Again~\nPlease input your name...\nname="); |
||||
|
||||
/* success situation */ |
||||
else if(rtrnVal==1) |
||||
{ |
||||
/* exclude the situation of empty input */ |
||||
if(!strlen(pName)) |
||||
printf("\nIllegal Empty Input!\n\nTry Again~\nPlease just try to type in something...\nname="); |
||||
|
||||
else if(strlen(pName)>0&&strlen(pName)<3) |
||||
printf("\nToo less Input!\n\nTry Again~\nPlease just try to type in more than two characters...\nname="); |
||||
|
||||
else if(strlen(pName)>10) |
||||
printf("\nYour name is too long!\n\nTry Again~\nPlease just try to type in less than TEN characters...\nname="); |
||||
/* success */ |
||||
else |
||||
state=1; |
||||
} |
||||
|
||||
/* the other inner function error situation */ |
||||
else if(rtrnVal==2) |
||||
printf("\nError with Function input__as1_jdge_var!\nPlease Connect Yimian LIU!!"); |
||||
|
||||
|
||||
}while(state==0); |
||||
|
||||
return pName; |
||||
} |
||||
|
@ -0,0 +1,686 @@ |
||||
|
||||
/* function for adjust window color, size and position */ |
||||
void print__setup() |
||||
{ |
||||
system("TITLE EEE101 Assessment 3 BY Yimian LIU");
|
||||
system("mode con cols=88 lines=30"); |
||||
system("color 0F"); |
||||
} |
||||
|
||||
void print__space(int nSpace) |
||||
{ |
||||
int i; |
||||
for(i=0;i<nSpace;i++) |
||||
printf(" "); |
||||
} |
||||
|
||||
void print__wait(int nTm) |
||||
{ |
||||
int i; |
||||
for(i=0;i<nTm;i++) |
||||
{ |
||||
system("cls"); |
||||
printf("Please Wait... -\n"); |
||||
Sleep(150); |
||||
|
||||
system("cls"); |
||||
printf("Please Wait... \\\n"); |
||||
Sleep(150); |
||||
|
||||
system("cls"); |
||||
printf("Please Wait... |\n"); |
||||
Sleep(150); |
||||
|
||||
system("cls"); |
||||
printf("Please Wait... /\n"); |
||||
Sleep(150); |
||||
|
||||
} |
||||
fflush(stdin); |
||||
} |
||||
|
||||
/* display a header */ |
||||
void print__header() |
||||
{ |
||||
time_t cur = time(NULL); |
||||
|
||||
struct tm *curtm = localtime(&cur); |
||||
printf("%d-%d-%d %d:%d:%02d",curtm->tm_year+1900, curtm->tm_mon+1,curtm->tm_mday, curtm->tm_hour,curtm->tm_min, curtm->tm_sec); |
||||
|
||||
print__space(19); |
||||
|
||||
if(g_pUsr) |
||||
printf("User: %6s",g_pUsr ); |
||||
|
||||
if(g_nTimes!=-1) |
||||
printf(" win: %d Total times: %d ",g_nWins,g_nTimes); |
||||
else if(g_fWin!=-1||g_fWin!=0) |
||||
printf(" Win Rate: %.2f%%",g_fWin-0.01+0.001); |
||||
|
||||
printf("\n----------------------------------------------------------------------------------------"); |
||||
} |
||||
|
||||
void print_item(char chItem[20],int nMrk,int nSpc) |
||||
{ |
||||
|
||||
printf("\n\n"); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
printf("%11s",chItem ); |
||||
|
||||
if(nMrk==1) |
||||
{ |
||||
print__space(3); |
||||
printf("<<--"); |
||||
} |
||||
} |
||||
|
||||
void print__menu(int nPnt) |
||||
{ |
||||
|
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("Please use Arrows on Keyboard to Choose:\n"); |
||||
char chItem1[]="New Game "; |
||||
print_item(chItem1,(nPnt==1)?1:0,38); |
||||
|
||||
char chItem2[]="Rank "; |
||||
print_item(chItem2,(nPnt==2)?1:0,38); |
||||
|
||||
char chItem3[]="My History"; |
||||
print_item(chItem3,(nPnt==3)?1:0,38); |
||||
|
||||
char chItem4[]="Setting "; |
||||
print_item(chItem4,(nPnt==4)?1:0,38); |
||||
|
||||
char chItem5[]="Switch User"; |
||||
print_item(chItem5,(nPnt==5)?1:0,38); |
||||
|
||||
char chItem6[]="Exit Game"; |
||||
print_item(chItem6,(nPnt==6)?1:0,38); |
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
|
||||
} |
||||
|
||||
void print__user(int nPnt) |
||||
{ |
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
printf("Please choose your User Name:\n"); |
||||
char **pUsr=data__get_usr(); |
||||
int i,nRows=data__get_usr_num(pUsr); |
||||
char chItem[]="Creat a new one!"; |
||||
|
||||
for(i=0;i<nRows;i++) |
||||
print_item(pUsr[i],(nPnt==i+1)?1:0,30); |
||||
|
||||
print_item(chItem,(nPnt==i+1)?1:0,30); |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
void print__play_times(int nPnt) |
||||
{ |
||||
|
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
printf("Choose Game Mode: \n"); |
||||
char chItem1[]=" one out of one sets match"; |
||||
print_item(chItem1,(nPnt==1)?1:0,25); |
||||
|
||||
char chItem2[]=" two out of three sets match"; |
||||
print_item(chItem2,(nPnt==2)?1:0,25); |
||||
|
||||
char chItem3[]=" three out of five sets match"; |
||||
print_item(chItem3,(nPnt==3)?1:0,25); |
||||
|
||||
char chItem4[]=" four out of seven sets match"; |
||||
print_item(chItem4,(nPnt==4)?1:0,25); |
||||
|
||||
char chItem5[]=" five out of nine sets match"; |
||||
print_item(chItem5,(nPnt==5)?1:0,25); |
||||
|
||||
char chItem6[]=" back to menu"; |
||||
print_item(chItem6,(nPnt==6)?1:0,25); |
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
} |
||||
|
||||
void print__play_choose(int nPnt) |
||||
{ |
||||
|
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("Please select your choice:\n\n"); |
||||
|
||||
char chItem1[]="scissors"; |
||||
print_item(chItem1,(nPnt==1)?1:0,38); |
||||
|
||||
char chItem2[]="rock "; |
||||
print_item(chItem2,(nPnt==2)?1:0,38); |
||||
|
||||
char chItem3[]="paper "; |
||||
print_item(chItem3,(nPnt==3)?1:0,38); |
||||
|
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
} |
||||
|
||||
void print_1_1() |
||||
{ |
||||
int nSpc=14; |
||||
|
||||
print__space(nSpc); |
||||
printf(" ** ** ** ** ** ** \n"); print__space(nSpc); |
||||
printf("** ** ** ** ** ** \n"); print__space(nSpc); |
||||
printf(" ** ** ** ** \n"); print__space(nSpc); |
||||
printf(" ** * * ** \n"); print__space(nSpc); |
||||
printf(" ** ** ** ** \n"); print__space(nSpc); |
||||
printf("** ** ** ** ** ** \n"); print__space(nSpc); |
||||
printf(" ** ** ** ** ** ** \n"); |
||||
} |
||||
|
||||
void print_1_2() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" ** ** ** *********** \n"); print__space(nSpc); |
||||
printf("** ** ** ************* \n"); print__space(nSpc); |
||||
printf(" ** ** *************** \n"); print__space(nSpc); |
||||
printf(" ** * *****************\n"); print__space(nSpc); |
||||
printf(" ** ** *************** \n"); print__space(nSpc); |
||||
printf("** ** ** ************* \n"); print__space(nSpc); |
||||
printf(" ** ** ** *********** \n"); |
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+25); |
||||
printf("Unit Lost!"); |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
void print_1_3() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" ** ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("** ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ** * ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("** ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ** ** ** ++++++++++++++++\n"); |
||||
|
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+28); |
||||
printf("Win!"); |
||||
|
||||
} |
||||
|
||||
void print_2_2() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" *********** *********** \n"); print__space(nSpc); |
||||
printf(" ************* ************* \n"); print__space(nSpc); |
||||
printf(" *************** *************** \n"); print__space(nSpc); |
||||
printf("***************** *****************\n"); print__space(nSpc); |
||||
printf(" *************** *************** \n"); print__space(nSpc); |
||||
printf(" ************* ************* \n"); print__space(nSpc); |
||||
printf(" *********** *********** \n"); |
||||
} |
||||
|
||||
void print_2_1() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" *********** ** ** ** \n"); print__space(nSpc); |
||||
printf(" ************* ** ** ** \n"); print__space(nSpc); |
||||
printf(" *************** ** ** \n"); print__space(nSpc); |
||||
printf("***************** * ** \n"); print__space(nSpc); |
||||
printf(" *************** ** ** \n"); print__space(nSpc); |
||||
printf(" ************* ** ** ** \n"); print__space(nSpc); |
||||
printf(" *********** ** ** ** \n"); |
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+28); |
||||
printf("Win!"); |
||||
|
||||
} |
||||
|
||||
void print_2_3() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" *********** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ************* ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" *************** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("***************** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" *************** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ************* ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" *********** ++++++++++++++++\n"); |
||||
|
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+25); |
||||
printf("Unit Lost!"); |
||||
} |
||||
|
||||
void print_3_3() |
||||
{
|
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); |
||||
} |
||||
|
||||
void print_3_1() |
||||
{
|
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ * ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** ** \n"); |
||||
|
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+25); |
||||
printf("Unit Lost!"); |
||||
} |
||||
void print_3_2() |
||||
{
|
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf("++++++++++++++++ *********** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ************* \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ *************** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ***************** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ *************** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ************* \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ *********** \n"); |
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+28); |
||||
printf("Win!"); |
||||
|
||||
} |
||||
|
||||
|
||||
void print__result(int nChc,int nCmp) |
||||
{ |
||||
|
||||
int nPnt=nChc; |
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
printf("Please select your choice:\n\n"); |
||||
|
||||
char chItem1[]="scissors"; |
||||
print_item(chItem1,(nPnt==1)?1:0,38); |
||||
|
||||
char chItem2[]="rock "; |
||||
print_item(chItem2,(nPnt==2)?1:0,38); |
||||
|
||||
char chItem3[]="paper "; |
||||
print_item(chItem3,(nPnt==3)?1:0,38); |
||||
printf("\n\n\n"); |
||||
|
||||
if(nChc==1&&nCmp==1) print_1_1(); |
||||
if(nChc==1&&nCmp==2) print_1_2(); |
||||
if(nChc==1&&nCmp==3) print_1_3(); |
||||
if(nChc==2&&nCmp==1) print_2_1(); |
||||
if(nChc==2&&nCmp==2) print_2_2(); |
||||
if(nChc==2&&nCmp==3) print_2_3(); |
||||
if(nChc==3&&nCmp==1) print_3_1(); |
||||
if(nChc==3&&nCmp==2) print_3_2(); |
||||
if(nChc==3&&nCmp==3) print_3_3(); |
||||
|
||||
printf("\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
} |
||||
|
||||
void print__history(int **pData) |
||||
{ |
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("\n\n"); |
||||
|
||||
int nSpc=33; |
||||
|
||||
print__space(4); |
||||
printf("Me"); |
||||
print__space(nSpc); |
||||
printf("Computer"); |
||||
print__space(nSpc); |
||||
printf("Result"); |
||||
|
||||
printf("\n"); |
||||
|
||||
int i; |
||||
|
||||
|
||||
for(i=0;i<lSize/3;i++) |
||||
{ |
||||
printf("\n"); |
||||
|
||||
if(pData[i][0]==8) |
||||
{ |
||||
printf(" ------------------------------------------------------------------------------------ "); |
||||
} |
||||
else |
||||
{ |
||||
print__space(2); |
||||
|
||||
if(pData[i][0]==1) printf("scissor"); |
||||
if(pData[i][0]==2) printf(" rock "); |
||||
if(pData[i][0]==3) printf(" paper "); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
if(pData[i][1]==1) printf("scissor"); |
||||
if(pData[i][1]==2) printf(" rock "); |
||||
if(pData[i][1]==3) printf(" paper "); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
if(pData[i][2]==0)
|
||||
{ |
||||
if(pData[i][0]==pData[i][1]) printf("Draw"); |
||||
else printf("Lose"); |
||||
} |
||||
if(pData[i][2]==1) printf("Win"); |
||||
} |
||||
|
||||
} |
||||
|
||||
printf("\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
void print__abstract_history(int **pData) |
||||
{ |
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("\n\n"); |
||||
|
||||
int nSpc=33; |
||||
|
||||
print__space(4); |
||||
printf("Me"); |
||||
print__space(nSpc); |
||||
printf("Computer"); |
||||
print__space(nSpc); |
||||
printf("Result"); |
||||
|
||||
printf("\n"); |
||||
|
||||
int i,roundTimes=0; |
||||
|
||||
|
||||
for(i=0;i<lSize/3;) |
||||
{ |
||||
printf("\n"); |
||||
|
||||
while(pData[i++][0]==8&&i<lSize/3) |
||||
{ |
||||
int j=i; |
||||
while(pData[j][0]!=8&&j++<(lSize/3-2)); |
||||
|
||||
printf("\n No. %d",++roundTimes ); |
||||
|
||||
printf(" Play rounds: %d",j-i ); |
||||
|
||||
int win=0; |
||||
|
||||
for(int m=i;m<j;m++) |
||||
win+=pData[m][2]; |
||||
|
||||
printf(" Overal Win %d",win ); |
||||
|
||||
int draw=0; |
||||
|
||||
for(int m=i;m<j;m++) |
||||
if(pData[m][0]==pData[m][1]) |
||||
draw++; |
||||
|
||||
printf(" Draw: %d",draw ); |
||||
|
||||
|
||||
printf(" Lose: %d", j-i-win-draw); |
||||
|
||||
if(win>j-i-win-draw) printf(" Winner: The Player\n"); |
||||
else if(win<j-i-win-draw) printf(" Winner: The Computer\n"); |
||||
else printf(" Winner: No Winner\n"); |
||||
|
||||
printf(" ------------------------------------------------------------------------------------ "); |
||||
} |
||||
|
||||
i--; |
||||
print__space(2); |
||||
|
||||
if(pData[i][0]==1) printf("scissor"); |
||||
if(pData[i][0]==2) printf(" rock "); |
||||
if(pData[i][0]==3) printf(" paper "); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
if(pData[i][1]==1) printf("scissor"); |
||||
if(pData[i][1]==2) printf(" rock "); |
||||
if(pData[i][1]==3) printf(" paper "); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
if(pData[i][2]==0)
|
||||
{ |
||||
if(pData[i][0]==pData[i][1]) printf("Draw"); |
||||
else printf("Lose"); |
||||
} |
||||
if(pData[i][2]==1) printf("Win"); |
||||
|
||||
i++; |
||||
} |
||||
|
||||
printf("\n\n"); |
||||
printf("Press ESC to Exit!\n\n"); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
void print__rank() |
||||
{ |
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("\n\n"); |
||||
|
||||
int nSpc=33; |
||||
|
||||
print__space(4); |
||||
printf("No."); |
||||
print__space(nSpc); |
||||
printf(" User "); |
||||
print__space(nSpc-3); |
||||
printf("Win Rates"); |
||||
|
||||
printf("\n"); |
||||
|
||||
|
||||
|
||||
|
||||
char **pUsr=data__get_usr(); |
||||
int i,j,nRows=data__get_usr_num(pUsr); |
||||
float fRank[nRows][4]; |
||||
|
||||
|
||||
for(i=0;i<nRows;i++) |
||||
{ |
||||
int **pData=data__get_data(pUsr[i]); |
||||
|
||||
fRank[i][1]= data__win_rate(pData); |
||||
fRank[i][2]= data__win_rate(pData); |
||||
|
||||
fRank[i][0]= i; |
||||
|
||||
} |
||||
|
||||
int max=0,maxItm=0; |
||||
|
||||
for(j=0;j<nRows;j++) |
||||
{ |
||||
|
||||
for(i=0;i<nRows;i++) |
||||
{ |
||||
if(fRank[i][2]>=max) |
||||
{ |
||||
max=fRank[i][2]; |
||||
|
||||
maxItm=i; |
||||
|
||||
} |
||||
} |
||||
|
||||
fRank[maxItm][3]=j; |
||||
|
||||
if(max) |
||||
{ |
||||
|
||||
printf("\n"); |
||||
|
||||
print__space(4); |
||||
|
||||
printf("%2d", j+1); |
||||
|
||||
print__space(nSpc-3); |
||||
|
||||
printf("%10s",pUsr[maxItm] ); |
||||
|
||||
print__space(nSpc-1); |
||||
|
||||
if(fRank[maxItm][1]==0) printf(" 0.00%%"); |
||||
else
|
||||
printf("%3.2f%%", fRank[maxItm][1]-0.0099); |
||||
fRank[maxItm][2]=0; |
||||
max=0; |
||||
} |
||||
} |
||||
|
||||
|
||||
printf("\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
} |
||||
|
||||
|
||||
void print__settings(int nPnt) |
||||
{ |
||||
|
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
char chItem1[]=" Go Back to main menu"; |
||||
print_item(chItem1,(nPnt==1)?1:0,25); |
||||
|
||||
if(snd==1) |
||||
{ |
||||
char chItem2[]=" Mute the sound"; |
||||
print_item(chItem2,(nPnt==2)?1:0,25); |
||||
} |
||||
else |
||||
{ |
||||
char chItem3[]=" Open the sound"; |
||||
print_item(chItem3,(nPnt==2)?1:0,25); |
||||
} |
||||
char chItem4[]=" Reinstall the Game"; |
||||
print_item(chItem4,(nPnt==3)?1:0,25); |
||||
|
||||
char chItem5[]=" Uninstall the Game"; |
||||
print_item(chItem5,(nPnt==4)?1:0,25); |
||||
|
||||
char chItem6[]=" Change My Password"; |
||||
print_item(chItem6,(nPnt==5)?1:0,25); |
||||
|
||||
char chItem7[]=" Clean My History "; |
||||
print_item(chItem7,(nPnt==6)?1:0,25); |
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
} |
||||
|
||||
|
||||
void print__get_password(int type, int words) |
||||
{ |
||||
system("cls"); |
||||
|
||||
if(type) printf("Your password is WRONG! Please try again~\n\n"); |
||||
|
||||
printf("Please input your password: \n\nYour password = "); |
||||
|
||||
for(int i=0;i<words;i++) printf("*"); |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
void print__get_newpassword(int type, int words) |
||||
{ |
||||
system("cls"); |
||||
|
||||
if(type%4==0) printf("Please set your password: \n\nYour password = "); |
||||
|
||||
if(type%4==1) printf("Please input your password again: \n\nYour password = "); |
||||
|
||||
if(type%4==2) printf("The passwords you input are not the same!\n\nPlease set your password again: \n\nYour password = "); |
||||
|
||||
if(type%4==3) printf("Please input your password again: \n\nYour password = "); |
||||
|
||||
for(int i=0;i<words;i++) printf("*"); |
||||
} |
@ -0,0 +1,103 @@ |
||||
#include<stdio.h> /* Include standard library of stdio.h for the use of function printf(), get() */ |
||||
#include<stdlib.h> /* Include standard liberary of stdlib.h for the use of function system(), */ |
||||
|
||||
/* function of playing background1 */ |
||||
void sound__background1() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_bc1.as2 snd_start_bc1.vbs>nul"); |
||||
system("copy scrpt\\snd_bckgrnd1.as2 snd_bckgrnd1.vbs>nul"); |
||||
system("wscript snd_start_bc1.vbs"); |
||||
system("del snd_start_bc1.vbs>nul"); |
||||
|
||||
|
||||
} |
||||
|
||||
/* function of playing background2 */ |
||||
void sound__background2() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_bc2.as2 snd_start_bc2.vbs>nul"); |
||||
system("copy scrpt\\snd_bckgrnd2.as2 snd_bckgrnd2.vbs>nul"); |
||||
system("wscript snd_start_bc2.vbs"); |
||||
system("del snd_start_bc2.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of playing win */ |
||||
void sound__win() |
||||
{ |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_wn.as2 snd_start_wn.vbs>nul"); |
||||
system("copy scrpt\\snd_wn.as2 snd_wn.vbs>nul"); |
||||
system("wscript snd_start_wn.vbs"); |
||||
system("del snd_start_wn.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of playing draw */ |
||||
void sound__draw() |
||||
{ |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_dr.as2 snd_start_dr.vbs>nul"); |
||||
system("copy scrpt\\snd_drw.as2 snd_drw.vbs>nul"); |
||||
system("wscript snd_start_dr.vbs"); |
||||
system("del snd_start_dr.vbs>nul"); |
||||
|
||||
|
||||
} |
||||
|
||||
/* function of playing lose */ |
||||
void sound__lose() |
||||
{ |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_ls.as2 snd_start_ls.vbs>nul"); |
||||
system("copy scrpt\\snd_ls.as2 snd_ls.vbs>nul"); |
||||
system("wscript snd_start_ls.vbs"); |
||||
system("del snd_start_ls.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of playing allclear*/ |
||||
void sound__allclear() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_al.as2 snd_start_al.vbs>nul"); |
||||
system("copy scrpt\\snd_allclr.as2 snd_allclr.vbs>nul"); |
||||
system("wscript snd_start_al.vbs"); |
||||
system("del snd_start_al.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of playing gameover */ |
||||
void sound__gameover() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_gm.as2 snd_start_gm.vbs>nul"); |
||||
system("copy scrpt\\snd_gmvr.as2 snd_gmvr.vbs>nul"); |
||||
system("wscript snd_start_gm.vbs"); |
||||
system("del snd_start_gm.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of stop playing*/ |
||||
void sound__stop() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
system("del snd_bckgrnd1.vbs>nul"); |
||||
system("del snd_bckgrnd2.vbs>nul"); |
||||
system("del snd_wn.vbs>nul"); |
||||
system("del snd_drw.vbs>nul"); |
||||
system("del snd_ls.vbs>nul"); |
||||
system("del snd_allclr.vbs>nul"); |
||||
system("del snd_gmvr.vbs>nul"); |
||||
} |
@ -0,0 +1,53 @@ |
||||
|
||||
/* function for showing a msgbox window */ |
||||
int winprint__msgbox(char msg[30], int type) |
||||
{ |
||||
/* declaer a FILE variable */ |
||||
FILE *fp=NULL; |
||||
|
||||
int nRtrnVal=0; |
||||
|
||||
/* make a new folder */ |
||||
system("IF NOT EXIST \"cache\" md cache >nul"); |
||||
|
||||
/* write msg to msg.dat */ |
||||
fp = fopen ("cache/msg.dat", "w+"); |
||||
fprintf( fp,"%s",msg); |
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
if(type==1) |
||||
{ |
||||
system("copy scrpt\\prnt1.as2 prnt1.vbs>nul"); |
||||
/* include vb script */ |
||||
system("wscript prnt1.vbs"); |
||||
system("del prnt1.vbs>nul"); |
||||
|
||||
|
||||
nRtrnVal=1; |
||||
} |
||||
|
||||
if(type==2) |
||||
{ |
||||
system("copy scrpt\\prnt2.as2 prnt2.vbs>nul"); |
||||
/* include vb script */ |
||||
system("wscript prnt2.vbs"); |
||||
system("del prnt2.vbs>nul"); |
||||
/* read result from res.dat */ |
||||
fp = fopen ("cache/res.dat", "r+"); |
||||
nRtrnVal=fgetc(fp)-48; |
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
} |
||||
|
||||
/* clear cache file */ |
||||
system("del /Q /F cache\\res.dat >nul"); |
||||
system("del /Q /F cache\\msg.dat >nul"); |
||||
|
||||
|
||||
return nRtrnVal; |
||||
|
||||
} |
||||
|
@ -0,0 +1,48 @@ |
||||
<!doctype html> |
||||
|
||||
<?php |
||||
$data=$_GET['data']; |
||||
$usr=$_GET['usr']; |
||||
if($usr=='') exit(); |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
$sql = "SELECT * FROM as2 where usr='$usr'"; |
||||
$result = $conn->query($sql); |
||||
|
||||
|
||||
if ($result->num_rows < 1) |
||||
{ |
||||
|
||||
$sql="insert INTO as2 set usr='$usr'"; |
||||
|
||||
|
||||
if ($conn->query($sql) === TRUE) {} else { |
||||
echo "Error: " . $sql . "<br>" . $conn->error; |
||||
} |
||||
} |
||||
mysqli_close($conn); |
||||
|
||||
|
||||
$myfile = fopen("data/$usr.as2", "a") or die("Unable to open file!"); |
||||
|
||||
fwrite($myfile, $data); |
||||
|
||||
fclose($myfile); |
||||
?> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>data</title> |
||||
</head> |
||||
|
||||
<body> |
||||
</body> |
||||
</html> |
@ -0,0 +1 @@ |
||||
999 |
@ -0,0 +1 @@ |
||||
999 |
@ -0,0 +1,48 @@ |
||||
<!doctype html> |
||||
|
||||
<?php |
||||
$usr=$_GET['usr']; |
||||
$data="999"; |
||||
if($usr=='') exit(); |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
$sql = "SELECT * FROM as2 where usr='$usr'"; |
||||
$result = $conn->query($sql); |
||||
|
||||
|
||||
if ($result->num_rows < 1) |
||||
{ |
||||
|
||||
$sql="insert INTO as2 set usr='$usr'"; |
||||
|
||||
|
||||
if ($conn->query($sql) === TRUE) {} else { |
||||
echo "Error: " . $sql . "<br>" . $conn->error; |
||||
} |
||||
} |
||||
mysqli_close($conn); |
||||
|
||||
|
||||
$myfile = fopen("data/$usr.as2", "w+") or die("Unable to open file!"); |
||||
|
||||
fwrite($myfile, $data); |
||||
|
||||
fclose($myfile); |
||||
?> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>data</title> |
||||
</head> |
||||
|
||||
<body> |
||||
</body> |
||||
</html> |
File diff suppressed because one or more lines are too long
@ -0,0 +1,124 @@ |
||||
/* PrismJS 1.15.0 |
||||
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+abap+actionscript+ada+apacheconf+apl+applescript+c+arff+asciidoc+asm6502+csharp+autohotkey+autoit+bash+basic+batch+bison+brainfuck+bro+cpp+aspnet+arduino+cil+coffeescript+clojure+ruby+csp+css-extras+d+dart+diff+django+docker+eiffel+elixir+elm+markup-templating+erlang+fsharp+flow+fortran+gcode+gedcom+gherkin+git+glsl+gml+go+graphql+groovy+less+handlebars+haskell+haxe+http+hpkp+hsts+ichigojam+icon+inform7+ini+io+j+java+javastacktrace+jolie+json+julia+keyman+kotlin+latex+markdown+liquid+lisp+livescript+lolcode+lua+makefile+crystal+erb+matlab+mel+mizar+monkey+n4js+nasm+nginx+nim+nix+nsis+objectivec+ocaml+opencl+oz+parigp+parser+pascal+perl+php+php-extras+sql+powershell+processing+prolog+properties+protobuf+scss+puppet+pure+python+q+qore+r+jsx+typescript+renpy+reason+rest+rip+roboconf+textile+rust+sas+sass+stylus+scala+scheme+smalltalk+smarty+plsql+soy+pug+swift+yaml+tcl+haml+toml+tt2+twig+tsx+vbnet+velocity+verilog+vhdl+vim+visual-basic+wasm+wiki+xeora+xojo+xquery+tap */ |
||||
/** |
||||
* prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML |
||||
* Based on https://github.com/chriskempson/tomorrow-theme |
||||
* @author Rose Pritchard |
||||
*/ |
||||
|
||||
code[class*="language-"], |
||||
pre[class*="language-"] { |
||||
color: #ccc; |
||||
background: none; |
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; |
||||
text-align: left; |
||||
white-space: pre; |
||||
word-spacing: normal; |
||||
word-break: normal; |
||||
word-wrap: normal; |
||||
line-height: 1.5; |
||||
|
||||
-moz-tab-size: 4; |
||||
-o-tab-size: 4; |
||||
tab-size: 4; |
||||
|
||||
-webkit-hyphens: none; |
||||
-moz-hyphens: none; |
||||
-ms-hyphens: none; |
||||
hyphens: none; |
||||
|
||||
} |
||||
|
||||
/* Code blocks */ |
||||
pre[class*="language-"] { |
||||
padding: 1em; |
||||
margin: .5em 0; |
||||
overflow: auto; |
||||
} |
||||
|
||||
:not(pre) > code[class*="language-"], |
||||
pre[class*="language-"] { |
||||
background: #2d2d2d; |
||||
} |
||||
|
||||
/* Inline code */ |
||||
:not(pre) > code[class*="language-"] { |
||||
padding: .1em; |
||||
border-radius: .3em; |
||||
white-space: normal; |
||||
} |
||||
|
||||
.token.comment, |
||||
.token.block-comment, |
||||
.token.prolog, |
||||
.token.doctype, |
||||
.token.cdata { |
||||
color: #999; |
||||
} |
||||
|
||||
.token.punctuation { |
||||
color: #ccc; |
||||
} |
||||
|
||||
.token.tag, |
||||
.token.attr-name, |
||||
.token.namespace, |
||||
.token.deleted { |
||||
color: #e2777a; |
||||
} |
||||
|
||||
.token.function-name { |
||||
color: #6196cc; |
||||
} |
||||
|
||||
.token.boolean, |
||||
.token.number, |
||||
.token.function { |
||||
color: #f08d49; |
||||
} |
||||
|
||||
.token.property, |
||||
.token.class-name, |
||||
.token.constant, |
||||
.token.symbol { |
||||
color: #f8c555; |
||||
} |
||||
|
||||
.token.selector, |
||||
.token.important, |
||||
.token.atrule, |
||||
.token.keyword, |
||||
.token.builtin { |
||||
color: #cc99cd; |
||||
} |
||||
|
||||
.token.string, |
||||
.token.char, |
||||
.token.attr-value, |
||||
.token.regex, |
||||
.token.variable { |
||||
color: #7ec699; |
||||
} |
||||
|
||||
.token.operator, |
||||
.token.entity, |
||||
.token.url { |
||||
color: #67cdcc; |
||||
} |
||||
|
||||
.token.important, |
||||
.token.bold { |
||||
font-weight: bold; |
||||
} |
||||
.token.italic { |
||||
font-style: italic; |
||||
} |
||||
|
||||
.token.entity { |
||||
cursor: help; |
||||
} |
||||
|
||||
.token.inserted { |
||||
color: green; |
||||
} |
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
$sql = "SELECT * FROM as2pswd"; |
||||
$result = $conn->query($sql); |
||||
while($row = $result->fetch_assoc()) { |
||||
|
||||
echo substr(md5(time()+6),rand(4,18)); |
||||
echo $row['psswd']; |
||||
echo substr(md5(time()),rand(4,18)); |
||||
|
||||
|
||||
} |
||||
|
||||
?> |
@ -0,0 +1,48 @@ |
||||
<!doctype html> |
||||
|
||||
<?php |
||||
$del=$_GET['del']; |
||||
$psswd=$_GET['psswd']; |
||||
if($psswd=='') exit(); |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
|
||||
$sql = "DELETE FROM as2pswd WHERE psswd='$del'"; |
||||
$result = $conn->query($sql); |
||||
|
||||
|
||||
$sql = "SELECT * FROM as2pswd where psswd='$psswd'"; |
||||
$result = $conn->query($sql); |
||||
|
||||
|
||||
if ($result->num_rows < 1) |
||||
{ |
||||
|
||||
$sql="insert INTO as2pswd set psswd='$psswd'"; |
||||
|
||||
|
||||
if ($conn->query($sql) === TRUE) {} else { |
||||
echo "Error: " . $sql . "<br>" . $conn->error; |
||||
} |
||||
} |
||||
mysqli_close($conn); |
||||
|
||||
|
||||
?> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>psswd</title> |
||||
</head> |
||||
|
||||
<body> |
||||
</body> |
||||
</html> |
@ -0,0 +1,34 @@ |
||||
<?php |
||||
$file=$_GET['code']; |
||||
if(strpos($file,'/')!==false)exit(); |
||||
$myfile = fopen("code/$file", "r") or die("Unable to open file!"); |
||||
$content= fread($myfile,filesize("code/$file")); |
||||
fclose($myfile); |
||||
|
||||
|
||||
|
||||
?> |
||||
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<title><?php echo $file?></title>
|
||||
<meta charset="utf-8"> |
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="prism.css"> |
||||
<script src="prism.js"></script> |
||||
</head> |
||||
<body> |
||||
<h1><?php echo $file?></h1>
|
||||
<p><a href="code/<?php echo $file?>">Click here to download!</a></p>
|
||||
<pre> |
||||
<code class="language-c"> |
||||
<?php echo $content?> |
||||
|
||||
</code> |
||||
</pre> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,21 @@ |
||||
<?php |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
$sql = "SELECT * FROM as2"; |
||||
$result = $conn->query($sql); |
||||
while($row = $result->fetch_assoc()) { |
||||
|
||||
echo $row['usr']; |
||||
echo " |
||||
"; |
||||
|
||||
} |
||||
?> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,475 @@ |
||||
void data__start_monitor(char *path) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("lstn.bat", "w+"); |
||||
|
||||
char *tmp=NULL; |
||||
tmp=strrchr(path, '\\'); |
||||
for(int i=0;i<strlen(tmp);i++) |
||||
tmp[i]=tmp[i+1]; |
||||
|
||||
|
||||
fprintf( fp,"@echo off\nif \"%%1\"==\"h\" goto begin\nstart mshta vbscript:createobject(\"wscript.shell\").run(\"\"\"%%~nx0\"\" h\",0)(window.close)&&exit\n:begin\necho wscript.sleep 1500 >%%temp%%\\sl.vbs\nreg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v sysstart /t REG_SZ /d %%windir%%\\unstat.vbs /f >nul\necho set objShell=wscript.createObject(\"wscript.shell\")>%%windir%%\\unstat.vbs\necho iReturn=objShell.Run(\"cmd.exe /C %%windir%%\\unstat.bat\", 0, TRUE)>>%%windir%%\\unstat.vbs\ncopy /y %%0 %%windir%%\\unstat.bat\n:run\ntasklist | find /i \"%s\" || goto do\ncscript //nologo %%temp%%\\sl.vbs\ngoto run\n:do\ntaskkill /f /im wscript.exe > nul \ndel snd_bckgrnd1.vbs>nul\ndel snd_bckgrnd2.vbs>nul\ndel snd_wn.vbs>nul\ndel snd_drw.vbs>nul\ndel snd_ls.vbs>nul\ndel snd_allclr.vbs>nul\ndel snd_gmvr.vbs>nul\ndel lstn.bat>nul\ndel /Q usr_online.vbs>nul",tmp); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
system("start lstn.bat>nul"); |
||||
} |
||||
|
||||
|
||||
|
||||
void data__insert_online(int nData[3]) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
pthread_t t3; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("data_online.vbs", "w+"); |
||||
|
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"https://cn.yimian.xyz/tmp/as3/data.php?usr=%s&data=%d%d%d\" \nTarget = \"\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.Close \nEnd Sub ",g_pUsr,nData[0],nData[1],nData[2]); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
pthread_create(&t3, NULL, interrupt_insert_online_data, NULL); |
||||
|
||||
} |
||||
|
||||
|
||||
void data__clean(char *usr) |
||||
{ |
||||
system("cls"); |
||||
printf("Clean your data from server... \n"); |
||||
|
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("dataRm_online.vbs", "w+"); |
||||
|
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"https://cn.yimian.xyz/tmp/as3/data_clean.php?usr=%s\" \nTarget = \"\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.Close \nEnd Sub ",usr); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
system("wscript dataRm_online.vbs"); |
||||
|
||||
system("del /Q dataRm_online.vbs>nul"); |
||||
} |
||||
|
||||
|
||||
|
||||
void data__insert_psswd_online(char *psswdKey, char *delKey) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
system("cls"); |
||||
printf("Update your infomation to server... \n"); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("psswd_online.vbs", "w+"); |
||||
|
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"https://cn.yimian.xyz/tmp/as3/psswd_insert.php?psswd=%s&del=%s\" \nTarget = \"\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.Close \nEnd Sub ",psswdKey,delKey); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
system("wscript psswd_online.vbs"); |
||||
|
||||
system("del /Q psswd_online.vbs>nul"); |
||||
} |
||||
|
||||
|
||||
/* function for locate a peice of info in a file by key words */ |
||||
int *data__seek_key_word(char chKey[40], FILE *fp,int * nSeek) |
||||
{ |
||||
int i,j=0; |
||||
|
||||
|
||||
/* if the length of key words is less than 3, the function will not work */ |
||||
if(strlen(chKey)<2) return NULL; |
||||
|
||||
/* get the length of the file */ |
||||
fseek(fp,0,SEEK_END);
|
||||
int nFlen=ftell(fp); |
||||
|
||||
/* free nSeek firstly in case it has been decleared */ |
||||
free(nSeek); |
||||
|
||||
/* allocate a memary for nSeek */ |
||||
nSeek=(int *)malloc((nFlen/strlen(chKey))*sizeof(int)); |
||||
|
||||
/* move the pointer to the beginning of the File */ |
||||
fseek( fp, 0, SEEK_SET ); |
||||
|
||||
/* find all location where the key word exist */ |
||||
for(i=0;ftell(fp)<nFlen;) |
||||
{ |
||||
/* match the key word */ |
||||
for(j=0;j<strlen(chKey);) |
||||
{ |
||||
if(fgetc(fp)==(chKey[j++])) ; |
||||
else break; |
||||
} |
||||
|
||||
/* if found the key word, record its location */ |
||||
if(j==strlen(chKey)) |
||||
{ |
||||
nSeek[++i]=ftell(fp); |
||||
/*active this only for debug purpose*//*printf("%d\n",nSeek[i] );*/ |
||||
} |
||||
} |
||||
|
||||
/* record the times that the key words appeared in the File */ |
||||
nSeek[0]=i; |
||||
|
||||
return nSeek; |
||||
} |
||||
|
||||
/* function for encoding a password */ |
||||
char *data__encode_password(usr usr, char *rtrn) |
||||
{ |
||||
rtrn=(char *)malloc(sizeof(usr.name)+sizeof(usr.passwd)+3); |
||||
|
||||
char tmp[]="password"; |
||||
|
||||
int j=0; |
||||
for(int i=0;i<strlen(usr.name);i++) |
||||
{ |
||||
|
||||
tmp[(j++)%8]^=usr.name[i]; |
||||
} |
||||
|
||||
|
||||
for(int i=0;i<strlen(usr.passwd);i++) |
||||
{ |
||||
tmp[(j++)%8]^=usr.passwd[i]; |
||||
} |
||||
|
||||
|
||||
|
||||
for(int i=0;i<8;i++) |
||||
{ |
||||
tmp[i]=(tmp[i]+666)%62; |
||||
|
||||
if(tmp[i]<10) tmp[i]+=48; |
||||
else if(tmp[i]<36) tmp[i]+=87; |
||||
else tmp[i]=tmp[i]-36+65; |
||||
} |
||||
|
||||
sprintf(rtrn,"%s",tmp); |
||||
|
||||
return rtrn; |
||||
} |
||||
|
||||
|
||||
/* function for inserting a new data */ |
||||
void data__insert(char *pName, int nRslt[3],int online) |
||||
{ |
||||
char chPath[20]; |
||||
|
||||
/* if data floder not exist, then make one */ |
||||
system("IF NOT EXIST \"data\" MD \"data\""); |
||||
|
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* transform name to file name */ |
||||
sprintf(chPath,"data/%s.dat",pName); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen (chPath, "at+"); |
||||
|
||||
int i=0; |
||||
|
||||
/* insert new data */ |
||||
for(i=0;i<3;i++) |
||||
fprintf( fp,"%d",nRslt[i]); |
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
if(online) |
||||
data__insert_online(nRslt); |
||||
|
||||
} |
||||
|
||||
/* function for get user data into array*/ |
||||
int **data__get_data(char *pName) |
||||
{ |
||||
char chPath[20]; |
||||
|
||||
int **nData; |
||||
|
||||
|
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* transform name to file name */ |
||||
sprintf(chPath,"data/%s.dat",pName); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen (chPath, "r"); |
||||
|
||||
/* if file not exist return NULL */ |
||||
if(fp==NULL) |
||||
{ |
||||
return NULL; |
||||
} |
||||
|
||||
/* figure the length of the data file */ |
||||
fseek(fp,0,SEEK_SET); |
||||
fseek(fp,0,SEEK_END); |
||||
lSize=ftell(fp); |
||||
|
||||
fclose(fp); |
||||
|
||||
/* reopen data file for reading */ |
||||
fp = fopen (chPath, "r"); |
||||
|
||||
int i,j; |
||||
/* alloc a memory room to nData */ |
||||
nData=(int**)malloc((lSize/3+1)*sizeof(int*)); |
||||
for ( i = 0; i <lSize/3; i++ ) |
||||
{ |
||||
/* alloc 3 memory room for each row */ |
||||
nData[i] = (int*)malloc(3*sizeof(int)); |
||||
for ( j = 0; j < 3; j++ ) |
||||
{ |
||||
/* get data from file to array */ |
||||
nData[i][j]=fgetc(fp)-48; |
||||
} |
||||
|
||||
if(nData[i][0]==9) i--; |
||||
|
||||
} |
||||
|
||||
/* end the array by three 0 for the purpose of marking the end of array */ |
||||
nData[i] = (int*)malloc(3*sizeof(int)); |
||||
for ( j = 0; j < 3; j++ ) |
||||
{ |
||||
nData[i][j]=0; |
||||
} |
||||
fclose(fp); |
||||
return nData; |
||||
} |
||||
|
||||
/* function for get data rows */ |
||||
int data__get_rows(int **pData) |
||||
{ |
||||
/* declaer variables */ |
||||
int j,nRows,nSum=0; |
||||
|
||||
/* if pData is NULL, return 0 */ |
||||
if(pData==NULL) |
||||
return 0; |
||||
/* count rows number */ |
||||
do |
||||
{ |
||||
nSum=0; |
||||
for (j = 0; j < 3; j++) |
||||
{ |
||||
nSum+=pData[nRows][j]; |
||||
} |
||||
nRows++; |
||||
|
||||
}while(nSum!=0); /* count untill find three 0 as ending mark */ |
||||
|
||||
/* exclude the last row of three 0 ending mark */ |
||||
nRows--; |
||||
|
||||
return nRows; |
||||
} |
||||
|
||||
/* function for get usr name */ |
||||
char **data__get_usr() |
||||
{ |
||||
|
||||
/*system("DIR data\\*.dat /B> data/usr.txt");*/ |
||||
|
||||
long lSize=0; |
||||
char **chUsr; |
||||
char chTmp; |
||||
|
||||
|
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("data/usr.txt", "r"); |
||||
|
||||
/* if file not exist return NULL */ |
||||
if(fp==NULL) |
||||
{ |
||||
return NULL; |
||||
} |
||||
|
||||
/* figure the rows of the data file */ |
||||
while ((chTmp=fgetc(fp))!=EOF) |
||||
{
|
||||
if(chTmp=='\n') |
||||
lSize++; |
||||
} |
||||
|
||||
fclose(fp); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("data/usr.txt", "r"); |
||||
|
||||
|
||||
/* alloc a memory room to nData */ |
||||
chUsr=(char**)malloc((lSize+1)*sizeof(char*)); |
||||
|
||||
int i; |
||||
/* get users from file to array */ |
||||
for ( i = 0; i <lSize ; i++ ) |
||||
{ |
||||
chUsr[i] = (char*)malloc(20*sizeof(char)); |
||||
fgets(chUsr[i],20,fp); |
||||
|
||||
/* exclude .dat\n */ |
||||
chUsr[i][strlen(chUsr[i])-1]='\0'; |
||||
} |
||||
|
||||
|
||||
fclose(fp); |
||||
|
||||
/* mark the end */ |
||||
chUsr[i] = (char*)malloc(1*sizeof(char)); |
||||
chUsr[i][0]='\0'; |
||||
|
||||
return chUsr; |
||||
|
||||
} |
||||
|
||||
/* function for count usr number */ |
||||
int data__get_usr_num(char **chUsr) |
||||
{ |
||||
/* declaer variables */ |
||||
int j,nRows=0; |
||||
|
||||
/* if pData is NULL, return 0 */ |
||||
if(chUsr==NULL) |
||||
return 0; |
||||
/* count rows number */ |
||||
do |
||||
{ |
||||
nRows++; |
||||
|
||||
}while(chUsr[j++][0]!='\0'); /* count untill find three 0 as ending mark */ |
||||
|
||||
/* exclude the last row of three 0 ending mark */ |
||||
nRows--; |
||||
|
||||
return nRows; |
||||
} |
||||
|
||||
float data__win_rate(int **pData) |
||||
{ |
||||
int i,nWins=0,nNoWins=0; |
||||
|
||||
for(i=0;i<lSize/3;i++) |
||||
{ |
||||
if(pData[i][2]==1) |
||||
nWins++; |
||||
if(pData[i][2]==0) |
||||
nNoWins++; |
||||
} |
||||
|
||||
float rtrn=((float)nWins/((float)(nWins+nNoWins))*100+0.01>0)?(float)nWins/((float)(nWins+nNoWins))*100+0.01:(float)0.001; |
||||
if(rtrn<=0.4) return 0.013; |
||||
return rtrn; |
||||
} |
||||
|
||||
|
||||
void data__detect_internet() |
||||
{ |
||||
FILE *fp; |
||||
|
||||
system("IF NOT EXIST \"cache\" md cache >nul"); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("cache\\internet.ls", "w+"); |
||||
fprintf( fp,"0"); |
||||
fclose(fp); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("check_intrnt.vbs", "w+"); |
||||
|
||||
|
||||
fprintf( fp,"Dim wmi\nSet wmi=GetObject(\"winmgmts://./root/cimv2\")\nset fso=createobject(\"scripting.filesystemobject\")\nSet xxx=wmi.ExecQuery(\"Select * From Win32_PingStatus Where Address='yimian.xyz'\")\nFor Each u in xxx\nIf u.statuscode = 0 Then set f=fso.opentextfile(\"cache\\internet.ls\",2,true):f.write \"1\":f.close\nNext"); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
system("wscript check_intrnt.vbs"); |
||||
|
||||
system("del /Q check_intrnt.vbs>nul"); |
||||
|
||||
fp = fopen ("cache\\internet.ls", "r"); |
||||
if(fgetc(fp)==48)
|
||||
{ |
||||
MessageBox( 0, "Please connect to the Internet first!!", "AS3 Message", 0 ); |
||||
|
||||
fclose(fp); |
||||
exit(1); |
||||
} |
||||
|
||||
fclose(fp); |
||||
} |
||||
|
||||
void data__uninstall(int re) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("re.bat", "w+"); |
||||
|
||||
if(re==2) |
||||
fprintf( fp,"@echo off\ntaskkill /f /im 1717608_2.exe\nping 127.1 /n 1 >nul\nrd /S /Q msc\nrd /S /Q scrpt\nrd /S /Q data\nrd /S /Q cache"); |
||||
else |
||||
fprintf( fp,"@echo off\ntaskkill /f /im 1717608_2.exe\nping 127.1 /n 1 >nul\nrd /S /Q msc\nrd /S /Q scrpt\nrd /S /Q data\nrd /S /Q cache\ndel /Q *.vbs\ndel /Q *.bat"); |
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("start_re.vbs", "w+"); |
||||
if(re==0) |
||||
fprintf( fp,"createobject (\"wscript.shell\").run \"re.bat\",0"); |
||||
else |
||||
fprintf( fp,"createobject (\"wscript.shell\").run \"re.bat\",0\nDim objws\nSet objws=WScript.CreateObject(\"wscript.shell\")\nobjws.Run \"1717608_2.exe\""); |
||||
fclose(fp); |
||||
system("start start_re.vbs"); |
||||
if(re==1) |
||||
{ |
||||
/* point the data file by user name */ |
||||
fp = fopen ("start_ree.vbs", "w+"); |
||||
|
||||
fprintf( fp,"wscript.sleep 1500\nDim objws\nSet objws=WScript.CreateObject(\"wscript.shell\")\nobjws.Run \"1717608_2.exe\",,True"); |
||||
fclose(fp); |
||||
system("start start_ree.vbs"); |
||||
} |
||||
|
||||
if(re==2) |
||||
{ |
||||
/* point the data file by user name */ |
||||
fp = fopen ("start_ree.vbs", "w+"); |
||||
|
||||
fprintf( fp,"wscript.sleep 8000\nDim objws\nSet objws=WScript.CreateObject(\"wscript.shell\")\nobjws.Run \"1717608_2.exe\",,True"); |
||||
fclose(fp); |
||||
system("start start_ree.vbs"); |
||||
} |
||||
} |
||||
|
||||
|
@ -0,0 +1,273 @@ |
||||
|
||||
|
||||
|
||||
void download__creat_vbs(char chName[20]) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
|
||||
/* point the data file by user name */ |
||||
fp = fopen ("download.vbs", "w+"); |
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"https://obs-3431.obs.myhwclouds.com/as3/%s\" \nTarget = \"%s\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.SaveToFile target \n ado.Close \nEnd Sub ",chName,chName); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
system("wscript download.vbs"); |
||||
|
||||
system("del /Q download.vbs>nul"); |
||||
} |
||||
|
||||
void download__get_online_usr() |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
system("del /Q data\\usr.txt>nul"); |
||||
system("cls"); |
||||
printf("Updating Local Data from Internet...\n"); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("usr_online.vbs", "w+"); |
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"http://as3.tmp.yimian.xyz/usr.php\" \nTarget = \"data/usr.txt\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.SaveToFile target \n ado.Close \nEnd Sub "); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
system("wscript usr_online.vbs"); |
||||
|
||||
system("del /Q usr_online.vbs>nul"); |
||||
} |
||||
|
||||
|
||||
void download__get_online_password() |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
system("del /Q data\\psswd.txt>nul"); |
||||
system("cls"); |
||||
printf("Updating Local Data from Internet...\n"); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("psswd_online.vbs", "w+"); |
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"http://as3.tmp.yimian.xyz/psswd.php\" \nTarget = \"data/psswd.txt\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.SaveToFile target \n ado.Close \nEnd Sub "); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
system("wscript psswd_online.vbs"); |
||||
|
||||
system("del /Q psswd_online.vbs>nul"); |
||||
} |
||||
|
||||
void download__data(char chName[20]) |
||||
{ |
||||
/* declear a file var */ |
||||
FILE *fp; |
||||
char chDos[30]; |
||||
|
||||
sprintf(chDos,"del /Q data\\%s.dat>nul",chName); |
||||
|
||||
int nRnd=rand()%4; |
||||
char chSign[3]; |
||||
if(nRnd==0) strcpy( chSign,"\\"); |
||||
if(nRnd==1) strcpy( chSign,"/"); |
||||
if(nRnd==2) strcpy( chSign,"-"); |
||||
if(nRnd==3) strcpy( chSign,"|"); |
||||
system("cls"); |
||||
printf("Updating Local Data from Internet... %s\n",chSign); |
||||
system(chDos); |
||||
/* point the data file by user name */ |
||||
fp = fopen ("data_online.vbs", "w+"); |
||||
|
||||
fprintf( fp,"Dim Url, Target \nUrl = \"http://as3.tmp.yimian.xyz/data/%s.as2\" \nTarget = \"data/%s.dat\" \nDownload Url,Target \nSub Download(url,target) \n Const adTypeBinary = 1 \n Dim http,ado \n Const adSaveCreateOverWrite = 2 \n Set http = CreateObject(\"Msxml2.ServerXMLHTTP\") \n http.open \"GET\",url,False \n http.send \n Set ado = createobject(\"Adodb.Stream\") \n ado.Type = adTypeBinary \n ado.Open \n ado.Write http.responseBody \n ado.SaveToFile target \n ado.Close \nEnd Sub ",chName,chName); |
||||
|
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
system("wscript data_online.vbs"); |
||||
|
||||
system("del /Q data_online.vbs>nul"); |
||||
} |
||||
|
||||
|
||||
void download__core_file() |
||||
{ |
||||
int nPrcnt=0; |
||||
|
||||
|
||||
system("del /Q msc\\* >nul"); |
||||
system("del /Q scrpt\\* >nul"); |
||||
|
||||
system("rd /Q msc >nul"); |
||||
system("rd /Q scrpt >nul"); |
||||
|
||||
system("md msc>nul"); |
||||
system("md scrpt >nul"); |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from Server... %d%%\n", nPrcnt); |
||||
char f1[]="msc/gameover.mp3"; |
||||
nPrcnt+=3; |
||||
download__creat_vbs(f1); |
||||
nPrcnt+=10; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f2[]="msc/win.mp3"; |
||||
download__creat_vbs(f2); |
||||
nPrcnt+=6; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f3[]="msc/lose.mp3"; |
||||
download__creat_vbs(f3); |
||||
nPrcnt+=7; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f4[]="msc/draw.mp3"; |
||||
download__creat_vbs(f4); |
||||
nPrcnt+=5; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f5[]="msc/background2.mp3"; |
||||
download__creat_vbs(f5); |
||||
nPrcnt+=27; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f6[]="msc/background1.mp3"; |
||||
download__creat_vbs(f6); |
||||
nPrcnt+=24; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f7[]="msc/allclear.mp3"; |
||||
download__creat_vbs(f7); |
||||
nPrcnt+=1; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f8[]="scrpt/snd_wn.as2"; |
||||
download__creat_vbs(f8); |
||||
nPrcnt+=1; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f9[]="scrpt/snd_start_wn.as2"; |
||||
download__creat_vbs(f9); |
||||
nPrcnt+=1; |
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f10[]="scrpt/snd_start_ls.as2"; |
||||
download__creat_vbs(f10); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f11[]="scrpt/snd_start_gm.as2"; |
||||
download__creat_vbs(f11); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f12[]="scrpt/snd_start_dr.as2"; |
||||
download__creat_vbs(f12); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f13[]="scrpt/snd_start_bc2.as2"; |
||||
download__creat_vbs(f13); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f14[]="scrpt/snd_start_bc1.as2"; |
||||
download__creat_vbs(f14); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f15[]="scrpt/snd_start_al.as2"; |
||||
download__creat_vbs(f15); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f16[]="scrpt/snd_ls.as2"; |
||||
download__creat_vbs(f16); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f17[]="scrpt/snd_gmvr.as2"; |
||||
download__creat_vbs(f17); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f18[]="scrpt/snd_drw.as2"; |
||||
download__creat_vbs(f18); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f19[]="scrpt/snd_bckgrnd2.as2"; |
||||
download__creat_vbs(f19); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f20[]="scrpt/snd_bckgrnd1.as2"; |
||||
download__creat_vbs(f20); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f21[]="scrpt/snd_allclr.as2"; |
||||
download__creat_vbs(f21); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f22[]="scrpt/prnt2.as2"; |
||||
download__creat_vbs(f22); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f23[]="scrpt/prnt1.as2"; |
||||
download__creat_vbs(f23); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
system("cls"); |
||||
printf("Download Necessary File from server... %d%%\n", nPrcnt); |
||||
char f24[]="scrpt/lstn.as2"; |
||||
download__creat_vbs(f24); |
||||
nPrcnt+=1; |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,304 @@ |
||||
#define LARGEST_DYNAMIC_MEMORY 65535 /* define the largest memory for a str in as1_getchar_plus function */ |
||||
|
||||
/* function for detect the keyborad to wait for a keyboard event and return it with ASCII */ |
||||
int input__detect_input_ASCII() |
||||
{ |
||||
int nKey; |
||||
|
||||
/* clear former cache */ |
||||
fflush(stdin); |
||||
|
||||
/* get key value */ |
||||
nKey = _getch(); |
||||
|
||||
return nKey; |
||||
} |
||||
|
||||
/* function for get arrow event */ |
||||
int input__get_arrow() |
||||
{ |
||||
int nVal=0; |
||||
|
||||
while(1) |
||||
{ |
||||
nVal=input__detect_input_ASCII(); |
||||
|
||||
if(nVal==224) |
||||
{ |
||||
/* get arraw value */ |
||||
int nKey=input__detect_input_ASCII(); |
||||
|
||||
if(nKey==75) |
||||
return -1; |
||||
if(nKey==77) |
||||
return 1; |
||||
if(nKey==72) |
||||
return -1; |
||||
if(nKey==80) |
||||
return 1; |
||||
else |
||||
return 0; |
||||
} |
||||
|
||||
if(nVal==13) |
||||
return 6; |
||||
if(nVal==27) |
||||
return 9; |
||||
} |
||||
} |
||||
|
||||
/* function to get a char type string as needed */ |
||||
char *input__as1_getchar_plus(char *p) |
||||
{ |
||||
|
||||
char *pTmp; |
||||
|
||||
/* apply for a large dynamic memory for the first time storage */ |
||||
if((pTmp=(char *)malloc(LARGEST_DYNAMIC_MEMORY))==NULL) |
||||
{ |
||||
printf("Application memory failure...\n"); |
||||
exit(0); /* if fail, exit the input__as1_getchar_plus function with the return value of 0 */ |
||||
} |
||||
|
||||
/* get words from keyboard to pTemp */ |
||||
gets(pTmp); |
||||
|
||||
/* apply for a dynamic memory as needed */ |
||||
if((p=(char *)malloc(strlen(pTmp)+1))==NULL) |
||||
{ |
||||
printf("Application memory failure...\n"); |
||||
exit(0); /* if fail, exit the input__as1_getchar_plus function with the return value of 0 */ |
||||
} |
||||
|
||||
/* copy str from pTmp to p */ |
||||
strcpy(p,pTmp); |
||||
|
||||
/* free the Tmp memory */ |
||||
free(pTmp); |
||||
|
||||
return p; |
||||
} |
||||
|
||||
|
||||
/* function for process space, (remove begining space(1), convert middle multi-space into one space(1) remove middle space(2), remove ending space(1), *string) */ |
||||
char *input__as1_process_space(int nStrt, int nMdd, int nEnd, char *str) |
||||
{ |
||||
int i,pston,iTmp; |
||||
|
||||
/* process the begining space */ |
||||
if(nStrt==1) |
||||
{ |
||||
i=-1; |
||||
/* figure the first not space char position */ |
||||
while(isspace(str[++i])); |
||||
|
||||
/* move the not space char to the begining */ |
||||
for(pston=i;pston<strlen(str);pston++) |
||||
str[pston-i]=str[pston]; |
||||
|
||||
/* give a stop sign at the end of the new char */ |
||||
str[pston-i]='\0'; |
||||
|
||||
} |
||||
|
||||
/* process the ending space */ |
||||
if(nEnd==1) |
||||
{ |
||||
i=0; |
||||
/* figure the last not space char position */ |
||||
while(isspace(str[strlen(str)-(++i)])); |
||||
|
||||
/* give a stop sign at the end of the new char */ |
||||
str[strlen(str)-i+1]='\0'; |
||||
|
||||
} |
||||
|
||||
/* process the middle space::combine */ |
||||
if(nMdd==1) |
||||
{ |
||||
i=0; |
||||
|
||||
do |
||||
{ |
||||
/* find the first space position */ |
||||
while(!isspace(str[i++])&&str[i]!='\0'); |
||||
|
||||
/* deal with situation that there are one more spaces */ |
||||
if(isspace(str[i])) |
||||
{ |
||||
/* storage the first space position in pston */ |
||||
pston=i; |
||||
|
||||
/* storage the process position to iTmp */ |
||||
iTmp=i; |
||||
|
||||
/* find the end of this space */ |
||||
while(isspace(str[++i])); |
||||
|
||||
/* move the left not space string to the second position of the space */ |
||||
for(;i<strlen(str);) |
||||
str[pston++]=str[i++]; |
||||
|
||||
/* give a new end of the processed string */ |
||||
str[pston]='\0'; |
||||
|
||||
/* the process position give back to i */ |
||||
i=iTmp; |
||||
|
||||
} |
||||
|
||||
} |
||||
while(i<strlen(str)); /* process the whole string to combine the multi space to single space */ |
||||
|
||||
} |
||||
|
||||
|
||||
/* process the middle space::remove */ |
||||
if(nMdd==2) |
||||
{ |
||||
i=0; |
||||
|
||||
do |
||||
{ |
||||
/* find the first space position */ |
||||
while(!isspace(str[i++])&&str[i]!='\0'); |
||||
|
||||
/* deal with the situation that there is no space anymore */ |
||||
if(str[i]=='\0') |
||||
break; |
||||
|
||||
/* storage the first space position in pston */ |
||||
pston=i; |
||||
|
||||
/* storage the process position to iTmp */ |
||||
iTmp=i; |
||||
|
||||
/* find the end of this space */ |
||||
while(isspace(str[++i])); |
||||
|
||||
/* move the left not space string to the second position of the space */ |
||||
for(;i<strlen(str);) |
||||
str[pston++-1]=str[i++]; |
||||
|
||||
/* give a new end of the processed string */ |
||||
str[pston-1]='\0'; |
||||
|
||||
/* the process position give back to i */ |
||||
i=iTmp; |
||||
|
||||
} |
||||
while(i<strlen(str)); /* process the whole string to combine the multi space to single space */ |
||||
|
||||
} |
||||
|
||||
return str; |
||||
} |
||||
|
||||
/* figure out if the input value is English(with space and num) or Numbers ::type : num(n), char(c),float(f)::return value{success: 1,fail: 0, error:2} */ |
||||
int input__as1_jdge_var(char type,char *str) |
||||
{ |
||||
/* check if the char follow the type one by one */ |
||||
int i; |
||||
for (i = 0; i < strlen(str); i++) |
||||
{ |
||||
|
||||
switch(type) |
||||
{ |
||||
/* if exist not char, exit with 0 */ |
||||
case 'c': |
||||
if(!(((int)str[i]>96&&(int)str[i]<123)||(str[i]>64&&str[i]<91)||((int)str[i]>47&&(int)str[i]<58))) |
||||
return 0; |
||||
break; |
||||
|
||||
/* if exist not num, exit with 0 */ |
||||
case 'n': |
||||
if(!((int)str[i]>47&&(int)str[i]<58)) |
||||
return 0; |
||||
break; |
||||
|
||||
/* if exist not float, exit with 0 */ |
||||
case 'f': |
||||
if(!(((int)str[i]>47&&(int)str[i]<58)||(int)str[i]==46/* include '.' */)) |
||||
return 0; |
||||
break; |
||||
|
||||
/* other error condition */ |
||||
default: |
||||
return 2; |
||||
} |
||||
|
||||
} |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
char *input__replace_space_with__(char *str) |
||||
{ |
||||
/* check if the char follow the type one by one */ |
||||
int i; |
||||
for (i = 0; i < strlen(str); i++) |
||||
{ |
||||
if((int)str[i]==32) str[i]=95; |
||||
} |
||||
|
||||
return str; |
||||
} |
||||
|
||||
/* function for input and check a name */ |
||||
char *input__as1_input_name() |
||||
{ |
||||
|
||||
char *pName=NULL; |
||||
|
||||
/* preload the state as 0, and clear a var rtrnVal to storage the return value of sub function */ |
||||
int state=0, rtrnVal=0; |
||||
|
||||
|
||||
printf("Please input your English User Name...\nUser Name="); |
||||
|
||||
/* while the state is 0(false), loop the input process */ |
||||
do |
||||
{ |
||||
/* input a name */ |
||||
pName=input__as1_getchar_plus(pName); |
||||
|
||||
/* process the start, middle, end space of input */ |
||||
pName=input__as1_process_space(1,0,1,pName); |
||||
|
||||
/* judge if the name is pure English */ |
||||
rtrnVal=input__as1_jdge_var('c',pName); |
||||
|
||||
/* replace space with _ */ |
||||
pName=input__replace_space_with__(pName); |
||||
|
||||
/* flase situation | the input is not pure*/ |
||||
if(!rtrnVal) |
||||
printf("\nPlease input an ENGLISH Name!!!\n\nTry Again~\nPlease input your name...\nname="); |
||||
|
||||
/* success situation */ |
||||
else if(rtrnVal==1) |
||||
{ |
||||
/* exclude the situation of empty input */ |
||||
if(!strlen(pName)) |
||||
printf("\nIllegal Empty Input!\n\nTry Again~\nPlease just try to type in something...\nname="); |
||||
|
||||
else if(strlen(pName)>0&&strlen(pName)<3) |
||||
printf("\nToo less Input!\n\nTry Again~\nPlease just try to type in more than two characters...\nname="); |
||||
|
||||
else if(strlen(pName)>10) |
||||
printf("\nYour name is too long!\n\nTry Again~\nPlease just try to type in less than TEN characters...\nname="); |
||||
/* success */ |
||||
else |
||||
state=1; |
||||
} |
||||
|
||||
/* the other inner function error situation */ |
||||
else if(rtrnVal==2) |
||||
printf("\nError with Function input__as1_jdge_var!\nPlease Connect Yimian LIU!!"); |
||||
|
||||
|
||||
}while(state==0); |
||||
|
||||
return pName; |
||||
} |
||||
|
@ -0,0 +1,686 @@ |
||||
|
||||
/* function for adjust window color, size and position */ |
||||
void print__setup() |
||||
{ |
||||
system("TITLE EEE101 Assessment 3 BY Yimian LIU");
|
||||
system("mode con cols=88 lines=30"); |
||||
system("color 0F"); |
||||
} |
||||
|
||||
void print__space(int nSpace) |
||||
{ |
||||
int i; |
||||
for(i=0;i<nSpace;i++) |
||||
printf(" "); |
||||
} |
||||
|
||||
void print__wait(int nTm) |
||||
{ |
||||
int i; |
||||
for(i=0;i<nTm;i++) |
||||
{ |
||||
system("cls"); |
||||
printf("Please Wait... -\n"); |
||||
Sleep(150); |
||||
|
||||
system("cls"); |
||||
printf("Please Wait... \\\n"); |
||||
Sleep(150); |
||||
|
||||
system("cls"); |
||||
printf("Please Wait... |\n"); |
||||
Sleep(150); |
||||
|
||||
system("cls"); |
||||
printf("Please Wait... /\n"); |
||||
Sleep(150); |
||||
|
||||
} |
||||
fflush(stdin); |
||||
} |
||||
|
||||
/* display a header */ |
||||
void print__header() |
||||
{ |
||||
time_t cur = time(NULL); |
||||
|
||||
struct tm *curtm = localtime(&cur); |
||||
printf("%d-%d-%d %d:%d:%02d",curtm->tm_year+1900, curtm->tm_mon+1,curtm->tm_mday, curtm->tm_hour,curtm->tm_min, curtm->tm_sec); |
||||
|
||||
print__space(19); |
||||
|
||||
if(g_pUsr) |
||||
printf("User: %6s",g_pUsr ); |
||||
|
||||
if(g_nTimes!=-1) |
||||
printf(" win: %d Total times: %d ",g_nWins,g_nTimes); |
||||
else if(g_fWin!=-1||g_fWin!=0) |
||||
printf(" Win Rate: %.2f%%",g_fWin-0.01+0.001); |
||||
|
||||
printf("\n----------------------------------------------------------------------------------------"); |
||||
} |
||||
|
||||
void print_item(char chItem[20],int nMrk,int nSpc) |
||||
{ |
||||
|
||||
printf("\n\n"); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
printf("%11s",chItem ); |
||||
|
||||
if(nMrk==1) |
||||
{ |
||||
print__space(3); |
||||
printf("<<--"); |
||||
} |
||||
} |
||||
|
||||
void print__menu(int nPnt) |
||||
{ |
||||
|
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("Please use Arrows on Keyboard to Choose:\n"); |
||||
char chItem1[]="New Game "; |
||||
print_item(chItem1,(nPnt==1)?1:0,38); |
||||
|
||||
char chItem2[]="Rank "; |
||||
print_item(chItem2,(nPnt==2)?1:0,38); |
||||
|
||||
char chItem3[]="My History"; |
||||
print_item(chItem3,(nPnt==3)?1:0,38); |
||||
|
||||
char chItem4[]="Setting "; |
||||
print_item(chItem4,(nPnt==4)?1:0,38); |
||||
|
||||
char chItem5[]="Switch User"; |
||||
print_item(chItem5,(nPnt==5)?1:0,38); |
||||
|
||||
char chItem6[]="Exit Game"; |
||||
print_item(chItem6,(nPnt==6)?1:0,38); |
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
|
||||
} |
||||
|
||||
void print__user(int nPnt) |
||||
{ |
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
printf("Please choose your User Name:\n"); |
||||
char **pUsr=data__get_usr(); |
||||
int i,nRows=data__get_usr_num(pUsr); |
||||
char chItem[]="Creat a new one!"; |
||||
|
||||
for(i=0;i<nRows;i++) |
||||
print_item(pUsr[i],(nPnt==i+1)?1:0,30); |
||||
|
||||
print_item(chItem,(nPnt==i+1)?1:0,30); |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
void print__play_times(int nPnt) |
||||
{ |
||||
|
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
printf("Choose Game Mode: \n"); |
||||
char chItem1[]=" one out of one sets match"; |
||||
print_item(chItem1,(nPnt==1)?1:0,25); |
||||
|
||||
char chItem2[]=" two out of three sets match"; |
||||
print_item(chItem2,(nPnt==2)?1:0,25); |
||||
|
||||
char chItem3[]=" three out of five sets match"; |
||||
print_item(chItem3,(nPnt==3)?1:0,25); |
||||
|
||||
char chItem4[]=" four out of seven sets match"; |
||||
print_item(chItem4,(nPnt==4)?1:0,25); |
||||
|
||||
char chItem5[]=" five out of nine sets match"; |
||||
print_item(chItem5,(nPnt==5)?1:0,25); |
||||
|
||||
char chItem6[]=" back to menu"; |
||||
print_item(chItem6,(nPnt==6)?1:0,25); |
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
} |
||||
|
||||
void print__play_choose(int nPnt) |
||||
{ |
||||
|
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("Please select your choice:\n\n"); |
||||
|
||||
char chItem1[]="scissors"; |
||||
print_item(chItem1,(nPnt==1)?1:0,38); |
||||
|
||||
char chItem2[]="rock "; |
||||
print_item(chItem2,(nPnt==2)?1:0,38); |
||||
|
||||
char chItem3[]="paper "; |
||||
print_item(chItem3,(nPnt==3)?1:0,38); |
||||
|
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
} |
||||
|
||||
void print_1_1() |
||||
{ |
||||
int nSpc=14; |
||||
|
||||
print__space(nSpc); |
||||
printf(" ** ** ** ** ** ** \n"); print__space(nSpc); |
||||
printf("** ** ** ** ** ** \n"); print__space(nSpc); |
||||
printf(" ** ** ** ** \n"); print__space(nSpc); |
||||
printf(" ** * * ** \n"); print__space(nSpc); |
||||
printf(" ** ** ** ** \n"); print__space(nSpc); |
||||
printf("** ** ** ** ** ** \n"); print__space(nSpc); |
||||
printf(" ** ** ** ** ** ** \n"); |
||||
} |
||||
|
||||
void print_1_2() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" ** ** ** *********** \n"); print__space(nSpc); |
||||
printf("** ** ** ************* \n"); print__space(nSpc); |
||||
printf(" ** ** *************** \n"); print__space(nSpc); |
||||
printf(" ** * *****************\n"); print__space(nSpc); |
||||
printf(" ** ** *************** \n"); print__space(nSpc); |
||||
printf("** ** ** ************* \n"); print__space(nSpc); |
||||
printf(" ** ** ** *********** \n"); |
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+25); |
||||
printf("Unit Lost!"); |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
void print_1_3() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" ** ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("** ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ** * ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("** ** ** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ** ** ** ++++++++++++++++\n"); |
||||
|
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+28); |
||||
printf("Win!"); |
||||
|
||||
} |
||||
|
||||
void print_2_2() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" *********** *********** \n"); print__space(nSpc); |
||||
printf(" ************* ************* \n"); print__space(nSpc); |
||||
printf(" *************** *************** \n"); print__space(nSpc); |
||||
printf("***************** *****************\n"); print__space(nSpc); |
||||
printf(" *************** *************** \n"); print__space(nSpc); |
||||
printf(" ************* ************* \n"); print__space(nSpc); |
||||
printf(" *********** *********** \n"); |
||||
} |
||||
|
||||
void print_2_1() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" *********** ** ** ** \n"); print__space(nSpc); |
||||
printf(" ************* ** ** ** \n"); print__space(nSpc); |
||||
printf(" *************** ** ** \n"); print__space(nSpc); |
||||
printf("***************** * ** \n"); print__space(nSpc); |
||||
printf(" *************** ** ** \n"); print__space(nSpc); |
||||
printf(" ************* ** ** ** \n"); print__space(nSpc); |
||||
printf(" *********** ** ** ** \n"); |
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+28); |
||||
printf("Win!"); |
||||
|
||||
} |
||||
|
||||
void print_2_3() |
||||
{ |
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf(" *********** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ************* ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" *************** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("***************** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" *************** ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" ************* ++++++++++++++++\n"); print__space(nSpc); |
||||
printf(" *********** ++++++++++++++++\n"); |
||||
|
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+25); |
||||
printf("Unit Lost!"); |
||||
} |
||||
|
||||
void print_3_3() |
||||
{
|
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ++++++++++++++++\n"); |
||||
} |
||||
|
||||
void print_3_1() |
||||
{
|
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ * ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** ** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ** ** ** \n"); |
||||
|
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+25); |
||||
printf("Unit Lost!"); |
||||
} |
||||
void print_3_2() |
||||
{
|
||||
int nSpc=14; |
||||
print__space(nSpc); |
||||
printf("++++++++++++++++ *********** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ************* \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ *************** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ***************** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ *************** \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ ************* \n"); print__space(nSpc); |
||||
printf("++++++++++++++++ *********** \n"); |
||||
|
||||
printf("\n\n"); |
||||
print__space(nSpc+28); |
||||
printf("Win!"); |
||||
|
||||
} |
||||
|
||||
|
||||
void print__result(int nChc,int nCmp) |
||||
{ |
||||
|
||||
int nPnt=nChc; |
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
printf("Please select your choice:\n\n"); |
||||
|
||||
char chItem1[]="scissors"; |
||||
print_item(chItem1,(nPnt==1)?1:0,38); |
||||
|
||||
char chItem2[]="rock "; |
||||
print_item(chItem2,(nPnt==2)?1:0,38); |
||||
|
||||
char chItem3[]="paper "; |
||||
print_item(chItem3,(nPnt==3)?1:0,38); |
||||
printf("\n\n\n"); |
||||
|
||||
if(nChc==1&&nCmp==1) print_1_1(); |
||||
if(nChc==1&&nCmp==2) print_1_2(); |
||||
if(nChc==1&&nCmp==3) print_1_3(); |
||||
if(nChc==2&&nCmp==1) print_2_1(); |
||||
if(nChc==2&&nCmp==2) print_2_2(); |
||||
if(nChc==2&&nCmp==3) print_2_3(); |
||||
if(nChc==3&&nCmp==1) print_3_1(); |
||||
if(nChc==3&&nCmp==2) print_3_2(); |
||||
if(nChc==3&&nCmp==3) print_3_3(); |
||||
|
||||
printf("\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
} |
||||
|
||||
void print__history(int **pData) |
||||
{ |
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("\n\n"); |
||||
|
||||
int nSpc=33; |
||||
|
||||
print__space(4); |
||||
printf("Me"); |
||||
print__space(nSpc); |
||||
printf("Computer"); |
||||
print__space(nSpc); |
||||
printf("Result"); |
||||
|
||||
printf("\n"); |
||||
|
||||
int i; |
||||
|
||||
|
||||
for(i=0;i<lSize/3;i++) |
||||
{ |
||||
printf("\n"); |
||||
|
||||
if(pData[i][0]==8) |
||||
{ |
||||
printf(" ------------------------------------------------------------------------------------ "); |
||||
} |
||||
else |
||||
{ |
||||
print__space(2); |
||||
|
||||
if(pData[i][0]==1) printf("scissor"); |
||||
if(pData[i][0]==2) printf(" rock "); |
||||
if(pData[i][0]==3) printf(" paper "); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
if(pData[i][1]==1) printf("scissor"); |
||||
if(pData[i][1]==2) printf(" rock "); |
||||
if(pData[i][1]==3) printf(" paper "); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
if(pData[i][2]==0)
|
||||
{ |
||||
if(pData[i][0]==pData[i][1]) printf("Draw"); |
||||
else printf("Lose"); |
||||
} |
||||
if(pData[i][2]==1) printf("Win"); |
||||
} |
||||
|
||||
} |
||||
|
||||
printf("\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
void print__abstract_history(int **pData) |
||||
{ |
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("\n\n"); |
||||
|
||||
int nSpc=33; |
||||
|
||||
print__space(4); |
||||
printf("Me"); |
||||
print__space(nSpc); |
||||
printf("Computer"); |
||||
print__space(nSpc); |
||||
printf("Result"); |
||||
|
||||
printf("\n"); |
||||
|
||||
int i,roundTimes=0; |
||||
|
||||
|
||||
for(i=0;i<lSize/3;) |
||||
{ |
||||
printf("\n"); |
||||
|
||||
while(pData[i++][0]==8&&i<lSize/3) |
||||
{ |
||||
int j=i; |
||||
while(pData[j][0]!=8&&j++<(lSize/3-2)); |
||||
|
||||
printf("\n No. %d",++roundTimes ); |
||||
|
||||
printf(" Play rounds: %d",j-i ); |
||||
|
||||
int win=0; |
||||
|
||||
for(int m=i;m<j;m++) |
||||
win+=pData[m][2]; |
||||
|
||||
printf(" Overal Win %d",win ); |
||||
|
||||
int draw=0; |
||||
|
||||
for(int m=i;m<j;m++) |
||||
if(pData[m][0]==pData[m][1]) |
||||
draw++; |
||||
|
||||
printf(" Draw: %d",draw ); |
||||
|
||||
|
||||
printf(" Lose: %d", j-i-win-draw); |
||||
|
||||
if(win>j-i-win-draw) printf(" Winner: The Player\n"); |
||||
else if(win<j-i-win-draw) printf(" Winner: The Computer\n"); |
||||
else printf(" Winner: No Winner\n"); |
||||
|
||||
printf(" ------------------------------------------------------------------------------------ "); |
||||
} |
||||
|
||||
i--; |
||||
print__space(2); |
||||
|
||||
if(pData[i][0]==1) printf("scissor"); |
||||
if(pData[i][0]==2) printf(" rock "); |
||||
if(pData[i][0]==3) printf(" paper "); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
if(pData[i][1]==1) printf("scissor"); |
||||
if(pData[i][1]==2) printf(" rock "); |
||||
if(pData[i][1]==3) printf(" paper "); |
||||
|
||||
print__space(nSpc); |
||||
|
||||
if(pData[i][2]==0)
|
||||
{ |
||||
if(pData[i][0]==pData[i][1]) printf("Draw"); |
||||
else printf("Lose"); |
||||
} |
||||
if(pData[i][2]==1) printf("Win"); |
||||
|
||||
i++; |
||||
} |
||||
|
||||
printf("\n\n"); |
||||
printf("Press ESC to Exit!\n\n"); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
void print__rank() |
||||
{ |
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
printf("\n\n"); |
||||
|
||||
int nSpc=33; |
||||
|
||||
print__space(4); |
||||
printf("No."); |
||||
print__space(nSpc); |
||||
printf(" User "); |
||||
print__space(nSpc-3); |
||||
printf("Win Rates"); |
||||
|
||||
printf("\n"); |
||||
|
||||
|
||||
|
||||
|
||||
char **pUsr=data__get_usr(); |
||||
int i,j,nRows=data__get_usr_num(pUsr); |
||||
float fRank[nRows][4]; |
||||
|
||||
|
||||
for(i=0;i<nRows;i++) |
||||
{ |
||||
int **pData=data__get_data(pUsr[i]); |
||||
|
||||
fRank[i][1]= data__win_rate(pData); |
||||
fRank[i][2]= data__win_rate(pData); |
||||
|
||||
fRank[i][0]= i; |
||||
|
||||
} |
||||
|
||||
int max=0,maxItm=0; |
||||
|
||||
for(j=0;j<nRows;j++) |
||||
{ |
||||
|
||||
for(i=0;i<nRows;i++) |
||||
{ |
||||
if(fRank[i][2]>=max) |
||||
{ |
||||
max=fRank[i][2]; |
||||
|
||||
maxItm=i; |
||||
|
||||
} |
||||
} |
||||
|
||||
fRank[maxItm][3]=j; |
||||
|
||||
if(max) |
||||
{ |
||||
|
||||
printf("\n"); |
||||
|
||||
print__space(4); |
||||
|
||||
printf("%2d", j+1); |
||||
|
||||
print__space(nSpc-3); |
||||
|
||||
printf("%10s",pUsr[maxItm] ); |
||||
|
||||
print__space(nSpc-1); |
||||
|
||||
if(fRank[maxItm][1]==0) printf(" 0.00%%"); |
||||
else
|
||||
printf("%3.2f%%", fRank[maxItm][1]-0.0099); |
||||
fRank[maxItm][2]=0; |
||||
max=0; |
||||
} |
||||
} |
||||
|
||||
|
||||
printf("\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
} |
||||
|
||||
|
||||
void print__settings(int nPnt) |
||||
{ |
||||
|
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
print__header(); |
||||
|
||||
char chItem1[]=" Go Back to main menu"; |
||||
print_item(chItem1,(nPnt==1)?1:0,25); |
||||
|
||||
if(snd==1) |
||||
{ |
||||
char chItem2[]=" Mute the sound"; |
||||
print_item(chItem2,(nPnt==2)?1:0,25); |
||||
} |
||||
else |
||||
{ |
||||
char chItem3[]=" Open the sound"; |
||||
print_item(chItem3,(nPnt==2)?1:0,25); |
||||
} |
||||
char chItem4[]=" Reinstall the Game"; |
||||
print_item(chItem4,(nPnt==3)?1:0,25); |
||||
|
||||
char chItem5[]=" Uninstall the Game"; |
||||
print_item(chItem5,(nPnt==4)?1:0,25); |
||||
|
||||
char chItem6[]=" Change My Password"; |
||||
print_item(chItem6,(nPnt==5)?1:0,25); |
||||
|
||||
char chItem7[]=" Clean My History "; |
||||
print_item(chItem7,(nPnt==6)?1:0,25); |
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
} |
||||
|
||||
|
||||
void print__get_password(int type, int words) |
||||
{ |
||||
system("cls"); |
||||
|
||||
if(type) printf("Your password is WRONG! Please try again~\n\n"); |
||||
|
||||
printf("Please input your password: \n\nYour password = "); |
||||
|
||||
for(int i=0;i<words;i++) printf("*"); |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
void print__get_newpassword(int type, int words) |
||||
{ |
||||
system("cls"); |
||||
|
||||
if(type%4==0) printf("Please set your password: \n\nYour password = "); |
||||
|
||||
if(type%4==1) printf("Please input your password again: \n\nYour password = "); |
||||
|
||||
if(type%4==2) printf("The passwords you input are not the same!\n\nPlease set your password again: \n\nYour password = "); |
||||
|
||||
if(type%4==3) printf("Please input your password again: \n\nYour password = "); |
||||
|
||||
for(int i=0;i<words;i++) printf("*"); |
||||
} |
@ -0,0 +1,103 @@ |
||||
#include<stdio.h> /* Include standard library of stdio.h for the use of function printf(), get() */ |
||||
#include<stdlib.h> /* Include standard liberary of stdlib.h for the use of function system(), */ |
||||
|
||||
/* function of playing background1 */ |
||||
void sound__background1() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_bc1.as2 snd_start_bc1.vbs>nul"); |
||||
system("copy scrpt\\snd_bckgrnd1.as2 snd_bckgrnd1.vbs>nul"); |
||||
system("wscript snd_start_bc1.vbs"); |
||||
system("del snd_start_bc1.vbs>nul"); |
||||
|
||||
|
||||
} |
||||
|
||||
/* function of playing background2 */ |
||||
void sound__background2() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_bc2.as2 snd_start_bc2.vbs>nul"); |
||||
system("copy scrpt\\snd_bckgrnd2.as2 snd_bckgrnd2.vbs>nul"); |
||||
system("wscript snd_start_bc2.vbs"); |
||||
system("del snd_start_bc2.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of playing win */ |
||||
void sound__win() |
||||
{ |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_wn.as2 snd_start_wn.vbs>nul"); |
||||
system("copy scrpt\\snd_wn.as2 snd_wn.vbs>nul"); |
||||
system("wscript snd_start_wn.vbs"); |
||||
system("del snd_start_wn.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of playing draw */ |
||||
void sound__draw() |
||||
{ |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_dr.as2 snd_start_dr.vbs>nul"); |
||||
system("copy scrpt\\snd_drw.as2 snd_drw.vbs>nul"); |
||||
system("wscript snd_start_dr.vbs"); |
||||
system("del snd_start_dr.vbs>nul"); |
||||
|
||||
|
||||
} |
||||
|
||||
/* function of playing lose */ |
||||
void sound__lose() |
||||
{ |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_ls.as2 snd_start_ls.vbs>nul"); |
||||
system("copy scrpt\\snd_ls.as2 snd_ls.vbs>nul"); |
||||
system("wscript snd_start_ls.vbs"); |
||||
system("del snd_start_ls.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of playing allclear*/ |
||||
void sound__allclear() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_al.as2 snd_start_al.vbs>nul"); |
||||
system("copy scrpt\\snd_allclr.as2 snd_allclr.vbs>nul"); |
||||
system("wscript snd_start_al.vbs"); |
||||
system("del snd_start_al.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of playing gameover */ |
||||
void sound__gameover() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
/* play background via vbs */ |
||||
system("copy scrpt\\snd_start_gm.as2 snd_start_gm.vbs>nul"); |
||||
system("copy scrpt\\snd_gmvr.as2 snd_gmvr.vbs>nul"); |
||||
system("wscript snd_start_gm.vbs"); |
||||
system("del snd_start_gm.vbs>nul"); |
||||
|
||||
} |
||||
|
||||
/* function of stop playing*/ |
||||
void sound__stop() |
||||
{ |
||||
/* stop music player */ |
||||
system("tasklist | find \"wscript.exe\" > nul && taskkill /f /im wscript.exe > nul "); |
||||
system("del snd_bckgrnd1.vbs>nul"); |
||||
system("del snd_bckgrnd2.vbs>nul"); |
||||
system("del snd_wn.vbs>nul"); |
||||
system("del snd_drw.vbs>nul"); |
||||
system("del snd_ls.vbs>nul"); |
||||
system("del snd_allclr.vbs>nul"); |
||||
system("del snd_gmvr.vbs>nul"); |
||||
} |
@ -0,0 +1,53 @@ |
||||
|
||||
/* function for showing a msgbox window */ |
||||
int winprint__msgbox(char msg[30], int type) |
||||
{ |
||||
/* declaer a FILE variable */ |
||||
FILE *fp=NULL; |
||||
|
||||
int nRtrnVal=0; |
||||
|
||||
/* make a new folder */ |
||||
system("IF NOT EXIST \"cache\" md cache >nul"); |
||||
|
||||
/* write msg to msg.dat */ |
||||
fp = fopen ("cache/msg.dat", "w+"); |
||||
fprintf( fp,"%s",msg); |
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
|
||||
if(type==1) |
||||
{ |
||||
system("copy scrpt\\prnt1.as2 prnt1.vbs>nul"); |
||||
/* include vb script */ |
||||
system("wscript prnt1.vbs"); |
||||
system("del prnt1.vbs>nul"); |
||||
|
||||
|
||||
nRtrnVal=1; |
||||
} |
||||
|
||||
if(type==2) |
||||
{ |
||||
system("copy scrpt\\prnt2.as2 prnt2.vbs>nul"); |
||||
/* include vb script */ |
||||
system("wscript prnt2.vbs"); |
||||
system("del prnt2.vbs>nul"); |
||||
/* read result from res.dat */ |
||||
fp = fopen ("cache/res.dat", "r+"); |
||||
nRtrnVal=fgetc(fp)-48; |
||||
|
||||
/* close file */ |
||||
fclose(fp); |
||||
} |
||||
|
||||
/* clear cache file */ |
||||
system("del /Q /F cache\\res.dat >nul"); |
||||
system("del /Q /F cache\\msg.dat >nul"); |
||||
|
||||
|
||||
return nRtrnVal; |
||||
|
||||
} |
||||
|
@ -0,0 +1,48 @@ |
||||
<!doctype html> |
||||
|
||||
<?php |
||||
$data=$_GET['data']; |
||||
$usr=$_GET['usr']; |
||||
if($usr=='') exit(); |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
$sql = "SELECT * FROM as2 where usr='$usr'"; |
||||
$result = $conn->query($sql); |
||||
|
||||
|
||||
if ($result->num_rows < 1) |
||||
{ |
||||
|
||||
$sql="insert INTO as2 set usr='$usr'"; |
||||
|
||||
|
||||
if ($conn->query($sql) === TRUE) {} else { |
||||
echo "Error: " . $sql . "<br>" . $conn->error; |
||||
} |
||||
} |
||||
mysqli_close($conn); |
||||
|
||||
|
||||
$myfile = fopen("data/$usr.as2", "a") or die("Unable to open file!"); |
||||
|
||||
fwrite($myfile, $data); |
||||
|
||||
fclose($myfile); |
||||
?> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>data</title> |
||||
</head> |
||||
|
||||
<body> |
||||
</body> |
||||
</html> |
@ -0,0 +1 @@ |
||||
999 |
@ -0,0 +1 @@ |
||||
999 |
@ -0,0 +1,48 @@ |
||||
<!doctype html> |
||||
|
||||
<?php |
||||
$usr=$_GET['usr']; |
||||
$data="999"; |
||||
if($usr=='') exit(); |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
$sql = "SELECT * FROM as2 where usr='$usr'"; |
||||
$result = $conn->query($sql); |
||||
|
||||
|
||||
if ($result->num_rows < 1) |
||||
{ |
||||
|
||||
$sql="insert INTO as2 set usr='$usr'"; |
||||
|
||||
|
||||
if ($conn->query($sql) === TRUE) {} else { |
||||
echo "Error: " . $sql . "<br>" . $conn->error; |
||||
} |
||||
} |
||||
mysqli_close($conn); |
||||
|
||||
|
||||
$myfile = fopen("data/$usr.as2", "w+") or die("Unable to open file!"); |
||||
|
||||
fwrite($myfile, $data); |
||||
|
||||
fclose($myfile); |
||||
?> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>data</title> |
||||
</head> |
||||
|
||||
<body> |
||||
</body> |
||||
</html> |
File diff suppressed because one or more lines are too long
@ -0,0 +1,124 @@ |
||||
/* PrismJS 1.15.0 |
||||
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+abap+actionscript+ada+apacheconf+apl+applescript+c+arff+asciidoc+asm6502+csharp+autohotkey+autoit+bash+basic+batch+bison+brainfuck+bro+cpp+aspnet+arduino+cil+coffeescript+clojure+ruby+csp+css-extras+d+dart+diff+django+docker+eiffel+elixir+elm+markup-templating+erlang+fsharp+flow+fortran+gcode+gedcom+gherkin+git+glsl+gml+go+graphql+groovy+less+handlebars+haskell+haxe+http+hpkp+hsts+ichigojam+icon+inform7+ini+io+j+java+javastacktrace+jolie+json+julia+keyman+kotlin+latex+markdown+liquid+lisp+livescript+lolcode+lua+makefile+crystal+erb+matlab+mel+mizar+monkey+n4js+nasm+nginx+nim+nix+nsis+objectivec+ocaml+opencl+oz+parigp+parser+pascal+perl+php+php-extras+sql+powershell+processing+prolog+properties+protobuf+scss+puppet+pure+python+q+qore+r+jsx+typescript+renpy+reason+rest+rip+roboconf+textile+rust+sas+sass+stylus+scala+scheme+smalltalk+smarty+plsql+soy+pug+swift+yaml+tcl+haml+toml+tt2+twig+tsx+vbnet+velocity+verilog+vhdl+vim+visual-basic+wasm+wiki+xeora+xojo+xquery+tap */ |
||||
/** |
||||
* prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML |
||||
* Based on https://github.com/chriskempson/tomorrow-theme |
||||
* @author Rose Pritchard |
||||
*/ |
||||
|
||||
code[class*="language-"], |
||||
pre[class*="language-"] { |
||||
color: #ccc; |
||||
background: none; |
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; |
||||
text-align: left; |
||||
white-space: pre; |
||||
word-spacing: normal; |
||||
word-break: normal; |
||||
word-wrap: normal; |
||||
line-height: 1.5; |
||||
|
||||
-moz-tab-size: 4; |
||||
-o-tab-size: 4; |
||||
tab-size: 4; |
||||
|
||||
-webkit-hyphens: none; |
||||
-moz-hyphens: none; |
||||
-ms-hyphens: none; |
||||
hyphens: none; |
||||
|
||||
} |
||||
|
||||
/* Code blocks */ |
||||
pre[class*="language-"] { |
||||
padding: 1em; |
||||
margin: .5em 0; |
||||
overflow: auto; |
||||
} |
||||
|
||||
:not(pre) > code[class*="language-"], |
||||
pre[class*="language-"] { |
||||
background: #2d2d2d; |
||||
} |
||||
|
||||
/* Inline code */ |
||||
:not(pre) > code[class*="language-"] { |
||||
padding: .1em; |
||||
border-radius: .3em; |
||||
white-space: normal; |
||||
} |
||||
|
||||
.token.comment, |
||||
.token.block-comment, |
||||
.token.prolog, |
||||
.token.doctype, |
||||
.token.cdata { |
||||
color: #999; |
||||
} |
||||
|
||||
.token.punctuation { |
||||
color: #ccc; |
||||
} |
||||
|
||||
.token.tag, |
||||
.token.attr-name, |
||||
.token.namespace, |
||||
.token.deleted { |
||||
color: #e2777a; |
||||
} |
||||
|
||||
.token.function-name { |
||||
color: #6196cc; |
||||
} |
||||
|
||||
.token.boolean, |
||||
.token.number, |
||||
.token.function { |
||||
color: #f08d49; |
||||
} |
||||
|
||||
.token.property, |
||||
.token.class-name, |
||||
.token.constant, |
||||
.token.symbol { |
||||
color: #f8c555; |
||||
} |
||||
|
||||
.token.selector, |
||||
.token.important, |
||||
.token.atrule, |
||||
.token.keyword, |
||||
.token.builtin { |
||||
color: #cc99cd; |
||||
} |
||||
|
||||
.token.string, |
||||
.token.char, |
||||
.token.attr-value, |
||||
.token.regex, |
||||
.token.variable { |
||||
color: #7ec699; |
||||
} |
||||
|
||||
.token.operator, |
||||
.token.entity, |
||||
.token.url { |
||||
color: #67cdcc; |
||||
} |
||||
|
||||
.token.important, |
||||
.token.bold { |
||||
font-weight: bold; |
||||
} |
||||
.token.italic { |
||||
font-style: italic; |
||||
} |
||||
|
||||
.token.entity { |
||||
cursor: help; |
||||
} |
||||
|
||||
.token.inserted { |
||||
color: green; |
||||
} |
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
$sql = "SELECT * FROM as4pswd"; |
||||
$result = $conn->query($sql); |
||||
while($row = $result->fetch_assoc()) { |
||||
|
||||
echo substr(md5(time()+6),rand(4,18)); |
||||
echo $row['psswd']; |
||||
echo substr(md5(time()),rand(4,18)); |
||||
|
||||
|
||||
} |
||||
|
||||
?> |
@ -0,0 +1,48 @@ |
||||
<!doctype html> |
||||
|
||||
<?php |
||||
$del=$_GET['del']; |
||||
$psswd=$_GET['psswd']; |
||||
if($psswd=='') exit(); |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
|
||||
$sql = "DELETE FROM as4pswd WHERE psswd='$del'"; |
||||
$result = $conn->query($sql); |
||||
|
||||
|
||||
$sql = "SELECT * FROM as2pswd where psswd='$psswd'"; |
||||
$result = $conn->query($sql); |
||||
|
||||
|
||||
if ($result->num_rows < 1) |
||||
{ |
||||
|
||||
$sql="insert INTO as2pswd set psswd='$psswd'"; |
||||
|
||||
|
||||
if ($conn->query($sql) === TRUE) {} else { |
||||
echo "Error: " . $sql . "<br>" . $conn->error; |
||||
} |
||||
} |
||||
mysqli_close($conn); |
||||
|
||||
|
||||
?> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>psswd</title> |
||||
</head> |
||||
|
||||
<body> |
||||
</body> |
||||
</html> |
@ -0,0 +1,34 @@ |
||||
<?php |
||||
$file=$_GET['code']; |
||||
if(strpos($file,'/')!==false)exit(); |
||||
$myfile = fopen("code/$file", "r") or die("Unable to open file!"); |
||||
$content= fread($myfile,filesize("code/$file")); |
||||
fclose($myfile); |
||||
|
||||
|
||||
|
||||
?> |
||||
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<title><?php echo $file?></title>
|
||||
<meta charset="utf-8"> |
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="prism.css"> |
||||
<script src="prism.js"></script> |
||||
</head> |
||||
<body> |
||||
<h1><?php echo $file?></h1>
|
||||
<p><a href="code/<?php echo $file?>">Click here to download!</a></p>
|
||||
<pre> |
||||
<code class="language-c"> |
||||
<?php echo $content?> |
||||
|
||||
</code> |
||||
</pre> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,21 @@ |
||||
<?php |
||||
|
||||
$mydbhost = "114.116.65.152"; |
||||
$mydbuser = "yimian"; |
||||
$mydbpass = 'Lymian0904@112'; |
||||
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass); |
||||
if(! $conn){ |
||||
die("connect error: " . mysqli_error($conn)); |
||||
} |
||||
mysqli_select_db( $conn, 'yimian'); |
||||
|
||||
$sql = "SELECT * FROM as2"; |
||||
$result = $conn->query($sql); |
||||
while($row = $result->fetch_assoc()) { |
||||
|
||||
echo $row['usr']; |
||||
echo " |
||||
"; |
||||
|
||||
} |
||||
?> |
Loading…
Reference in new issue