Send file from web server to a local machine using a...script? - php

I'm currently in development of a web based project. Majority of the project is either finished, or has a development plan. Let me mention right off the bat, besides my very limited HTML and CSS knowledge that I know very little to nothing of JavaScript or PHP. Which is why I have come here to ask for some advice, or quite possibly some help.
Right now, I have an HTML page with a form that users fill out. this form contains information about their specific options they have chosen. ( the users content is quite irrelevant at this time.)
When they submit, the contents of the form are saved in a .txt file in the root directory of my web server. ( along with the other contents of my site, the HTML, etc.. )
What I need help with or some more knowledge is how I can have that txt file sent to one of my local machine's here, from the web sites server.
The text file will need to be read from my local machine, and based on the user input my local machine will execute some JavaScript locally and what not ( this part of the process already has plan )
You can think of it kind of as a remote viewer/VNC kind of process. Excpet with alot more limitation for security/ease of use pruposes.
If anyone can help or enlighten me on some procedure that would do seomthing to this effect that would be great.
Regards,
Schoolpost

Related

Include html from remote server Edit then save on remote server

Let me begin with, that English is not my native tong.
There probably gonna be some miss-pelt words/sentences.
Explaining the situation:
I have bought a script for a lot of money that allows me to put it in the root directory and edit the static html documents with specific tags.
It saves the changes direct on the html.
i use it for old clients that bought a website from me a wile ago. (static html css websites)
Now i dont want to put the script on their own webserver, i would practically be giving away a script where somebody put a lot of time in.
The plan
Now i plan to put it on my own server next to my website.
The script allows me to save through a ftp connection.
so its save to say that it is possible to save from a remote server.
I manage to make a simple user script that let the client log in than php gets the ftp information from my sql server for the "ftp save function".
But now the real question
Is it possible for me to let my clients login onto my webserver and then "Include" their website into the session on my server and let the editor do his thing ?
so the script has to thing that it is on the root of the html document.
My explaining is probably unclear so let me add a image ;)
picaso
Thank you for your time ..
Hope to hear something from you all.

Are php files stored on a web server?

I am trying to learn how to use php via ajax and interact with wamp and databases. I do not understand how this works & it's slowing my progress significantly.
When I hear/read "upload php files to your server", what does that mean? I was under the impression that you included all files (php/js/html/etc) in the same folder locally when putting a website/app/etc online - am I mistaken? Are files stored on server and then initiated when called?
Where should php files (specifically scripts to pull and send information) be located? Not understanding this is bottle-necking my progress greatly, so thanks for the help.
A server is a Computer with High Specification which keeps running all time so that anyone can have access anytime.
let us see an Analogy.If you had hands on language's Such as C,C++,Python. You must have heard They are High level Language and need to be converted to machine code before they are Executed.
Similarly when we are on web our web browser only understands HTML (That is How to display data on screen)
PHP is a Scripting language (which means how program will work is decided by PHP)
A Database is location Where You can store Data For latter (PHP my need to access this data for computing eg: check if user is a valid user).
When You create a Website You Want a computer That is available all time (server).But they are expensive so You rent some space from Company such as GoDady ..Now This is like having Your own Computer. Uploding Files to Server Means Putting website Files to Your New Computer.
Now suppose You Want to Access your file on your local computer What you do?
C:/myfolder/myfile.php
Similarly on Server 'C' is Your websites Name so if your php file is in myfolder directory on your server.
www.mywebsite.com/myfolder/myfile.php
When you request webpage www.myfle.com it go to the server there it processes Php scripts and sends back only Html components that Browser Understands.

Can't link files with database (phpmyadmin)

