Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5989043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:02:40+00:00 2026-05-22T23:02:40+00:00

Hi guys I am trying to set up a Login form in my android

  • 0

Hi guys I am trying to set up a Login form in my android App.

This is how things actually work: the user enters his username and password in two EditText, this informations are sended to a PHP script through POST, the PHP scrip queries the DB and returns 1 (CORRECT USER AND PASS!) or 0 (NOT CONNECTED, INVALID USER OR PASS).

The “problem” is that now I’m doing it this way:

<?php
  /../
  if(conneted == true){
     echo 1;
  } else {
     echo 2; 
  }
?>

In my android App I obtain the HttpResponse that contains 1 or 0.

But is this safe? Using echo is the best way to obtain an answer from the script?

Thank you!
Marco

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:02:41+00:00Added an answer on May 22, 2026 at 11:02 pm

    For something like this you may want to use the HTTP status: 200 for success and a 403 Forbidden for the NOT_CONNECTED, INVALID USER or INVALID PASS states. You can then use the body of the message for the explanation (if you care to provide an explanation: you may not want to for security reasons).

    EDIT: so

    header($_SERVER["SERVER_PROTOCOL"]." 403 Forbidden");
    

    if the authentication failed and

    header($_SERVER["SERVER_PROTOCOL"]." 200 OK");
    

    if the authentication succeeded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I'm trying to work my way through this but am having an
hello guys i am trying to print title from a set of urls in
Hey guys i am trying to automate my system at work for sending artwork
Hi guys I'm trying to set the width of an EditText. My goal is
Hello guys. I trying set EditText to input only numbers and point ( .
I have been trying to set up Titanium and Android for 3 days. Still
Hey guys im having a problem trying to program out a set of logic.
Hello guys Im trying to set a max width and height so that when
What I'm trying to do Hello Guys. I got a Service which, set's a
Hey guys, I'm having trouble trying to find the user's longitude and location as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.