Re: [PHP] Send mail in HTML FORMAT

2002-11-03 Thread Jennifer Swofford
You also need to add the text/html header, such as:

$headers = Content-Type: text/html \r\n;

mail([EMAIL PROTECTED], subject,$out , From: website, $headers);

jen

 I read from a template, insert data and save it as a new file with html
 code...
 i want to send that file that is the same as $out via mail embedded in
it...

 i do

 $fifi = fopen ('/'.$cursada.$cuatrimestre.'/'.$registronro.'.htm', w);
 $fp = $fifi;
 fputs ($fifi, $out . );
 fclose ($fifi);
 mail([EMAIL PROTECTED], subject,$out , From: website);

 but when i receive that mail.. i get the source of the file with html
 body bla bla bla not in HTML FORMAT..

 thnx in advance!..

 Spooky




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




RE: [PHP] Blank PHP pages.

2002-10-16 Thread Jennifer Swofford

What's your PHP code look like?

--- Angel Gabriel [EMAIL PROTECTED] wrote:
 I get absolutly NOTHING! I get the most basic HTML
 page, but blank, as in
 the following

 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0
 Transitional//EN
 HTMLHEAD
 META content=text/html; charset=windows-1252
 http-equiv=Content-Type/HEAD
 BODY/BODY/HTML


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




Re: [PHP] Help Needed

2002-10-15 Thread Jennifer Swofford

--- Pushpinder Singh Garcha [EMAIL PROTECTED] wrote:
 Hi

 I am trying to create an online survey using PHP
 ...I am using MySQL as
 the database and MAC OS Jaguar. I do not need the
 results to be added to
 the database. I need to be able to send the results
 of the survey to an
 email addressI know that this is possible using
 MS FrontPage but
 with PHP I am not so sure. Please help.

The last time I did this, I did something like the following.  Note that it
all starts out with an HTML form with fields called name and question1. 
The form action called a page containing the following.

!-- SEND EMAIL --
?
$to .= [EMAIL PROTECTED];
$subject = This is the subject;
$message = This is the message

Name: $name
Question 1: $question1;

$headers .= From: Me [EMAIL PROTECTED]\r\n;
$headers .= Cc: [EMAIL PROTECTED]\r\n;

mail($to, $subject, $message, $headers);
?
!--END SEND EMAIL --


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




[PHP] upload directory

2002-10-14 Thread Jennifer Swofford

Is there an easy way to upload an entire directory?  Rather than selecting the 19 
files in a directory, to just select the directory, and have all its contents go with 
it?  (Or even a not-such-an easy way?)

Thank you very much for any hints.
Jen



Re: [PHP] upload directory

2002-10-14 Thread Jennifer Swofford

