Forumopolis


Go Back   Forumopolis > Main > The Main Forum

Reply
Thread Tools
Old 2013-04-18, 3:51 PM   #1
Spanky McPoopypants
In it to win...
 
Spanky McPoopypants's Avatar
 
Join Date: Aug 2005
Tech [Web help] Pulling content from a text file to display on a site.

I am in search of a way to automatically pull content from a text document (.doc, .txt, etc) and display it to a block on a website.
The purpose is for an end user to be able to FTP the text file to a pre-determined location and have the site update its listing by pulling the content from that file.

Help!
__________________

Spanky McPoopypants is offline   Reply With Quote
Old 2013-04-18, 4:11 PM   #2
Screevo
New Avatar Pending
 
Join Date: Aug 2005

Well, that's super dangerous to do since FTP is inherently insecure, BUT:

for PHP in a secure, non public on the web environment, you could just use include('filename.txt') or require('filename.txt') if you want the script to fail if the file doesn't exist. Keep in mind that if you use PHP, someone could upload a file that has PHP in it and cause it to be echoed as PHP.

Otherwise, you'd want to read the file into a variable, possibly utilizing a function to escape the text to eliminate possible dangerous data, and echo the variable, potentially with nlbr() to turn new line characters into HTML breaks.

If you want this to work with anything other than a plain text document, that'd be a lot trickier since you'd have to be able to read that file format.

edit: info on the second option: http://www.tizag.com/phpT/fileread.php
__________________

haters bring me balance / every kyle needs a cartman / i know how failure tastes / i drink it straight from the carton / i always keep a gallon in the fridge at my apartment / to remind me how it feels to drop the ball like stevie bartman

Last edited by Screevo; 2013-04-18 at 4:14 PM.
Screevo is offline   Reply With Quote
Old 2013-04-18, 4:26 PM   #3
Ben Wyatt: Human Disaster
The apex of sexy danger.
 
Ben Wyatt: Human Disaster's Avatar
 
Join Date: Aug 2005
AKA: Elatha, Westley, The Dread Pirate Roberts, Aloysius Snuffleupagus

Could you give them a text entry box to copy-paste the plaintext into? That would remove some of the security issues that free access to FTP might bring up. And introduce others, of course, but hey.
__________________
Ben Wyatt: Human Disaster is offline   Reply With Quote
Old 2013-04-18, 4:28 PM   #4
Spanky McPoopypants
In it to win...
 
Spanky McPoopypants's Avatar
 
Join Date: Aug 2005

Thanks for the info.

What the function is needed for:

A City Court office wants to be able to submit a trial calendar and have it published online. They want to be able to do it without the clerk having to do anything other than submit the document. It would only be open to a single user.
__________________

Spanky McPoopypants is offline   Reply With Quote
Old 2013-04-18, 4:46 PM   #5
Screevo
New Avatar Pending
 
Join Date: Aug 2005

Quote:
Originally Posted by Spanky McPoopypants View Post
Thanks for the info.

What the function is needed for:

A City Court office wants to be able to submit a trial calendar and have it published online. They want to be able to do it without the clerk having to do anything other than submit the document. It would only be open to a single user.
How would it only be open to a single user? What access controls are you going to put in place?
__________________

haters bring me balance / every kyle needs a cartman / i know how failure tastes / i drink it straight from the carton / i always keep a gallon in the fridge at my apartment / to remind me how it feels to drop the ball like stevie bartman
Screevo is offline   Reply With Quote
Old 2013-04-18, 4:50 PM   #6
Spanky McPoopypants
In it to win...
 
Spanky McPoopypants's Avatar
 
Join Date: Aug 2005

Just letting the clerk use a program like FileZilla to FTP the file to a specific directory with an FTP login created for them. We would ideally like for the function to pull the content from that file and fill in the text area with it.
I'm not wanting any type of transfer that is browser-based. The clerk would just name the file "calendar.doc" and the function would read the contents of "calendar.doc" and display it on the page. That way, the clerk can just overwrite the file with each update.
__________________

Spanky McPoopypants is offline   Reply With Quote
Old 2013-04-18, 4:52 PM   #7
Screevo
New Avatar Pending
 
