Save Session State for web app [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I've built a web application and when I enter information, it just disappears when I refresh the page. What script am I looking for and is there any links anyone could provide to help me in the right direction?? Pleaseeeeeeeee

I believe you're looking for sessions:
Session support in PHP consists of a way to preserve certain data across subsequent accesses. This enables you to build more customized applications and increase the appeal of your web site. All information is in the Session reference section.

You should make your data persistent server side. You could use the session by using $_SESSION within PHP or retrieve your data stored persistently in a database. However that means you will have to make a call to the server, before you refresh your page, by using for example a jQuery ajax call. After saving the data you can refresh your page, retrieve your data and fill in the appropriate information from the server.

Related

How to destroy a session an hour or day after a user exit site [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have an admin page where some users can have access to but I want that whenever they leave the site or close the tab for about an hour or a day the session should be destroyed so as not to allow someone else.
The thing you are searching for is $_COOKIE. There you can define how long the Variable is saved etc. The only thing you will have to consider is that the values are stored locally and not on the server. If you want to achieve that, you can create a Cookie-Key system similar to the one PHP uses to save the Session data on the Server. In that Case the User would get a key, saved as a cookie and the data is stored on the server under that key.

Is it okay to use Firebase as function call like state if the data was change then call my server side (I used PHP) instead of Firebase as a database? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I want to use firebase just a function call just to use my existing database and just to have realtime changes in my site.
Firebase can't magically add realtime functionality to an existing database. It actually has an entire backend infrastructure set up to enable its realtime functionality, which your database would be missing.
Some options:
Build your own realtime functionality on top of your current database.
Synchronize changes to your database with a copy of that data in Firebase, which you then use for updating realtime listeners.
Switch your data model over to Firebase completely.
And I guess the last option is:
Keep using your current database, without realtime options.
None of these is pertinently better or worse than the others, so pick whichever one makes most sense to you and be willing to change your mind along the way.

Scraping data which loaded after scrolling to bottom [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working with PHP and I want to scrape some data from any website. But I have a problem. I scrape data but these items number are 48. But I know that page has 11K items. Rest of datas extend when you scroll and you get new bunch of datas (48 items).
I'm scraping with simple_html_dom. How can I manipulate scroll and get data ?
Thanks! :)
Sounds like the missing data is loaded via ajax.
Check the Network tab in the Developer Console (by pressing F12). Take a look at the URL which is being called (and the response), and edit it to your needs. Then call this URL instead of the one you are taking now.
It is impossible by this way.
But if you need to scrap this data you can send requests to endpoints which return lazily loaded data. You must research js code of target site.
p.s.
If you want to use really hard approach, you can research browser emulating.

How to make it so cookies are fixed and not able to be edited [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
My website uses cookies and I've noticed that I'm able to change the value of the cookies with a chrome plugin. Is there a way to make it so people cannot edit the cookie? I've been thinking of writing a script to check if the cookie changes but I'm not sure if this would work. Any help would be greatly appreciated, thanks.
No, cookies are stored on the client side and you don't have any control over them. You have to validate them on the server prior use every single time. When it comes to web development, you need to see your clients as a potential security liability. You can't trust them.
If you want to make it a little harder for the attacker, you can encrypt contents of your cookies, but the fact they're on the client side means the attacker can try to decrypt them and modify as wishes...
=> If you have data you need to keep away from users, don't use cookies for that. You should use Session in that case.

Why do sessions need to be stored on a sites server? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I was just wondering why sessions need to be stored on a sites server...I know its because its inaccessible so user sessions cannot be changed, but then why do you need cookies? Why can you not just have one type of data containers which are always stored in a server?
Thanks in advance.
HTTP is stateless by design, you need cookies to have sessions in the first place. Sure, you could add a phpsessionid to every URL, but then you just made your URL's a mess and put state where it doesn't belong.
Cookies exist to add small amounts of state, if you are just using PHP sessions then all they need is to store a phpsessionid and you are done. However, maybe you have preferences that a user could set that don't necessitate the usage of a full-blown session, cookies provide a great method of saving this data without costing disk space on your server.
Cookies and sessions (and now local storage) for that matter are not mutually exclusive, use the right tool for the right job.
Very simple, when you close your browser, session storage is removed, in cookies you can for example store usernames, so they are allready filled in when the user re-visits your site

Categories