Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

1

After a cursory read, this jumped out at me: $user_check_query -> bind_param("ss", $email); You’re binding 1 string parameter, but have two s codes. You do it again here: $stmt->bind_param("sssssssssssssss", $firstname,$lastname,$email, $email,$password1,$account_verified,$str); 15 s’s but only 7 parameters. It appears you are ...


2

Everything must be done on the database level. It is incomparably resource-friendly. Instead of fetching all the data from database and looping over many rows most of which do not even meet the condition, we must set this condition right in the query, to fetch the only rows we need. Better yet, instead of deleting and updating rows one by one, we must ...


4

This code is safe from the SQL injection standpoint but it is likely prone to XSS because of the untreated output, and also to possibly leak the sensitive information due to the error message unconditionally spat out. Regarding other improvements I would suggest a more robust connection code and to avoid bindParam calls thanks to disabled emulation mode. ...


4

The fact that mysqli has nothing to do with PDO aside, there are several things about your code at whole: this "class Database" from some article is a dummy. It is absolutely useless and there is not a single reason to prefer it over original PDO. Let alone some flaws in the code inside. under no circumstances you should create a new database connection in ...


2

Your three password requirements can be baked into one expression. if (!preg_match('/(?=.*[a-z])(?=.*\d).{5,}/i', $password)) { $this->errors[] = 'Passwords must have a minimum of 5 characters and contain at least one letter and at least on number'; return false; } $this->password = password_hash($password, PASSWORD_DEFAULT); return true; ...


2

For some of your class' issues I have a review already. Some time ago I wrote an article about common mistakes in database wrappers. To list them briefly, the most grave problem, no support for prepared statements. In 2019 it cannot be excused. It's like starting your own bank and storing the money on the backyard. You will go bankrupt yourself and ruin ...


Top 50 recent answers are included