PHP+C はネットワーク著作権検証を実装します

WBOY
リリース: 2016-06-23 13:40:35
オリジナル
1028 人が閲覧しました

客户端(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.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!