Jump to content


Photo

Auto-Prune Log


  • Please log in to reply
32 replies to this topic

#21 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 14 August 2006 - 03:12 PM

bump

#22 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 14 August 2006 - 04:18 PM

ok.. did some things again.. try it again. I really am sorry. I didn't want this to take this long either, i swear.

#23 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 14 August 2006 - 05:22 PM

ok, Now it doubled everything and put an extra blank line between every line.

#24 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 14 August 2006 - 06:15 PM

i dunno.. it should've worked.. i'm lost now..

#25 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 14 August 2006 - 10:04 PM

Do you want the log, and you can mess around with it?

#26 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 15 August 2006 - 02:09 AM

bump

#27 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 15 August 2006 - 02:33 PM

bump

#28 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 15 August 2006 - 02:37 PM

Have you read the manual yet on files ?
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#29 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 15 August 2006 - 04:34 PM

no, I haven't

#30 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 15 August 2006 - 10:43 PM

bump

#31 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 17 August 2006 - 01:06 AM

bump

#32 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 17 August 2006 - 01:18 AM

<?php

$file = "./logs.txt";
$limit = "5";

$log = file($file);
$lines = count($log);

if ($lines > $limit + 19){

	if (!$handle = fopen($file, 'w')) {
		echo "Cannot open file ($file)";
		exit;
	}

	for ($i = 0; $i <= 18; $i++) {
		fwrite($handle, $log[$i]);
		unset($log[$i]);
	}
	
	$i = 0;
	while (count($log) > $limit) {
		unset($log[$i]);
		$i++;
	}
	
	foreach ($log as $line) {
		fwrite($handle, $line);
	}
	
	fclose($handle);
   
}
  
?>

Don't beg for code in the future please.

#33 prattmic

prattmic
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 17 August 2006 - 05:17 PM

It worked! Thank you so much!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users