-
Notifications
You must be signed in to change notification settings - Fork 0
/
registracija.php
45 lines (38 loc) · 1.36 KB
/
registracija.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
45
<?php
require_once("konekcija.php");
$ime=""; $prezime=""; $username=""; $password="";
if (isset($_POST['ime']))
{
if ($_POST['ime']=="") { header("Location: registracija.html"); die(); }
$ime=popraviString($veza, $_POST['ime']);
}
if (isset($_POST['prezime']))
{
if ($_POST['prezime']=="") { header("Location: registracija.html"); die(); }
$prezime=popraviString($veza, $_POST['prezime']);
}
if (isset($_POST['username']))
{
if ($_POST['username']=="") { header("Location: registracija.html"); die(); }
$username=popraviString($veza, $_POST['username']);
}
if (isset($_POST['password']))
{
if ($_POST['password']=="") { header("Location: registracija.html"); die(); }
$password=md5(popraviString($veza, $_POST['password']));
}
$slika="slikeProfila/default.png";
if ($_FILES && isset($_FILES['slika']['name']))
switch($_FILES['slika']['type'])
{
case "image/png": case "image/jpeg": case "image/gif": case "image/tiff": case "image/bmp":
$slika="slikeProfila/$username.png";
move_uploaded_file($_FILES['slika']['tmp_name'], $slika);
break;
}
$upit="INSERT INTO korisnici(ime,prezime,username,password,slika) VALUES('$ime','$prezime','$username','$password','$slika')";
//echo $upit;
$rez=mysqli_query($veza, $upit);
if (!$rez) { header("Location: greske.php?tip=2"); die(); }
header("Location: login.php"); die();
?>