使用XML/CSV/FTP的自动php/mysql更新脚本 [英] Automatic php/mysql update script using XML/CSV/FTP

查看:75
本文介绍了使用XML/CSV/FTP的自动php/mysql更新脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个PHP/MYSQL房地产分类网站,人们可以在该网站上注册并手动添加房地产分类广告.一切正常,但是我现在需要将该功能添加到批量上传属性广告中.

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.

我有两种方法可以做到这一点,第一种是通过XML,在我们的网站上注册的会员可以在其服务器上的网站页面上的服务器上添加XML文件的url.我们的自动脚本每天晚上都会读取XML文件,并使用XML提要中的详细信息和图像填充MYSQL数据库.

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.

第二部分是我挣扎的地方.一些房地产经纪人希望能够通过FTP将ZIP文件上传到我们的网站上,并将每晚CSV文件和图像上传到我们的服务器上,因此我们可以通读CSV文件并从中普及MYSQL数据库.

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.

我们将如何在服务器上给每个房地产经纪人一个位置来通过FTP传送他们的文件?我可以在我们的服务器上自动创建一个目录,其中包含他们的用户名,该用户名也只能访问FTP吗?我可以在服务器上自动创建FTP帐户吗?

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?

请注意,我正在运行安装了CPANEL的Linux服务器.我的网站正在使用MYSQL数据库在PHP中开发.

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.

推荐答案

您最好提供HTTPS文件上传功能,而不是FTP,因为您可以使用现有的PHP/MySQL身份验证系统来确保它的安全,而事实并非如此.不需要您的客户提供任何技术知识.然后,您可以使用PHP来解析ZIP文件,并实时检查其中是否包含所需文件,并在图像丢失或CSV损坏时提供即时反馈,从而节省了一些客户支持工作.

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.

请参见 http://www.php.net/manual/zh/class .ziparchive.php

自动创建FTP帐户需要pam_mysql,并且可能导致与cPanel的冲突.如果您确实要这样做,请在serverfault.com上询问

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

这篇关于使用XML/CSV/FTP的自动php/mysql更新脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