使用 android 中的 php 会话更新在线数据库 [英] Update online database using a php session in android

查看:33
本文介绍了使用 android 中的 php 会话更新在线数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要让我的一个应用程序更新我服务器上的数据库(喜欢、评论等...),我认为禁用机器人以不断更新它的唯一方法是让用户创建一个帐户并通过java请求服务器端的php脚本来更新记录,但我不知道如何让应用程序了解用户是否登录...

I need for one of my apps to update a database on my server (likes, comments, etc...) and I thought that the only way to disabilitate bots to update it constantly is through making the user create an account and via java ask for a php script on the server side to update the records, but I don't know how to get the app to understand if a user is logged in or not...

你有什么想法可以帮助我吗?谢谢

Do you have any ideas that could help me? Thank you

推荐答案

In your user table add two extra column device id and token. when a
user is logged in first time generate a random token and send it to
the app and update your database.In app store  that token in
persistence. every time when app starts send that token to server if
token matches with db token that means u r logged in, else not.for
logout send null or zero to server. Try with this.

这篇关于使用 android 中的 php 会话更新在线数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