Automatic php/mysql update script using XML/CSV/FTP - php

Im currently working on developing a PHP/MYSQL property classifieds website where people can register and manually add property classified adverts. This is all working fine, but I now need to add the functionality to bulk upload property adverts.
There are 2 ways I need to do this, the first is via XML, where a member who is registered on our site can add the url of an XML file on their server, on their account page on our website. Our automatic script will read through the XML file each evening and populate our MYSQL database using the details and images from their XML feed.
The second part is where I am struggling. Some Estate Agents want to be able to upload their properties to our website by FTP'ing a ZIP file, with CSV file and images to our server each evening, so we can then read through the CSV file and populare the MYSQL database from this.
How would we go about giving each Estate agent a place on our server to ftp their files too? Could I automatically create a directory on our server with the name of their username where only they had access to FTP too? Would I be able to automatically create FTP accounts on my server?
Please note I am running a linux server with CPANEL installed. My website is developing in PHP with a MYSQL database.
Any advice on the best methods to implement this functionality would be appreciated.

You'll be better off offering a HTTPS file upload, rather than FTP, because you can secure that with your existing PHP/MySQL authentication system and it doesn't require any technical knowledge from your clients. Then you can use use PHP to parse the ZIP file and check it contains what you need in real time, and provide instant feedback if images are missing or the CSV is corrupt, saving you some customer support effort.
See http://www.php.net/manual/en/class.ziparchive.php
Automating the creation of FTP accounts would require pam_mysql, and may cause a conflict with cPanel. If you really want to do that, ask over on serverfault.com

Related

Integrating MS Office with PHP & SQLServer Filetables

I have implemented a Document Management System (Web Application) in PHP which stores all documents on SQL server in Filetable. The Software works fine with Downloading the document, modifying it and uploading back to the server.
My Question :
1: When the file is downloaded the browser handles it as an attachment and could be opened in MS-Word by the user. Is it possible to open the document in particular application for e.g in MS-Word? Make changes to the document and while saving the document it saves/uploads directly to the SQL server. So that the user doesn't have to upload it back from my web application.
I would appreciate any leads to the solution.
Thanks in Advance.
You could setup webdav endpoints which interacts with your file database.
See also this question:
Open remote document and save back to remote server
There is a feature in SQL with name FileTables this allow for client application (ex: ms word) to open the file directly from Database using network share folder. This also allow to store directly to database without any programming.
I also come up with this question and see this as an options. But I still didn't know if this feature can be combined with WebDAV.
ref: https://learn.microsoft.com/en-us/sql/relational-databases/blob/compare-options-for-storing-blobs-sql-server?redirectedfrom=MSDN&view=sql-server-ver15

How to find the web site page add on the page of public web site

I want to get the notification if the company public web site add the document on there web sites. I need to do this for around 400 public sites. As every site will have different document directory, i will make the database for all sites directory information in Mysql at my local server.
Example1
http://www.hubpower.com
The documents directory is placed in on the following path
http://www.hubpower.com/wp-content/themes/hubco/pdf/
There are further two documents link in the above folder:
http://www.hubpower.com/wp-content/themes/hubco/pdf/3Q2K17%20Result.pdf
http://www.hubpower.com/wp-content/themes/hubco/pdf/1910-financial-results-announcements-(dec-2015).pdf
Example2
http://www.pk.abbott/investor/investor-information.html
There are two documents directories is placed in on the following path
http://dam.abbott.com/en-pk/documents/pdf/investors/
http://dam.abbott.com/en-pk/investor-relations/
Here are the documents links:
http://dam.abbott.com/en-pk/documents/pdf/investors/Q12017.pdf
http://dam.abbott.com/en-pk/investor-relations/2016Q3.pdf
http://dam.abbott.com/en-pk/investor-relations/Abbott_A_R_2016.pdf
http://dam.abbott.com/en-pk/investor-relations/AR2015.pdf
If website add any more pdf documents on above path, I would like to have notification on email plus further download the new documents from website directory to my local server.
Please advice some solution to achieve this goal. I prefer working with
Restful, PHP, Angularjs, Nodejs, python,Javacript
Thanks & regards
you can use any Website Content Changes tool like Chrome Plugin Visualping which can email you.
Form this Answer
In general, you will need to poll the website if there are no other possibilities like a news feed. You can't force them to provide such a service.
For Wikipedia in detail, there are live update IRC streams, one for each project. Wikistream is such an app that reads the feed, you can view it's open source node.js code at github.
You can use nodejs and the request module to get the html for every 400 pages you are mentioning, then you parse it with cheerio, then you use mysql module to put all the data into your database, you can also check if the data you scraped already exist in your database, if yes, you do nothing, you can do this like once a day

Virtual file system in php?

