Help - Search - Members - Calendar
Full Version: Unique Member Page
Zymic Webmaster Forums > Zymic Free Web Hosting > Tutorials
uncled1023
Ok, here is a tutorial to create a Unique Members page! To use this script correctly, it is HIGHLY suggested that you use my Membership and Login system tutorial.

To begin, create a new file if you havent got one already, and call it members.php
Now, you will want to check to make sure the user is logged in, so include your login_check.php file that we created earlier.
CODE
<?php
include 'login_check.php';


Now that we know that they are a member, lets get the user they are trying to view and set up an array of that users info.

CODE

$username = safe($_GET['username']);
if($username == '')
{
    $username = safe($_COOKIE['username']);
}
$qry = mysql_query("SELECT * FROM users WHERE username = '".$username."'");
$row = mysql_fetch_array($qry);
?>


With their info set into the array $row, we can now create a table in display their info.

CODE
Welcome to your member profile!
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>
<?php
echo "Username: ".$username;
?></td></tr>
<br><br><tr><td>
<?php
if($row['show_email'] != 1) {  // checks to see if the user allows their email to be shown, where '1' means they allow it to be shown
?>[Email Hidden]
<?php } else {
echo "Email: ".$row['email']; // if they allow it, it displays their email
}
?>
<br><br></tr></td><tr><td>
<?php
echo "Website: ".$row['website']; // displays the users website
?><br><br></tr></td><tr><td>
<?php
echo "Registration Date: ".$row['regdate']; // displays the users registration dats
?><br><br></tr></td><tr><td>
<?php
echo "Location: ".$row['location']; // displays the users location
?><br><br></tr></td></table>
<a href="/logout.php">Log Out</a>


Now if you created the page correctly, this is what your members.php should look like:
CODE
<?php
include 'login_check.php';
$username = safe($_GET['username']);
if($username == '')
{
    $username = safe($_COOKIE['username']);
}
$qry = mysql_query("SELECT * FROM users WHERE username = '".$username."'");
$row = mysql_fetch_array($qry);
?>
Welcome to your member profile!
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>
<?php
echo "Username: ".$username;
?></td></tr>
<br><br><tr><td>
<?php
if($row['show_email'] != 1) {  // checks to see if the user allows their email to be shown, where '1' means they allow it to be shown
?>[Email Hidden]
<?php } else {
echo "Email: ".$row['email']; // if they allow it, it displays their email
}
?>
<br><br></tr></td><tr><td>
<?php
echo "Website: ".$row['website']; // displays the users website
?><br><br></tr></td><tr><td>
<?php
echo "Registration Date: ".$row['regdate']; // displays the users registration dats
?><br><br></tr></td><tr><td>
<?php
echo "Location: ".$row['location']; // displays the users location
?><br><br></tr></td></table>
<a href="/logout.php">Log Out</a>


Now, to have your users be able to go to this site, you will have to add a link to it in your index.php file.
So, add the following right above where you ask the logged in user to logout, like so:
CODE
If you would like to view your members page, please visit your <a href='/index.php?id=members'>Members Page</a>


That is it!! Now you have a table that will tell your user all the information that he has in the database, and will allow other users to view that persons profile!!

REMEMBER!!!!
on any link to your members site, you must have the code look like this:
CODE
<a href ="/index.php?id=members&username=DESIRED_USERNAME_HERE">Members only</a>


If you want the source files created in this tutorial, you can download them here: http://www.megaupload.com/?d=3NEWPUYC

If you want to see a working example, you can visit: test.city-scapes.net

Thank you all and good night!
wozzym
g00d job smile.gif
Banjo
Iv got the edit profile page working for uncled1023, he may release the source for that if any one wants it.
oziyn
another great tut by uncled1023

buddy ur awsome.....it wud be nice to talk to u 1 on 1 once......i have thousands of questions lol
uncled1023
lol, sure. if you have msn messenger, mine is uncled1023@hotmail.com or aim is uncledisback
oziyn
ok cool il add u then
Liqfan
Nice tut! Appreciate you sharing it, but not for absolute beginners biggrin.gif Since it's just copy/paste for noobies (referring to me mostly tongue.gif), we don't actually learn anything about what does what. But hey, it's far more than what I can do, so great tut !
Dragonius
Can you release the source for the edit page as well?
BaKerSKater19
Whenever I do it, I get
CODE
Fatal error: Call to a member function query() on a non-object in /home/bakerska/public_html/concretefingerboards.com/logon/mebmers.php on line 79

rojerbinny3132
Nice job..
Jacob
Banjo/Uncled1023: I think it would be a good idea to release the remainder of this source if it is still handy. tongue.gif
Sheep Sim
I'm having a bit of trouble...I copied the code exactly how it was in the tutorial. I'm a complete n00b at PHP (this is my first time, I've only done HTML, CSS, very little JavaScript, and Flash Actionscript), so I don't understand what it means.

Notice: A session had already been started - ignoring session_start() in /www/zzl.org/s/h/e/sheepsim/htdocs/check_login.php on line 3 Notice: Undefined index: art in /www/zzl.org/s/h/e/sheepsim/htdocs/members.php on line 12 Notice: Undefined index: username in /www/zzl.org/s/h/e/sheepsim/htdocs/members.php on line 12 Welcome to your member profile! This is where you can edit your information, check your mail, compose a new message, and delete your account. Notice: Undefined index: art in /www/zzl.org/s/h/e/sheepsim/htdocs/members.php on line 18 Username:


Notice: Undefined index: art in /www/zzl.org/s/h/e/sheepsim/htdocs/members.php on line 23 Notice: Undefined variable: db_object in /www/zzl.org/s/h/e/sheepsim/htdocs/members.php on line 25 Fatal error: Call to a member function query() on a non-object in /www/zzl.org/s/h/e/sheepsim/htdocs/members.php on line 25
Gregory Santana by Mxz
is very Important
uncled1023
I have not been on here for a long time... I might release my old City-Scapes source code for people to scrounge around with.
uncled1023
New code, works with the membership tutorial.
mar
Ty work't whitout any problems, but how do i allow users to change p/w? it list the data but u cant change anyting
Hawkstra
Thanks, this is awesome
sherryabhy
I like to appreciate you because you shared such a very best and superb informative information with us. It is very beneficial as well as too much good to get best and unique knowledge.
safeguard
thanks for sharing
safeguard
great job
VinCecil
how do i make it so others can view others profiles?
also how do i make it so you can edit your profile?
Cottermanna
great tuts... easy to follow..
Thanks Mate!
leapfrogglobe.org/ rolleyes.gif
Rajul jain
thanks for posting this.
webmaster forums
PHP to give Unique area only accessible by that member PHP On page the user can only see their stats and can edit only.

wrchallenge.org/
diematrik
Hi uncled1023,

I am Shone. I have a doubt in your unique members page code. When I login and go to the members page, it takes me back to my login page. Please reply to this as fast as you can.
wacko.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.