Im creating an app where the user inputs match events in a rugby game and the player who done it. e.g. pass,wing or try,scrumhalf. This information needs to be uploaded to an external database for the website to have access to it.
I don't want every time the user clicks an event for it to upload it to the database. I want them to do a whole match with it somehow storing it on the ipad. The user then clicks an upload button and all the events get uploaded to php which then inserts them into the database.
How is the best way to go about this?
I've tried everything and not sure.
Suggestions and example code would really be appreciated.
Thanks
Sounds like your app should /may do a 'simple' call to a REST-API.
You should find a lot of examples for that. For networking you should find a more comfortable lib at cocoapods.
Related
I'm working on an application where I have a web interface for a screen on my wall, and the goal is to allow my friends to upload images to it.
Right now I have a basic web interface with a login, which authenticates a session and has a page which allows uploading an image and changing some of the parameters of the screen. The parameters are stored in a MySQL database, as well as the login details. This part I've heavily based off the approach detailed in this link:
https://phppot.com/php/secure-remember-me-for-login-using-php-session-and-cookies/
Ideally I can allow my friends to upload images to this screen in a secure way that is as simple as possible. What I am imagining is a unique URL link that can be sent to them, which takes them to a page where they can upload an image but do not have access to change any of the screen parameters and so on. This URL would allow anyone who has it to upload pictures, but I want the owner of the screen to also be able to deactivate the URL if it is no longer secure. The owner could ideally generate a number of URLs that they could share with different people, which would all upload to the same screen.
My question is firstly, is this a good approach and is there a way to do this securely (without opening access to the screen parameters and so on)? I would prefer to avoid giving these "guest" users login details, as that is one more account to remember and reduces the simplicity of uploading to the screen.
My next question would be how to do it? My current idea is to have a new database with columns for the screen ID (to allow it to work when I have multiple screens) and link URL. The screen owner would generate some kind of random string as the URL and save it to the database. The "guest" upload page would only allow uploads if the redirected URL is found in the database. Right now I'm looking at affiliate link examples to get ideas on how to implement this, but if anyone has better suggestions of what to search for or other examples it would help a lot.
I'm very new to web development so I'm not sure if I'm describing my approach clear enough or if my goal even makes sense. I'm also very uncertain of any possible security issues I may be introducing with this approach, so anyone has suggestions or possible pitfalls please let me know. I don't know how much I don't know.
You can use Tokens :
generating tokens with php
You generate an URL with the token inside then send it to your friends:
www.myULR/token
After, you create a table token with all tokens with a jointure with user's id,
and you should easily verify with PHP, if tokens exist and user is not an impostor, allow him to upload files.
After having spent several hours looking into the matter and searched for a solution, I'm hoping someone out here can help me out and give me some hints.
My project, in a nutshell, is this:
Using Phonegap/Cordova, I want to create a one page iPad "form" app from which the submitted data should eventually get to a Google Spreadsheet.
The idea is for a hair dresser who would like to log his employees transactions: [Employee name], [Male/Female/Child haircut], [multiple choice "options": Shampoo, etc], [Amount charged], [Visa/Mastercard / Check / Cash]
I've looked into several "solutions":
Email the form, then use a Google Script + RegEx to grab the data and populate the sheet. (This sounds ugly, no?)
Submit the data to a .php webservice (forgive me if I'm using the wrong terminology!) to populate a database stored on my VPS (MySQL?), then use a Google Script to fetch the data a regular intervals to populate the sheet.
Submit the data to Parse and, again, use Google Script or a parse.com API if they have any.
Here's a very rough draft of what the app would look like (it doesn't need to be fancy)
Sketch of the concept
Any hint would be much appreciated!
Thanks in advance...
I've been playing with the Google+ API PHP starterkit. My ultimate goal is to run a cron job on my server that uses the Google+ API to grab the activity data, then store it in a MYSQL database-- where I can then dynamically update a twitter-like feed on a website.
Is this a possible/practical way of mining a Google+ profile's public stream? If not, what do you suggest as a good alternative?
Sounds like a good way to me.
One thing you have to keep in mind though is that there is no easy way to check if an activity has been deleted after you have added it to your database. You would have to check with $plus->activities->get($activityId) for each of the activities you want to display to see if it still exists (unless of course you don't mind them appearing on your website).
Apart from that your solution will work fine.
Hello I am working on an educational app just for my own learning where a user can login, upload photos, and then have them display on a website. I am a little confused on the general idea of how it should work. I know this isn't the best place for this type of question but I can't find it anywhere else.
Basically I want a user to be able to login with something like OpenID and then upload a photo ( I am using phonegap and thus they would use the Phonegap API to do this and I understand the mobile side here ) to a server and then have be hosted on the server and be able to have a user's photos displayed together.
Do I need to have each photo be submitted to a database and if so how would I store the photo info? If you have any input it would be appreciated I am a little lost. I know php for the server side I just don't know what to do.
Do I need to have each photo be submitted to a database
Only if you want to, you would have the base64 encode it or store it as a blob though. Your best bet would be to store the image somewhere on your server outside of the database and instead store its address or path in a database along with a unique ID.
how would I store the photo info?
What photo info, the exif data? Or are you talking about additional general information? (date it was uploaded, user that uploaded it, etc etc) Either way, you would make a column in the database table for each chunk of data you want to store.
For example, if you wanted to store the date each photo was uploaded and which user uploaded it, you would set up columns in such a way that a row in the database that look something like this:
(columns) id photo user date
(row) 58 uploads/img58.jpg myuser192 1338483324
as for actually getting the photos on your server, perhaps you could use an html5 friendly solution like Uploadify
I am making an offline website that needs to sync every night with a server. Our employees work outside and sometimes underground and need to access the site for its database. But once home they must send us their findings.
The first time they connect, I check with google gears if they have the sqlite database and if not I run a script to insert it. Once they have it, I sync their next appointments to their local database.
When they are done, the next day, they connect to send us every thing and to download their new appointments.
For now i was able to create the sqllite database and insert new values inside thanks to google gears. But i haven t found a way to read the database with php to sync it with our online database.
To go from online to off, with PHP I can write an array in a hidden field and then read that field with JavaScript. But in the other way i was wondering if there was on other way then creating a form with DOM and submitting it in JavaScript to read the values with PHP?
I need to sync a Lot of values, do you know if there is an easier way?
Thanks for your help
I have found vortex, a powerfull script for gear that helps sync everything from files to data. It will definitely help me.
Here is the link to the developer's blog. The download link is in there.
I will come back when the website works to help the interested.
You should use Ajax for posting your new data to the PHP server.
You could use jquery (or any other framework), their lootle of resources how to post data to php on the web.
Your webpage could have a button hidden when offline, this button would enable user to start a synchronization.
Here a tutorial from PHP and jquery!