[PHP] Includes

2002-10-07 Thread Rick Beckman

I'm wanting to use PHP to make updating an entire site easier by using
include() [I think that's the function] to include navigation bars, notices,
etc. on multiple pages. What's the best way to do that, and is it possible
to keep the included files from being indexed/viewed on their own (possibly
by password protecting [htaccess] the directory they are in)? Thanks in
advance for any help.

-- 
Kyrie Eleison,
Rick Beckman
www.spiritsword.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Umm... Uh-oh

2002-10-04 Thread Rick Beckman

Okay, I was mistaken... There is a gaping security hole in my simple li'l
script... How do I modify it to only accept files from a certain path? I
want the url format to be script.php?call=1 where 1 is the called file in
the /includes/ directory. Just when I get optimistic I leave the entire
system exposed. Yeah, that fits with my luck. :-)

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


Rick Beckman wrote:
 Sarcasm aside, I do have the script set up (although I didn't note so
 in the last response) to not accept files with '.' or '..' in the
 path. The URL can accept directories within the one the PHP script is
 in, but not in a different path or any directory above its own (i.e.,
 the server files).


 John W. Holmes wrote:
 I have a page set up that loads the contents of a text file into an
 HTML template using PHP. (i.e. something.com/page.php?include=1
 where 1 is a simple no-extension text file in the same directoy as
 page.php). Is there a
 way to modify the PHP code in the template page to search for the
 included page in another directory? Right now, the only way to do it
 is to have the URL as page.php?include=files/1.

 Currently, here is the code I use to takes the $include URL variable
 and makes the file accessible in the template:

 $info = file($include);

 Can I get the URL to your server, please, so I can pull up
 page.php?include=/etc/passwd ?? Thanks, I would really appreciate
 that.

 But seriously, I really hope you are validating what $include is.

 If you want the file to be included from a different directory, then
 you have to pass some flag/variable to PHP to tell it where to look.
 If you always want it to be in the same dir, then use

 $info = file('files/' . $include);

 ---John Holmes...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] the files I'm working with

2002-10-04 Thread Rick Beckman

song.php is the file that I'm using as my template file, and it calls
information from the includes/ directory, which the file 1 would be in. If
someone would please look at song.php (I stripped it down to the basics
pretty much) and let me know the best and most secure way to do what I want
it to do. When finished, the includes directory will have dozens of files
(numbered 1 and up), as you can see from the dropdown list in song.php .
Thanks for the help.

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


Rick Beckman wrote:
 Okay, I was mistaken... There is a gaping security hole in my simple
 li'l script... How do I modify it to only accept files from a certain
 path? I want the url format to be script.php?call=1 where 1 is the
 called file in the /includes/ directory. Just when I get optimistic I
 leave the entire system exposed. Yeah, that fits with my luck. :-)


 Rick Beckman wrote:
 Sarcasm aside, I do have the script set up (although I didn't note so
 in the last response) to not accept files with '.' or '..' in the
 path. The URL can accept directories within the one the PHP script is
 in, but not in a different path or any directory above its own (i.e.,
 the server files).


 John W. Holmes wrote:
 I have a page set up that loads the contents of a text file into an
 HTML template using PHP. (i.e. something.com/page.php?include=1
 where 1 is a simple no-extension text file in the same directoy
 as page.php). Is there a
 way to modify the PHP code in the template page to search for the
 included page in another directory? Right now, the only way to do
 it is to have the URL as page.php?include=files/1.

 Currently, here is the code I use to takes the $include URL
 variable and makes the file accessible in the template:

 $info = file($include);

 Can I get the URL to your server, please, so I can pull up
 page.php?include=/etc/passwd ?? Thanks, I would really appreciate
 that.

 But seriously, I really hope you are validating what $include is.

 If you want the file to be included from a different directory, then
 you have to pass some flag/variable to PHP to tell it where to look.
 If you always want it to be in the same dir, then use

 $info = file('files/' . $include);

 ---John Holmes...


