Display SQL Data on a PhoneGap App - Possible Using URLs? - php

I'm building a web application using PHP & MySQL. A user profile displays MySQL data using a select query like so:
SELECT a.name_first,a.name_last,b.bio_category,b.bio_short,b.bio_full,b.profile_img
FROM stars_login a, stars_data_bio b
WHERE a.id_s=b.id_s
AND a.id_s='$select_id'
The $select_id variable is defined using ?id= in the URL like so:
http://localhost/public_html/profile/profile.php?id=1
I'm also looking at turning the web application into a phone app. I don't have much experience creating native apps as I'm more of a web designer.
I have however used Adobe PhoneGap before (cheating kinda, I know).
My question: is there a way to display a user profile in an Adobe PhoneGap app using a similar method to my exploded URLs in PHP?
Eg: there will be a search bar on my PhoneGap App home screen, where a user can search for a username. When they hit the search button they will be redirected to the profile view (similar to the profile.php page on my website). The PhoneGap profile page will then show the SQL data for the corresponding user.
I'm not sure if this is possible, but if it is, could you let me know how to go about it?
Also - how would I display the data that is stored server side on my local app?
I'm fairly new to all of this - I'm 18 and self teaching for a personal project of mine. All help is appreciated!

You can do this in your Hybrid app:
Create an HTML form which will serve as the front end to user
Use AJAX to send input from the user to your server
Process whatever pass parameter/s in that ajax request (such as the query you mentioned).
Return the result as json/jsonp then display the result back to the front end (no.1)

Related

Mobile App Unique ID detection in PHP

I'm building a mobile app which will call a search engine on my website. I have PHP code to detect if a person is coming in through a Mobile device. However, I want to see if I can detect if they are coming in through my app versus a regular page browse.
In the past, I've had a hidden field on a form submission, but this is not feasible anymore.
I want to know if there is a way if somebody accesses a page on my website through the mobile app or a mobile browser?
One option is to pass a PHP $_GET parameter, but I'm looking for other solutions.
Perhaps override the user agent used in the mobile app, or send an additional header that your PHP scripts can look for
You can modify the default user agent to identify your application.

documentation to create a like button in a facebook app

I'm trying to figure out which facebook documentation is relevant to what I want to do.
I want to create a facebook app which I understand is like a glorified iframe pointing to my web server which will serve just 2 html pages. On one of my pages, I want to create a link or button that looks like a big orange race car. When the user clicks on the race car, it fires the "facebook like event", then redirects the user to the second page on my web server. Right now, I do not know how to create the orange race car like button.
I've already set up the facebook app, and it is correctly reading the web pages on my server. I am using PHP.
So my question is any of the following:
a) which page of facebook documentation should I read to learn how to do this
b) does anyone know of any example code I can work with?
**In the past, I had to use oauth to have the user register my app and login before they can do anything with my web app. But this time, my web app IS A FACEBOOK APP, so I'm hoping i don't have to do any of that oauth process. This is why i feel lost in the facebook documentation...i'm not sure which parts are specifically relevant to my facebook app's orange car like button, and which is not.
But this time, my web app IS A FACEBOOK APP, so I'm hoping i don't have to do any of that oauth process.
There you’re wrong already. You will not get any info about the specific user, unless you have them connect to your app first.
Right now, I do not know how to create the orange race car like button.
Using the normal Like button plugin, you can hardly change anything about its appearance at all. (And you are not allowed to, by Facebook policies.)
So your only viable option to have a button of your own choice that triggers a like, is to use the Open Graph built-in like action.
JOHN SAYS - I followed up this question with another - stackoverflow.com/questions/12607458/like-action-for-facebook which has part of the answer to this question

Facebook IFrame App Question (Flash, PHP, MySQL)

I am developing a Flash game for Facebook that uses PHP to access MySQL to store users game info. I am a bit stuck right now though. Here is my scenario.
User logs into Facebook and starts app which calls index.php and houses my Flash game. (works fine).
I use $facebook->getUser(); to authenticate and begin gathering user information (also works fine).
Flash will then access a getdata.php file on my server that will access MySql and echo certain info (ie. fname=John&lname=Doe&age=25).
Step 3 is the problem and I'll do my best to explain it...
My getdata.php also does a $facebook->getUser(); authentication, but the user is NOT authenticated on that script, whereas within the IFRAME app, the user is still authenticated. I'm assuming it has something to do with the fact that the main page is within Facebook's IFRAME and is possibly seen as a different session than when Flash tries to connect with my getdata.php file on my server. Is this the case? And can anyone help point me in the right direction as to how I might use Flash within an IFrame app to access a script on my server to retreive variables?
EDIT: I should mention that I'm using ActionScript 3 for Flash, but I'm fairly certain the problem doesn't lie there because it will retrieve the variables, but since the user is not authenticated on the server, then it will return a success=0.
Also wanted to point out that if I access my flash game through my actual server, and not Facebook, then all works well. Another reason why I think it's a session-type problem.
This is a session problem. You should try to pass the facebook signed_request, or any data you can use to build a valid user session, into your flash file and then pass them back to getdata.php where it can be used to access the users data.

Use data of own database in facebook application

I want to develop a Facebook application which shows the data from database from my own server.
I have found one question here : Can you use your own database for Facebook applications?
But like above question I don't want to use iFrame to show my content on Facebook application.
Any solution for this as, I am new to Facebook application development.
Edit:
Simplified version: I have a page in my server which generate xml feed of the product. So can I read this xml feed url in facebook Application?
Almost all applications use an iframe to display the actual app, I don't think you'll be able to avoid it. What you put into that iframe however is entirely yours. It runs from your server, and so can use whatever back end you prefer.
Why don'T you want to use iFrame? FBML & Iframes are only ways you can show your content with !

iOS/php: communicating with database

I am grabbing some data to put in my iOS app by visiting an url. But now, given the URL, the users can access the content of my application without using it. Is there a way to hide the info on this URL from public?
The content I get is through a php script to get the database queries.
You can set up a security system on your website and connect to it using a special URL with an encoded variable.
For example you can make your iOS application connect to :
http://mywebsite.com/somepage.php?id=yuw7262
Then in your PHP page, you can get the value of "id", decipher it and if it is valid, allow the user to go forward. It is pidgin security but it will work.
Put some security in your php scripts.
Use $_SESSIONs to verify that a user is logged in and is using your app correctly

Categories