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
2 Pages V   1 2 >   Reply to this topic Start new topic
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
wozzym
post Mar 9 2008, 06:08 AM
Post #2


Outrageously Uber Ninja
Group Icon

Group: Community Helper
Posts: 2,198
Joined: 2-March 08
From: Australia
Member No.: 12,578



g00d job smile.gif
Go to the top of the page 
 
  + Quote Post
Banjo
post Mar 9 2008, 12:40 PM
Post #3


Marvellous Ninja
******

Group: Moderators
Posts: 581
Joined: 25-October 07
From: Windsor, UK
Member No.: 1,866



Iv got the edit profile page working for uncled1023, he may release the source for that if any one wants it.
Go to the top of the page 
 
  + Quote Post
oziyn
post Apr 4 2008, 01:18 AM
Post #4


Newbie
*

Group: Members
Posts: 16
Joined: 16-March 08
Member No.: 14,302



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
Go to the top of the page 
 
  + Quote Post
uncled1023
post Apr 4 2008, 03:02 AM
Post #5


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
oziyn
post Apr 4 2008, 11:20 AM
Post #6


Newbie
*

Group: Members
Posts: 16
Joined: 16-March 08
Member No.: 14,302



ok cool il add u then
Go to the top of the page 
 
  + Quote Post
Liqfan
post Apr 18 2008, 07:20 AM
Post #7


Super Ninja
****

Group: Members
Posts: 367
Joined: 1-April 08
From: Belgium
Member No.: 16,573



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 !
Go to the top of the page 
 
  + Quote Post
Dragonius
post Apr 29 2008, 03:41 AM
Post #8


Newbie
*

Group: Members
Posts: 1
Joined: 25-April 08
Member No.: 22,276



Can you release the source for the edit page as well?
Go to the top of the page 
 
  + Quote Post
BaKerSKater19
post Mar 6 2009, 11:05 PM
Post #9


Newbie
*

Group: Members
Posts: 29
Joined: 21-December 08
From: TX
Member No.: 74,191



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

Go to the top of the page 
 
  + Quote Post
rojerbinny3132
post Apr 3 2009, 10:48 AM
Post #10


Newbie
*

Group: Members
Posts: 19
Joined: 3-April 09
Member No.: 90,027



Nice job..
Go to the top of the page 
 
  + Quote Post
Jacob
post Oct 20 2009, 12:36 PM
Post #11


Outrageously Uber Ninja
*******

Group: Moderators
Posts: 5,140
Joined: 11-May 08
From: Australia
Member No.: 25,876



Banjo/Uncled1023: I think it would be a good idea to release the remainder of this source if it is still handy. tongue.gif
Go to the top of the page 
 
  + Quote Post
Sheep Sim
post Jan 1 2010, 06:00 AM
Post #12


Newbie
*

Group: Members
Posts: 3
Joined: 6-December 09
Member No.: 121,465



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
Go to the top of the page 
 
  + Quote Post
Gregory Santana ...
post Jan 6 2010, 01:55 PM
Post #13


Newbie
*

Group: Members
Posts: 1
Joined: 6-January 10
Member No.: 125,226



is very Important
Go to the top of the page 
 
  + Quote Post
uncled1023
post Feb 11 2010, 01:06 AM
Post #14


Super Duper Ninja
*****

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



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.
Go to the top of the page 
 
  + Quote Post
uncled1023
post May 7 2010, 01:02 AM
Post #15


Super Duper Ninja
*****

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



New code, works with the membership tutorial.
Go to the top of the page 
 
  + Quote Post
mar
post Jul 17 2010, 02:20 AM
Post #16


Member
**

Group: Members
Posts: 43
Joined: 6-June 10
Member No.: 144,748



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
Go to the top of the page 
 
  + Quote Post
Hawkstra
post Feb 6 2011, 02:56 AM
Post #17


Newbie
*

Group: Members
Posts: 28
Joined: 1-October 07
Member No.: 760



Thanks, this is awesome
Go to the top of the page 
 
  + Quote Post
sherryabhy
post Mar 10 2011, 04:22 AM
Post #18


Newbie
*

Group: Members
Posts: 5
Joined: 10-March 11
Member No.: 181,322



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.
Go to the top of the page 
 
  + Quote Post
safeguard
post Apr 15 2011, 02:04 PM
Post #19


Member
**

Group: Members
Posts: 49
Joined: 23-March 11
Member No.: 183,301



thanks for sharing
Go to the top of the page 
 
  + Quote Post
safeguard
post Apr 27 2011, 01:14 PM
Post #20


Member
**

Group: Members
Posts: 49
Joined: 23-March 11
Member No.: 183,301



great job
Go to the top of the page 
 
  + Quote Post
2 Pages V   1 2 >
 Reply to this topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 26th May 2013 - 04:39 AM