begin 666 song.php
M/%$3T-465!%($A434P@4%53$E#((M+R]7,T,O+T141!(5$U,(#0N,#$@
M5')A;G-I=EO;F%L+R]%3B(@(FAT=' Z+R]W=WN=S,N;W)G+U12+VAT;6PT
M+VQO;W-E+F1T9(^#0H\:'1M;!L86YG/2)E;B(^#0H\/PT*21I;F9O(#T@
M9FEL92@DV]N9RD[#0H))YE=S @/2!S=')?F5P;%C92@B7XB+(B+1I
M;F9O6S!=*3L-@DD;F5W,2 ]('-TE]R97!L86-E*);B(L(B(L)EN9F];
M,5TI.PT*21N97R(#T@W1R7W)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(#$S(CY'F5A=!7
M:ET92!!;F=E;#PO;W!T:6]N/@T*0D\;W!T:6]N('9A;'5E/2(Q-(@;%B
M96P](E1R86-K(#$T(CY*=7-T($]V97(@:6X@25A=F5N/]O'1I;VX^#0H)
M3PO;W!T9W)O=7 ^#0H)/]S96QE8W0^#0H)/EN'5T('1Y4](G-U8FUI
M=(@=F%L=64](D=E=!)=$B

[PHP] Re: the files I'm working with

2002-10-04 Thread Rick Beckman

Outlook Express added a .dat extension to the 1 file... The actual files
I'm working with do NOT have extensions. Just wanted to clear that up.


-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


Rick Beckman wrote:
 song.php is the file that I'm using as my template file, and it calls
 information from the includes/ directory, which the file 1 would be
 in. If someone would please look at song.php (I stripped it down to
 the basics pretty much) and let me know the best and most secure way
 to do what I want it to do. When finished, the includes directory
 will have dozens of files (numbered 1 and up), as you can see from
 the dropdown list in song.php . Thanks for the help.


 Rick Beckman wrote:
 Okay, I was mistaken... There is a gaping security hole in my simple
 li'l script... How do I modify it to only accept files from a certain
 path? I want the url format to be script.php?call=1 where 1 is the
 called file in the /includes/ directory. Just when I get optimistic I
 leave the entire system exposed. Yeah, that fits with my luck. :-)


 Rick Beckman wrote:
 Sarcasm aside, I do have the script set up (although I didn't note
 so in the last response) to not accept files with '.' or '..' in the
 path. The URL can accept directories within the one the PHP script
 is in, but not in a different path or any directory above its own
 (i.e., the server files).


 John W. Holmes wrote:
 I have a page set up that loads the contents of a text file into
 an HTML template using PHP. (i.e. something.com/page.php?include=1
 where 1 is a simple no-extension text file in the same directoy
 as page.php). Is there a
 way to modify the PHP code in the template page to search for the
 included page in another directory? Right now, the only way to do
 it is to have the URL as page.php?include=files/1.

 Currently, here is the code I use to takes the $include URL
 variable and makes the file accessible in the template:

 $info = file($include);

 Can I get the URL to your server, please, so I can pull up
 page.php?include=/etc/passwd ?? Thanks, I would really appreciate
 that.

 But seriously, I really hope you are validating what $include is.

 If you want the file to be included from a different directory,
 then you have to pass some flag/variable to PHP to tell it where
 to look. If you always want it to be in the same dir, then use

 $info = file('files/' . $include);

 ---John Holmes...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: $B$($($H(B

2002-10-04 Thread Rick Beckman

The best translation I could find comes from worldlingo.com ...
$B$3(B $B$l(B $B$C(B $B$F(B $B$I(B $B$(B $B$d(B $B$C(B $B$F(B 
solution? $B$9(B $B$k(B $B$s(B $B$G(B $B$7(B $B$g(B $B$(B?

Obviously, that's not enough to help.. Sorry. However, they do offer
clarification by human translators for only 31 bucks... I suppose if the
problem is great enough, someone will shell out the cash. Other than that,
no dice.

--?
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


$BK\AO(B wrote:
 $B$3$l$C$F$I$$d$C$F2rFI$9$k$s$G$7$g$!!!(B



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: $B$($($H(B

2002-10-04 Thread Rick Beckman

And I see my post got butchered... Well, that's what I get for trying to
help. :-\

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


Rick Beckman wrote:
 The best translation I could find comes from worldlingo.com ...
 $B$3(B $B$l(B $B$C(B $B$F(B $B$I(B $B$(B $B$d(B
 $B$C(B $B$F(B solution? $B$9(B $B$k(B $B$s(B $B$G(B
 $B$7(B $B$g(B $B$(B?

 Obviously, that's not enough to help.. Sorry. However, they do offer
 clarification by human translators for only 31 bucks... I suppose
 if the problem is great enough, someone will shell out the cash.
 Other than that, no dice.

 --?
 Kyrie Eleison,
 Rick
 www.spiritsword.com/phpBB2/


 $BK\AO(B wrote:
 $B$3$l$C$F$I$$d$C$F2rFI$9$k$s$G$7$g$!!!(B



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Calling Files from a different directory

2002-10-03 Thread Rick Beckman

I have a page set up that loads the contents of a text file into an HTML
template using PHP. (i.e. something.com/page.php?include=1 where 1 is a
simple no-extension text file in the same directoy as page.php). Is there a
way to modify the PHP code in the template page to search for the included
page in another directory? Right now, the only way to do it is to have the
URL as page.php?include=files/1.

Currently, here is the code I use to takes the $include URL variable and
makes the file accessible in the template:

$info = file($include);

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


---
Outgoing mail is certified Virus Free because I care. Jesus Saves!
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/02



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Calling Files from a different directory

2002-10-03 Thread Rick Beckman

Sarcasm aside, I do have the script set up (although I didn't note so in the
last response) to not accept files with '.' or '..' in the path. The URL can
accept directories within the one the PHP script is in, but not in a
different path or any directory above its own (i.e., the server files).

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


John W. Holmes wrote:
 I have a page set up that loads the contents of a text file into an
 HTML template using PHP. (i.e. something.com/page.php?include=1
 where 1 is a simple no-extension text file in the same directoy as
 page.php). Is there a
 way to modify the PHP code in the template page to search for the
 included page in another directory? Right now, the only way to do it
 is to have the URL as page.php?include=files/1.

 Currently, here is the code I use to takes the $include URL variable
 and makes the file accessible in the template:

 $info = file($include);

 Can I get the URL to your server, please, so I can pull up
 page.php?include=/etc/passwd ?? Thanks, I would really appreciate
 that.

 But seriously, I really hope you are validating what $include is.

 If you want the file to be included from a different directory, then
 you have to pass some flag/variable to PHP to tell it where to look.
 If you always want it to be in the same dir, then use

 $info = file('files/' . $include);

 ---John Holmes...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Recursive Replace

2002-10-02 Thread Rick Beckman

? for ($i = 7; $i  sizeof($info); $i+=1) { echo $info[$i]; } ?

That line of code successfully will display lines 7 and on of an included
text file into my HTML boilerplate. However, in my hundreds of source text
files, br is not included at the end of the lines, therefore lines 7 and
on appear as one chunk of text, rather than neatly formatted lines. How can
I combine that line of code with str_replace() or some other replace
function in order to turn \n into br for each line. I've experimented
with several different possibilities, but none of them output anything.

Please help ASAP. The lyrics site is the most popular part of my website,
and unfortunately it's down until I get this code figured out.

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Recursive Replace

2002-10-02 Thread Rick Beckman

Nevermind. Leave it to me to make a very stupid mistake. I fixed it though,
and now it works great. For any who are interested, here is the working
code... Dunno why you'd need it, but whatever:

? for ($i = 7; $i  sizeof($info); $i+=1)
{
 $new7 = str_replace(\n,br,$info[$i]);
 echo $new7;
}
?

My mistake was leaving that I left the second '$' out of '$info[$i]'. At
least I found it before I frustrated myself. Thanks anyway! :-)

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


Rick Beckman wrote:
 ? for ($i = 7; $i  sizeof($info); $i+=1) { echo $info[$i]; } ?

 That line of code successfully will display lines 7 and on of an
 included text file into my HTML boilerplate. However, in my hundreds
 of source text files, br is not included at the end of the lines,
 therefore lines 7 and on appear as one chunk of text, rather than
 neatly formatted lines. How can I combine that line of code with
 str_replace() or some other replace function in order to turn \n
 into br for each line. I've experimented with several different
 possibilities, but none of them output anything.

 Please help ASAP. The lyrics site is the most popular part of my
 website, and unfortunately it's down until I get this code figured
 out.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Recursive Replace

2002-10-02 Thread Rick Beckman

Thanks everyone! Works great! :-) If only I would have noticed how obvious
it was before trying making it more difficult than I had to.

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


Mike Ford wrote:
 -Original Message-
 From: Rick Beckman [mailto:[EMAIL PROTECTED]]
 Sent: 02 October 2002 12:12

 ? for ($i = 7; $i  sizeof($info); $i+=1) { echo $info[$i]; } ?

 That line of code successfully will display lines 7 and on of
 an included
 text file into my HTML boilerplate. However, in my hundreds
 of source text
 files, br is not included at the end of the lines,
 therefore lines 7 and
 on appear as one chunk of text, rather than neatly formatted
 lines. How can
 I combine that line of code with str_replace() or some other replace
 function in order to turn \n into br for each line.

 If it's genuinely one line per $info[] element, just add the
 dad-blamed br to your echo:

  ? for ($i = 7; $i  sizeof($info); $i+=1) { echo $info[$i], 'br';
 } ?

 Cheers!

 Mike

 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Thanks!

2002-10-01 Thread Rick Beckman

Thanks, Erwin!

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


Erwin wrote:
 On line 6, I have the list of musicians in the song.
 Example (ignore the quotes): Doyle Lawson -- lead vocal; Dale Perry
 -
 - bass vocal
 Is there a way to make it so that, when I include line 6 in my PHP
 template, the ; will be replaced with a line break so I get one
 musician per line in the HTML output?

 You could use str_replace on the line you've just read...
 http://www.php.net/str_replace

 Lines 7 and so on are the lyrics. The text file has one line per line
 (makes sense, right?) and a blank line between sections of the song.
 I have the script set up to read all the lines from 7 on, but it
 jumbles them all together, ignoring the line breaks. Is there a way
 to script PHP to add the line breaks, or should the line break HTML
 just be inserted everywhere needed in all my separate files?

 Use nl2br: http://www.php.net/nl2br
 This function replaces all \n (newlines) with BR\n (HTML break
 with newline)

 HTH
 Erwin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP Include Help

2002-09-30 Thread Rick Beckman

I have a series of text files that are set up with each line being a
different field. Line 0 is song title, 1 is artist, 2 is album, and so
forth. I know how to use PHP to include those files in an HTML template so
that I don't have to make a separate page for each song, however, I do have
two problems:

On line 6, I have the list of musicians in the song.
Example (ignore the quotes): Doyle Lawson -- lead vocal; Dale Perry -- bass
vocal
Is there a way to make it so that, when I include line 6 in my PHP template,
the ; will be replaced with a line break so I get one musician per line in
the HTML output?

Lines 7 and so on are the lyrics. The text file has one line per line (makes
sense, right?) and a blank line between sections of the song. I have the
script set up to read all the lines from 7 on, but it jumbles them all
together, ignoring the line breaks. Is there a way to script PHP to add the
line breaks, or should the line break HTML just be inserted everywhere
needed in all my separate files?

All help is appreciated!



-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


---
Outgoing mail is certified Virus Free because I care. Jesus Saves!
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/02



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Including Text File in PHP/HTML Template

2002-09-30 Thread Rick Beckman

I have a series of text files that are set up with each line being a
different field. Line 0 is song title, 1 is artist, 2 is album, and so
forth. I know how to use PHP to include those files in an HTML template
using 'echo' so that I don't have to make a separate page for each song,
however, I do have two problems:

On line 6, I have the list of musicians in the song.
Example (ignore the quotes): Doyle Lawson -- lead vocal; Dale Perry -- bass
vocal
Is there a way to make it so that, when I include line 6 in my PHP template,
the ; will be replaced with a line break so I get one musician per line in
the HTML output?

Lines 7 and so on are the lyrics. The text file has one line per line (makes
sense, right?) and a blank line between sections of the song. I have the
script set up to read all the lines from 7 on, but it jumbles them all
together, ignoring the line breaks. Is there a way to script PHP to add the
line breaks, or should the line break HTML just be inserted everywhere
needed in all my separate files?

All help is appreciated!


-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


---
Outgoing mail is certified Virus Free because I care. Jesus Saves!
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/02



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php