-
Notifications
You must be signed in to change notification settings - Fork 1
/
promjenalozinke.php
45 lines (35 loc) · 1.09 KB
/
promjenalozinke.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*include_once 'baza.class.php';
include_once 'greske.php';
$email = $_GET['email'];
if(isset($_POST['btnlozinkazahtjev'])){
$baza = new baza();
$baza->spojiBaza();
$promjenaLozinka = $_POST['novalozinka'];
$upit = "select email from korisnik where email = '$email'";
if ($promjena = $baza->selectUpit($upit)){
$nova = md5($promjenaLozinka);
if (!is_null($promjena)){
$uspEmail = $promjena->fetch_array();
echo $uspEmail[0];
$upit2 = "UPDATE korisnik SET sifra = '$nova' WHERE email = '$email'";
if($baza->ostaliUpiti($upit2)){
}
else{
trigger_error("Greska prilikom upisa nove lozinke :( ", E_USER_ERROR);
}
}
else{
trigger_error("Email nepostoji ", E_USER_ERROR);
}
}
}*/
function novaSifra() {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < 10; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}
?>