Yeh I knew i could do it that first way but that website I linked to showed it wasnt the most efficient way, but thanks for figuring out that avatar stuff man I learned quite a bit from your code too
I think you were running some avatar mod/plugin so I had to edit mine since my install is rather plain, I changed the layout some to my liking and fixed the date on it, but if someone is running PunBB without avatar plugins/mods this is some sample code, I replaced the die() also
<p>
Random Profile<br>
<?php
//random profile
$query = "SELECT id, username, num_posts, registered, location FROM ".$db->prefix."users WHERE username!='Guest' ORDER BY RAND() LIMIT 1";
$result = $db->query($query) or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
$data = $db->fetch_assoc($result);
if ($pun_user['show_avatars'] != '0')//$pun_config['o_avatars'] == '1' &&
{
$avatars_dir="forums/img/avatars/";//avatars are located here
if ($img_size = @getimagesize($avatars_dir.'/'.$data['id'].'.gif'))
$user_avatar = '<img src="'.$avatars_dir.'/'.$data['id'].'.gif" '.$img_size[3].' alt="" />';
else if ($img_size = @getimagesize($avatars_dir.'/'.$data['id'].'.jpg'))
$user_avatar = '<img src="'.$avatars_dir.'/'.$data['id'].'.jpg" '.$img_size[3].' alt="" />';
else if ($img_size = @getimagesize($avatars_dir.'/'.$data['id'].'.png'))
$user_avatar = '<img src="'.$avatars_dir.'/'.$data['id'].'.png" '.$img_size[3].' alt="" />';
}
else
$user_avatar = '';
// echo "<br />",$query,"<br /><b>Id: </b>",$data['id'],"<br /><b>Username: </b>",$data['username'],"<br />","<br />";
//echo "<b>Id:</b> " . $data['id'];
echo "<strong>" . $data['username'] . "</strong><br />";
echo $user_avatar . "<br />";
echo "Posts: <strong>" . $data['num_posts'] . "</strong><br />";
echo "Registered on: <strong>" . date('M j, Y' , $data['registered']) . "</strong><br />";
echo "Location: <strong>" . $data['location'] . "</strong>";
//echo "<b>Avatar:</b> <img src=\"forums/img/avatars/" . $data['avatar'] . "\" alt=\"" . $data['avatar'] . "\" />";
//echo "<b>Avatar: </b> " . $user_avatar;
?>
</p>
Now all thats left is a search box and I think i think i know how, I'd still like to figure out to do it the efficient way but I guess its not that vital. I plan to learn MySQL soon. This punBB rocks man I've got almost everything I need for a simple CMS