Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 598
0 Users 8 Guests Online
Forum Index » Tutorials » Tut Problem: Member.php &
Posted on Monday 16th June 2008 at 08:40 PM
Douglas
templates/default/images/noavatar.png's Avatar
Newbie
I've placed the tutorial for the usersystem, and in generaly it works very nice. i just have 1 smal problem with the members.php code, which is the same in the Who's Online tut.

I've noticed that when i visit the members.php page while logged in, i see my own username around 4 times beneath each other..: http://i16.photobucket.com/albums/b2/Dougystilo/multi.png

Same problem with the Who's Online tut., and i'm using the exact script of it. But other than that it works.

My Members.php page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Douglas Elemex®</title>
<style type="text/css">
<!--
.style14 {font-size: 14}
.style15 {
color: #FF66CC;
font-weight: bold;
}
-->
</style>
</head>

<body><table width="50" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td><table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" valign="top"><?
// Display the header
include('header3-new.php');
?></td>
</tr>
<tr>
<td width="186" rowspan="2" valign="top" bgcolor="#000000"><p><img name="Navigation" src="images/Navigation.gif" width="151" height="20" border="0" id="Navigation" alt="" /></p>
<p>
<?
// Display the menu
include('menu.html');
?><br />
</p></td>
<td width="584" height="19" valign="top" bgcolor="#FFFFFF"><?
// Display the menu
include('memnet.php');
?>
<hr align="center" width="584" noshade="noshade" />
<p class="style14"><strong>Profile Viewing</strong> <span class="style15">::</span></p>
<p>
<?php
session_start(); //allows session
include "config.php";
if(isset($_GET['user'])) { //if there trying to view a profile
//gets the user name and makes it safe
$username = addslashes($_GET[user]);
//querys the db to find the username
$getuser = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'");
//checks see if the username exists in the db

$usernum = mysql_num_rows($getuser);
//if it don't exist
if($usernum == 0)

{
//don't exist

echo ("User Not Found");

}
//if it does exist then show there profile
else{
$user = mysql_fetch_array($getuser);
echo "
<b>$user[username]'s Profile</b><br><br>
Last Seen: $user[last_seen]<br>
Email: $user[email]<br>
Location: $user[location]<br>
Sex: $user[sex]<br>
Age: $user[age]<br>
<a href='friendrequest.php?user=$user[username]'>Add as Friend</a>
";

}
}else{
//gets all the members from the database
$getusers = mysql_query("SELECT * FROM `members` ORDER BY `id` ASC") or die(mysql_error());
//loops there name out
while ($user = mysql_fetch_array($getusers)) {
echo "<a href='members.php?user=$user[username]'>$user[username]</a><br>";
}
}
?><br />
</p>
</td>
</tr>
<tr>
<td valign="bottom"><hr />
<table width="584" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td height="19" valign="top">&nbsp;</td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF"><?
// Display the header
include('footer3.html');
?></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>