javascript - I am trying to manage a small number of users control of a webpage -
To begin, I have a raspberry Pi, a lighttp server running on the malt I have a webpage Which will include up to 10 people at a time. Each user will be given a "master" or "supervisor" tag. The webpage will contain controls that can only use "master".
Just one major: I'm just learning most of this so that I can make something wrong about how to accomplish this.
My basic idea is as when a user connects to the database, their IP address will be caught and inserted in a SQLite database with a user's tag and connection time. From there, I would be able to query the database for user tags when they tried to execute various commands.
Whatever I use is very light and do not store cookies on user devices.
There is currently JavaScript, it is probably not the most efficient, but I am planning to do this so that it looks good.
This code is going to connect the database and user
& lt; Script type = "text / javascript" src = "http://l2.io/ip.js?var=myip" & gt; & Lt; / Script & gt; & Lt; Script type = "application / javascript" & gt; Var db = openDatabase ('userCon.contbl.sqlite', '1.0', 'contbl', 1024); Db.transaction (function {transaction} {var ip = myip; var conStatus = "master" var date = new date (); console.log ('' ip + '', '+ conStatus +', '(' IP, constuctus, date), function (transaction, result) {}, function ('ipad, cony type, previous active)', 'transaction, err) {console.log (err.message + ": error") ; // here an error}};}); & Lt; / Script & gt; & Lt; Script type = "app / javascript" src = "http://jsonip.appspot.com/?callback=getip" & gt; & Lt; / Script & gt; I'm unable to connect to the SQLite database created on pi, which can be after my research because SQLite is running locally and is not on the server
Is there any work to point to the SQLite database on PI, or is there a better resource to use for this type of work?
Edit:
I think my original post was not specific enough basic idea I need to be able to pass a small bit of information from a webpage , To host the server back. That is, the user connects to the server and sends it to the IP then the server tags which are in the form of an observer of the IP controller. From there, the server sees the web page differently, to which the user tagged I went.
My original plan was to actually use the light weight database such as Secitaim, but as I have learned, SQLite is the only local experiment. I need to break it with at least 10 connections.
I hope someone is a suggestion or an example to solve this problem.
The most common way to run JavaScript on a web page is to talk to the server these days Kind of Rental Web Service
You have to search for a server-side programming language that runs on PiE. Maybe node.js? It's like JavaScript, but on a server, see here:
Then you talk about the methods that you want in server-side language to the database, then your client-side javascript Call. Google "REST services node.js" and you will find many to-do-to-to-end.
Comments
Post a Comment