Add URL logging to PHProxy 0.5b2

If you want to keep an eye on what your proxy visitors are seeing truth your proxy, just open index.php and add this:

After line 184:

1
function url_parse($url, & $container) {

Add this:

1
2
3
4
$stuff = $_SERVER['REMOTE_ADDR'].",".$url."\n";
$fp = fopen('log.txt',"a");
fwrite($fp,$stuff);
fclose($fp);

Now all the visited URL’s will be stored in a file called log.txt in CSV format

26 Responses to “Add URL logging to PHProxy 0.5b2”


  1. 1 nasser

    ph-proxy

  2. 2 Tania

    Its Great!

  3. 3 Chris

    Great, thanks :D

    To log the time/date the proxy was used to visit whatever site use this (the time will ofcourse be the server time)…

    $proxytime = date(’h:i:s A’);
    $proxydate = date(’d-m-Y’);
    $stuff = $_SERVER['REMOTE_ADDR'].”,”.$url.” , “.$proxydate.” , “.$proxytime.”\n”;
    $fp = fopen(’log.txt’,”a”);
    fwrite($fp,$stuff);
    fclose($fp);

  4. 4 OVGuillermo

    Thank you for your site. I have found here much useful information.
    Good site ! ;)

  5. 5 CoawStoossy

    For most people,affordable life insurance quote falls into that category because it protects a family against a devastating loss of income.

  6. 6 Jason Liquorish

    Hi, is it also possible to ban users, ips, keywords, hosts and such?

    Thanks

  7. 7 VP

    Here is code for a shell script crontab to rotate the logs and delete old ones. This avoids wasting disk space and prevents from having to manually clear the log.

    #!/bin/sh

    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export PATH

    # NOTE: Change this value to the full path of
    # the directory where the log files are contained.
    PROXYDIR=full/path/to/proxy/logs

    # Rotate the old logs
    rm -f ${PROXYDIR}/log.txt.4
    mv ${PROXYDIR}/log.txt.3 ${PROXYDIR}/log.txt.4
    mv ${PROXYDIR}/log.txt.2 ${PROXYDIR}/log.txt.3
    mv ${PROXYDIR}/log.txt ${PROXYDIR}/log.txt.2

    # Create the new log
    touch log.txt

    # Set ownership of the new log file so Apache can write to it
    chmod 666 log.txt

  8. 8 Mauricio Zepeda

    Se escribe ‘through’ no ‘truth’

  9. 9 edgar

    tell me how to unlock bebo.com

  10. 10 Nijhir Lomax

    please give us a code 2 see see myspace.com or Ray J And Kim Kardashian Sex tape please

  11. 11 Buuster

    JiY7iw Hello Zhopa! Google.

  12. 12 Buuster

    MAopQF Hello Zhopa! Google.

  13. 13 Arian

    Does anyone know how to add into the script a way to block websites, like i could block a website and if someone tried to go to it through the proxy it would take it to a custom error page that i made.

  14. 14 Arian

    O i forgot to ask if there is a way to have a built-in flash on my domain, because i schools computers dont let you install flash for like youtube and stuff, so i was wondering if there is a way to get a file to install on my hosting to just run flash from it, like a plug-in or something???

  15. 15 jhonny

    yeah. I know this

  16. 16 jamie

    ur hot!!!!!

  17. 17 Steve

    Thanks, this worked with no problem.

  18. 18 proxy

    how to log all the user details

  19. 19 Taley

    dude i like really need to no a way to UNblock myspace from the skools u no how???

  20. 20 amy pope

    heya! culd u plz tel me a proxy site that i cn get in2 wen im in skwl!

    plzzzzzzz

  21. 21 Floroskop

    Hello!
    I think this try.

  22. 22 immmy bizzle

    gimme a fukin proxy desprsate im a bebo junky

  23. 23 Jak

    Hey, this doesn’t work for me. I added the above and it just comes out with a blank page when I use the proxy.

    Any ideas, thanks.

  24. 24 JD

    New undercover proxy
    http://www.exams-help.com/studentportal
    user: hello
    pass: hello

  25. 25 operation internet freedom

    no download, no register, no spyware, adware and 100% free and clean!! bypass web filter with http://www.orangezone.co.cc remember lay low and don’t share with your friends!! remember to clear the browser cache and history too.

    also don’t forget to subscribe for the mailing list, got some premium VIP proxy there

    goodluck

  26. 26 PHproxy Visitor Logging & Statitics

    Hi, the code above is great, however there are a few modifications and issues that I should point out.

    Firstly, you CANNOT just copy and paste the above code into your site using NOTEPAD, WORDPAD or any other editor. This is because this website uses funny characters and fonts that are not recognized by PHP. For example the quotes characters ” and ‘ in the code above do not work when copied and pasted. Thus, the solution is to type the code manually. I know it seems lame, but it actually does work. Proof is at my site my-proxy.us/log.txt - see for yourself.

    Okay second thing, the first peice of code which allows just IP and setting tracking works fine. However, the code which provides date and time logging must be modified. Your final code should look like this

    $proxytime=date(’h:i:s’);
    $proxydate=date(’d-m-Y’);
    $stuff = $_SERVER['REMOTE_ADDR'].”,”.$url.”,”.$proxydate.”,”.$proxytime.”\n”;
    $fp = fopen(’log.txt’,”a”);
    fwrite($fp,$stuff);
    fclose($fp);

    Basically the error was an extra A in the $proxytime line. Remember dO NOT COPY AND PASTE. Type it in manually (even if using simple notepad.exe)

    Check out my phproxy with complete logging at http://my-proxy.us

Leave a Reply