I have webspace that I can access through ftp. I need a database that I can read and write to remoteley. Is there any way to put a database on a server when the only way I can access that server is through an FTP username and password? I would like to be able to send data from a raspberry pi to this database, then display the data on my website.
There is not one database in the world that you can access the data via FTP directly. FTP is a file transport protocol and most database use their own protocol to communicate with remote users.
For example Microsoft SQL server uses the TDS protocol. MySQL will have its own protocol etc. Another problem you will have is that FTP is extremely insecure. Your user name and password will be hacked if you use this protocol. DO NOT use FTP to transfer sensitive data.
The only way you will be able to let the Raspberry Pi send data to the database is to program it to talk the MySQL protocol. Or to send up a file via FTP and then upload this file with scripts.
Related
In PHP, I am accessing another user's files using FTP on the same server. In this case, do I need to use secure FTP or is it ok to have normal FTP as both source and destination are on same server?
Thanks.
I need to have read access data to a dbf file stored within a client computer that's connected to my server locally. Is there any way that I can do this using PHP?
The scenario is, when the admin of the site clicks UPDATE on his PC, it tells the server to open the dbf file from another client PC and gets data from it. I have read this but it seems it does not have parameters that allows me to specify the IP address of the client PC.
My idea is to access via IP example: 192.168.1.24 is the IP and the dbf file is in "C:Users\Data\Sales.dbf".
You cannot access another one's computer, obviously for security reasons. You have to upload this file and store it on your server to open it there is no way around that unless you hack your clients.
I have a MYSQL database with users table, and I want to make a python application which allows me to login to that database with the IP, pass, username and everything hidden. The thing is, the only IP which is allowed to connect to that mysql database, is the server itself (localhost).
How do I make a connection to that database from a user's computer, and also be able to retrieve data from it securely? Can I build some PHP script on the server that is able to take parameters and retrieve data to that user?
You should not make a connection from the user's computer. By default, most database configurations are done to allow only requests from the same server (localhost) to access the database.
What you will need is this:
A server side script such as Python, PHP, Perl, Ruby, etc to access the database. The script will be on the server, and as such, it will access the database locally
Send a web request from the user's computer using Python, Perl, or any programming language to the server side script as described above.
So, the application on the user's computer sends a request to the script on the server. The script connects to the database locally, accesses the data, and sends it back to the application. The application can then use the data as needed.
That is basically, what you are trying to achieve.
Hope the explanation is clear and it helps.
You can use below code into your python script to connect your application with remote mysql database.
import MySQLdb
myDB = MySQLdb.connect(host="x.x.x.x", port=3306, user="**********", passwd="*****************")
You need to install mysql-python to connect your python application with mysql database.
As i understood you are able to connect only with "server itself (localhost)" so to connect from any ip do this:
mysql> CREATE USER 'myname'#'%.mydomain.com' IDENTIFIED BY 'mypass';
I agree with #Daniel no PHP script needed...
I have a Ubuntu Server on which I have my Apache and FTP server (I am using Proftpd server). I have a small PHP CMS and for database I am using MySQL server. This was my server side environment. Now on client side I have a C# ftp client which I use to download the file from FTP server. Also, this C# client communicates with my PHP CMS.
So in short there are two communications occurs at a time
1. C# client and FTP server for file transfer.
2. C# client and PHP CMS for some other work.
So, now what I want is real time progress (progress bar) of my ftp transfer on one of my CMS webpage.
Obviously one of thing I can do is that I can tell my C# client to upload it's download progress to PHP server using some web service or web socket and then I can show the progress of ftp transfer(basically progress of downloading of C# client).
But before doing this I just want to know that is it possible for my PHP server to check what FTP server is doing. Since, no communication occurs between them I don't know how to accomplish it? I have a MySQL server and I know that proftp can communicate with MySQL server and it has some predefined table in which I can store whatever is ftp server doing. But will it possible to use it to show a real time progress? Is their any other technique to do this or will I have to force my C# client to do it?
From what you say, you have no need to talk to the FTP server at all (except to download the file, of course). Your FTP client could upload the FTP transfer status to a Web socket (and why could it not display it directly?), there to be recovered by the CMS and shown in the page. By using sessions, you do not even need to actively save that information anywhere, provided the Web socket call properly initializes the session cookies.
In the FTP client download callback function just add a call to send the progress status to the server. There, a scriptlet will save it into, say, $_SESSION['download_status']. An AJAX call on the CMS page can then retrieve it and display it periodically.
Don't forget to also upload FTP session and exception status (transfer interrupted, etc.).
I need to make a secure connection using php to a remote mysql database. Do I need to install ssl certificates on both servers? Or just in the server where I have the mysql database?
It depends on what you want to secure.
If you want to secure the communication between the user-agent (browser) to your web server, you need to set up a certificate on the web server.
If you want to secure the communication between the web server (the DB client) and the MySQL server, you need to set up a certificate on the MySQL server.
In addition, you could make the MySQL client (your PHP script) use a client-certificate to authenticate to the MySQL server. This might not be necessary if MySQL username/password are considered enough.
The certificate resides only on the MYSQL server side if you want to connect from your script to the database. Your database server does not ever initiate connections with your web code, so the web side would not need a certificate for DB communication. If you want to secure the communication between the client browser all the way to the DB, then you need a certificate for the website for the client browser to consume.