Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsZymic Free Web HostingTutorials right
left right
uncled1023
post Mar 9 2008, 05:48 AM
Post #1


Super Duper Ninja
*****

Group: Members
Posts: 423
Joined: 24-February 08
Member No.: 11,718



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!

This post has been edited by zpcs: Dec 19 2012, 06:47 AM
Reason for edit: Broken URL Link (Abandoned/Expired URL Address Link) and then Broken URL Link allowanced for Descriptive URL Link so as not to disturb content
Go to the top of the page 
 
  + Quote Post
 
Start new topic
Replies
uncled1023
post Apr 4 2008, 03:02 AM
Post #2


Super Duper Ninja
*****

Group: Members
Posts: 423
Joined: 24-February 08
Member No.: 11,718



lol, sure. if you have msn messenger, mine is uncled1023@hotmail.com or aim is uncledisback
Go to the top of the page 
 
  + Quote Post

Posts in this topic
uncled1023   Unique Member Page   Mar 9 2008, 05:48 AM
wozzym   g00d job :)   Mar 9 2008, 06:08 AM
Banjo   Iv got the edit profile page working for uncled102...   Mar 9 2008, 12:40 PM
oziyn   another great tut by uncled1023 buddy ur awsome.....   Apr 4 2008, 01:18 AM
uncled1023   lol, sure. if you have msn messenger, mine is unc...   Apr 4 2008, 03:02 AM
oziyn   ok cool il add u then   Apr 4 2008, 11:20 AM
Liqfan   Nice tut! Appreciate you sharing it, but not f...   Apr 18 2008, 07:20 AM
Dragonius   Can you release the source for the edit page as we...   Apr 29 2008, 03:41 AM
BaKerSKater19   Whenever I do it, I get Fatal error: Call to ...   Mar 6 2009, 11:05 PM
rojerbinny3132   Nice job..   Apr 3 2009, 10:48 AM
NaRzY   Banjo/Uncled1023: I think it would be a good idea ...   Oct 20 2009, 12:36 PM
Sheep Sim   I'm having a bit of trouble...I copied the cod...   Jan 1 2010, 06:00 AM
Gregory Santana by Mxz   is very Important   Jan 6 2010, 01:55 PM
uncled1023   I have not been on here for a long time... I migh...   Feb 11 2010, 01:06 AM
uncled1023   New code, works with the membership tutorial.   May 7 2010, 01:02 AM
mar   Ty work't whitout any problems, but how do i ...   Jul 17 2010, 02:20 AM
Hawkstra   Thanks, this is awesome   Feb 6 2011, 02:56 AM
sherryabhy   I like to appreciate you because you shared such a...   Mar 10 2011, 04:22 AM
safeguard   thanks for sharing   Apr 15 2011, 02:04 PM
safeguard   great job   Apr 27 2011, 01:14 PM
VinCecil   how do i make it so others can view others profile...   Dec 12 2011, 01:55 PM
Cottermanna   great tuts... easy to follow.. Thanks Mate! le...   Apr 10 2012, 06:46 PM
Rajul jain   thanks for posting this.   Jun 25 2012, 03:39 AM
webmaster forums   PHP to give Unique area only accessible by that me...   Dec 13 2012, 08:52 AM
diematrik   Hi uncled1023, I am Shone. I have a doubt in you...   Dec 18 2012, 11:55 AM

 Reply to this topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 19th May 2013 - 06:01 PM