Website Development Prices

Friday, June 24, 2016

Preuzimanje podataka iz kontrole tipa password (Retrieving password data)

Kontrole za lozinke su HTML kontrole koje su korisne za unos lozinke i drugih osetljivih podataka. Iz ugla PHP, one se ponasaju kao polja za unos teksta, a iz ugla korisnika, prikazuju se tacke (en. bullet points) kada korisnik unosi tekst.

Primer: trazicemo od korisnika da unese lozinku.

HTML kod

<!DOCTYPE html>
<html>
<head>
<title>HTML forme</title>
</head>


<body>
<h1>Upotreba kontrola za lozinke</h1>

<form method="post" action="php-lozinka.php">
<h3>Koja je vasa lozinka?</h3>
<br />
<input name="lozinka" type="password">

<br /><br />
<input type="submit" value="Posaljite">
</form>
</body>

</html>

Rezultat:





Lozinku mozete procitati u PHP kodu uz pomoc $_POST["lozinka"].

PHP kod:

<!DOCTYPE html>
<html>
<head>
<title>HTML forme</title>
</head>

<body>
<h1>Preuzimanje podataka iz kontrola za lozinke</h1>

Vasa lozinka je

<?php
echo $_POST["lozinka"];
?>

</body>

</html>

Rezultat:



Controls for passwords are HTML controls that are useful for entering passwords and other sensitive data. From the perspective of PHP, they behave like text fields, and from the perspective of the user, are displayed in points (bullet points) when the user enters text.

Example: we will ask the user to enter a password.

HTML code

<!DOCTYPE html>
<html>
<head>
<title>HTML forms</title>
</head>

<body>
<h1>Using password data</h1>

<form method="post" action="php-password.php">
<h3>What is your password?</h3>
<br />
<input name="mypassword" type="password">

<br /><br />
<input type="submit" value="Send">
</form>
</body>

</html>

Result




The password can be read in the PHP code with the help of $_POST["mypassword"].

PHP code:

<!DOCTYPE html>
<html>
<head>
<title>HTML forms</title>
</head>

<body>
<h1>Retrieving data from password controls</h1>

Your password is

<?php
echo $_POST["mypassword"];
?>

</body>

</html>

Result:



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.