Advanced Search

Results 1 to 4 of 4

Thread: help with my php login script

  1. #1
    Join Date
    Jan 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy help with my php login script

    Hey all!

    Sorry for this long post but I am struggling a little..

    Let me set the scene

    I work for a company, I was nominated to refurbish the website for them. I have previously done CSS and HTML with a little Javascript. With this in mind I set about creating a website (turned out ok) using HTML and CSS. The other thing I need to implement is a secure login page. Managed to teach myself PHP in a fairly short amount of time, discovered SQL injections and had to start again.

    I am running:

    IIS (direct access to server from company via remote desktop)
    PHP
    HTML
    CSS

    Now a few problems I am experiencing and things I am confused about:

    1:A user can log into my website, however there is no distinction between logged in or not.. i.e. you cna log in and get other webpages which are set after that (via link) however if you hit log out it just goes back to the html original page..

    2: It is currently running on local host, so I know i need to get it up and running, however hiding URLS, im guessing that is using URL reqrite on IIS? wondering if anyone had a decent guide to it.

    3: I need to add a validation to my existing IF statement to check if the value is null in the table then not let them log in, however you can still direct access the pages in the URL and need to find a way of stopping it

    4: A way of letting me approve who joins (only want a very select few to join)

    5: web pages which are personalised for each person (letting them access specific files to that user) and a way of easily uploading files for them (dunno if i can just place them in a folder for that user and its automatically uploaded to their personalised page?)

    I know thats a lot, but its confusing the hell out of me, I was quite happy I got this far..


    Here is the JSfiddle for the login page (looks crappy as no background or images)

    http://jsfiddle.net/94Pzz/

    I posted some queries on other websites like stack overflow, got some help but mostly abuse . I have done some extensive readings on your fourms as well and they have been the most helpful I have come across..

    I have tired a lot of this myself and got what I would considerer to be a working functional public facing side, its just the private side of the website I need to fix.

    Failing that someone shoot me please.

    Thankyou
    James

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,625
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Hello James,
    I hope you're not on a deadline. : )
    PHP has a fairly easy learning curve, but in most cases, you can't just walk in and do all the stuff you're describing.

    S/O is a great place, but it's not a place for beginners. All programming forums will appreciate a well-formed, well-researched question, but S/O will let you know -very loudly- when your question doesn't meet those criteria. Find a forum that is more beginner-oriented (like DD), and be prepared to really get into "learning" mode. There's a lot of stuff you don't know, and you're only going to find more of it. : )

    Your questions, right now, are fairly vague. A significant part of what you're "missing" is a concept of how all these features work, not simply how to code them. A lot of what you are asking can be sorted out (with time) but following tutorials and/or looking at examples of existing code (e.g., open-source software projects). You might even consider using a Content Management System (Wordpress, for example) that already has a lot of these features included.

    Some basic responses (come back with more specific questions):

    1. Make a distinction between "logged in" and "logged out." The simplest way is to set a session variable (e.g., $_SESSION["logged_in_user"] = true). Your "logout" link will unset that variable.

    2. Your "localhost" is a server, so setting it up on your production machine (assuming you have the same server software on both) will follow the same procedure. Unfortunately, I don't have much experience with IIS. Check MS or IIS-specific forums for guides.

    3. Do you understand how to connect to your database and query it? What kind of DB is it? (advice: in the case of MySQL, DO NOT follow any tutorials that use mysql_* functions: they are deprecated and should not be used. Look for tutorials covering MySQLi or PDO instead.)
    As for accessing pages directly, well, of course you can. You need to add your validation check to the page you want validated.

    4. If it really is "a very select few," then the simplest way would be to create their accounts manually and then send them their login information. No user-facing registration process at all.
    If you want user registration, then simply allow the process to go forward, but flag new accounts as "disabled" by default and send yourself an email. You can then review and approve/disapprove the account yourself.

    5. Depends on your purposes. Are you simply talking about file storage for users? Do they need to do anything with these files? Could you simply use an existing, functional service (like dropbox)?
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    Learning PHP is relatively easy (and I think intuitive). I learned it well by trial and error, but it took years (and certainly there's plenty that I'm still learning). For me, the best way to learn was to pick a project (but not one that was way beyond my level at the time) and work out how to do it. Certainly the end results improve as your base knowledge improves. It's hard to need to build a "real" website as you're learning PHP, but you can probably get there.

    Beyond that, traq's post is a great place to start, so I won't add much more. But we'll be happy to help as you continue-- try to post specific questions with as much information as possible, and we'll be able to point you in the right direction. These broad questions can be somewhat difficult because understanding the answers requires understanding some of the details too-- we'll try though.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jan 2014
    Location
    India
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    According to me, we can create a login script; we first need to create a database to store users. For the purpose of this tutorial we will simply need the fields "username" and "password", however you can create as many fields as you wish.

    For many help – Create a Database
    php.about.com/od/learnmysql/ss/create_tables_3.htm

Similar Threads

  1. PHP login script
    By moose86 in forum Looking for such a script or service
    Replies: 1
    Last Post: 11-29-2011, 10:54 PM
  2. Login script PHP
    By Mattphp in forum PHP
    Replies: 2
    Last Post: 06-02-2010, 02:41 PM
  3. Need help with a login script
    By Dirt_Diver in forum PHP
    Replies: 4
    Last Post: 08-25-2008, 12:36 PM
  4. Login Script...
    By Rockonmetal in forum PHP
    Replies: 5
    Last Post: 12-08-2007, 10:42 PM
  5. Need help with Login script
    By allahverdi in forum PHP
    Replies: 3
    Last Post: 08-13-2007, 11:03 PM

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
  •