Login sistemom $_SESSION problem

Pozdrav, Imam problem sa login sistem, izgleda da je problem u $_SESSION-ima.

login.php

<?php include('_inc/_database.inc.php'); ?>
Prijava @import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400,700); *{margin:0;padding:0;}
body{ background:#e2e2e2;
  font-family:'Open Sans',sans-serif;
}

.button{
  width:100px;
  background:#3399cc;
  display:block;
  margin:0 auto;
  margin-top:1%;
  padding:10px;
  text-align:center;
  text-decoration:none;
  color:#fff;
  cursor:pointer;
  transition:background .3s;
  -webkit-transition:background .3s;
}

.button:hover{
  background:#2288bb;
}
.cent {position:absolute; top:-150px; bottom:0; left:0; right:0;
		margin:auto; height:240px; width:70%;}
#login{
  width:400px;
  margin:0 auto;
  margin-top:8px;
  margin-bottom:2%;
  transition:opacity 1s;
  -webkit-transition:opacity 1s;
}

#login h1{
  background:#3399cc;
  padding:20px 0;
  font-size:140%;
  font-weight:300;
  text-align:center;
  color:#fff;
}

form{
  background:#f0f0f0;
  padding:6% 4%;
}

input[type="text"],input[type="password"]{
  width:91%;
  background:#fff;
  margin-bottom:4%;
  border:1px solid #ccc;
  padding:4%;
  font-family:'Open Sans',sans-serif;
  font-size:95%;
  color:#555;
}

input[type="submit"]{
  width:100%;
  background:#3399cc;
  border:0;
  padding:4%;
  font-family:'Open Sans',sans-serif;
  font-size:100%;
  color:#fff;
  cursor:pointer;
  transition:background .3s;
  -webkit-transition:background .3s;
}

input[type="submit"]:hover{
  background:#2288bb;
}
</style>
<div class="cent">
	<div id="login">
	  <h1>Prijava</h1>
		  <form action="login.php" method="POST">
		    <input type="text" name="username" placeholder="Korisničko ime..." />
		    <input type="password" name="password" placeholder="Lozinka..." />
		    <input type="submit" name="prijava" value="Prijava" />
		  </form>
		  <?php
		  if(isset($_POST['prijava'])){
		  	$username = $_POST['username'];
		  	$password = $_POST['password'];

		  	//Protect MYSQL Injection
		  	$username = stripslashes($username);
		  	$password = stripslashes($password);
		  	$username = mysql_real_escape_string($username);
		  	$password = mysql_real_escape_string($password);
		 	$sql = "SELECT * FROM korisnici WHERE ime='$username' AND lozinka='$password'";
		  	$result = mysql_query($sql) or die ('Unable to run query:'.mysql_error());
		  	$count=mysql_num_rows($result);
			  	if($count==1){
			  		$_SESSION['username'];
			  		$_SESSION['password'];
			  		header("Location: index.php");
			  	}else {
			  		echo 'Pogresni podatci.';

			  	}
			  }
		  ?>
	</div>
</div>

index.php

<?php

session_start();
if(!isset($_SESSION[‘username’])){
header(“Location: login.php”);
}
?>

I kod index.php ima h1 tag ‘Login uspjesan’

   if($count==1){
	  		$_SESSION['username'] = $username;
	  		$_SESSION['password'] = $password;
	  		header("Location: index.php");
	  	}else {
	  		echo 'Pogresni podatci.';

	  	}

Hvala, nasao sam vec ranije rijesenje ali eto.


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Profit Monkey