die funktion funktioniert wenn ich sie einmal aufrufe..
sobald sie aber zwei mal aufgerufen wird gibts einen speicherzugriffsfehler.
hat irgendwer eine ahnung woran das liegen könnte?
mfg smokey
PHP-Code:
int checkip(char *ip)
{
int count=0;
int ts1, ts2;
struct timeb ts;
FILE *logfile;
char *puffer;
char *iplog;
int ret=0;
logfile = fopen("log.dat","r");
ftime(&ts);
while (fread(&puffer, 1, 1, logfile)>0)
{
if(strcmp(&puffer,":"))
strncat(iplog,&puffer,1);
else
{
if(!strcmp(iplog,ip))
{
fread(&puffer, 10, 1, logfile);
break;
}
//printf("Gesperrt");
strcpy(iplog,"");
}
}
ts1 = convint(&puffer);
ftime(&ts);
ts2 = ts.time;
ts1 = ts2-ts1;
if(ts1 < 1800)
ret=1;
fclose(logfile);
return ret;
}