Click here to Skip to main content
15,312,540 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
php (check-login.php)
if (
$_POST['username'] === '1234' &&
$_POST['password'] === '1234' ) {
echo 'correct';
} else {
echo 'wrong';



<!DOCTYPE html>
<html lang="en">

   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  	<script src=""></script>
    <link href="" rel="stylesheet">
   <link rel="stylesheet" href="css/bootstrap.css" id="bscss">
   <link rel="stylesheet" href="css/app.css" id="maincss">
   <style type="text/css">
		.login-form {
			max-width: 300px;
			margin: 0 auto;
		#inputUsername {
		  margin-bottom: -1px;
		  border-bottom-right-radius: 0;
		  border-bottom-left-radius: 0;
		#inputPassword {
			border-top-left-radius: 0;
  			border-top-right-radius: 0;

 <body ng-app="postExample" ng-controller="PostController as postCtrl">
   <div class="wrapper">
      <div class="block-center mt-xl wd-xl">
         <div class="panel panel-dark panel-flat">
            <div class="panel-heading text-center">
               <a href="#">
                  <img src="img/logo.png" alt="Image" class="block-center img-rounded">
            <div class="panel-body">
               <p class="text-center pv">SIGN IN TO CONTINUE.</p>
              <form class="login-form" ng-submit="postCtrl.postForm()">
		<label for="inputcompanyname" class="sr-only">companyname</label>
		<input type="text" id="inputcompanyname" class="form-control" placeholder="companyname" required autofocus ng-model="postCtrl.inputData.companyname">
        <label for="inputUsername" class="sr-only">Username</label>
        <input type="text" id="inputUsername" class="form-control" placeholder="Username" required autofocus ng-model="postCtrl.inputData.username">
		<label for="inputPassword" class="sr-only">Password</label>
        <input type="password" id="inputPassword" class="form-control" placeholder="Password" required ng-model="postCtrl.inputData.password">
		<div class="alert alert-danger" role="alert" ng-show="errorMsg">{{errorMsg}}</div>
        <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
         <div class="p-lg text-center">
            <span>VCIDEX @;</span>
            <span>Bring IT Mass</span>
	angular.module('postExample', [])
	.controller('PostController', ['$scope', '$http', function($scope, $http) {
		this.postForm = function() {
			var encodedString = 'username=' +
				encodeURIComponent(this.inputData.username) +
				'&password=' +
				method: 'POST',
				url: 'check-login.php',
				data: encodedString,
				headers: {'Content-Type': 'application/x-www-form-urlencoded'}
			.success(function(data, status, headers, config) {
				if ( data.trim() === 'correct') {
					window.location.href = 'success.html';
				} else {
					$scope.errorMsg = "Login not correct";
			.error(function(data, status, headers, config) {
				$scope.errorMsg = 'Unable to submit form';


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900