Let user to post without registration and identify his post - php

I want that user can post on my android app (on a discussion) without registration. But I also want to make an identification of the post, who posts the post. I thought I will save user's phone's IMEI no to identify him. So that I can show his post to him (on my posts section).
Is it safe to use IMEI? Or is there any way to do my work successfully.
I want to add that I will save the post to my web server.

On Android you can save data in the "sharedpreferences" and retrieve the saved key later to display posts made by the user. However, if the user clears your application data, the key is lost.
An other option, you can use Android MySql, save both userId and postId or just postId. When the user launches the app, get posts from your server.
Hope this help.

im not that much in android app development, but it is possible to change the IMEI number of android phones easily.
Also, if 2 users want to use the application on the same smartphone, there will be an issue.
if you don't set up registration with at least email, im not sure you can log which user posted what.

Related

With PHP how pass data to html page?

Guys i'm creating a bot on a telegram that at certain (textual) input responds by writing in various ways.
The bot is also able to create buttons in the telegram chat (between the user and the bot).
In one of these buttons, if the user clicks, a page from my website opens.
I have to switch the chat ID to this internet page but I'm looking for a safe way to do it.
I could put the id in the link
example.com?chat_id=xxx
but it's unsafe and I don't want the user to be able to change the link and the value of the chat_id
So how could I do?
Is there a way to pass the data to the internet page from file.php?
In short, a POST method
I hope you can help me (sorry for my English)
When you get "chat_id", you can get user id too.
users.getUsers
Returns basic user info according to their identifiers.
You need to create a key, for your bot. Use the same in your php
application. Make a hash with infos and your key.
Replace example.com?chat_id=xxx with
example.com?chat_id=YOUR HASH.When the user go to your page, decrypt them with your key.
And now, you have chat id & user.
I recommend to use a salt

How to managed facebook post in own database for better manipulation?

Imagine I want to store in my database the facebook posts from a user/page for getting them and manipulate them simplier.
I will make a php script that will be launch every day for each user/page who will get the posts I don't already have in my database and insert them.
Now, on my front website, you can log in, and see your posts.
Now, you go on facebook, and modify one of your post.
Now you come again on my website, and obviously, you don't see the modification you did on facebook, because this modification is on facebook database and not in mine, and your posts a retrived from my Database.
Theorically, one of the solution will be that facebook has a "log" table for posts, where i can find something like "this posts has be updated" so i can update my table. Something like that exist ?
If not i have a second solution, at each posts send from my server to my website, update it automatically with facebook database (getById the post on fb an update it in my db) and after that send the posts to my website. But this will be a mess and a lot of request for nothing.
So how can i do this ? Someone have already tried this ? Or only directly manage the posts from facebook database ?
Thanks =)
Facebook has a mechanism to send updates to you, called webhooks.
https://developers.facebook.com/docs/graph-api/webhooks
You can subscribe to several fields for users or pages, among them the feed.
You’ll have to check if it delivers updates to already existing posts as well - but I think it should, would make little sense if it didn’t.

PHP posting on page wall

I have a website where users can post jobs for free. How can I link these posts to a facebook page about this website? I don't want the users to login to fb.
At this moment I post them to twitter and then using selective tweets to post them on my page. But selective tweets is not able to post logo's specific for that job.
I created a fb app. Did not select anything just gave it a name and got an appID and appSecret. I dont now what to select in "Select how your app integrates with Facebook". Becouse it is not a mobile app and it is not a website with fb login.
Kind regards.
you can use share on facebook facility of facebook ,from http://developer.facebook.com.
you can easily add this to your website.
have fun!
You can do this easily via MYSQL and PHP, depending on how your current site is setup. What i would do is store the jobs into a separate table while saving, like this
(table) Facebook
pageid //numerical value
header //job title
message //job description
So that you can use it for the next part.
Create an application via Facebook and give it authentication to users and your Facebook page.
by adding this application to your page you can then call something like :
$facebook->set_user($user, $session_key);
$facebook->api_client->stream_publish($item['header'], $item['message'], $item['pageid']);
Using your keys from facebook.
Then you can run a Cron that updates every x minutes, and after it has posted it, in an array, you can clear the table for the next row of jobs.
Let me know where you are on this and ill try to help as much as possible.

OpenFire Online/Offline Users in PHP

I have a OpenFire server running (it is using MySQL as it's database) and I'm trying to make a PHP http pre-bind system(using SASL) work with my web app.
I have got to a part of my app where I need to choose a random username that is not already online(for guest users). I was thinking of choosing some random users(in the Guests group I've created) and using the Presence Service plugin to check their online status until I find an available one(a user that's offline).
Is there a better way to get a list of offline/online users?
Does the server store the online status of users in the db?
I've been looking around the OpenFire db but I can't figure it out.
Thanks.
I wrote a small plugin for Openfire (with help of some other really simple plugin that I could plug without having to dig through the Openfire API docs) which basically spits out a JSON encoded list of users online. I could then just grab this and run json_decode and cycle through the array. I can't find the source at the moment, but it seems someone else made this aswell:
http://community.igniterealtime.org/thread/45107
EDIT:
I notice the Github project linked to in the above post is now gone, but I would try contacting them and see if they still have it.
ANOTHER EDIT:
Link to the Github repo: https://github.com/candy-chat/onlineUsersPlugin
In roster of the user, You can get online and offline users. Also you can get status message of online users from the roster.
But for that u have to subscribe the presence of that user. Only adding that user in roster is not enough you have to subscribe the presence of that user then you can get presence of other users.

FaceBook php api get realtime updates?

Hi i am trying to use Realtime updates in facebook application,
My application basically backs up the user's photos, messages and friendlist, i want when a user adds a new friend data on server should also be updated, when a user adds a new album the most recent album should be downloaded automatically to my server
I got this code from github-php , but dont know what next?
Please help if anyone has done with real time updates
you need to query the code after certain interval which you can use AJAX to update the page without refresh.
There is no automatic updates without query the information every time.
You have to subscribe using one module and you specify a callback url during the subscription... you only subscribe once and you get updates for everyone who has authorized your app. The updates come to you via the callback url and its very crappy info that basically tells you that you have to go back and query fb to get the full details.

Categories