Our social:

Latest Post

Wednesday

User authentication using AngularJS, PHP, MySQL

1) D:\xampp\htdocs\app

    ->app
        ->css
            ->app.css
        ->data
            ->check_session.php
            ->destroy_session.php
            ->user.php
        ->img
        ->js
            ->controllers
                ->homeCtrl.js
                ->loginCtrl.js
            ->directives
                ->loginDrc.js
            ->services
                ->loginService.js
                ->sessionService.js
            ->app.js
        ->lib
            ->angular
                ->angular.js
                ->angular.min.js
                ->angular-route.js
                ->angular-resource.js
        ->partials
            ->tpl
                ->login.tpl.html
            ->home.html
            ->login.html
        ->index.html
       
Source code
-----------
index.html
----------
<!doctype html>
<html lang="en" ng-app="myApp">
<head>
  <meta charset="utf-8">
  <title>My AngularJS App</title>
  <link rel="stylesheet" href="css/app.css"/>
</head>
<body>
  <div ng-view></div>
  <!-- In production use:
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
  -->
  <script src="lib/angular/angular.js"></script>
  <script src="lib/angular/angular-route.js"></script>

  <script src="js/app.js"></script>

  <script src="js/directives/loginDrc.js"></script>

  <script src="js/controllers/loginCtrl.js"></script>
  <script src="js/controllers/homeCtrl.js"></script>
 
  <script src="js/services/loginService.js"></script>
  <script src="js/services/sessionService.js"></script>
</body>
</html>
----------
partials/login.html
----------
<div class="wrap" login-directive>Call directive login form</div>


----------
partials/home.html
----------
<div class="wrap">
    <p>{{txt}}</p>
    <a href="" ng-click="logout()">Logout</a>
</div>

-----------
partials/tpl/login.tpl.html
-----------
<div class="bs-example">
<form role="form" name="form1">
  <div class="form-group">
      <p>Welcome : <span>{{user.mail}}</span></p>
    <label for="exampleInputEmail1">Mail</label>
    <input type="text" placeholder="Enter name"
    class="form-control" ng-model="user.mail" required>
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Password</label>
    <input type="password" placeholder="Password" id="exampleInputPassword1" class="form-control" ng-model="user.pass" required>
  </div>
  <button class="btn btn-default" type="submit" ng-click="login(user)" ng-disabled="form1.$invalid">Submit</button>
  <p>{{msgtxt}}</p>
</form>
</div>

----------
data/check_session.php
----------

<?php
    session_start();
    if( isset($_SESSION['uid']) ) print 'authentified';
?>

----------
data/destroy_session.php
----------
<?php
    session_start();
    if( isset($_SESSION['uid']) ) print 'authentified';
?>

----------
data/user.php
----------
<?php
    $user=json_decode(file_get_contents('php://input'));  //get user from
    if($user->mail=='elgaliamine@gmail.com' && $user->pass=='1234')
        session_start();
        $_SESSION['uid']=uniqid('ang_');
        print $_SESSION['uid'];
?>
---------
js/app.js
---------
'use strict';
// Declare app level module which depends on filters, and services
var app= angular.module('myApp', ['ngRoute']);
app.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'loginCtrl'});
  $routeProvider.when('/home', {templateUrl: 'partials/home.html', controller: 'homeCtrl'});
  $routeProvider.otherwise({redirectTo: '/login'});
}]);


app.run(function($rootScope, $location, loginService){
    var routespermission=['/home'];  //route that require login
    $rootScope.$on('$routeChangeStart', function(){
        if( routespermission.indexOf($location.path()) !=-1)
        {
            var connected=loginService.islogged();
            connected.then(function(msg){
                if(!msg.data) $location.path('/login');
            });
        }
    });
});

-----------
js/controllers/homeCtrl.js
-----------
'use strict';

app.controller('homeCtrl', ['$scope','loginService', function($scope,loginService){
    $scope.txt='Page Home';
    $scope.logout=function(){
        loginService.logout();
    }
}])
-----------
js/controllers/loginCtrl.js
-----------
'use strict';

app.controller('loginCtrl', ['$scope','loginService', function ($scope,loginService) {
    $scope.msgtxt='';
    $scope.login=function(data){
        loginService.login(data,$scope); //call login service
    };
}]);
-----------
js/directives/loginCtrl.js
-----------


'use strict';
app.directive('loginDirective',function(){
    return{
        templateUrl:'partials/tpl/login.tpl.html'
    }

});
-----------
js/services/loginService.js
-----------
'use strict';
app.factory('loginService',function($http, $location, sessionService){
    return{
        login:function(data,scope){
            var $promise=$http.post('data/user.php',data); //send data to user.php
            $promise.then(function(msg){
                var uid=msg.data;
                if(uid){
                    //scope.msgtxt='Correct information';
                    sessionService.set('uid',uid);
                    $location.path('/home');
                }          
                else  {
                    scope.msgtxt='incorrect information';
                    $location.path('/login');
                }                  
            });
        },
        logout:function(){
            sessionService.destroy('uid');
            $location.path('/login');
        },
        islogged:function(){
            var $checkSessionServer=$http.post('data/check_session.php');
            return $checkSessionServer;
            /*
            if(sessionService.get('user')) return true;
            else return false;
            */
        }
    }

});
-----------
js/services/sessionService.js
-----------

