how does real time applications interact with website admin panel? [closed] - php

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
My question is about logic not api specific.
if I have an e-commerce application that consist of 2 separate components (one is for the seller and the other for the buyers) and I have, lets say, laravel php admin panel for customer support (as super admin) and amdin panel for sellers can use web browser to edit their product pages and reply to customer in realtime. (now sellers has 2 options android app and web page to do same job)
How the hosting is done for the website (admin page) and android application, according to my understanding is:
1- admin panel (webpage) will be on server hosting the Laravel and MySQL database.
2- Android application will retrieve data from database from server.
3- when sellers use their android application to add products.. Database on server will be updated.. so buyers can see the new added items.
4-When Buyers uses the chat interface in android application then this database will not use the server where the Laravel (or any framework) admin page are hosted.. instead it will connect to real time plateform like firebase.
That is my understanding for this type of application and the overall relations between web server and android app.. Is that logic is right? please any advise will be helpful.

I was using pusher for my realtime chat, you can store messages in your database and broadcast MessageSent event with pusher, listen channel on front of your website/app and append chat with received info from pusher.
You have to make 2 channels
Broadcast::channel('/user/chat/{userId}', function ($user) {
return $user->id === $userId;
});
Broadcast::channel('/admin/chat', function () {
return $user->isAdmin === 1;
});
and broadcast user messages to /admin/chat route and admin replies to /user/chat/{userId}, hope it helps
Read docs: https://laravel.com/docs/5.7/broadcasting

Related

