#include <sys/time.h>
#include <strings.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>


int ()
{
  FILE *fp ,*fp1;
  char pass[15], *getWord;
  system("wget -p --convert-links http://www.cs.rmit.edu./students/");
  system("mkdir previous");
  system("mv www.cs.rmit.edu./images/*.*   previous/");
  system("mv www.cs.rmit.edu./students/*.* previous/");
  system("cd www.cs.rmit.edu./images");
  system("cksum *.* > ../../cksum1.txt");
  sleep(10000);
  system("cd .. ");
  system("cd .. ");
  system("wget -p --convert-links http://www.cs.rmit.edu./students/");
  system("mkdir current");
  system("mv www.cs.rmit.edu./images/*.*  current/");
  system("mv www.cs.rmit.edu./students/*.* current/");
  system("cd www.cs.rmit.edu./images");
  system("cksum *.* > ../../cksum2.txt");
  system("diff cksum1.txt cksum2.txt> checksumdifference.txt");
  system("diff previous current > difference.txt");
  fp1 =fopen("difference.txt","r");
  getWord = fgets(pass, 15, fp1);
  if(strlen(getWord)!= 0)
  system("mailx -s   \"Difference in  \"    < difference.txt ");
  fp =fopen("checksumdifference.txt","r");
  getWord = fgets(pass, 15, fp);
  if(strlen(getWord)!= 0)
    system("mailx -s  \"Difference in \"   < checksumdifference.txt");

  return 0;
}

# include <stdlib.h>
# include <stdio.h>
# include <strings.h>


int ()
{
	
	FILE* fpp;										
	FILE* fp;
			
	char s[100];
	int i;
	
	while(1)										
	{
		system("wget -nv http://www.cs.rmit.edu./students");				
		
		i=0;		
		
		fp = fopen("dummyindex.txt","r");
		
		if(fp == (FILE*) NULL)								
		{
			printf(" is  previously saved webpage in the file\n");
			i=1;
			fp = fopen("dummyindex.txt","w");

		}
				
		fclose(fp);
		
				
		
		
		
		system("diff index.html dummyindex.txt > compareoutput.txt");		

				
		if(fpp != (FILE*) NULL)	
		{
			
			fpp = fopen("compareoutput.txt","r");					
			
			fgets(s,100,fpp);							
			
			fclose(fpp);								
		
		
		   
			if((strlen(s)>0) && i==0)								
			{
				system("mail @cs.rmit.edu. < compareoutput.txt");	
				system("cp index.html dummyindex.txt");				
				printf("Message has been sent\n");				
			}
			else
				printf(" is  change in the \n");			
		}
		
		

		system("rm index.html")	;				
		
		sleep(86400);									
	}
				
	return 1;
}
