require_once 'scripts/database.php'; //session_start(); $db = new Database(); $db->connectToDB(); if ($db->checkIfConnected()) { $username = $_POST['username']; $password = $_POST['password']; if (isset($username) && isset($password)) { if ($username == "") { echo "Enter username"; } else { if ($password == "") { echo "Enter password"; } else { if ($db->checkLogin($username, $password)) { echo "Logged in"; //$_SESSION['user'] = $username; } else { echo "invalid login"; } } } } } else { echo "not connected"; } //print_r($_SESSION); ?> <!doctype html> <html class="no-js" lang="">
<?php include_once 'classes/database.php'; $login_error = false; if (isset($_POST['btn_login_user'])) { $db = new Database(); $info = array('login_username' => $_POST['username'], 'login_password' => $_POST['password']); $response = $db->checkLogin($info); if ($response['status'] == 200) { header("location:{$response['redirect_url']}"); } else { $login_error = true; } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Chanchal Garments</title> <link href="assets/css/bootstrap.min.css" rel="stylesheet"> <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet"> <link href="assets/css/animate.css" rel="stylesheet"> <link href="assets/css/style.css" rel="stylesheet">
<?php if (!empty($_POST['username']) && !empty($_POST['password'])) { require_once 'class.database.php'; $db = new Database(); $chk['key'] = $db->checkLogin($_POST['username'], $_POST['password']); $chk['statuscode'] = $chk['key'] ? 100 : 102; print json_encode($chk); } else { print json_encode(array('statuscode' => 101)); }