This tutorial will show you how to make a script to see who has seen
your AOL Instant Messenger profile.
PART I - CREATING THE MYSQL DATABASE
First and foremost, for this tutorial, you're going to need a *nix
server running PHP, mySQL, and phpMyAdmin. First, we need to create a
mySQL table which will store the viewer's name and password. So, log on
to phpMyAdmin, and select your database. My database is called
"spoono_db". Inside the database, we're going to have to create a
table, so click the link of "spoono_db" on the left frame of phpMyAdmin
and go to the bottom of the right frame where it displays "Create
Table". We'll call it "aim" and have 2 columns for it.
The two columns for the "aim" table inside the "spoono_db" are:
- id - which will be an int (auto increment and primary)
- screenname - which will be text
PART II - CREATING THE VIEWER PAGE
So, now we have the database created. Now we need to create the
actual page where the viewer will go. The view page has to do two
things:
- Add the viewer to the database if he hasn't been added already.
- Display the viewers who have seen your profile.
Here is the code to program it:
//display the whole database
$result = MYSQL_QUERY("SELECT * from aim");
while($r=mysql_fetch_array($result))
{
$screenname=$r["screenname"];
if(strlen($screenname) < 30)
echo "$screenname
";
}
?>
Check out that hunk of code :) Alright, you should be familiar with the first four lines whcih just logs in and selects the database.The $result variable tries to select the screenname variable that matches the name of the screenname the viewer of the page has. If it doesn't match, then the screenname gets added. The second result variable runs a while loop through the database displaying all the screennames on the list. The If statement just make sures no one tries to abuse it. Thats it. Save this page as view.php. For example, http://www.spoono.com/php/tutorials/aim/view.php.
PART III - PUTTING THE LINK IN YOUR PROFILE
<a
href="http://www.spoono.com/php/tutorials/aim/view.php?sentname=%n"
target="_self">Click Here to See Who's Seen My Profile</a>
Thats it! Just change the URL inside
(http://www.spoono.com/php/tutorials/aim/view.php) to the location of
your view.php and you're done!