1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ierofanga [76]
4 years ago
8

Write a php program that checks the elements of a string array named $passwords. use regular expressions to test whether each el

ement is a strong password. for this exercise, a strong password must have at least one number, one lowercase letter, one uppercase letter, no spaces, and at least one character that is not a letter or number. (hint: use the [^0-9a-za-z] character class.) th e string should also be between 8 and 16 characters long.
Computers and Technology
1 answer:
Naya [18.7K]4 years ago
6 0

<?php

function pass_strong($candidate) {

   if (!preg_match_all('$\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S [\W])\S*$', $candidate))

       return FALSE;

   return TRUE;

}

/*

   Explaining

   $\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$

   $ = string beginning

   \S* = characters set

   (?=\S{8,}) =  with length atleast 8

   (?=\S*[a-z]) = with at least 1 letter that is lowercase

   (?=\S*[A-Z]) = with at least 1 letter that is uppercase

   (?=\S*[\d]) = with at least 1 number

   (?=\S*[\W]) = with at least 1 special character

   $ = string end

*/

$Passwords = 'password01';

if(pass_strong($Passwords))

   echo "$Passwords is a strong password<br />";

else echo "$Passwords is NOT a strong password<br />";

?>

You might be interested in
Which formal security-related process should take place at the beginning of the code creation project? Group of answer choices R
Igoryamba

Answer:

Risk assessment, Input validation and Output validation.

Explanation:

Software development life cycle, SDLC, is a systematic process a software being created must pass through or follow, from the stage of conception to death of the application.

There are various processes that occurs at the beginning of SDLC, a few of the activities are risk management, input and output validation.

Risk management is used to determine the feasibility, usefulness and profitability to cost of the software before development. The input and output validation is for security control access to the data of the software.

3 0
3 years ago
In computer science what are the methods used to protect the information stored by a piece of software called?
Nezavi [6.7K]

Answer:

cryptography

Explanation:

cryptography

In computer science, cryptography refers to secure information and communication techniques derived from mathematical concepts and a set of rule-based calculations called algorithms, to transform messages in ways that are hard to decipher

3 0
3 years ago
In what decade was photography invented? the 1800s the 1820s the 1840s the 1860s
frutty [35]

Answer:

In the year 1820's

It is B

4 0
3 years ago
A web crawler uses a search _______ to traverse the web.​
aliina [53]
<span>A web crawler uses a search algorithm to traverse the web.
</span>The web crawler is responsible for the process of browsing the net. It systematically browses the World Wide Web<span> by looking at the keywords in the pages, the kind of content each page has and the links, and then return this information to the search engine.</span>
The process is called Web crawling or spidering.
7 0
3 years ago
Consider the following code:
ICE Princess25 [194]

Answer: 3

Explanation:

Because X = 18 and our condition given to the code if > and < which do not match with the input so it prints 3.

4 0
3 years ago
Other questions:
  • Radio waves pros and cons
    10·2 answers
  • What is the purpose of look up tables in spreadsheet software apex
    13·1 answer
  • Physical activity such as sports or even a brisk walk can help reduce
    7·2 answers
  • Can someone buy me eddie van der tabs???
    13·1 answer
  • What is one reason that writing effective messages is so important
    11·2 answers
  • How to count how many uppercase letters in sentence in python?
    8·1 answer
  • How to do row of circles in phyton programming ?
    11·1 answer
  • Cómo surge y cuál es el objetivo del observatorio de radio y televisión
    11·1 answer
  • 1. Many photographs tell a story. What is the story of this photograph? What is happening? Where is the photograph taken? Why is
    6·1 answer
  • Which statement best describes one reason why assembly language is easier
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!