Похожие чаты

$Result = $connection->query("SELECT * FROM users WHERE email='$email'"); I'm trying to

echo out first_name from the database after using the command above but it's not working.
How should the code be?

32 ответов

6 просмотров

It is not safe, use PDO. First see a tutorial Pdo, it's sample. After: https://stackoverflow.com/questions/51240891/select-sql-row-using-pdo-with-where-statement

My email is lol; drop table users;

Пользователь-63429 Автор вопроса
Пользователь 63429
What do you mean

Your line of code is vulnerable to an attack commonly known as 'SQL injection'. Well, unless you escape $email behind the screen. You ask a user to type in email, he types lol; drop table users; It turns into SELECT * FROM users WHERE email='lol; drop table users; '"); SQL sees it as 3 different lines. 1st and 3rd would give errors, second will drop the table called users :D

Пользователь-63429 Автор вопроса
Alignant
Your line of code is vulnerable to an attack commo...

I have done email validation with JavaScript

Пользователь 63429
I have done email validation with JavaScript

That's better, but it's still not secure enough. If it's a post form, someone can use a tool like insomnia to send a post request directly =)

Пользователь 63429
How can I solve it then

Yes, validate it on server as @Silas_229 said.

Пользователь 63429
screenshot

Never Trust The User, the front end validation is only mean to improve the user experience.

Пользователь-63429 Автор вопроса
Alignant
Your line of code is vulnerable to an attack commo...

Could validation using JavaScript and mysqli_real_escape_string project my website from SQL injection?

Пользователь 63429
screenshot Could validation using JavaScript and mysqli_real_...

Always do server side validation , front end can be easily change

Пользователь-63429 Автор вопроса
Пользователь 63429
🤔. How is that possible

Easiest option will be to remove class/id frm the input which you want yo bypass becuase most of JS validation are given through class/id only.. Another could be to look at the xhr request and send same request from Postman (if target is not using csrf)

Пользователь 63429
screenshot Could validation using JavaScript and mysqli_real_...

I don't trust client side form validation because can be by passed easily, it is better to use both.

Jeegar
Even Tester too

😂😂😂😂😂😂😂

Пользователь-63429 Автор вопроса
Rajesh
Use prepare statement

Hello @Jeegar26 . I changed the authentication system to the server side. I used mysqli_real_escape string and prepared statements.

Пользователь-63429 Автор вопроса
Jeegar
Always do server side validation , front end can ...

I have now done the backend form validation and also worked on countering SQL injection.

Пользователь-63429 Автор вопроса
Пользователь-63429 Автор вопроса
Dern
😍

👍😁

Похожие вопросы

Обсуждают сегодня

Какой-то там пердун в 90-х решил, что есть какая-то разная типизация. Кого вообще это волнует?
КТ315
49
Hi. Do we have a raid bot? Why nobody doing raids on X? Even RH mentioned this and nobody paying attention...whats the channel for hex memes? If mods cant run raids just insta...
H
31
Подскажите, а есть vault lite или ченить такое?) А то нужен вольт для похода в вольт, но весит он ~500 мб) как-то многовато для парочки запросов ))
Alexandr Orloff
17
блеать, почему так?? где в роутере это исправляется?
Арсен Маньяков 🇦🇲
16
void terminal_scroll() { memmove(terminal_buffer, terminal_buffer + VGA_WIDTH, buffer_size - VGA_WIDTH); memset(terminal_buffer + buffer_size - VGA_WIDTH, 0, VGA_WIDTH); ...
Егор
47
🌊 Ocean Nodes Dashboard Update 🚀 Hey, Oceaners! First off, a massive round of applause 👏to all of you for the amazing engagement since we launched Ocean Nodes. In just a few ...
KreigDK | Never DM first🌊
3
Всем привет! Подскажите, пожалуйста, в чем ошибка? Настраиваю подключение к MySQL. Либы лежат рядом с exe. Все как по "учебнику"
Евгений
16
А можете как-то проверить меня по знаниям по ассемблеру?
A A
132
Здравствуйте! У меня появилась возможность купить книгу "Изучай Haskell во имя добра!". Но я где-то слышал, что эта книга устарела. Насколько это правда??
E
22
люди, которые используют flameshot, к вам вопрос. Можно-ли поставить хоткей на создание скриншота? В программе есть отдел "горячие клавиши", но там все для редактирования, скр...
ThunDer104
11
Карта сайта