parsing text files

This is a discussion on parsing text files within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I am very new to PHP, what I am trying to do is something like this: Parse text files based ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-23-2003
mike c
 
Posts: n/a
Default parsing text files

I am very new to PHP, what I am trying to do is something like this:

Parse text files based on a URL the user enters.

For example something like (my syntax is probably wrong):

http://www.example.com/index.php?one.txt
http://www.example.com/index.php?two.txt
http://www.example.com/index.php?three.txt

This way I would have a standard html template that gets populated by
different text files.


Reply With Quote
  #2 (permalink)  
Old 07-24-2003
mike c
 
Posts: n/a
Default Re: parsing text files


"vKp" <asso101@hotmail.com> wrote in message
news:bfm6qo$m9b$1@newsg4.svr.pol.co.uk...

> Then on the index page have something like:
> <?php
> $page = $_GET['page'];
> include("path/to/text/file/dir/" . $page . ".txt");
> ?>
>
> One thing you should be careful of is making sure that you don't just
> include any old file from any location.


What about simply hardcoding the URL into the path?
Like this:
include("http://www.example.com/dir/" . $page . ".txt");

Would that take care of any security concerns as only pages that originate
on my server could be used?


Reply With Quote
  #3 (permalink)  
Old 07-24-2003
Martijn Engler (a.k.a. Blizt)
 
Posts: n/a
Default Re: parsing text files

mike c wrote:

> What about simply hardcoding the URL into the path?
> Like this:
> include("http://www.example.com/dir/" . $page . ".txt");
>
> Would that take care of any security concerns as only pages that originate
> on my server could be used?
>
>


It probably would. Because the possibility to do something like
http://www.example.com/?page=evilsite.com/myevilcode with a txt-file
with some really "evil" code in it would be eliminated. So, maybe I
forget some other sec.problems but it would take care of the most
famous/dangerous one.

Regards,
Blizt

Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:49 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0