prattmic
-
Posts
36 -
Joined
-
Last visited
Never
Posts posted by prattmic
-
-
bump
-
bump
-
no, I haven't
-
bump
-
bump
-
Do you want the log, and you can mess around with it?
-
ok, Now it doubled everything and put an extra blank line between every line.
-
bump
-
...
-
hello?
-
Now it deleted the whole log.
-
Now it got rid of the part that wasn't suppose to be deleted
-
The script is making my log longer not shorter.
-
... ??? ??? ???
-
Hello?
-
Um, are you going to give me the code?
-
Yes, except 20 is the oldest. 19 is [code=php:0]?>[/code]
-
Line 20 is the first line of my log and it is the oldest entry. Well, since this is for a script that I distribute, the limit would vary meaning it would need some kind of code to add 19/20 to however high the limit is.
-
I wouldn't want to delete first 19 lines as that would get rid of my header in the log. And I would want to delete enough so that it is under its limit of lines.
-
Well, I'm kinda new to PHP, so I get what your saying, but I don't know how to do it.
-
I have text logs that I wish to auto-prune. This is the header of the log:
[code=php:0]<?php
// DO NOT DELETE THIS
include 'phpsimplechoose_config.php';
//Below is where the verification takes place. Try to play around with it.
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Please enter User/Password"');
header('HTTP/1.0 401 Unauthorized');
die;
} else {
if (($_SERVER['PHP_AUTH_USER'] !== $phpsc_username) || ($_SERVER['PHP_AUTH_PW'] !== $phpsc_password)) {
header('WWW-Authenticate: Basic realm="Incorrect! Please try again."');
header('HTTP/1.0 401 Unauthorized');
die;
}
}
// To delete log erase everything after the next line, but not the next line itself (Line 20 and down can be deleted)
?>[/code]
The rest of the log consists of lines looking somewhat like this:
[code]192.168.1.1: Thu August 10, 2006 11:23 : Choice 1. thgfd Choice 2. hfghfghd Choice 3. fgdgfh We say... hfghfghd <br />[/code]
What I want to do is when the log reaches X number of the previous entries for it to delete some. However, I want the header not to be deleted.
If you need more info, just ask!
Thanks in advance! -
No its my fault that I didn't explain good enough.
-
Thank you for all your help. If you want to see the full script in action (but not done) it is at http://prattmic.homedns.org/phpsimplechoose/0_7_beta/phpsimplechoose.php
-
Yes it does, but how do I take away the line number and the IP in the line, since they will all have the same IP anyway.
Auto-Prune Log
in PHP Coding Help
Posted