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

  • Home
  • SEARCH
  • 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 6656373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:38:06+00:00 2026-05-26T01:38:06+00:00

I have some PHP script that logs in and returns a JSON array with

  • 0

I have some PHP script that logs in and returns a JSON array with a session ID if the login was successful.

In my app, I want to login at the front page and continue out through the app being logged in. I created a singleton class that holds a session ID (along with a few other fields) received from the JSON from the PHP page. This singleton object’s field “session_id” gets checked depending on what the user does.

If the user wants to log out, then the session_id just gets set to null thus logging out.

I also use the HttpURLConnection library to POST the username/password when logging in.

Is this a decent enough approach for handling this situation?

  • 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-26T01:38:07+00:00Added an answer on May 26, 2026 at 1:38 am

    Here are some things you should think about:

    • Once you have authenticated the user and stored the session_id locally, send the session_id in the header of each of your http requests. That way, you’re not sending the credentials with each request, but the session id. And if something happens on the server side to the session, the transaction will not be allowed.
    • When logging out, don’t just delete the session_id on your app (client) side. Send a logout to the server as well so that the session can be killed server side.
    • If the session is killed on the server side, you’ll want to do 1 of 2 things A) prompt the user to re-login. B) Use the store credentials to log back in, create a new session id and store it again in your singleton.

    This will guarantee a bit more security and functionality than just clearing the session id on your app side.

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

Sidebar

Related Questions

I have a php script that uses some css/javascript tabs, they work on my
I have some problems with a PHP script that calls a Bash script.... in
Currently I have a system where a PHP script logs some information (time and
I have some php script that I would like to run on EVERY row
I have a php script that I'm trying to pull some data from a
I have a PHP script that is using wget to download some images. However,
I have a PHP script that simply takes some data, separates it into tab
I have a PHP script that I am using to generate some rather complicated
I have some values in a PHP script that I must insert in a
I have a php script which accesses a MSSQL2005 database, reads some data from

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.