PHP Security Functions htmlspecialchars md5 Quiz — 15 Questions
PHP Security Quiz हिंदी में — htmlspecialchars, strip_tags, addslashes, md5, sha1, password_hash से जुड़े XSS, SQL Injection prevention के 15 important questions। BCA, MCA, BSc students के लिए।
-
htmlspecialchars() function का मुख्य काम क्या है?
- Special HTML characters को entities में convert करके XSS attacks से बचाना
- String को uppercase में convert करना
- Database से data fetch करना
- String को encrypt करना
-
htmlspecialchars() में < character किसमें convert होता है?
- <
- >
- &
- "
-
PHP security का "Rule #1" क्या कहता है?
- User input को HTML में display करते समय हमेशा htmlspecialchars() use करो
- हमेशा md5() से passwords hash करो
- हमेशा addslashes() से SQL queries बनाओ
- कभी भी user input validate मत करो
-
htmlspecialchars_decode() और html_entity_decode() में क्या फर्क है?
- htmlspecialchars_decode() सिर्फ 5 special characters decode करता है; html_entity_decode() सभी HTML entities decode करता है
- दोनों बिल्कुल same काम करते हैं
- htmlspecialchars_decode() सभी entities decode करता है
- html_entity_decode() सिर्फ numbers के लिए है
-
strip_tags() function क्या करता है?
- String से सभी HTML और PHP tags हटा देता है
- String को HTML entities में convert करता है
- String को hash करता है
- String को database में save करता है
-
strip_tags() में whitelist कैसे दी जा सकती है?
- strip_tags($html, '<b><i><p>') या PHP 8+ में array से
- Whitelist देना possible नहीं है
- सिर्फ single tag allow कर सकते हैं
- whitelist() नाम का अलग function use करना पड़ता है
-
strip_tags() और htmlspecialchars() में मुख्य फर्क क्या है?
- strip_tags() tags हटाता है; htmlspecialchars() characters को escape करता है (हटाता नहीं)
- दोनों बिल्कुल same काम करते हैं
- strip_tags() सिर्फ numbers के लिए है
- htmlspecialchars() tags हटाता है, strip_tags() escape करता है
-
addslashes() function के बारे में article में क्या warning दी गई है?
- SQL injection prevent करने के लिए addslashes() पर्याप्त नहीं — PDO Prepared Statements use करो
- addslashes() सबसे secure तरीका है SQL के लिए
- addslashes() को कभी use नहीं करना चाहिए
- addslashes() सिर्फ passwords के लिए है
-
md5() हैश function कितने character का hex output देता है?
- 32 characters
- 40 characters
- 64 characters
- 16 characters
-
sha1() हैश function कितने character का hex output देता है?
- 40 characters
- 32 characters
- 64 characters
- 20 characters
-
Passwords store करने के लिए md5() या sha1() use करना क्यों गलत है?
- ये बहुत fast हैं इसलिए hackers rainbow tables और brute force से crack कर सकते हैं
- ये सिर्फ numbers के साथ काम करते हैं
- ये PHP के पुराने versions में deprecated हैं
- ये string की length नहीं बता सकते
-
Passwords को securely hash और verify करने के लिए कौन से functions use करने चाहिए?
- password_hash() और password_verify()
- md5() और sha1()
- addslashes() और stripslashes()
- htmlspecialchars() और strip_tags()
-
md5() और sha1() का सही (correct) use case क्या है?
- File integrity check और cache keys बनाना
- User passwords store करना
- Credit card numbers encrypt करना
- Session tokens generate करना for login
-
Gravatar image URL बनाने के लिए article में किस function का उपयोग दिखाया गया है?
- md5(strtolower(trim($email)))
- sha1($password)
- password_hash($email, PASSWORD_BCRYPT)
- htmlspecialchars($email)
-
Secure User Registration के Combined Example में steps का सही order क्या है?
- trim → strip_tags → validate → password_hash → PDO insert → htmlspecialchars display
- password_hash → trim → PDO insert → validate → strip_tags
- htmlspecialchars display → validate → trim → password_hash
- PDO insert → trim → strip_tags → validate → password_hash