First scenario is correct.


 Are you trying to do this via a web-script?
 Meaning, your php script is the server, and windows would be the client?

 Or is your script uploading a file to another server?

 Tim


 - Original Message -
 From: Jennifer Swofford [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, October 14, 2002 5:14 PM
 Subject: [PHP] upload directory


 Is there an easy way to upload an entire directory?  Rather than selecting
 the 19 files in a directory, to just select the directory, and have all
its
 contents go with it?  (Or even a not-such-an easy way?)

 Thank you very much for any hints.
 Jen




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




Re: [PHP] POST and GET variables don't work

2002-10-13 Thread Jennifer Swofford

BTW, disregard my comment about GET... I confused myself.  Zzz.

Jen


 Try:

 $_Post[name];

 or $HTTP_POST_VARS[name];

 In new PHP version, register_globals is set to off by default, which is
 why $name isn't working for you.  Although, I'm surprised GET isn't
 working

 Jen


  I've just built PHP from source (4.2.3) on Red Hat Linux 7.2 with
 
  configure --with-java --with-apxs=/usr/local/apache/bin/apx
 
  It's running with Apache 1.3.26
 
  PHP work ok, even Java works, but if I try to pass variables from a form
  with either POST or GET, the variables don't get through.  This is the
 code
  I'm using:
 
  index.html:
  ...
  form action=php.php method=post
   Name: input type=text name=namebr
input type=submit
/form
  ...
 
  php.php:
 
  ?php
  echo *;
  echo $name;
  echo *;
  ?
 
  The variable $name is always empty.  I tried this same scripts on the
RPM
  version installed with Mandrake 7.2 and it worked fine, so it shouldn't
be
  the scripts.  What could be wrong? Maybe I missed a ./configure option?
 
  Thanks in advance,
 
 
  Andres




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




Re: [PHP] POST and GET variables don't work

2002-10-13 Thread Jennifer Swofford

Try:

$_Post[name];

or $HTTP_POST_VARS[name];

In new PHP version, register_globals is set to off by default, which is
why $name isn't working for you.  Although, I'm surprised GET isn't
working

Jen


 I've just built PHP from source (4.2.3) on Red Hat Linux 7.2 with

 configure --with-java --with-apxs=/usr/local/apache/bin/apx

 It's running with Apache 1.3.26

 PHP work ok, even Java works, but if I try to pass variables from a form
 with either POST or GET, the variables don't get through.  This is the
code
 I'm using:

 index.html:
 ...
 form action=php.php method=post
  Name: input type=text name=namebr
   input type=submit
   /form
 ...

 php.php:

 ?php
 echo *;
 echo $name;
 echo *;
 ?

 The variable $name is always empty.  I tried this same scripts on the RPM
 version installed with Mandrake 7.2 and it worked fine, so it shouldn't be
 the scripts.  What could be wrong? Maybe I missed a ./configure option?

 Thanks in advance,


 Andres




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




Re: [PHP] Weird, weird, weird!

2002-10-08 Thread Jennifer Swofford

--- Mike At Spy [EMAIL PROTECTED] wrote:

 Anyone ever have the experience of working on a
 site, working with MySQL and
 then having something almost inexplicable happen?

Hmmm, yes, that would be a daily exercise for me.  Ah, but I see that your
inexplicable problem has been explained... lucky.  Never mind.

Jen


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




[PHP] eregi_replace help

2002-10-07 Thread Jennifer Swofford

Hello all,

I am trying to use php to read through an html file and replace all image
paths, like such:

Change images/firstimage.gif to http://www.blah.com/firstimage.gif; ...
Change somesuch/images/secondimage.jpg to
http://www.blah.com/secondimage.jpg;

So I am going through the file and matching the image path strings,
stripping them down to just the image name using basename, and then adding
http://www.blah.com/; onto the beginning of them.  Except it's not working,
and I'm not sure where my logic has gone awry.  Instead of replacing each
image path with its respective image name, it is replacing all image paths
with the *same* image name.

Here is the code.  (Yes I'm new, I apologize for the mess, there are a few
lines in there I'm using for debugging purposes, to show me what it's
doing.)

?
$filename = newexample.html;
$fd = fopen ($filename, r);
$contents = fread ($fd, filesize ($filename));

while (preg_match('{()([A-z0-9_/-](\/))*[A-z0-9_/-]+(.gif|.jpg)}',
$contents, $matches)) {

echo bMATCHED:/b .$matches[0].br\n;

$base = basename($matches[0]);
$newimage = http://www.blah.com/.$base;
echo brbase: .$base.br;
echo new image: .$newimage.br;
echo hr;

$contents = eregi_replace('\/*[A-z0-9_/-]+(.gif|.jpg)', $newimage,
$contents);

print $contents;

}

fclose ($fd);

?

When I run it, I get:

~
MATCHED: blah/images/first.gif

base: first.gif
new image: http://www.blah.com/first.gif

Here it prints the contents of the html file, except all images look like
http://www.blah.com/first.gif; (when there are supposed to be lots of other
images, such as second.jpg, etc).
~

Where have I gone wrong?  Thanks to all, as usual, for your hints and help.

Jen


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




Re: [PHP] eregi_replace help

2002-10-07 Thread Jennifer Swofford

BTW - I have found errors in the regular expression that I was matching so
don't bother to point those out.  ;)  That shouldn't affect the nature of
the problem I was asking about.