We have a system where, a large part of it is the ability to upload and download files if you are logged in and have the correct permissions.
What we are looking at doing to help with the organization from the users point of view is having a virtual file system type layout.
Even if (or even preferably) all the users files are actually just stored in one directory, and the virtual file system is just a screen put up from the database.
What we are wondering before we invest in creating this is if this already exists somewhere, open source (but able to be used in commercial software), free, or paid (first two preferably!).
A simple file system on top of PHP can be done by WebDAV that is built on top of PHP:
http://sabre.io/
This would be a good example, but there are others as well. WebDAV is essentially a web based file system (http://en.wikipedia.org/wiki/WebDAV).
This could not only provide a file system, but also would let you edit files directly with Word/Excel (2007+) in it. Showing then a treeview of folders and files would be quite trivial, using few database tables and some jquery components, such as jsTree and jqGrid.
Although if you are searching for a full document management system: http://www.opendocman.com/ or http://code.google.com/p/simpledoc/ this would be more then enough.
It really depends on how many features you are going to incorporate into this system. Will there be an OCR, would you like to store the files in the cloud service, how many user input there will be (is simple upload enough, or camera, scanners and other devices are needed to be used as well)?
As for the commercial products, you could check out Microsoft SharePoint (http://en.wikipedia.org/wiki/Microsoft_SharePoint) or IBM Lotus Notes (http://en.wikipedia.org/wiki/IBM_Lotus_Notes)

Syncing data and images with a client in a web application

I'm writing a web application in PHP which needs to store images and image meta data. In future, the application may need to work offline on the client. A user might need to download all the images and data to his laptop before going to a remote area without internet access. Whilst at the remote location the user could add new images to the system and be able to compare them with his local copy of the image database. When returning to an area with internet access, the user would run a sync operation which would copy his new images to the server and retrieve any new ones.
I've looked at the new web storage / localstorage options in HTML5 (web sql database seems to have been dropped) and I think this is going to be too limited as there is only 5MB space and one or two images could easily exceed that.
Is what I want to do actually possible / practical with a browser-based web application? Or should I be looking at writing a desktop/tablet application with local file storage capabilities for users without net access. Initially, it does need to be a web application, I'm just trying to think ahead. Will I give myself more options in future by using something like couchDB for the backend from the start? As I understand it, this comes with good syncing functionality.
Thanks,
I decided to use Titanium Desktop.
http://www.appcelerator.com/products/titanium-desktop-application-development/

Suggestions on a solution for storing photos per client, which they can then have access to

I am trying to build an app for a photographer. These are his requirements:
Photographer can upload photos or files (files up to 20-30mb).
Photographer can categorize photos and files by client.
Photographer can create client username and passwords.
Photographer can send email from web interface to link to download. (which requires client login)
Client can login and view and download photos and files assigned to his account.
Photographer mentioned 1-2 terabytes of data needs to be stored.
So, my questions:
Is there an open source system out there that already does this.
Is there an app already out there that does this. Photographer currently uses "yousendit" but the free solution is not sufficient since data is lost after 2 weeks.
He mentioned he could host it on a box at his office, but his connection is limited.. thaughts? At that point storage space would not be an issue. I would have to code this app.
GoDaddy hosting for example does unlimited storage with one of its plans that is reasonable. If I coded my own app, this would be perfect. I do hate GoDaddy though..
I will listen to any alternative suggestions.
Thanks!!
I'm not sure about building an app like this, but SmugMug is an existing app that hits most of your requirements.
Can upload unlimited JPGs as part of base cost, other files can be uploaded at additional cost
Photos can be categorized into galleries per client.
Galleries can be locked down, with clients getting unique user/pass to their gallery
Not 100% sure if you can email a link directly from the site, but I believe you can.
Additionally, if you get a pro account, clients can order prints online (no need to build your own payment processing), you can "theme" the galleries how you like, automatic watermarking, etc.
The base cost is $40-$150/year, depending on what level you choose, plus whatever you need for additional file storage. Not sure if it meets all your needs, but just throwing it out there. Note: I am not affiliated w/ SmugMug, just a satisfied user.
The first question you need to answer is whether you will store the files in the database or on the file system. Given the amount of data in question, I would store the file on the file system and keep meta data about the files including their location in the database. The catch to this approach is that you have to keep the two in sync with each other. It is not particularly difficult to build that system.
The second question relates to where you store the files. You could store the at the same place where you host the site or you could use a cloud storage option like Amazon's S3 (or DreamHOst mentioned by J_B). One advantage of using cloud storage is that the site can hosted anywhere without affecting the location of the files.
DreamHost might not mind. They say they will give you all the storage your site needs with all plans (+ some extra for storing whatever you want).
I don't know about an app that does that. Doesn't sound REAL hard to write.

Categories