Task: linking the new PDF's with the websites database (phpmyadmin)
link: http://thepeninsulaqatar.com/pdf/the-peninsula-newspaper?page=57
Explanation: I am uploading all the old PDFs to the website's Upload folder (in the httpdocs directory)
Obstacle: How to link all the uploaded PDFs with the phpmyadmin database.
I can always supply any additional information, since I can't really locate the problem from the tables.
What's meant by linking: So I mean here that after uploading the PDFs on their designated folder that are already names on the database, the database automatically auto-detects and when you press the button it prompts you to download the PDFs as in page one from the website I sent. What I mean by phpmyadmin: MySQL database I guess. It's embedded at most web hosting servers.
There is no easy and short answer to this. Three general approaches come into mind. None is better than the other, it depends on your situation which you prefer:
auto detection:
you need some form of script that runs periodically and scans for new files. This is typically done by a cron job, but that again is typically not offered for typical low budget web space. An alternative would be what is called a "poor mans cron" approach. Works, but annoying and complex.
registering during the upload:
a file upload typically is implemented in a script accepting and storing the file. The straight forward approach would be to enhance that script to also register the uploaded file inside the database. This is easy to implement, but you need to modify the existing script.
live scanning the file system:
instead of registering the uploaded files in some database you could also simply live scan the file system each time you want to offer a selection of a file. This obviously is slower than a database query, but it saves you from having to register the files at all, so far easier to implement. And it is very robust, since you have a single point of truth about what files exist under what name and url.
None of the approaches is trivial, but this certainly is not voodoo magic. It's impossible to give final script snippets here, the current state of the question does not offer enough information for this. Especially the existing situation, so existing scripts are missing.

Can PHP running on a remote server handle files on my computer?

I'm very new to programming, I know only HTML/CSS. I have an idea, I want to make a ittle more dynamic website. I want to find the programming language that suits my needs. The website I imagined should have a function like that:
If I go to the website there's a button. If I click on that button, theh website displays the files and folders of my local hard drive, for example my computer's C: partition. After that if I click on a file or folder, the program deletes that file.
Can PHP running on remote server handle local files like that? Can PHP program access my files from a remote server? If the answer is 'yes', could you help me with little code snippet, how can PHP do that, which part of the language can handle this situation?
Or do I have to choose another programing language?
(I ask about PHP because it seems to be the "first step" towards making dynamic websites and it's for general use. It would be good not to learn a very specific programming language as my first programming language...)
No it can't. You will need some java applet plus certified authorization or some VBScript with client approval. PHP ran only at server side and return the result as html to the web client
No. The remote server can only handle files you explicitly upload to it.

How to protect PHP from the public?

So I'm a bit confused about what crafty users can and can't see on a site.
If I have a file with a bunch of php script, the user cant see it just by clicking "view source." But is there a way they can "download" the entire page including the php?
If permission settings should pages be set to, if there is php script that must execute on load but that I dont want anyone to see?
Thanks
2 steps.
Step 1: So long as your PHP is being processed properly this is nothing to worry about...do that.
Step 2: As an insurance measure move the majority of your PHP code outside of the Web server directory and then just include it from the PHP files that are in the directory. PHP will include on the file system and therefore have access to the files, but the Web server will not. On the off chance that the Web server gets messed up and serves your raw PHP code (happened to Facebook at one point), the user won't see anything but a reference to a file they can't access.
PHP files are processed by the server before being sent to your web browser. That is, the actual PHP code, comments, etc. cannot be seen by the client. For someone to access your php files, they have to hack into your server through FTP or SSH or something similar, and you have bigger problems than just your PHP.
It depends entirely on your web server and its configuration. It's the web server's job to take a url and decide whether to run a script or send back a file. Commonly, the suffix of a filename, file's directory, or the file's permission attributes in the filesystem are used to make this decision.
PHP is a server side scripting language that is executed on server. There is no way it can be accessed client side.
If PHP is enabled, and if the programs are well tagged, none of the PHP code will go past your web server. To make things further secure, disable directory browsing, and put an empty index.php or index.html in all the folders.
Ensure that you adhere to secure coding practices too. There are quite a number of articles in the web. Here is one http://www.ibm.com/developerworks/opensource/library/os-php-secure-apps/index.html

Categories