Unique Member Page, (T-Pt:3) |
||
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.
Zymic Webmaster Forums Zymic Free Web Hosting Tutorials |
||
Unique Member Page, (T-Pt:3) |
||
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
|
|
|
![]() |
Jan 1 2010, 06:00 AM
Post
#2
|
|
|
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 |
|
|
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
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 ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users) |
||
| 0 Members: | ||
Forum Jump |
||
| Lo-Fi Version | Time is now: 19th May 2013 - 01:50 PM |