Skip to main content
The 2024 Developer Survey results are live! See the results
33 votes

Login form C# SQL

SQL Injection alarm Don't use user passed text in your sql statements if you aren't using parameters. From: https://stackoverflow.com/a/7505842/2655508 Using parameters helps prevent SQL Injection ...
Heslacher's user avatar
  • 50.4k
18 votes

Login form C# SQL

Cleartext passwords Not a code-specific issue exactly but it would appear that you are storing the user's passwords in clear text. This means that anyone gaining access to the LOGIN_Tab would be ...
motosubatsu's user avatar
18 votes
Accepted

Is my PHP login system following best practices? Is the code really OOP?

This is a pretty good attempt at a login system. The code looks much better than 99% of code that I see on Stack Overflow. Keep up the good work! Your code is almost clean. Your classes do so little ...
Dharman's user avatar
  • 881
16 votes

Login form C# SQL

In addition to Heslacher's answer I would also look at the using statement. It is very important to keep a handle on resources like Sql Connections to ensure they ...
Geek's user avatar
  • 439
12 votes

Login form C# SQL

Security issues are covered, so just a bit on the code itself. You have three nearly identical pieces of code, inside a switch-statement. That seems to be a code-smell. Apart from that, I'm missing a ...
oerkelens's user avatar
  • 396
11 votes
Accepted

Python username and password program

A few points: You can simplify the if loop by using the else condition. Getting input should be at the beginning of the ...
Quintec's user avatar
  • 432
10 votes
Accepted

PHP-MySQL sign-in and sign-up project

Security There are quite a lot of beginners mistakes in your code. While there aren't any serious security issues right now, it does contain a whole bunch of bad practices which will sooner or later ...
tim's user avatar
  • 25.1k
10 votes

Login form C# SQL

using as already covered SQL injection as already covered For getting a single row Reader is more efficient than ...
paparazzo's user avatar
  • 6,016
10 votes
Accepted

PHP Login System with persistent login

Ok, moving down the list... I would separate the content of the includes folder into 2 semantically named folders: includes and ...
I wrestled a bear once.'s user avatar
9 votes

Simple login page

✔ Binding parameters You're using a database API and successfully binding your parameters. This will prevent SQL injection. ✘ No character white-lists Since you're outputting user input (ie: ...
ʰᵈˑ's user avatar
  • 336
7 votes
Accepted

LDAP Login Script

Logical inconsistencies and careless mistakes Let's look at the outline: ...
200_success's user avatar
7 votes

Java Servlet & JSP simple login

Critical error private static String username = ""; private static String password = ""; private static String queryString = ""; You should never keep request-...
RK1's user avatar
  • 464
7 votes

Is my PHP login system following best practices? Is the code really OOP?

A few other more minor bits not mentioned by Dharman, but agree 100% that the code is very good to start with, the Post - Redirect - Get pattern stands out many login systems do not have that ...
exussum's user avatar
  • 181
6 votes
Accepted

Configure AspNet.Identity to allow for either username OR email address on login

I know this is an old ticket, but I think I might have an approach that uses only one round trip to the database. ...
user1533613's user avatar
6 votes
Accepted

Simple login page

I generally like your code. There are some structural issues that may cause problems if your code base grows larger and some minor security issues, but apart from that, it is quite readable, well ...
tim's user avatar
  • 25.1k
6 votes
Accepted

Prompting user for connection parameters to SQL Server

It doesn't matter what you do with this code, the ConnectionString can always be accessed in the SqlConnection. As a test, here'...
Der Kommissar's user avatar
6 votes

Login form C# SQL

General issues SqlConnection loginCon = new SqlConnection("Data Source=******;Initial Catalog=***;Persist Security Info=True;User ID=*****;Password=**********"); ...
Alejandro's user avatar
  • 496
6 votes

Authentication script in Python

Ban yourself from recursion. If you're in the function main don't call main. What you want is to have a ...
Peilonrayz's user avatar
  • 43.4k
6 votes
Accepted

C++ simple password-protected console app

Using namespace std isn't a good practice in header files, where your program should at least partially reside, because you introduce potential name conflicts. So ...
papagaga's user avatar
  • 5,757
6 votes
Accepted

WinForm Logon Best Practices

You have a public static property UserName that can be set by anyone, anywhere in your code. You didn't detail the usage of this property. If it's the logon form that should update it and it will ...
Martin Verjans's user avatar
6 votes
Accepted

Node.js backend login logic

Async login bug The try/catch around User.findOne does not accomplish anything because ...
CertainPerformance's user avatar
5 votes

User registration and authentication in PHP and PDO

Preamble Writing a secure user management and authentication system is not an easy task. It has many pitfalls and you should follow a lot of guidelines and best practices along the way. Security and ...
insertusernamehere's user avatar
5 votes

Prompting user for connection parameters to SQL Server

Your code fails to escape values in the connection string. Use the SqlConnectionStringBuilder class instead. You set properties on it, and it will escape the ...
Kieren Johnstone's user avatar
5 votes

Web token authentication in Golang

Go Code Review Comments Don't Panic Don't use panic for normal error handling. Use error and multiple return values. ...
peterSO's user avatar
  • 3,531
5 votes
Accepted

MVVM pattern in Xamarin login form

No, it's not correct. View-model shouldn't contain anything related to view. It means LoginViewModel shouldn't contain references on progress bar and label. ...
Maxim's user avatar
  • 2,542
5 votes
Accepted

PHP - First Login System

Security You are escaping user input, which prevents SQL injection. It's good enough, but really not the recommended way to do this as it's too error-prone (whenever a project does this, it's ...
tim's user avatar
  • 25.1k
5 votes
Accepted

PHP login script

There is one logical inconsistency and two security issues. All other improvements will be just removal of useless or misplaced code. User not found case. If a user makes a typo in the username, ...
Your Common Sense's user avatar
5 votes
Accepted

Basic object-oriented PHP login, logout, and registration scripts

This response is far from exhausing, but I hope it contains a few good hints. Files When dealing with OOP you'll quickly learn that it is good practice to put one class in one file and then autoload ...
KIKO Software's user avatar
5 votes

Java Servlet & JSP simple login

package de.practice.Presentation That's not a valid package name under the Java convention. Packages are all lowercase with maybe underscores. ...
Bobby's user avatar
  • 7,797
5 votes

Java methods to add and authenticate users in MySQL

Funny coincidence, I just created the solution for your problem (but in PHP). The common thing here is the one-time use of a prepared statement, the difference is in the query string and arguments, so ...
potato's user avatar
  • 1,122

Only top scored, non community-wiki answers of a minimum length are eligible