Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back from 1 to 10+ pages to re-sync the thread and this will then show the latest posts. Thanks, Mike.
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

php login help

  • 09-08-2006 10:16am
    #1
    Closed Accounts Posts: 2,175 ✭✭✭


    I'm creating a website for a client, but I didn't know exactly what I was getting myself into when I signed up for it. I can't reveal much info about the site, but it will be running on apache with a MySQL back end through PHP.

    Wow, I almost sound like I know what I'm talking about. Almost. That much I've thought myself in the last 2 weeks. I have the site design and layout created pretty much, but there is no functionality behind it.

    If things aren't clear, I'm a complete novice with this dynamic website stuff. Gimme a dreamweaver project and I'll fly through it, but this is too much for me I think.

    Now, what I want to ask is is there any help or advice or anything when it comes to validation of users and logins? A friend in the know has pointed me straight this far, but he's not available to me for tutoring one-to-one. I've looked for tutorials on the net, but alot of them still require more know-how than I have right now. everything I've done so far has been on the asumption that I'll know what I need to know by now, which I don't.

    stressed. An6y help or anything would be really, really cool.
    Thanks guys.


Comments

  • Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭Goodshape


    So, do you know _any_ PHP?

    So long as you know the basics, log-in and validation of users isn't actually that tricky and there should be plenty of tutorials out there for it.

    I taught myself HTML and PHP through online tutorials, so that's really all I can advise for you. Just relax, try not to get too stressed, appreciate that these things aren't, in fact, made solely to confuse you, and get stuck in.

    It can all seem daunting at first but once it 'clicks', so to speak, you'll realise it's not actually all that difficult.

    And if you have any more specific questions later on, feel free to post back here with them. Simply asking 'where do I start?' is unlikely to get you too many detailed responses. You've got to sort that bit out for yourself I think.


  • Closed Accounts Posts: 2,175 ✭✭✭chamlis


    Indeed.
    I've found PHP and MySQL for Dummies. That'd be me.
    I'm kind of at the point where I can copy and paste the relevant stuff in the right place, but when it doesn't work I have no idea why. Then I go out for a cig, come back and it's still looking at me.

    My main thing at the moment is I have a php header spanned accross all the pages where I hope to put the login point. But for some reason it's blank when I run it on the browser. It runs fine on its own (well, it doesn't really validate just yet, but goes where it's supposed to) but when I put it in the header it just doesn't show up.
    I'm sure it's fundamental stuff, so I'll just read the dummy book and have another cig.
    But thanks though.


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    www.phpbuilder.net
    www.php.net
    http://www.codefetch.com/
    http://www.codearchive.com/


    Also you might want to invest in any of the php beginners books out there


  • Registered Users, Registered Users 2 Posts: 1,466 ✭✭✭Smoggy


    the basics of a web site login are :

    a login table in mysql, containing a minimum of 2 fields, being the username and password.
    Now when you click the login button on your form you take the 2 field values for the username and password into your php and check them against the values of the usernames / passwords stored in your database via sql.

    along the lines of :

    select * from login where username = $username and password = $password

    if a row is returned , then you have a valid login.


  • Moderators, Politics Moderators Posts: 40,351 Mod ✭✭✭✭Seth Brundle


    Just further to Smoggy's post - the check is done after you escape/filter the submitted data for quote marks and other unfriendly characters.
    http://en.wikibooks.org/wiki/Programming:PHP:SQL_Injection
    http://www.askbee.net/articles/php/SQL_Injection/sql_injection.html


  • Advertisement
  • Closed Accounts Posts: 2,175 ✭✭✭chamlis


    Hey thanks alot guys.
    That Dummy book seems to actually have quite a good step by step database/login tutorial running the legth of the book. I'll give it a good read through tonight.


  • Registered Users, Registered Users 2 Posts: 378 ✭✭sicruise


    After you perform the check you are going to have to add a variable to your session to show that the authentication was successful...

    Start your session on each page with
    <?php session_start(); ?>
    

    So after you have compared the username/password you can do the following
    $_SESSION['authenticated']=1;
    

    Now at the top of each page do a check to make sure that
    $_SESSION['authenticated']==1;
    
    and if not redirect the user to your login page...

    Or a useful way that I normally do it is just have different content displayed depending on whether the user is logged in or not.

    Also if you have accounts and they are not just logging in to view you can set other variables like ... $_SESSION=username;

    Hope this is helpful


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Sounds like me 6 months ago when I jumped into a full time php developement job with NO experience :D

    6 months later and I have a considerable knowledge of the language and managed to get by back then. So its really not too difficult but I know how you feel!

    These guys will set you right, and dont underestimate online tutorials, there's usually plenty of examples for EVERYTHING, so you can pick and choose or combine a couple. Best of luck! :D


  • Registered Users, Registered Users 2 Posts: 7,518 ✭✭✭matrim


    I'll send you on a sample PHP login script if you pm me you email address.

    And one of the most important things you need to remember when using PHP is validate all user input data, before doing anything with it.


  • Closed Accounts Posts: 150 ✭✭archdukefranz


    never fear, www.php.net has some of the best documentation for a language out there... plus plenty of user examples on google and in the docs..

    Really good first language to learn... won't go into user validation as I pretty much aggree with everything that was said before


  • Advertisement
Advertisement