--- Jennifer Swofford [EMAIL PROTECTED] wrote:
 Hello all,

 I am trying to use php to read through an html file
 and replace all image
 paths, like such:

snip


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




Re: [PHP] eregi_replace help

2002-10-07 Thread Jennifer Swofford

Thank you Marco!

Between your post and the other stuff I happened to find at the same time, I
got it working.  Turned out I was making it much more difficult than it had
to be.  I ended up with:

?
$filename = newexample.html;
$fd = fopen ($filename, r);
$contents = fread ($fd, filesize ($filename));

$contents =
preg_replace(/(\)([A-z0-9]+(\/))*([A-z0-9]+)(\.)(jpg|gif)(\)/,
\http://www.blah.com/$4.$6\;, $contents);

echo $contents;
fclose ($fd);
?

Lo and behold, it works.  Thanks all!

Jen

--- Marco Tabini [EMAIL PROTECTED] wrote:
 Jennifer--

 A couple of things. eregi_replace does not have a
 limitation parameter,
 which means that if you use it *all* the strings
 that match your pattern
 will be replace with the new pattern. In your case,
 if I read your code
 correctly (and I may not--I'm doing this from
 memory), the eregi
 replacement you perform will change *all* the paths
 you have in your
 file, and not just the first one, which, I believe,
 is what you're
 looking for.

 Also, there shouldn't be any need to make the
 replacements one by one. A
 single replacement should be enough if all the
 original paths have to be
 transformed into the same URL.

 For example:

 ereg_replace ({/images/}{test.(jpg|gif)},
 http://www.microsoft.com/images/\\2;, $t);

 This would replace any occurrence of /images/*.gif
 and /images/*.jpg
 to http://www.microsoft.com/images/*.gif; or *.jpg
 respectively (once
 again, double check my regex...doing this from
 memory). If you *do* need
 to change each occurrence individually, then you
 should use preg()
 instead, which uses Perl syntax and has a limitation
 parameter.

 Also--a minor thing and I'm sure you thought of it,
 but you're not
 saving the file at the end :-)

 Hope this helps.

 Cheers,


 Marco


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




Re: [PHP] MORE Problems with PHP as CGI and Flash !!!!!!!!!!

2002-10-03 Thread Jennifer Swofford

FEI, it works fine on my IE6/WinXP.  :)  (And NS7.)

 Rebekah,
 
 When I click link to go to the second index (using IE6, WinXP) at
 http://www.overbrookfarm.myiglou.com/index2.html my browser hangs and I
 never get the menus. However it all works fine in Mozilla 1.0 on the same
 platform. (Beautifully done site by the way, but ignores AFAICS
 accessibility, and folks with lower bandwidths. Have you thought about a
 non-Flash version as well, to allow a choice? I am not anti-Flash, just
 pro-accessibility.)
 
 HTH!
 
 Jay




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




Re: [PHP] eregi_replace / preg_match_all

2002-10-02 Thread Jennifer Swofford

Extraordinarily helpful; thank you very much!  Thanks to both Mike and Kevin
on this.

Jen

   Why does this work:
  
   $contents =
  
  eregi_replace((\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg),
   \blah.gif, $contents);
  
   But this does not:
  
  
  preg_match_all((\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg),
   $contents, $matches);
  
   for ($i=0; $i count($matches[0]); $i++) {
   echo matched: .$matches[0][$i].\n
   }
  
   I get this error:
  
   Warning: Unknown modifier '(' in
   /home/littleduck/www/www/newcontrol/temp/fread.php
  on
   line 20
 
  Well, first of all you've switched from a
  POSIX-extended regular expression
  function, eregi_replace(), to a Perl-compatible
  regular expression (PCRE)
  function, preg_match_all() -- all the POSIX-extended
  function names begin
  with an e, and all the PCRE ones with a p.  The
  rules are different for the
  two sets, and one of the most important ones is that
  the PCRE functions
  require the pattern to be enclosed within
  delimiters, and the POSIX-extended
  ones don't (this is because you can add optional
  _modifiers_ after the
  ending delimiter for PCRE matching).  The syntax of
  the regular expressions
  is also slightly different, and a pattern that works
  reliably for PCRE won't
  necessarily for POSIX-extended, and vice versa --
  especially as PCRE is far
  more versatile and feature-rich.
 
  So, your basic problem in the preg_match_all() is
  that you haven't *added*
  delimiters -- the requirement is that you must use
  the same character both
  before and after your pattern, or a matched pair
  from one of the sets (),
  {}, [], and . So, the pattern parser is seeing the
  initial ( in your
  expression, treating it as the opening delimiter,
  and taking your basic
  pattern to be the text up to the matching ) --
  that is, just (\).  It
  then looks to see if the next character is a valid
  _modifier_ (remember
  them?), finds ( which isn't one, and complains --
  and bingo!, there's your
  Unknown modifier '(' message.
 
  So, this, for example, would work:
 
 
 
 preg_match_all({(\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg)},
  $contents,
  $matches);
 
  although I'd point out that . is a
  pattern-matching element that means
  any character, so you might prefer to escape it --
  unfortunately, both
  regular expressions and PHP's double-quoted strings
  use \ as their escape
  character, so to get a single backslash into the
  expression to escape the
  ., you've got to use two \\s (and to match an
  actual single backslash, you
  have to write no less than *four* backslashes!).  So
  this would give:
 
 
 
 preg_match_all({(\)(\\.(/))*[A-Z0-9_/-]+(\\.gif|\\.jpg)}',
  $contents,
  $matches);
 
  Because of the problems with backslash breeding
  that this can cause, I'd
  always recommend using single-quoted strings for
  your patterns -- especially
  as, in this case, you have a double-quote in the
  pattern!  Thus, my final
  effort would be:
 
 
 
 preg_match_all('{()(\.(/))*[A-Z0-9_/-]+(\.gif|\.jpg)}',
  $contents,
  $matches);
 
  Lastly, you may care to search the archives of this
  list for postings about
  the relative efficiency of the two types of
  expressions -- I know one set is
  frequently recommended as more efficient than the
  other, but can never
  remember which!
 
  Hope this is helpful,
 
  Cheers!
 
  Mike



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




[PHP] reg exp matching/replacing

2002-10-02 Thread Jennifer Swofford

I'm getting much closer to achieving my goal here.  Now, I'm missing yet one more 
element.  Here is my code:

--
$filename = newexample.html;

$fd = fopen ($filename, r);

$contents = fread ($fd, filesize ($filename));

preg_match_all('{\/*[A-z0-9_/-]+(.gif|.jpg)}', $contents, $matches);

for ($i=0; $i count($matches[0]); $i++) {

echo matched: .$matches[0][$i].br\n;

$blah = basename($matches[0][$i]);

$contents = eregi_replace('\/*[A-z0-9_/-]+(.gif|.jpg)', $blah, $contents);
}

print $contents;

fclose ($fd);
--

In this PHP script I am reading in the contents from newexample.html, going through 
it and looking for image strings (something/.../imagename.gif|jpg), and stripping 
them down to their basenames (imagename.gif|jpg).  What I must ALSO do is print the 
contents of the html file with the new, stripped down image strings.  What's going on 
in the above code is that each time you get to:

$contents = eregi_replace('\/*[A-z0-9_/-]+(.gif|.jpg)', $blah, $contents);

it goes through the entire html file and replaces every image string with the same 
replacement, so when the script is done executing, every image string in the html file 
is identical.  Of course, what I *want* to do is replace them all individually.  So if 
the html file has:

img src=images/imagename.gif
img src=imagename2.jpg
img src=images/2/imagename3.gif

I want those strings to be replaced with:

img src=imagename.gif
img src=imagename2.jpg
img src=imagename3.gif

But, the code as I have it is just replacing them all with img src=imagename3.gif 
since it was the last one to have matched.

How might I go through and replace them one by one?  Obscure hints are welcome.  :)

Thanks,
Jen



[PHP] reg exp and basename help?

2002-10-01 Thread Jennifer Swofford

I need help with some regular expression matching.

Here is what I am doing.  In one php file, I'm reading
in the contents of an html file.  Both reside on the
same server.  What I need to do is change all image
tags that are like this:

img src=directory1/directory2/directoryN/image.gif

To this:

img src=image.gif

I know that basename works if you have something
like $path = /directory1/image.gif... $file =
basename($path) will return image.gif, which is what I
want.

But... how do I use ereg_replace (probably) and
basename together while reading this file?

The php file I currently have, which does read in the
file, is:

?
$filename = example.html;
$fd = fopen ($filename, r);
$contents = fread ($fd, filesize ($filename));
print $contents;
fclose ($fd);
?

So, I'd want to add something like...

$contents =
ereg_replace(/src=\[A-z0-9_\-\/]*\..+(gif|jpg)\/,
src=\blah.jpg\, $contents);

Um, except I know the regular expression is wrong
(haven't completely figured that out yet) and I
*don't* want to replace the image name with
blah.jpg... I was just using this line to test.

It seems like I should be able to go through and find
each path to each image, basename it, and replace it
with just the image name.  But how?  There will be
multiple numbers of img tags in the html file.

Thank you profusely in advance.
Jen
[EMAIL PROTECTED]

__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

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




[PHP] eregi_replace / preg_match_all

2002-10-01 Thread Jennifer Swofford

Why does this work:

$contents =
eregi_replace((\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg),
\blah.gif, $contents);

But this does not:

preg_match_all((\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg),
$contents, $matches);

for ($i=0; $i count($matches[0]); $i++) {
echo matched: .$matches[0][$i].\n
}

I get this error:

Warning: Unknown modifier '(' in
/home/littleduck/www/www/newcontrol/temp/fread.php on
line 20

The first example finds/replaces fine.  The second
does not find at all.  (If I replace the regular
expression string with something simple like
(gif|jpg) it works.)

Thank you for any hints!
Jen


__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

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




Re: [PHP] eregi_replace / preg_match_all

2002-10-01 Thread Jennifer Swofford

Thanks Kevin - 

Actually, I'm confused about that too, because this
does NOT work (delimeter):

$contents =
eregi_replace(/(\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg)/,
\blah.gif, $contents);

But this does (no delimeter):

$contents =
eregi_replace((\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg),
\blah.gif, $contents);

So I use the line of code without the delimeters. 
Which was my first hint that something might be wacky.
 ;)

But the preg_match_all code (below) doesn't work with
or without the delimeters.

I'm clearly new with regular expressions, but have
been working on this all day and need some outside
eyes.  8)

Thanks again,
Jen

--- Kevin Stone [EMAIL PROTECTED] wrote:
 Unknown modifier definitely has to do with the
 regular expression. Don't
 regex's need a beginning and ending delimeter apart
 from the quote?
 
 /(\)(.(\/))*[A-Z0-9_\/-]+(.gif|.jpg)/
 
 Maybe that's it?  But if so I dunno why the other
 one would be working.
 
 -Kevin
 
 - Original Message -
 From: Jennifer Swofford [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, October 01, 2002 2:20 PM
 Subject: [PHP] eregi_replace / preg_match_all
 
 
  Why does this work:
 
  $contents =
 
 eregi_replace((\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg),
  \blah.gif, $contents);
 
  But this does not:
 
 
 preg_match_all((\)(.(/))*[A-Z0-9_/-]+(.gif|.jpg),
  $contents, $matches);
 
  for ($i=0; $i count($matches[0]); $i++) {
  echo matched: .$matches[0][$i].\n
  }
 
  I get this error:
 
  Warning: Unknown modifier '(' in
  /home/littleduck/www/www/newcontrol/temp/fread.php
 on
  line 20
 
  The first example finds/replaces fine.  The second
  does not find at all.  (If I replace the regular
  expression string with something simple like
  (gif|jpg) it works.)
 
  Thank you for any hints!
  Jen
 
 
  __
  Do you Yahoo!?
  New DSL Internet Access from SBC  Yahoo!
  http://sbc.yahoo.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

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