Issue
I am a newbie to the Web-service area.
My question is I am using web service for login. When user click on login button, I have to call web-service and if web-service give me success reply then user go to home page.
I am confused with what to do; whether use on-click method means user click on login button call Javascript function which having call for web-service or any other thing available in PHP i.e. how to call in PHP when user click on login button, because after success I have to transfer user on homepage.
Then which method I have to follow:
- use JavaScript call for web service OR
- use PHP call for web-service but I don't know how to call when user click on button
because i want set session for user , when i use java-script function then how the userid is pass to php for storing in the session.
i am using codeigniter
Solution
I am not a php guy but this might help you make a better decision: As you said you have two options:
Option 1: (Bad Idea) 1. User Clicks login button 2. A JavaScript method is called, which makes a Ajax Call to authentication service 3. If authenticated, you redirect user to Home page
Option 2: 1. On Login click, you take the user to a controller. 2. Controller calls authentication 3. Responses with a redirect if successful.
Now why i say option 1 is bad idea because doing it in JS has potential threat, as some one can bypass the authentication to get access to login.
So doing it as you said with a 'php' call is a better idea.
Answered By - Shaunak Answer Checked By - Pedro (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.