Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


php logger

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
compactwater
I post too much
Reputation: 8

Joined: 02 Aug 2006
Posts: 3923

PostPosted: Thu Nov 22, 2007 8:14 pm    Post subject: php logger Reply with quote

Code:
<?php

if (isset($_REQUEST["username"])) {
$logname = "logs/user_" . $_REQUEST["username"] . "_" . date("Ymd") . "_.log";
$handle = fopen($logname, 'a');

if (!$_REQUEST["text"] == "") {
$toput = $_REQUEST["text"] . "
"; } else {
$toput = $_REQUEST["l0"] . "
" . $_REQUEST["l1"] . "
" . $_REQUEST["l2"] . "
" . $_REQUEST["l3"] . "
" . $_REQUEST["l4"] . "
" . $_REQUEST["l5"] . "
" . $_REQUEST["l6"] . "
" . $_REQUEST["l7"] . "
" . $_REQUEST["l8"] . "
" . $_REQUEST["l9"]; }


if (fwrite($handle, $toput) === FALSE) {
    echo "1";
   fclose($handle);
} else {
    echo "0";
    fclose($handle); }
}

?>


This is a logger. It will log things. The original idea was to be used to (key)log a person- I'll leave that part to your imagination.
You will need PHP, and full access to the 'logs' directory (you can change that). This will return 1 if there was an error, or 0 if everything went fine.

Usage:
/log.php?username=test&text=Hello world!

Or, to log multiple lines:
/log.php?username=test&l0=Hello&l1=world!&l5=How are you doing?&l9=I'm fine!

Example log file:
user_test_20071122_.log
inside:
Code:
Hello world!


Example log 2:
inside:
Code:
Hello
world!



How are you doing?



I'm fine!


This can also be used with a form.
Code:
<form action="log.php" method="POST">
Username:<br />
<input type="text" name="username"><br />
Message:<br />
<textarea NAME="text" cols="40" rows="6"></textarea><br />
<input type="submit" value="Log it">
</form>


It will look like this...


When using only one line, you can force it to start on another line by adding "%0D%0A" to the url.
Exmaple:

/log.php?username=morethenone&text=How are you?%0D%0AI'm fine.

That will give you:
Code:
How are you?
I'm fine.


If you want to see what was recorded, change:
Code:
if (fwrite($handle, $toput) === FALSE) {
    echo "1";
   fclose($handle);
} else {
    echo "0";
    fclose($handle); }
}

to
Code:
if (fwrite($handle, $toput) === FALSE) {
    echo "1";
   fclose($handle);
} else {
    echo "0<br/>";
    echo $toput;
    fclose($handle); }
}
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Thu Nov 22, 2007 8:23 pm    Post subject: Reply with quote

You should use a database for this.
_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Nov 22, 2007 9:02 pm    Post subject: Reply with quote

Compactwater. Cross Site Scripting?
Back to top
View user's profile Send private message
compactwater
I post too much
Reputation: 8

Joined: 02 Aug 2006
Posts: 3923

PostPosted: Thu Nov 22, 2007 9:05 pm    Post subject: Reply with quote

dnsi0 wrote:
Compactwater. Cross Site Scripting?
To keep anyone from doing that, use &_SERVER["HTTP_REFERER"], if it's not from your site (or wherever you want it to come from) then deny access.
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Thu Nov 22, 2007 9:06 pm    Post subject: Reply with quote

compactwater wrote:
dnsi0 wrote:
Compactwater. Cross Site Scripting?
To keep anyone from doing that, use &_SERVER["HTTP_REFERER"], if it's not from your site (or wherever you want it to come from) then deny access.


Extremely insecure. Referer(sic) headers are EASILY and OFTEN spoofed as part of penetration testing. Do not do this.

_________________
Back to top
View user's profile Send private message
compactwater
I post too much
Reputation: 8

Joined: 02 Aug 2006
Posts: 3923

PostPosted: Thu Nov 22, 2007 9:07 pm    Post subject: Reply with quote

Then maybe doing it in .htaccess will suit your needs?
Ahh, well this was intended for personal use.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites