Now I need some login php help =P

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anthony
    Member
    • Apr 2004
    • 30

    Now I need some login php help =P

    I'm just full of questions these days....

    On my site, I have the customer login box. I also have panel.php...the page it leads to when logged in properly. I kinda figured out how to use the username as the "Welcome USERNAME, here, you will be able to view your billing, etc..etc..." but that's all I've been able to do

    and links are Trouble tickets (a seperate script)
    Billing (another seperate yet to be determined script, home made probably)
    Profile (like here you see on dathorn in your profile link, again probably home made)
    Welcome Email (again same thing as Dathorn...homemade again)


    Now the snag I'm really hitting in, is, for now, I'm just gonna create a txt file or database, that stores the info I get when someone signs up and associates the info to the username I give.

    Soooo, when someone logs in, I can't figure out how to make it check that file, to make sure its the right user/pass (the way its setup now, is anything and everything can login), then associate the username to all the information associated to that customer. Then, make the links to the left dynamic, seeing as how it's all seperate scripts, they need to skip login form. The only one it really really needs to bypass is that of the trouble tickets. The other sections, I'll just template them and make them show the info from the file.

    so, in short, I'm trying to figure out how to make the login fetch info from the file, then generate dynamic pages and links, depending on the user login. Then on their profile page, to be able to change their information without needing me to intervene. Then maybe in the future, make the info they send, get sent directly into the file.

    Sounds complicated, but in my head it seems so simple, but I can't figure it out, grrr.
  • james
    Senior Member
    • Mar 2004
    • 183

    #2
    Have you ever used MySQL?

    I'd definitely recommend using a database instad of files.

    Dathorn has MySQL support, so it's quite easy to use.

    The control panel that I wrote uses php to talk to a mysql database.

    James

    Comment

    • Jonathan
      Senior Member
      • Mar 2004
      • 1229

      #3
      http://hotscripts.com -> PHP -> Tips & Tutorials
      "How can someone be so distracted yet so focused?"
      - C

      Comment

      • Anthony
        Member
        • Apr 2004
        • 30

        #4
        Ok,

        I got the basic stuff nailed down from this guy



        But, to have all the extra fields, that I have in my signup page be put in the SQL database, I'd just have to create all the fields in the dbUsers table, right? And then to have dynamic links depending on the login, I use the variables that are in the table? Or something else?

        Sorry for the newbness...I'm great at managing, but I just started getting a bigger interest in programming (comes with the territory...)

        Thanks!

        Comment

        • james
          Senior Member
          • Mar 2004
          • 183

          #5
          Anthony,

          I'd personally use phpMyAdmin to create the database tables. If you need more help on this let me know.

          Yes, you're right with regards to just extending the table.

          Just add another column for each piece of user information that you wish to store in the database.

          The varchar(25) says that that field is a string up to 25 characters in length. char(16) says that that field is a string that HAS to be 16 characters long.

          Things such as the html form will have to obviously be modified, as well as the insert into database code:
          PHP Code:
          $q "INSERT INTO `dbUsers` (`username`,`password`,`email`) "
                      
          ."VALUES ('".$_POST["username"]."', "
                      
          ."PASSWORD('".$_POST["password"]."'), "
                      
          ."'".$_POST["email"]."')"
          ie add lines for the other fields to be inserted.

          Then, in members.php, you'll have to do another mysql query on your database, this time filtering the results by the $_SESSION["valid_user"] variable:
          PHP Code:
          $q "SELECT * FROM `dbUsers` "
                      
          ."WHERE `username`='".$_SESSION["valid_user"]."'";
                  
          // Run query
                  
          $r mysql_query($q);
          if ( 
          $obj = @mysql_fetch_object($r) )
                      {
                      
          // retrieved user details
          $address$obj->address;
          //etc

                      

          I hope this is enough to get you started.

          James

          Comment

          • Jonathan
            Senior Member
            • Mar 2004
            • 1229

            #6
            "How can someone be so distracted yet so focused?"
            - C

            Comment

            Working...