Reply
php login system with profiles
Old 06-06-2009, 04:23 AM php login system with profiles
Junior Talker

Posts: 2
Trades: 0
Hi I am new to the forums but joined so i can get more experience and such. So I have a question about a login system with profiles. Right now i have a nice registering system. I also have this on each page

Code:
<?php session_start(); 
                if($_SESSION['logged'] == 1){
                include(&quot;nav1.php&quot;);
                }
                else{
                include(&quot;nav.php&quot;);
                }
                ?>
for the navigation bar changing. How would i go about doing it so that when users logged in they would see a profile button at the top where they can edit their own profile. Right now every button is the same for each logged in user. for example. user logs in and they see a logout button but no individual button that is unique to their account. I am not asking for you to do it for me just a push in the right direction. thanks
chrisx17x2008 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 06-06-2009, 05:49 AM Re: php login system with profiles
Average Talker

Posts: 20
Name: Alwin Pester
Location: Denvar, Colorado
Trades: 0
thank you very much. this is a site that i am looking for. i think it is really help those who are interest on php
Alwin Pester is offline
Reply With Quote
View Public Profile Visit Alwin Pester's homepage!
 
Old 06-06-2009, 07:03 AM Re: php login system with profiles
lizciz's Avatar
Ultra Talker

Posts: 330
Name: Mattias Nordahl
Location: Sweden
Trades: 0
You can add a link that says Profile or similar, and a page "profile.php" to which you send the users ID, as in "profile.php?id=xyz". On that page, retrieve the users relevant information and display it.

You can then add another page for changing that information, perhaps "updateprofile.php?id=xyz", with a form with fields for the information that can be changed. Of course, a user should only be allowed to edit their own profile, so you should keep track of the user ID or username with a session variable.
__________________
596f75206d65616e20796f752063616e2061637475616c6c79 207265616420746869733f
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 06-08-2009, 08:49 AM Re: php login system with profiles
lothop's Avatar
Ultra Talker

Posts: 295
Trades: 0
Quote:
Originally Posted by chrisx17x2008 View Post
Hi I am new to the forums but joined so i can get more experience and such. So I have a question about a login system with profiles. Right now i have a nice registering system. I also have this on each page

Code:
<?php session_start(); 
                if($_SESSION['logged'] == 1){
                include(&quot;nav1.php&quot;);
                }
                else{
                include(&quot;nav.php&quot;);
                }
                ?>
for the navigation bar changing. How would i go about doing it so that when users logged in they would see a profile button at the top where they can edit their own profile. Right now every button is the same for each logged in user. for example. user logs in and they see a logout button but no individual button that is unique to their account. I am not asking for you to do it for me just a push in the right direction. thanks
Once a user has logged in I normally store their username in a cookie. Then check to see if the cookie is set. If it is set output the profile button.
Lizciz is right saying use a profile.php?id=xyz. So have them click on that link, display the profile page. You can check the cookie again to make sure that their username is the same one attached to the ID in the database. Then print out a form they can edit rather than their profile page they cant edit.
__________________
Websites Created;
warscope.com
ratepayers.org.nz
lothop is offline
Reply With Quote
View Public Profile
 
Old 06-28-2009, 08:51 AM Re: php login system with profiles
Junior Talker

Posts: 1
Trades: 0
Quote:
Originally Posted by lizciz View Post
You can add a link that says Profile or similar, and a page "profile.php" to which you send the users ID, as in "profile.php?id=xyz". On that page, retrieve the users relevant information and display it.

You can then add another page for changing that information, perhaps "updateprofile.php?id=xyz", with a form with fields for the information that can be changed. Of course, a user should only be allowed to edit their own profile, so you should keep track of the user ID or username with a session variable.
why can you give a script as a sample on how to do that??? it will be help full rather thans explaning it
Mrdonrule is offline
Reply With Quote
View Public Profile
 
Old 06-30-2009, 07:37 PM Re: php login system with profiles
orionoreo's Avatar
Ultra Talker

Posts: 261
Name: Jerry
Trades: 0
I'm not sure how secure this would be as someone who know's or tries out some file names can just type in nav1.php, unless you cross checked again in nav and nav1...

I have a similar nav system on my site, when logged in you get a different menu but I keep them both on the same file...

On top of each file I verify their credentials and define a logged in variable like so

PHP Code:

//_check_login.php

//Default = Not Logged In
$logged_in FALSE;

//Check if They Are Logged In
if (isset($_COOKIE['login_var'])) {
//Check credentials
if ($_COOKIES['login_var']=='whatever'$logged_in TRUE;

so an example of my index.php

PHP Code:

require('check_login.php');

include(
'nav.php'); 
and my nav would be like such

PHP Code:
//nav.php

if ($logged_in) echo 'SECURE MENU';
else echo 
'GUEST MENU'
and now that its defined you can pull out $logged_in anywhere in your site

hope this is what you're looking for...



Quote:
Originally Posted by chrisx17x2008 View Post
Hi I am new to the forums but joined so i can get more experience and such. So I have a question about a login system with profiles. Right now i have a nice registering system. I also have this on each page

Code:
<?php session_start(); 
                if($_SESSION['logged'] == 1){
                include(&quot;nav1.php&quot;);
                }
                else{
                include(&quot;nav.php&quot;);
                }
                ?>
for the navigation bar changing. How would i go about doing it so that when users logged in they would see a profile button at the top where they can edit their own profile. Right now every button is the same for each logged in user. for example. user logs in and they see a logout button but no individual button that is unique to their account. I am not asking for you to do it for me just a push in the right direction. thanks
orionoreo is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to php login system with profiles
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13809 seconds with 13 queries