php+c實現網路著作權驗證

來源:互聯網
上載者:User

標籤:php   c語言   著作權   驗證   架構   

用戶端(C):

/*Copyright check frame written by Radish.ghost Jan.2015*/#include<stdio.h>#include<windows.h>#include <UrlMon.h>#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);}/*<img src="http://img.blog.csdn.net/20150130120314717?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXE3NTQ0MDY2MTM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />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):

<?php/*線上著作權驗證*/Header("Content-type: text/plain"); $M=$_GET['M'];//擷取硬碟序號if(!file_exists($M)){file_put_contents($M,"50");echo  '50';}else{$times=file_get_contents($M);unlink($M);file_put_contents($M,$times-1);echo  $times;}?>


php+c實現網路著作權驗證

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.