'use strict';

app.factory('sessionService', ['$http', function($http){
    return{
        set:function(key,value){
            return sessionStorage.setItem(key,value);
        },
        get:function(key){
            return sessionStorage.getItem(key);
        },
        destroy:function(key){
            $http.post('data/destroy_session.php');
            return sessionStorage.removeItem(key);
        }
    };
}])

Tuesday

all company balance check code

every mobile_code know

Basic questions asked in interview for SEO job

1. Who is Matt Cutts?

    Matt Cutts is the head of Google's web spam team.

2. What is Google Sandbox in SEO?

    Google Sandbox is an imaginary area where new and less authoritative sites are kept for a specified time period until they establish themselves of being displayed on the search results. It happens by building too many links within a short period of time.

3. What is the difference between On page SEO and Off page SEO?

    On page SEO means optimizing your website and making changes on title, meta tags, site structure,
 site content, solving canonicalization problem, managing robots.txt etc.
Off page optimization means optimizing your web presence which involves backlink building and
social media promotion.

4. Does Google uses keyword tags?

    No, Google does not make use of keyword tags.



5.What is 301 redirect?

    It is a method of redirecting user from the old page url to the new page url. 301 redirect is a permanent redirect and is helpful in passing the link juice from the old url to the new url.

6. What is the difference between “White Hat SEO” and “Black Hat SEO”

    Black Hat SEO refers to the use of aggressive SEO strategies, techniques and tactics that focus

only on search engines and not a human audience, and usually does not obey Google webmaster
guidelines. For example, keyword stuffing, invisible text, doorway pages, sneaky redirects etc are
various examples of black hat SEO techniques.
In comparison to this when the SEO campaign is done with Google webmaster approved guidelines that's
called white hat SEO. While in short run the Black hat has big success it will attract penalties
 which can go up to blacklisting, dropping the SERP and dropping the site from Google indexing etc.

6. What are the limitations of title and description tags?

    Title tag can be between 66-70 characters and Meta description tag can be between 160-170 characters.

7.What are webmaster tools?

    Webmaster tools is a free service by Google from where we can get free Indexing data,
 backlinks information, crawl errors, search queries, CTR,
website malware errors and submit the XML sitemap.

8. What is robots.txt?

    Robots.txt is a text file used to give instructions to the search engine crawlers about the c
aching and indexing of a webpage, domain, directory or a file of a website.

9. Can you write HTML Code by hand? / What do you understand by Frames in HTML?

    A frame is a HTML technique which divides the content of a page onto several parts. Search engines see Frames as completely different pages and as such Frames have a negative impact on Seo. We should avoid the usage of Frames and use basic HTML instead.

10. How to know that my Web Site is banned by Search Engines?

    Following are the situations:

a)If your domain is not coming in the domain name search.

b)After a long time your domain is not coming on search engines

c)Your server logs register no visit from search engines/engine.

d)You lost your keyword positions and visits dramatically in fraction of days.

11. What is keyword density ?

    Keyword density make your content stand out in crowd.Here is important formula of keyword density

(total no of keyword/ total no of words in your article)  *100

12. Which Important factors makes ON Page Optimization better ?

    In On Page Optimization there are some important factors like

Title Tag

Meta tag

Keyword

Sitemap

Images

Internal linking

Bread crimp.

13. How many types of Meta Tags and their characters limits ?

    Two types meta tags in SEO

-Description Meta tag (150 characters limits)

-Keyword Meta tag (200 characters limits)

14. What SEO tools do you use ?

    Google webmaster tools, Google analytic, keyword research, Alexa, open site explorer.

15. Why does Google rank Wikipedia for so many topics?

    Wikipedia is an established authority! As such, it is referenced by huge numbers of other documents with relevant text associated with links back to Wikipedia.

If you have little bit of experience, here are the frequently asked questions for you:

1. What was your exact job profile in your previous company?

    Provide a suitable explanation about your job profile which would include your job responsibilities and the amount of work you have handled so far.

2.How will you increase the Pagerank of a page?

    By building more backlinks from authority sites and high page rank webpages.

3. How will you check the number of backlinks of your competitors site?

    With the help of the link operator on Google and by using various external tools like Alexa, Backlink Watch , Open Site Explorer,Backlink finder etc.

4.What is the difference between Spiders, Robots and Crawlers?

    A spider, also known as a robot or a crawler, is a program that follows, or "crawls", links throughout the Internet, grabbing content from sites and adding it to search engine indexes.

5. What is the difference between SEO and SEM?

    SEO stands for Search Engine Optimization while SEM stands for Search Engine Marketing. SEO provides organic traffic to a website with the help of search engines while SEM involves the use of Google adwords and other paid channels of advertising.

Useful Articles

      Want to Focus on Look and Feel Of your Website....
      Which CMS is right for you...?
      What is Google Panda and Penguine Updates
      Google SEO updates of 2013
      EVERY WEB DEVELOPER SHOULD KNOW.. SEO

Popular Articles

    SEO interview questions and answers for Freshers and experienced candidates
    Freshers Latest PHP Technical Interview Questions & Answers
    How should a website be on top page of Google - First Steps for SEO
    Top Reasons Why Websites Need SEO
    Freshers PHP Technical Interview Questions & Answers
    Difference between Static website and Dynamic website