How to give privacy to a program?
I created this program, which is later connected to another code to form a software..
Actually, now I want to make my software private. I mean, it must work on a particular system but, when pirated and tried to run on some other system, it must not work.
while surfing on internet I found that the IP address of a system is the unique code for every pc. Is there any way to keep my software private such that it runs on a particular ip address??
here's the half-code:
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<dos.h>
#include<stdlib.h>
static int i=0;
struct web
{
char name[30],pass[30];
}w[100];
int n;
int login(void);
int reg(void);
int main()
{
system("cls");
printf("\n\n\n\n\n\n\t\t\tWELCOME TO C WORLD!!");
printf("\n\t\t\t^^^^^^^^^^^^^^^^^^^^");
printf("\n\n\n\n\t\t\tPress Enter to proceed...");
if(getche()==13)
system("cls");
XY:
printf("\n\n\n\t\t\t1. LOGIN\t\t2. REGISTER");
printf("\n\n\n\t\t\t\tENTER YOUR CHOICE: ");
scanf("%d",&n);
switch(n)
{
case 1: system("cls");
login();
break;
case 2: system("cls");
reg();
break;
default: printf("\n\n\t\t\t\tNO MATCH FOUND");
printf("\n\n\t\t\tPress Enter to re-Enter the choice");
if(getche()==13)
system("cls");
goto XY;
}
return 0;
}
int reg()
{
FILE *fp;
char c,checker[30]; int z=0,j=0;
fp=fopen("Web_reg.txt","ab+");
printf("\n\n\t\t\t\tWELCOME TO REGISTER ZONE");
printf("\n\t\t\t\t^^^^^^^^^^^^^^^^^^^^^^^^");
for(i=0;i<100;i++)
{
printf("\n\n\t\t\t\t ENTER USERNAME: ");
scanf("%s",checker);
while(!feof(fp))
{
for(j=0;j<100;j++)
{
fread(&w[j],sizeof(w[j]),1,fp);
if(strcmp(checker,w[j].name)==0)
{
printf("\n\n\t\t\tUSERNAME ALREDY EXISTS");
fclose(fp);
reg();
break;
}
}
strcpy(w[i].name,checker);
fclose(fp);
break;
}
fp=fopen("Web_reg.txt","ab+");
printf("\n\n\t\t\t\t DESIRED PASSWORD: ");
while((c=getch())!=13)
{
w[i].pass[z++]=c;
printf("%c",'*');
}
w[i].pass[z]='\0';
fwrite(&w[i],sizeof(w[i]),1,fp);
fclose(fp);
printf("\n\n\tPress enter if you agree with Username and Password");
if(getche()==13)
{
system("cls");
printf("\n\n\t\t\t\tTHANK YOU FOR REGISTERING");
printf("\n\n\t\t\tYOU ARE SUCCESSFULLY REGISTERED");
printf("\n\n\n\t\t Press Enter to Login your account");
if(getche()==13)
{
system("cls");
login();
break;
}
}
break;
}
getch();
return 0;
}
int login()
{
FILE *fp;
char c,name[30],pass[30]; int z=0;
int checku,checkp;
fp=fopen("Web_reg.txt","rb");
printf("\n\n\t\t\t\tWELCOME TO LOG IN ZONE");
printf("\n\t\t\t\t^^^^^^^^^^^^^^^^^^^^^^");
printf("\n\n\t\t\t\t ENTER USERNAME: ");
scanf("%s",name);
printf("\n\n\t\t\t\t ENTER PASSWORD: ");
while((c=getch())!=13)
{
pass[z++]=c;
printf("%c",'*');
}
pass[z]='\0';
while(!feof(fp))
{
for(i=0;i<100;i++)
{
fread(&w[i],sizeof(w[i]),1,fp);
checku=strcmp(name,w[i].name);
checkp=strcmp(pass,w[i].pass);
if(checku==0&&checkp==0)
break;
}
if(checku==0&&checkp==0)
{
system("cls");
printf("\n\n\n\t\t\tYOU HAVE LOGGED IN SUCCESSFULLY!!");
printf("\n\n\n\t\t\t\tWELCOME!!");
break;
}
else
{
printf("\n\n\n\t\t\tYou are not a Registered User\n \t\t\tPress enter to register yourself");
if(getch()==13)
{
system("cls");
reg();
}
}
break;
}
getch();
return 0;
}