Search
Left Quote    Wise men speak because they have something to say; Fools because they have to say something.
- Plato (427-347 B.C.)    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Member's Profile
  This user is offline  BoricuaLayz
  Subject: "Member's Profile" Posted: @ 5:04 pm on Jul 18 2007   
Member #: 356
Rank: User - (30)
Since: 06/25/07
Posts: 44
From: Florida

ok I plan on giving each member a profile page where they can change their info about themselves like,

Site:
WebCam:
Aim:
ICQ:
Yahoo:
MSN:
Location:
Birthday:
Bio:
Current Mood:

I have already created the table 'profile' with these columns in the database where the 'members' table is located. how would i make a page where you can view the members information and a page where you can edit your own information?

Edited at 05:37:03 pm on 07/18/07


    Viewed: 9,075 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Member's Profile" Posted: @ 5:43 pm on Jul 18 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Create the page just like the signup, except set the value of the text boxes to the result from the database. Then, when the user clicks submit, use an UPDATE query to update the appropriate fields with the values entered in the text boxes.

set a condition on the page where the user can only edit their own profile (must be signed in).



Edited at 05:46:01 pm on 07/18/07


-bs0d | AllSyntax.com

    Viewed: 9,063 Times | Reply to This | To top
  This user is offline  BoricuaLayz
  Subject: "re: Member's Profile" Posted: @ 7:06 pm on Jul 18 2007    
Member #: 356
Rank: User - (30)
Since: 06/25/07
Posts: 44
From: Florida

ok i changes it around a bit
i just added columns into the members table
it was a lot easier on me when i did that
so now with that done how would i set variables on a profile page
where when i link to a profile the link looks like this
"http://d omain.com/blahb lah.php?member= Admin"
and in the page all the content will be pulled out of Admin's row



Edited at 07:54:25 pm on 07/18/07


    Viewed: 9,056 Times | Reply to This | To top
  This user is offline  WintersDance
  Subject: "re: Member's Profile" Posted: @ 11:56 pm on Jul 18 2007    

Member #: 353
Rank: User - (27)
Since: 06/19/07
Posts: 36
From: California

Like bs0d mentioned, make it so that the user has to be logged in. Then from his/hers own profile page they would have an option to edit their profile. The page that would display their information would check to see if they are logged in first, then using the session name, would compare that to the username in the DB and then retrieve those values and populate the form with it.

Once the values in the form have been changed, then you send an UPDATE query back to the username in the DB and update the new information.

So your url would look something like this:

<a href="edi t_profile.php?m ember=<?php echo $_SESSION['use rname']; ?>"> ;Edit Profile</a&g t;

If the user is logged in, then the session name variable will appear in the URL. Just make sure that sessions are used to control that page so that you can't just spoof the username in the url and access their account.




wintersdance |     Viewed: 9,043 Times | Reply to This | To top
  This user is offline  BoricuaLayz
  Subject: "re: Member's Profile" Posted: @ 1:23 am on Jul 19 2007    
Member #: 356
Rank: User - (30)
Since: 06/25/07
Posts: 44
From: Florida

i have done the edit profile part and all of it works perfect but now what i want to do is make a page where other members can view your profile. I as thinking of nameing viewprofile.php and it want it to call the members username variable in a link like this "viewprof ile.php?member= Admin" and the sql query will get information from Admin's row. How would i set the variables to work like that?



Edited at 01:42:02 am on 07/19/07


    Viewed: 9,040 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Member's Profile" Posted: @ 3:30 am on Jul 19 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

In that case, you would use $_GET['member ']. You use $_GET to get variables from the URL. Also, be careful when allowing visitors to dictate what will be used as a variable in your queries. Validate the input before continuing with your query to be safe.




-bs0d | AllSyntax.com

    Viewed: 9,030 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank