客户端(c):
/*copyright check frame written by radish.ghost jan.2015*/#include#include#include #ifdef c#define bool int //c hesn't bool type#endif#pragma comment(lib, urlmon.lib)#ifndef usetimes#define usetimes 50 //how many times can use#endifchar*getinf();//get the disk informationbool check1();//connect serverint check2();//check the fileint main(){check1();check2();if(check2())printf(you can use it!(%d times)\n,check2());else {printf(you can't use it!\n);exit(0);}/*your code here!*/return 0;}char*getinf(){ char buf[max_path]; dword ser; dword length; char tmp[100];int flag=0;getvolumeinformation(c:\\,null,max_path,&ser,&length,null,null,max_path); //ser为long 要转换成一个能用的字符串while(ser)//convert long to char*{ tmp[flag++]=(char)(ser%10+'0'); ser/=10;}tmp[flag]='\0';return tmp; }bool check1(){ char *ur=getinf(); char url[100]=http://localhost/bq.php?m=; strcat(url,ur); if(urldownloadtofile(0,url,c:\\a,0,null))return 1; else return 0;}int check2(){ int times; freopen(c:\\a,r,stdin); scanf(%d,×); if(times>(-1*usetimes+50))return times; else return 0;}
服务器端(php):