Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'config.php';
- //Konekcija na bazu
- $con = mysql_connect($hostname,$db_username,$db_password);
- if (!$con)
- {
- die('Neuspjela konekcija: ' . mysql_error());
- }
- mysql_select_db($db_name, $con);
- //Prijava korisnika
- $username= $_POST["userid"];
- $password= $_POST["password"];
- if (empty($username) || empty($password)){
- die(header("location: index.php?pristup=greska"));
- }
- $sql = mysql_query("select password from korisnici where username ='".$username."'");
- $result = mysql_fetch_array($sql);
- if(!$result)
- die(header("location: index.php?pristup=greska"));
- if ($password != $result['password']){
- die(header("location: index.php?pristup=greska"));
- }
- $sql_admin = mysql_query("select PacijentID from korisnici where username ='".$username."'");
- $result_admin = mysql_fetch_array($sql_admin);
- session_start();
- $_SESSION['korisnik'] = $username;
- if ($result_admin['PacijentID'] == '0'){
- header("location: administrator/index.php");
- }else{
- header("location: main.php?korisnik=$username");
- }
- mysql_close($con);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement