473,320 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP code for profile

i'm a PHP newbie and I'm assigned to an mission of creating a blog with some elements like Yahoo blog! : login -> home -> my page, my blog, my profile, my friend....

I'm now supposed to write the 'view profile page'

I wrote the login page using session and I'm now stuck. can anyone help me to finish the profile code which shows name, birthday, adress and so on of signed in member using session in form
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. echo "hello, you're logging in as". $_SESSION['username'];
  3. echo '<br>your profile:'
  4. ?>
  5.  
WHAT'S THEN? :|
Oct 10 '07 #1
2 2346
Jeigh
73
First you will need to link to the profile page like this:
Expand|Select|Wrap|Line Numbers
  1. view_profile.php?username=freddy
  2.  
or username=john etc.

Then use this code at the top:
Expand|Select|Wrap|Line Numbers
  1. $req_user = trim($_GET['username']);
  2.  
Then you just use queries like:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM members WHERE username='$req_user'
  2.  
To get the data you want. If you want it so only the person who owns that account can view certain information you could just use a code like:
Expand|Select|Wrap|Line Numbers
  1. $user = $_SESSION['username'];
  2.  
then use queries like:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM members WHERE username='$user'
  2.  
Hope that helps :)
Oct 10 '07 #2
Atli
5,058 Expert 4TB
Hi.

Please use [code] tags when posting code.

Thank you.
Oct 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore...
2
by: | last post by:
Hi all, How can I get a reference to my custom profile provider in my .aspx page? I have looked at httpcontext.current.profile. But from there where do I go? Ideally I would like to be able to...
6
by: Shimon Sim | last post by:
Hi I am working on application that need to hold custom user information - Last and first name, email, some other domain related information. I used to create Base class for all my pages. The base...
4
by: Marco Assandri | last post by:
Hi everybody, I have a problem with this code. 'An anonymous username copied from the Username column of Aspnet_Users table with IsAnonymous = True dim SurelyAnonymousUsername =...
6
by: Jeff | last post by:
Hey (and thank you for reading my post) In visual web developer 2005 express edition I've created a simple website project.. At this website I want users who register to be able to upload a...
3
by: shapper | last post by:
Hello, In my Page's VB.NET code I am changing the value of the Profile property NAME. Profile.Name = tbName.Text However, I need to change this property value from a class in my App_Code...
2
by: =?Utf-8?B?RGlya0dvZXM=?= | last post by:
I have added some profile properties to my web.config: <profile enabled="true"> <properties><add name="firstname"/></properties> </profile> However when I try to access the property in a code...
3
by: Oriane | last post by:
Hi there, I would like to open my Asp.Net project as a "Web Application" rather than as a "Web Site" in Visual Studio. But the thing is that I use the System.Web.Profile and the auto-generated...
1
by: shapper | last post by:
Hello, I am using a custom Profile provider as follows: public class Profile : ProfileBase { public Bio Bio { get; set; }
5
by: geoffreyfishing | last post by:
I have tried posting everywhere, but no one has given me an answer so far. I am willing to try everything short of a clean install of vista. My Problem: Some process has a locking handle on the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.