PHP with REST web services -


there rest web service exists. there 1 user: admin. once enter admin credentials while logging in, token generated internally security purposes , once token validated, suppose enter homepage.

i have added php part of code simple login have done already. know how , add , invoke token part authentication, based on above situation.

<?php session_start(); /* starts session */  /* check login form submitted */     if(isset($_post['submit'])){     /* define username , associated password array */     $logins = array('admin' => 'kcuf94!');      /* check , assign submitted username , password new variable */     $username = isset($_post['username']) ? $_post['username'] : '';     $password = isset($_post['password']) ? $_post['password'] : '';      /* check username , password existence in defined array */             if (isset($logins[$username]) && $logins[$username] == $password){         /* success: set session variables , redirect protected page  */         $_session['userdata']['username']=$logins[$username];         header("location:homepagedisplay.php");         exit;     } else {         /*unsuccessful attempt: set error message */         $echo="<span style='color:black'>invalid login details</span>";     } } ?> 


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -