PHP Applications
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Applications

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old November 9th, 2006, 09:32 PM
De De is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 De User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
let user access to user own pages

hi,
i have tables in database: "moderator" with access level, and "content" with moderator ID, so they can login to thier pages, and edit , add thier content. Can u help me to create a login authentication that make user login to thier own page with access level, and edit their own information?

Thank you a lot

Reply With Quote
  #2  
Old December 12th, 2006, 01:05 AM
jjen jjen is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 jjen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: let user access to user own pages

I could really use this as well.

I wish there was some kind of tuturial that walks you through installing a login feature and the ability to request a password if they forget.

In addition I need the ability for a member to retrieve his record from mysql, make changes and update it.

Does anyone have anything like this?

Reply With Quote
  #3  
Old December 17th, 2006, 01:00 AM
namdolf namdolf is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 namdolf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to namdolf
RE: let user access to user own pages

I found this simple to do when just making one. I havnt used anything tricky at all.
just have a form to login wich passes the username and the password to another page that runs the sql called login.php wich amongst other stuff contains this
php Code:
Original - php Code
  1. $connection = mysql_connect($hostname, $username, $password) or die ("Unable to connect!");
  2. $query = "SELECT uid, uperms from users WHERE uuser = '$uuser' AND upass = '$upass'";
  3. $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
  4.  
  5. // if row exists - login/pass is correct
  6. if (mysql_num_rows($result) == 1)
  7.     {
  8.     // initiate a session
  9.     session_start();
  10.  
  11.     // register the user's ID and permission level
  12.     session_register("SESSION_UID");
  13.     session_register("SESSION_UPERMS");
  14.     list($uid, $uperms) = mysql_fetch_row($result);
  15.     $SESSION_UID = $uid;
  16.     $SESSION_UPERMS = $uperms;
  17.  
  18.     // redirect to main menu page
  19.     header("Location:testingpass.php");
  20.     mysql_free_result ($result);
  21.  
  22.     // close connection
  23.     mysql_close($connection);
  24.     }
  25. else
  26.     // login/pass check failed
  27.     {
  28.     mysql_free_result ($result);
  29.     mysql_close($connection);
  30.     // redirect to error page
  31.     header("Location:index.php");
  32.     exit;
  33.     }
  34. ?>

this is then dealt with by testingpass.php which includes the users index page as an isclude for each level of users as follows

php Code:
Original - php Code
  1.  
  2. your unique user id is <?php echo $SESSION_UID ?> <br>
  3. your permission level is set to <?php echo $SESSION_UPERMS ?> <br>
  4.  
  5.  
  6. <?php // decide if user is admin or a lower level to bring up their relevant index page ?>
  7. <?php
  8.  if ($SESSION_UPERMS == "1")
  9.     {
  10.     echo "your an admin so you get full acccess to all pages" ;
  11.     }
  12.     else
  13.     {
  14.     echo "your a Normal user of the system so you get a customised links page with only the info you need on it depending on your users permission level!" ;
  15.     }
  16.     ?>
  17.  
  18. <? //php elseif for showing the subadmins pages ?>
  19.  
  20. <?
  21. if( $SESSION_UPERMS == "1" )
  22. {
  23.    include ("level1.php");
  24. }
  25. elseif( $SESSION_UPERMS == "2" )
  26. {
  27.    include ("level2.php");
  28. }
  29. elseif( $SESSION_UPERMS == "3" )
  30. {
  31.    include ("level3.php");
  32. }
  33. elseif( $SESSION_UPERMS == "4" )
  34. {
  35.    include ("level4.php");
  36. }
  37. elseif( $SESSION_UPERMS == "5" )
  38. {
  39.    include ("level5.php");
  40. }


then at the top of level1.php i have the following lines

php Code:
Original - php Code
  1.  
  2. <?
  3. // check for valid user session
  4. if(!session_is_registered("SESSION_UPERMS"))
  5. {
  6. $SESSION_UPERMS != 1;
  7. }
  8. $SESSION_UPERMS = 1;
  9. ?>


This should hopefully stop direct access to the pages bypassing the security login feature by bookmarks and stuff.
I would like any feedback as its my first attempt at thsi sort of stuff.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Applications > let user access to user own pages


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 11 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek