Okay, so yes I am a super noob here. I was doing research on a personal project. I thought I had found the answer but it didn't pan out...
I am a member of some "private" sites. Unfortunately, there are those out there that would like to be part of those sites without going through the proper means or channels to become a member. They will trade site accounts to get into sites or trade invites to these sites. Fortunately, alot of this "trading" goes on in a public forum. So it has come to my attention that possibly the easiest way to catch these people is by capturing their IP. And the easiest way for me would be via a pic hosted on a website that was included in a PM or private message to that person...They view the PM and Bam! I got'em (someone offers to trade XYZ account or invite...I get IP...Give it to XYZ administrators)!
So as I was trying to figure out the process for myself My problem is that I am using a free web-host...It does allow php (5.2?) but I don't think I have access to a cPanel or such that will give me an IP log.
I am using 000webhost.com in case you needed to know.
So my question is there some script that will do such a thing for me easily and create some kind of IP log associated to a pic hosted on the site?
I did come across this tutorial...
Do you want to know who and when is visiting your web pages without having to look thru
complex server logs? Would you like to be informed every time someone someone looks
at your site even if your not at your computer?
Fear not web 2.0 has the solution, and in just a few simple steps you too can have a spy
on your site.
All you need is a web host that allows php (a free account from heartinternet.co.uk works
just fine), A mobile phone to send your visitors information to, and a couple of twitter
accounts (for which you will need a couple of different email addresses).
First you will need to set up a primary twitter account and link it to your phone, the
instructions at www.twitter.com are quite straightforward and easy to follow. You might
like to subscribe to one or two twitter feeds like http://twitter.com/sockington or
http://twitter.com/bbcpolitics to test it. Then you will need to log out and create a second
account with an easy to remember name and an easy to remember password.
Now we can get started on a little php script that is going to do two things for us, first it will
display a nice little image so we have a reason for people to use the script, the second is
to send the IP of the person using the script to twitter.
The first part of the script looks like this:
1. <?php
2. header ("Content-type: image/png");
3. $im = @ImageCreate (100, 200)
4. or die ("Cannot Initialize new GD image stream");
5. $background_color = ImageColorAllocate ($im, 0, 151, 153);
6. $text_color = ImageColorAllocate ($im, 0, 255, 255);
7.
8. imageline ($im,0,0,100,200,$text_color);
9. imageline ($im,100,0,0,200,$text_color);
10.
11. ImagePng ($im);
And you should feel free to change background colour and text colours in lines 5 and 6.
The second part of the script is what sends the IP to twitter as follows:
12.
13. $username = 'username';
14. $password = 'password';
15. $ip=$_SERVER['REMOTE_ADDR'];
16. $url = 'http://twitter.com/statuses/update.xml';
17. $curl_handle = curl_init();
18. curl_setopt($curl_handle, CURLOPT_URL, "$url");
19. curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
20. curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
21. curl_setopt($curl_handle, CURLOPT_POST, 1);
22. curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$ip");
23. curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
24. $buffer = curl_exec($curl_handle);
25. curl_close($curl_handle);
26.
27. ?>
Created by NosDa 0705
A few problems with it...First I don't need it to go to a phone as long as it gets sent to this "twitter" account. Second, after uploading the initial script I get this error message...
Parse error: syntax error, unexpected T_STRING in /home/a5389136/public_html/CheckIP1.php on line 2
So I get stuck in that process pretty much from the get go! Bummer! Line 2...Yhat is pretty weak...
If there is anyone that can help me it would be greatly appreciated! Thanks for your time...Not just for reading but helping, too!
Last but not least...I am not stupid but am obviously new to this type of thing. As plain or simple a language as possible would also be appreciated!