AIM profile

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

host your own site! lol
kmano
Forum Newbie
Posts: 7
Joined: Thu Jan 22, 2004 11:02 pm

Post by kmano »

psh im too poor, i'm an admin on my companys site....but we have limited bandwith....I don't think the owner wants me to use it to host it for my AIM profile :-P
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

I host all my own profiles, FREE... apache is free, and php is free and using ChaneIP.com you can get free DDNS services with free domains like http://www.whatever.myddns.com and others.... but its still better than someone else hosting your site!
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

Hey guys, just a question, have any of you been able to get the AIM today window to work recently? Because my profile used to always open up in it, and jsut recently i noticed that its stoped... that it wont open up at all... just wondering if anyone else was having this problem!
kmano
Forum Newbie
Posts: 7
Joined: Thu Jan 22, 2004 11:02 pm

Post by kmano »

No it doesn't open for me as well. :?
th3gh05t
Forum Newbie
Posts: 22
Joined: Tue Apr 20, 2004 11:52 pm

Post by th3gh05t »

Hi,

I am really into making my own AIM profile.

You can check it out.. AIM: w0lverne

Anyway, I need some help with some code.

I have this code, that gets the users screenname, time and date, and IP address. The screenname and IP are correct but I get this error everytime I view the page.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/derek/www/profile/aim.php on line 45<br />
Here is the code that I using:

Code: Select all

<?php 
//  AIM Automatic-Answering Machine/Logger v1.0 
// 
// Code in your aim profile should look like this: 
//<A HREF="http://www.halo-source.com/aim.php?T4=%n" 
// TARGET="_self">Click Here</a> 
// 


// get user's IP Address 
$userip = getenv("REMOTE_ADDR"); 

//mysql information
$dbusername='derek'; 
$dbpassword='*********'; 
$hostname='localhost'; 
$databasename='aim'; 

// connect 
$link1 = mysql_connect($hostname, $dbusername, $dbpassword); 

//get db 
if (!mysql_select_db($databasename, $link1)) { 
echo "error with db"; 
exit(); 
} 

// get current time and date 
$time1 = date("h:i a"); 
$date1 = date("d/m/Y"); 

// sql statement to insert values 
$addstmt = "Insert into tablename(ip, time, date, screenname) values('%s', '%s', '%s', '%s')"; 

// code in case there is an error inserting 
if (!mysql_query(sprintf($addstmt, $userip, $time1, $date1, $T4), $link1)) { 
        $flag1 = 1; 
} 

// sql to check to see how many times the user has viewed the profile 
$result = mysql_query("select * from aimlist where screename = '".$T4."'"); 

// count the number of recs 
$countthis = 0; 
while ($row = mysql_fetch_array($result))  { 
        $countthis = $countthis + 1; 
        // you can do other things in here as well 
        // such as print out all the dates and times the user has viewed 
} 
// now print out the personalized message for each user 
// you can easily put this in another table 
// this will be done in the next version 

echo "<BR>You have looked at my profile ${countthis}"; 
echo "times.<BR>"; 
echo "Screenname: <b>${T4}</b><BR>"; 
echo "IP: <b>${userip}</b><BR>";  
echo "</body>"; 
echo "</html>"; 

?>
This is what I get when I click on the link in my profile. It almost works... :(
<br />
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/derek/www/profile/aim.php on line 45<br />

You have looked at my profile 0times.
Screenname: w0lverne
IP: 24.199.6.***
You can see that the "You looked at my profile X times.", isn't working either..

I got this code from evilwalrus.com. There were many mistakes in the code, that I have had to fix. But it isn't perfect yet. I think that I need to create a table into the database. But I am not sure what to name it, what fields to have in it.

If you could provide some code, that would be great!

Thanks, th3gh05t
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

looks like your select failed...

switch it to:
$result = mysql_query("select * from aimlist where screename = '".$T4."'") or die(mysql_error());
th3gh05t
Forum Newbie
Posts: 22
Joined: Tue Apr 20, 2004 11:52 pm

Post by th3gh05t »

Ok. I will replace that line with what you have.

But, I think that I need a table in my database..

What should that table be?
Post Reply