Jump to content

Recommended Posts

I have a memberlist page that has a link to the user profile page but no matter what user your click on it pulls the data of the current user.

 

my url is like follows  http://mydomain.com/index.php?action=profile&id=1

 

is there a problem with the url or my code?

 

profile.php

<?php
//Checks to see if theyre allowed to edit their profile
if ($uCan['viewprofile']) {
    //Double security incase the admin hasn't set a guest membergroup
    if ($uId) {

	if ($id == 0)
	{

		//Display Your User Profile
		echo '
			<div id="profile">
				<div class="margin" style="margin-left:5px; margin-right:5px; background-color:#333;">																						
					<img id="avatar" src="'.$avatar.'" alt="Your Avatar">
					<span id="user">
						<strong><h3>'.$uName.'</h3></strong>
						<br />
						<i>'.$uMembergroup.'</i>
					</span>
					<hr>
					<span id="userinfo">
						<br />
						<br />
						<strong>Email </strong>'.$uEmail.'<br />
						<strong>Msn </strong>'.$uMsn.'<br />
						<strong>Aim </strong>'.$iAim.'<br />
						<strong>Gtalk </strong>'.$uGtalk.'<br />
						<strong>Joined </strong>'.$uSignup.'<br />
						<strong>Location </strong>'.$uLocation.'<hr />
						<strong>Bio</strong><br />'.typography ($uBio).'<br />
					</span>
					<a href="index.php?action=editprofile">Edit Profile</a>
				</div>
			</div>
		';

	}else{

		//Display other user profile
		//Select the the Corresponding user
		$result = mysql_query("SELECT * FROM `users` WHERE id = '".$_GET['id']."' ");
		$row = mysql_fetch_assoc($result);

		echo '
		<div id="profile">
				<div class="margin" style="margin-left:5px; margin-right:5px; background-color:#333;">																						
					<img id="avatar" src="'.$row['avatar'].'" alt="Your Avatar">
					<span id="user">
						<strong><h3>'.$row['username'].'
						<br />
						<i>'.$row['membergroup'].'</i>
					</span>
					<span id="userinfo">
						<strong>Email </strong>'.$row['email'].'<br />
						<strong>Msn </strong>'.$row['msn'].'<br />
						<strong>Aim </strong>'.$row['aim'].'<br />
						<strong>Gtalk </strong>'.$row['gtalk'].'<br />
						<strong>Joined </strong>'.$row['signup'].'<br />
						<strong>Location </strong>'.$row['location'].'<br />
						<strong>Bio </strong>'.typography ($row['bio']).'<br />
					</span>
				</div>
			</div>
			';

	}

}
}
?>

 

memberlist.php

<?php

//Permission check to see if the user can view profiles
if ($uCan['viewprofile']) {

        //Select all the users
        $query = "SELECT * FROM users ORDER BY id ASC";
	$result = mysql_query($query);

	echo '
		<table width="75%" border="1" cellpadding="5px">
		  <caption>
			Member List
		  </caption>
		  <tr>
			<th scope="col">Avatar</th>
			<th scope="col">Username</th>
			<th scope="col">Email</th>
			<th scope="col">Gtalk</th>
			<th scope="col">Msn</th>
			<th scope="col">Aim</th>
			<th scope="col">Location</th>
			<th scope="col">Signup</th>
			<th scope="col">Position</th>
			<th scope="col">Gender</th>
		  </tr>
	';

        //And echo out all their names with links to their profiles
        while ($row = mysql_fetch_array($result)) {

            echo '<tr>
			  <td><img src="'.$row['avatar'].'" width="50" height="50" alt="Avatar"></td>
			  <td><a href="index.php?action=profile&id='.$row['id'].'">'.$row['username'].'</a></td>
			  <td><a href="mailto:'.$row['email'].'"><img src="i/icon-email.png" alt="Email" /></a></td>
			  <td><a href="gtalk.com"><img src="i/icon-gtalk.png" alt="msn" /></td>
			  <td><a href="msn.com"><img src="i/icon-msn.png" alt="msn" /></td>
			  <td><a href="aim.com"><img src="i/icon-aim.png" alt="msn" /></td>
			  <td>'.$row['location'].'</td>
			  <td>Signup</td>
			  <td>Position</td>
			  <td>Gender</td>
			  </tr>';

        }

	echo '</table>';

} else {
    echo 'You don\'t have permission to view this feature';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/171306-solved-profile-page-not-working/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.