PHP+C Realization of network Copyright verification

Source: Internet
Author: User
Client (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 is a long to be converted to a string that can be used while (Ser)//convert a long to char*{tmp[flag++]= (char) (ser%10+ ' 0 '); ser/=10;} tmp[flag]= ' + '; 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", x), if (times> ( -1*usetimes+50)) return Times;else return 0;}
   
  
 

Server-side (PHP):

 
  
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.