How Can I Perform MySql Insertions After A Paypal Checkout [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 3 years ago.
Improve this question
Recently I built a website where the user fills in a form and then goes to a checkout page they then press the pay with paypal button and then are taken to the paypal checkout, Then in the paypal button settings I have them taken the user to a php script where it inserts the info to the server via mysql then instantly taken to a thank you page.
At least that's what I want to happen; the page doesn't seem to do anything and when testing it out I echoed one of the variables and it doesn't show up so I gathered that the cookies aren't remembered or something of the sort, although I don't know why this is happening
I'm simply lost on whats going on and my scripts definitely work as before I didn't connect the button and when clicked it did all the correct orders however when the paypal checkout confirmation directs the user it doesn't seem to work
I have seen a few threads on this however never saw a concrete conclusion however apologies if this has been covered
Appreciate any advice or help immensely and thank anyone in advance,
Cheers
To guarantee your server is notified of when a transaction completes, I recommend using this server-side integration demo as a skeleton:
https://developer.paypal.com/demo/checkout/#/pattern/server
Notice that there is no PayPal transaction created until the line that reads:
fetch('/demo/checkout/api/paypal/order/' + data.orderID + '/capture/'
This would be doing an XHR to a PHP script on your server (at that sample path), which must itself then call the PayPal API to capture the transaction.
This server-side design guarantees that your server will be notified of all completed transactions at capture time, so it can then immediately write the required record to your mysql database.
If instead you used a different type of integration, such as a client-side one, e.g. as shown here: https://developer.paypal.com/demo/checkout/#/pattern/client
Your server would not be guaranteed to be notified of captured transactions, since the capture happens via JS in the client web browser.

Xmpp in Android with php server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am developing an app in which there is a chatting functionality also , except chat my rest app is done now i want to integrate chat in my app for which i am trying xmpp , i have tried a sample for xmpp with my own jabbered server and its working.
Following are my question are
1.How to integrate my app php data with jabbered server to show list of user chatting with there image , name , time and last message like the whats app chat list etc. like the image below
2.Flow of xmpp , like how its works example first the message is sent to FCM then to jabbered server and then to Device or it works differentely.
How to manage chat history , do i need local database to maintain it or jabbered help for history also.
Any suggestion , link , example will be appreciated Thanks.
I think you are asking a lot of questions at once. The way you want to implement it all with your server depends on you. But the best I can say to my own knowledge is that chat storage on WhatsApp is done on the device. Messages can be stored in an Sqlite database. I use node.js to power my own server. It's not possible for me to give you the full detail of how it all links together but I can try by saying I have an xmpp client on my Node.js server. Once a user registers the xmpp client is made to register the user in the ejabbered server also with the same username. So since the user info is in the table with all of his/her details they can easily be queried for by username from the Android app.
You need to do some research on xmpp, and maybe Node.js and SQLite.
FCM is something different and you might not really need it in the flow
first sorry for my poor English.
Answer for 1st,
XMPP Provides Register using PHP Service. Basically, Register from your device if successfully then register save user data in your server database. after register user you have to register user in XMPP, right now i don't have PHP snidest code.
other way is if user successfully register then it will give you register data. Take user id as register user in XMPP from your device.
i don't know how you manage your friend list but suppose you have user id using it concatenation suffix name with it you can send message.
Answer for 2nd,
You need refer document and make message format in XML and/or son .
in Message format you have to define sender id, receiver id, sending time, message and you can define your custom attribute. sender send message in XML format and receiver evaluate message.
Answer for 3rd,
You have manage local database for individual chat because it server work is over after delivering message to you. In group it will provide history message but here also you have to manege local it's database.
hope this information help you.

Synching PHP backed Admin portal with a Mobile app

How is it possible to let the android application to know each and every change on admin portal by real time.
Our system is a school based application that works on our own tablets. In system there are Teachers, Parents, Students and a super admin. The tablet has daily attendance management, grades, exams, meetings and so many features for a school system, now the same user entities will have all the features mentioned in the Admin portal as well. lets say www.ourtabletapp.com/admin
so we have a need to synchronize every change that occurs in Admin portal to Android application in real time. (Then and there)
Currently we do have one way synchronization as in any changes to mobile app (new records, modify records and etc) eg: adding a new meeting, then updating it and so on. which is done using a REST API we have written, so mobile app will call the API each time to connect with our DB and synchronize.
Question is what are the ways we have to make it two way synchronization? (Admin portal changes should reflect the mobile application immediately.)
Update:
mobile app is located somewhere else in users mobiles. when a record is added or updated, how to send a request from Admin portal to mobile application and update the sql lite database in it?
you can use the same logic that already has been implemented to notified the admin panel when someone update through the mobile app. let's say if anyone update the any student record from the admin panel , you have to update the DB first [ that already done i think ] and than you have to make the call of REST services that send the call to mobile app with the updated data.
let me know if you need any more help on this. you can share your structure for the better answer if needed.

How to manage licensing to enable features for a web application? [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 7 years ago.
Improve this question
I will be selling a new product that will be managed by a web application on my own servers.
The web application will allow to manage some devices.
I would like to limit the amount of managable devices to the number of licenses bought by the user.
My web app is currently allowing to manage all the devices with no quantity limitations.
I don't know where to start to implement the licensing (license key generation and checking) nor to limit the devices based on the license keys the user owns.
Any help would be more than welcome.
Thank you in advance.
FYI: I am using jquery, php and mysql.
I would implement several tables in database, as it is shown below:
There will be the following entities: User, License and Device
And these entities will be related to each other as it is shown above. Every license will contain information about qty of licensed devices.
When a device connects to your service your service recognizes it by its id, which is being sent by device upon the connection. Then you can check, is the device registered, and what license is related to this device.
Limitations on quantity of devices will be checked upon device registration.
When a user registers a device (adds information to tables: Devices and LicensedDevices), your code should check the quantity of already registered devices with this license against devicesQty field value in Licenses table.
And if devicesQty value allows to add more devices, then your code adds new device to the database.
UPDATE:
To control quantity of licensed devices you need to register these devices (for instance - using unique ids of these devices). Otherwise you cannot control quantity of devices which are using your service.
One device connects, works, disconnects, then another, then another and so on. How can you control quantity in this case? I think there is no way unless registering ids of these devices.
And if a user changes his device to a new one, then there should be a procedure to update information about a registered device.
If your customer uses only web-browser to use your services, then the only way to control license/devices is to bind userid+password+deviceId to a license. And check this information upon logging in to your web-service/web-servers.
If you are using a native application on mobile devices to connect to your web-service then there is more sophisticated way.
Implement license key generation/verification via asymetric encryption approach.
For each user generate public and private key. Then store private key in your database and do not show it to anyone.
Let say your public key is: ABC-123-456
Use Base64 algorithm to convert public key bytes to alphanumeric characters.
Then, upon selling a license generate an arbitrary unique license code.
Let say your license code is: XYZ-789-012
And provide end-users with public key and license code: ABC-123-456 and XYZ-789-012
User sets public key and license code to the custom mobile application settings. And this application encrypts all sending data with this public key. And license code is included to the data package before encrypting it.
When your server receives a data from a device, it finds appropriate user by deviceId, then it finds appropriate private key to decrypt the data package. And then it inspects this data package on correctness.

user licencing, mobile web php [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm developing a mobile web for android, iphone & blackberry. We should enforce license for users. Let us say this product comes with 3 types of license.
1 user 50USD
3 user 100USD
5 user 200USD
10 user 300 USD and so on...
They say "if customer has purchased application for 3 users then he should be allowed to access the application only in 3 devices, when he tries to access the same in 4th device he should be sent to some error page"
Let me explain further, we are designing a table, order selection app for restaurant, where every table(or waiter) will have a mobile, he/she opens the application and orders for the selected table. In such case a web app can be accessed in any device and customer may buy and install the app on their server and ask every one to access. That means he'll buy the product for one device and uses in many. So through PHP we need to limit the product to only one device. Remember it can be any device he's wish whenever, whatever the device he might use application should be accessed by/on x devices.
How can we do this? Any suggestions are welcomed.
Thanks in advance.
(FWIW I'd be very skeptical of buying a product licenced per device rather than on the basis of a named user).
The problem will be differentiating between devices.
While browser finger printing can provide very impressive results these datasets are predominantly filled with desktop browsers - I suspect you would see a lot less variation between mobile browsers (when was the last time you installed a new font on your android / iphone).
make a database of allowed devices, and set those devices with a cookie or track the users ip address (not recommended since it changes). You might also want to look into UNIX timestamps for figuring out time operations related to this.

Categories