Jump to content

Search the Community

Showing results for tags 'login/registration'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hey Guys, I am in the beginning stages of creating a user login / register system for my website. currently, i am working on the conditionals to make sure the information logged in is proper , either matching the DB of my users or spitting an error array , letting my users know that either they need to enter both a valid username & pass or that the info entered does not match the Database. i have created a few functions that clean up the $_POST variables using mysql_real_escape_string: and my main function login(); function sanitize($data) { return mysql_real_escape_string($data); } function user_id_from_username($username){ $username = sanitize($username); return (mysql_result(mysql_query(" SELECT `user_id` FROM `users` WHERE `username`= '$username'"), 0 , 'user_id')); } function login($username, $password){ $user_id = user_id_from_username($username); $username = sanitize($username); $password = md5($password); return(mysql_result(mysql_query(" SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username' AND `password` = '$password'"), 0) == 1) ? $user_id : false; } and the conditionals to check the parameters given: if (empty($_POST) === false) { $username = $_POST['loginname']; $password = $_POST['loginpass']; if (empty($username) === true || empty($password) === true) { $errors[] = 'You need to enter a valid Username & Password'; } else if (user_exists($username) === false ) { $errors[] = ' Sorry we could not find this user info in our userbase.'; } else if (user_active($username) === false ) { $errors[] = 'This account still needs to be activated'; } else { $login = login($username, $password); if ($login === false) { $errors[] = ' The Username / Password combination you entered is incorrect.'; } else { echo 'Login Ok!!'; Now finally my issue : When i click login all of my conditionals work except the most important one. When I input a working username and password i am given the same error from my array that the combination is not correct. so its finding the username but the password is not matching and accepting ? any suggestions ? i have been trying to figure this out for a minute. Thanks guys!. edit: (just wanted to add: sorry mods for all caps in title, tried to go back and edit but was to late)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.