Join Date: Aug 2005

Quote:
Originally Posted by Spanky McPoopypants View Post
Just letting the clerk use a program like FileZilla to FTP the file to a specific directory with an FTP login created for them. We would ideally like for the function to pull the content from that file and fill in the text area with it.
I'm not wanting any type of transfer that is browser-based. The clerk would just name the file "calendar.doc" and the function would read the contents of "calendar.doc" and display it on the page. That way, the clerk can just overwrite the file with each update.
Again, doing it in a word document will require some advanced coding, unless you can find a pre-written function that parses Word documents. Word has a "Save As HTML" feature that would probably help...

Anyway, an FTP username and password are transmitted in plain text. It's a rather insecure way to control access to a government website.
__________________

haters bring me balance / every kyle needs a cartman / i know how failure tastes / i drink it straight from the carton / i always keep a gallon in the fridge at my apartment / to remind me how it feels to drop the ball like stevie bartman
Screevo is offline   Reply With Quote
Old 2013-04-18, 5:32 PM   #8
frobbnik
Mouthy
 
frobbnik's Avatar
 
Join Date: Oct 2008
Location: Austin

FTPS exists, man, though a simple HTTP POST would be a better idea.

that being said, this is possibly the dumbest CMS implementation I've ever heard of.
__________________
I'm scissors, nerf rock. Paper's fine
frobbnik is offline   Reply With Quote
Old 2013-04-18, 6:16 PM   #9
Spanky McPoopypants
In it to win...
 
Spanky McPoopypants's Avatar
 
Join Date: Aug 2005

Well, the clerk is not wanting to deal with making changes themselves but also doesn't want to be at the mercy of someone "getting to it" when it comes to making changes.

That being said, thank you for your judgement on the quality of the implementation that is still in its infancy.
__________________

Spanky McPoopypants is offline   Reply With Quote
Old 2013-04-18, 6:44 PM   #10
Screevo
New Avatar Pending
 
Join Date: Aug 2005

FTPS or SFTP (two different things, which is weird) do exist as options, but you need to be working with a host that offers it. Chances are you're paying for hosting. In that case, SFTP is probably available (it's just FTP tunneled over SSH). Also available probably is SCP. I'd definitely utilize one of those as the transfer method.

Who BUILT your website? Is it presently just a collection of static HTML pages or is it running on a CMS platform like WordPress?
__________________

haters bring me balance / every kyle needs a cartman / i know how failure tastes / i drink it straight from the carton / i always keep a gallon in the fridge at my apartment / to remind me how it feels to drop the ball like stevie bartman
Screevo is offline   Reply With Quote
Old 2013-04-18, 6:50 PM   #11
Spanky McPoopypants
In it to win...
 
Spanky McPoopypants's Avatar
 
Join Date: Aug 2005

In-house hosting.
The site is in early development stages and is not live. Just looking for ways to go down the road. It won't be build on a WordPress backbone since it doesn't need to be dynamic beyond this one feature.
To tell you the truth, it doesn't NEED to display - I just thought it'd be a "neater" option than plopping down a "Download the calendar in PDF for Here" option.
I appreciate all of the feedback, though, and look forward to any advice you can provide.
__________________

Spanky McPoopypants is offline   Reply With Quote
Old 2013-04-18, 8:52 PM   #12
Screevo
New Avatar Pending
 
Join Date: Aug 2005

Save as HTML and upload is your best bet.
__________________

haters bring me balance / every kyle needs a cartman / i know how failure tastes / i drink it straight from the carton / i always keep a gallon in the fridge at my apartment / to remind me how it feels to drop the ball like stevie bartman
Screevo is offline   Reply With Quote
Old 2013-04-18, 9:20 PM   #13
Spanky McPoopypants
In it to win...
 
Spanky McPoopypants's Avatar
 
Join Date: Aug 2005

Thank you for all of the advice, Screevo. (and Ben and Frob)
__________________

Spanky McPoopypants is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:49 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Forumopolis & DramaLlama 2002 - 2014, Evan Exner | F5 2004-2010, Chris Routly