Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    im having problems creating a login script that lets me access a members area

    hi,

    im having problems creating a login script that lets me access a members area. i have created the registration script, that works and connects to the db. its the login side that im having trouble with. here are the files

    index.php <!DOCTYPE HTML> <html> <head> <title>Sign-In</title> <link rel='styles - Pastebin.com
    connectivity.php <?php function getConnection(){ $db = new PDO('mysql:host=localhost;dbna - Pastebin.com

  2. #2
    Regular Coder fastsol's Avatar
    Join Date
    Aug 2014
    Location
    Minnesota
    Posts
    185
    Thanks
    0
    Thanked 26 Times in 26 Posts
    Before we get into the actual issue you are having, is this going to be a learning thing for you OR are you actually trying to use this on a live site? If it's just learning how to make something of this nature, then we can proceed and get you going. BUT if this is intended to be used in any manner on a live site, you seriously need to scrap this entire code and start over with a real login script with security. The code you have now has so many issues that there isn't a single part of it that could be kept. I can provide you with a link to a youtube channel that has a few well written login scripts you can learn from, but whatever you do, do not use your code on a live site!!

  3. #3
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    im just using this for practice and learning.

  4. #4
    Regular Coder fastsol's Avatar
    Join Date
    Aug 2014
    Location
    Minnesota
    Posts
    185
    Thanks
    0
    Thanked 26 Times in 26 Posts
    Okay, I looked more at the current code you have. Honestly trying to help you with the issue you asked about would literally require rewriting the entire code you currently have. Nevermind the fact there is zero security in the code, the code itself will not even come close to working as it sits right now. It is riddled with a few dozen logic errors which makes the code not work at all right now without creating several errors on the page from php.

    First off, you need to make sure that you have error_reporting turned on in the php.ini file or you can use this code at the top of every page to ensure that php is outputting errors to you.
    PHP Code:
    error_reporting(E_ALL);
    ini_set('display_errors'1); 
    Then watch the series HERE to show you how to build what you are wanting. I will say that this series even at this point is a little old for the most current code that you "should" be using in todays world, but it does use normal good practices and shows/explains everything very well. Like this for example, I see you are using PDO which is excellent but this series uses old mysql which is bad now. There are more up-to-date series on this channel but I think it may be way over your head right now. So basically use this series to learn the logic behind making a login system and then update the code with stuff like PDO.

    I'm sorry but your code is too far off that we literally would need to rewrite it and that's not we're here for.

  5. #5
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi,

    i dont know what a php.ini file is or where i should put it.

  6. #6
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *sorry, ignore that, ill put it at the beginning of every .php file


 

Tags for this Thread

Posting Permissions

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