This is my start page
<?php
require 'vendor/slim/slim/Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->get('/login', function () {
include 'login.php';
});
$app->post('/login/login_authenticate', function () {
include 'login_authenticate.php';
});
$app->post('/login/login_authenticate/dash', function () {
include 'dashboard.php';
});
$app->run();
?>
This is my authentication page. The if condition is working fine, but the page is not redirecting. I ve checked the conditions .
<?php
error_reporting(0);
$app = new \Slim\Slim();
$body = $app->request->getBody();
$value = json_encode($_POST);
$json = json_decode($value, true);
$uname = $json['username'];
$psswrd = $json['password'];
$host = "localhost";
$username = "root";
$password = "";
$db_name = "resource";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("resource")or die("cannot select DB");
$sql = "SELECT * FROM user_master WHERE User_Name='$uname' && ` Pass_word='$psswrd'";`
$result_set = mysql_query($sql);
while($row = mysql_fetch_array($result_set)) {
$db_username= $row['User_Name'] ;
$db_password= $row['Pass_word'] ;
}
if ($db_username==$uname &&$db_password==$psswrd ) {
$app->redirect("login/login_authenticate/dash");
} else {
die("User name doesnt match");
}
$app->run();
?>
Please help me fix this. Thanks in advance.