SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict user_A's Avatar
    Join Date
    Mar 2004
    Location
    Vancouver, BC
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    user registration system

    Ok this is a little complicated as to what i want to do, first of all i want to have the ability to register users and provide them with a login system where they login using their username and password, but i also want to incorporate this so that only that user who logs in, is able to insert, update and delete ONLY their own postings (it's for an events calendar system), how hard is it to do this and can someone offer me some tips or a reference link to a tutorial online, i've found a few but not sure if they are what i would need to complete my project.

    Help is needed !!

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2005
    Location
    Venlo, the Netherlands
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's pretty easy. Just keep track of who posts what.
    So when a user posts a new event on the calendar, store his user_id with it in the events table

    Check if the logged in user is the same as the one who posted the event. If so provide a link to alter the post, if not then dont

    Be sure to built in the neccesary protection

  3. #3
    SitePoint Addict user_A's Avatar
    Join Date
    Mar 2004
    Location
    Vancouver, BC
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you give me a link to a tutorial, or should i just build a registration system, sign users up, give them usernames and passwords, and than do the rest when the user has been logged in?

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2005
    Location
    Venlo, the Netherlands
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, you can just start on this one. It's not that hard and the idea will grown on you while your working at it.

    I have no idea about how advanced you are, but i'll just state the obvious here to make sure:
    Create a table for the users, make sure you have a row with unique user_id's (autoincrement), user_names (unique) and user_passes
    Especially the user_id will become important to make distinction between the users

    Next you can built the login system yourself. There are plenty of tutorials for that, just use google.
    If a user logged in correctly, set a session or cookie with the users ID.

    Then on each page you can check if the user is allowed to edit by running a query like:

    Code:
    $sQuery   = 'SELECT user_id FROM event WHERE user_id = '.$_SESSION['user_id'].' AND event_id = '.$_GET['event'];
    $rsResult = mysql_query($sQuery);
    if(!mysql_num_rows($rsResult)){
      die('not allowed to');
    }
    else{
      // display the page
    }
    There are more advanced ways of doing this, but hey ho, try this first

  5. #5
    SitePoint Addict user_A's Avatar
    Join Date
    Mar 2004
    Location
    Vancouver, BC
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks for the advice! seems clear enugh!

  6. #6
    SitePoint Evangelist kooshin.com's Avatar
    Join Date
    Dec 2003
    Location
    http://kooshin.com
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well You can use this phpfreaks membership system as a reference then do your own . Actually there are two tutorials
    http://www.phpfreaks.com/tutorial_ca...ip-Systems.php

    I hope that will help.

  7. #7
    SitePoint Addict user_A's Avatar
    Join Date
    Mar 2004
    Location
    Vancouver, BC
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yea! thanks, i think i'll go on with the first one, i think that is what i would like to have!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •