I have created a basic chat application using the walk through on socket.io
I have added further content to the application, including database info, which meant I had to change the index.html to index.php.
Now when I try and run the application, it just downloads a document with all the code for the page, and it does not run.
I have changed all the code to index.php where necessary.
If I change the file name back to index.html and change the relevant code, it then works fine....
I really need to have database info on the page, which is why it needs to be index.php
Does anyone know why it does this? Is there a work around?
Related
I am developing a mobile application in phonegap. My app works in a way that when a user submits a form, the data gets posted to a file called functions.php (present in the root folder) and functions.php parses data and sends to my rest application using curl. When I run this application in a web server, it works perfectly fine but when i run it in phonegap and post data to functions.php, instead of running functions.php as a function, it displays all the code of functions.php on the mobile screen and stops there. Does anyone know whats going on?
The situation you describe is what happens when you try to run a php file from a webserver that does not have php installed, so it sounds like you are trying to load the functions.php locally from within your phonegap app. Phonegap has its own webserver, which is not a php server, so it won't run php files. If you need to interact with php/sql/other remote stuff, you should be using ajax requests to interact with the remote (non-phonegap) server. https://forum.jquery.com/topic/how-do-i-get-ajax-working-with-phonegap
I just finished writing a website using polymer 1.0+ with a PHP MVC framework on the server. I am about to start a new project, but I want to use app-router. Unfortunately to use app-router I have to redirect everything to index.html using my .htaccess file. But my PHP MVC wants everything to run through its index.php.
It got me thinking. Should I just write my PHP code as a REST API and have my Polymer code get data via iron-ajax?
If your PHP is mostly only used to access data, this sounds like a pretty sound idea in my opinion. It also opens you up to upgrading or migrating your backend to newer technology since it will only be a data layer.
You need to understand WHY app-router wants everything to route through index.html. The reason is that it invents other routes which are exposed to the browser that aren't real. Normally, as you are running the app, that doesn't matter, the browser doesn't attempt to load those url's, the app-router is just putting them into the history.
However, your use may take one of those urls and try and paste it (or get someone else to paste it - having sent it to them via (say) email) into the address bar, or you may have an <a href= link on your page and what you want to happen is the app loads from its base location and then the router routes it to the correct place.
So actually index.html isn't some magic incantation, its the url that the app is loaded from. If that happens to be index.php then that is what you should use.
I have a site with a basic members auth system built into it, I wanted to allow the logins for this site to also work on a vanilla forum using the jsconnect plugin. The forum is built within a folder of the site.
I've been through the documentation for the jsconnect plugin for vanilla forum.
However I can't quite grasp the process of actually setting it up, This is where I'm at right now;
I've downloaded and installed the jsconnect plugin within vanilla forum, I can access it within settings. However when i try to add a connection, once I hit submit I get a blank error screen:
Something has gone wrong.
We've run into a problem and are unable to handle this request right now.
Please check back in a little while.
I'm assuming this has something to do with me needing to have set up an Authenticate Url that goes somewhere, however what is it supposed to point to?
I read that I need to have a jsonp file however when i look at the jsconnect repo https://github.com/vanilla/jsConnectPHP Theres an index.php file that seems to handle the authentication, is that right?
Essentially I'm looking for some guidence on how I should proceed,
Any help would be sure appreciated!
you need to download the index.php file, then change the path for functions.jsconnect.php to /plugins/jsconnect/functions.jsconnect.php.
then add a connection and test url.
Firstly I'm not a web developer! My site was created by a company that is no longer in business, so I have access to the admin page to add content, but know nothing about the back end.
I have been asked by an SEO company to add Google analytics, when I tried to add the script.../script to my footer, which is included in all pages, it shows up in the page source of a web browser, but does not run, and Google tells me it's not installed.
Is there a way to add either a script to via the admin tool, or a < ?php include_once("analyticstracking.php") ?>
If the latter, into which directory should I ftp the analyticstracking.php file?
First of all, if it shows up in the page source, you are halfway there. You just probably did not copy-paste it right. Try copying the EXACT code in google analytics, put it in the footer and try again.
The include functions won't do anything different than putting the code straight in the footer.
Note that you need to have some visits on the site so that GA knows the script is installed.
I am building a prototype of a web app for a client, using axure - which is all front-end code (html/css/js files) - no php at all, so i can't use php authentication (sessions, etc) within the prototype itself.
So to protect it, the prototype is in a password-protected directory on my server (using htaccess / basic HTTP Authentication), so my client must login to review it.
But instead of requiring him to login through the ugly browser-based login-box, I'd LOVE to somehow use PHP to login for him, since he'll already be logged into my client-portal (Wordpress) site.
I setup a PHP page outside the prototype directory, and used cURL to hit the prototype's start-page (/project04/start.html) -- and successfully authenticate. But I can't then use cURL to load and display the content from start.html onto that php page, because all the paths (for assets and links) in the prototype become wrong (and there's a ton of JS that might be problematic too).
I tried using header(Location: project04/start.html) in the php, after the cURL login, but that didn't work - the redirect just triggered the ugly http-auth login box again.
Is there any way to use PHP to login, and then let the user into the protected directory, to browse around the prototype?
Alternatively, the prototype works great embedded into an iframe (on a php page of my Wordpress site). But then the prototype directory itself is not actually protected from direct viewing - it's just hidden. I tried moving it outside my document-root, as a way to protect it without htaccess-auth, but then the paths are all bad again.
Any help super appreciated.
Thanks!