php-windows Digest 12 Dec 2001 07:45:37 -0000 Issue 896
Topics (messages 10839 through 10853):
PHP 4.06 + IIS5 + header download
10839 by: Bryant Brabson
PHP + IIS5 works like hell
10840 by: Bryant Brabson
IIS Virtual Directories
10841 by: PHP
10851 by: Alastair Smith
10852 by: Alastair Smith
email script...
10842 by: Anthony Ritter
10848 by: Ross Fleming
10849 by: Anthony Ritter
[ADMIN] spam protection for lists.php.net lists
10843 by: Jim Winstead
Existing File...
10844 by: Anthony Ritter
10846 by: Daniel Parsons
10847 by: Anthony Ritter
Re: subject line complete
10845 by: Ross Fleming
Re: Microsoft Word .doc to HTML
10850 by: Ross Fleming
Mysql connection
10853 by: A. Bacon
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
I think that I had a similar problem recently while trying to return a Flash
file. Here's how I did it:
$fd = fopen ($filename, "rb");
$contents = fread ($fd, filesize ($filename));
header("Content-type: application/x-shockwave-flash");
echo $contents;
fclose ($fd);
--- End Message ---
--- Begin Message ---
We had problems using the isapi.dll with W2K and IIS5, but the cgi has worked very
well.
--- End Message ---
--- Begin Message ---
I have been searching all over for a solution with no help...
I got some virtual folder under the root of my website..
when i tried to read the contents of the folder and its subdirectories...it
returned and error...because its a virtual folder and not physically under
the root of the website..
i need a solution so that i can read and access contents of Virtual
Directories created by IIS 5..
DJ XLoRd
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
I'm getting the same error. It comes up as a 500 internal error, but the
strange thing is that it sometimes works. I can really make it not work by
adding a '?sadfsad' at the end of my PHP file. Also I sometimes get a
string that says "The directory name is invalid. ".
If you find any solutions, could you post them to this group? Thanks.
alastair
"Php" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have been searching all over for a solution with no help...
> I got some virtual folder under the root of my website..
> when i tried to read the contents of the folder and its
subdirectories...it
> returned and error...because its a virtual folder and not physically under
> the root of the website..
> i need a solution so that i can read and access contents of Virtual
> Directories created by IIS 5..
>
> DJ XLoRd
> [EMAIL PROTECTED]
>
>
--- End Message ---
--- Begin Message ---
After poking google's USENET search I found this article:
http://groups.google.com/groups?q=IIS+php++%22virtual+directories+%22&hl=en&
rnum=3&selm=41575B2947B7D411A03C00508BCFF1620E0D38%40usa07.cs.lmco.com
All you have to do is right click the site in IIS and select properites.
>From there go to the 'Home Directory' tab and click on configuration.
Scroll to PHP mappings and click edit and check the 'check that file exists'
checkbox. It seems to solve the problem.
cheers,
alastair
"Php" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have been searching all over for a solution with no help...
> I got some virtual folder under the root of my website..
> when i tried to read the contents of the folder and its
subdirectories...it
> returned and error...because its a virtual folder and not physically under
> the root of the website..
> i need a solution so that i can read and access contents of Virtual
> Directories created by IIS 5..
>
> DJ XLoRd
> [EMAIL PROTECTED]
>
>
--- End Message ---
--- Begin Message ---
I'm working through Julie Meloni's book PHP - Fast and Easy using MS Win 98
with Apache.
She has an example of a PHP script where both the html form for input and
the php code to send the form are in one php script using the mail()
function and the $PHP_SELF global variable.
I've included the code taken form the book: allinone_form.php
and
the code that I copied from the book when I tried to breakdown and
understand the syntax which is:
allinone1211.php
Both scripts are able to send e-mail. However, in her script if the user
fails to put either their name or address or message in the boxes, they are
reminded to fill in the box in red - in addition, the email is not sent.
However, in the allinone1211.php - which was copied line for line (or so I
thought) - the email is sent even if the user has not filled in all of the
appropriate boxes without the red reminders.
If anybody has a chance could they take a look a the following code:
Thanking all in advance.
Tony Ritter
........................................................
(allinone_form.php) Works fine.
<HTML>
<HEAD>
<TITLE>All-In-One Feedback Form</TITLE>
</HEAD>
<BODY>
<?
$form_block = "
<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">
<P><strong>Your Name:</strong><br>
<INPUT type=\"text\" NAME=\"sender_name\" VALUE=\"$sender_name\"
SIZE=30></p>
<P><strong>Your E-Mail Address:</strong><br>
<INPUT type=\"text\" NAME=\"sender_email\" VALUE=\"$sender_email\"
SIZE=30></p>
<P><strong>Message:</strong><br>
<TEXTAREA NAME=\"message\" COLS=30 ROWS=5
WRAP=virtual>$message</TEXTAREA></p>
<INPUT type=\"hidden\" name=\"op\" value=\"ds\">
<P><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Send This Form\"></p>
</FORM>
";
if ($op != "ds") {
echo "$form_block";
} else if ($op == "ds") {
if ($sender_name == "") {
$name_err = "<font color=red>Please enter your name!</font><br>";
$send = "no";
}
if ($sender_email == "") {
$email_err = "<font color=red>Please enter your e-mail
address!</font><br>";
$send = "no";
}
if ($message == "") {
$message_err = "<font color=red>Please enter a message!</font><br>";
$send = "no";
}
if ($send != "no") {
$msg = "E-MAIL SENT FROM WWW SITE\n";
$msg .= "Sender's Name: $sender_name\n";
$msg .= "Sender's E-Mail: $sender_email\n";
$msg .= "Message: $message\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "All-in-One Web Site Feedback";
$mailheaders = "From: My Web Site <> \n";
$mailheaders .= "Reply-To: $sender_email\n\n";
mail($to, $subject, $msg, $mailheaders);
echo "<P>Mail has been sent!</p>";
} else if ($send == "no")
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
?>
</BODY>
</HTML>
.................................................................
allinone1211.php (email is sent even if the boxes are not filled in)
<HTML>
<HEAD>
<TITLE> All In One Script </TITLE>
</HEAD>
<BODY>
<?
$form_block="
<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">
<P><STRONG>Your Name:</STRONG><BR>
<INPUT TYPE=\"text\" NAME=\"sender_name\" VALUE=\"$sender_name\" SIZE=30>
</P>
<P><STRONG>Your email address:</STRONG><BR>
<INPUT TYPE=\"text\" NAME=\"sender_email\" VALUE=\"$sender_email\"
SIZE=30> </P>
<P><STRONG>Your message:</STRONG><BR>
<TEXTAREA NAME=\"message\" COLS=30 ROWS=5 WRAP=VIRTUAL>
$message</TEXTAREA></P>
<INPUT TYPE=\"hidden\" NAME=\"op\" VALUE=\"ds\">
<P> <INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Send this form\"></P>
</FORM>
";
if($op!="ds") {
echo "$form_block";
} else if ($op=="ds"){
if ($sender_name==""){
$name_err="<font color=red>Please enter your name!</font><br>";
$send="no";
}
if($sender_email==""){
$email_err="<font color=red> Please enter your email address! </font>
<br>";
$send="no";
}
if($message==""){
$message_err="<font color=red> Please enter a message! </font><br>";
$message="no";
}
if (send!="no"){
$msg="This email is being sent from\n";
$msg.="Sender's name: $sender_name\n";
$msg.="Sender's email address: $sender_email\n";
$msg.="Message: $message\n\n";
$to="[EMAIL PROTECTED]";
$subject="All in one";
$mailheaders="From: My website<>\n";
$mailheaders.="Reply-To: $sender_email\n\n";
mail($to, $subject, $msg, $mailheaders);
echo "<P>Mail has been sent! </P>";
} else if ($send=="no"){
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
?>
</BODY>
</HTML>
--- End Message ---
--- Begin Message ---
Easy one this. You've
if (send!="no") { do all the send stuff}
where you should have
if ($send!="no") {do all the send stuff}
note the $ sign that tells PHP to reference the variable.
It should work now but I haven't looked very closely at it yet
Ross
Anthony Ritter wrote:
>
> I'm working through Julie Meloni's book PHP - Fast and Easy using MS Win 98
> with Apache.
>
> She has an example of a PHP script where both the html form for input and
> the php code to send the form are in one php script using the mail()
> function and the $PHP_SELF global variable.
>
> I've included the code taken form the book: allinone_form.php
> and
> the code that I copied from the book when I tried to breakdown and
> understand the syntax which is:
> allinone1211.php
>
> Both scripts are able to send e-mail. However, in her script if the user
> fails to put either their name or address or message in the boxes, they are
> reminded to fill in the box in red - in addition, the email is not sent.
>
> However, in the allinone1211.php - which was copied line for line (or so I
> thought) - the email is sent even if the user has not filled in all of the
> appropriate boxes without the red reminders.
>
> If anybody has a chance could they take a look a the following code:
>
> Thanking all in advance.
> Tony Ritter
> ........................................................
>
> (allinone_form.php) Works fine.
>
> <HTML>
> <HEAD>
> <TITLE>All-In-One Feedback Form</TITLE>
> </HEAD>
> <BODY>
> <?
> $form_block = "
> <FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">
> <P><strong>Your Name:</strong><br>
> <INPUT type=\"text\" NAME=\"sender_name\" VALUE=\"$sender_name\"
> SIZE=30></p>
> <P><strong>Your E-Mail Address:</strong><br>
> <INPUT type=\"text\" NAME=\"sender_email\" VALUE=\"$sender_email\"
> SIZE=30></p>
> <P><strong>Message:</strong><br>
> <TEXTAREA NAME=\"message\" COLS=30 ROWS=5
> WRAP=virtual>$message</TEXTAREA></p>
> <INPUT type=\"hidden\" name=\"op\" value=\"ds\">
> <P><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Send This Form\"></p>
> </FORM>
> ";
> if ($op != "ds") {
> echo "$form_block";
> } else if ($op == "ds") {
> if ($sender_name == "") {
> $name_err = "<font color=red>Please enter your name!</font><br>";
> $send = "no";
> }
> if ($sender_email == "") {
> $email_err = "<font color=red>Please enter your e-mail
> address!</font><br>";
> $send = "no";
> }
> if ($message == "") {
> $message_err = "<font color=red>Please enter a message!</font><br>";
> $send = "no";
> }
> if ($send != "no") {
> $msg = "E-MAIL SENT FROM WWW SITE\n";
> $msg .= "Sender's Name: $sender_name\n";
> $msg .= "Sender's E-Mail: $sender_email\n";
> $msg .= "Message: $message\n\n";
> $to = "[EMAIL PROTECTED]";
> $subject = "All-in-One Web Site Feedback";
> $mailheaders = "From: My Web Site <> \n";
> $mailheaders .= "Reply-To: $sender_email\n\n";
> mail($to, $subject, $msg, $mailheaders);
> echo "<P>Mail has been sent!</p>";
> } else if ($send == "no")
>
> echo "$name_err";
> echo "$email_err";
> echo "$message_err";
> echo "$form_block";
> }
> }
> ?>
> </BODY>
> </HTML>
> .................................................................
>
> allinone1211.php (email is sent even if the boxes are not filled in)
>
> <HTML>
> <HEAD>
> <TITLE> All In One Script </TITLE>
> </HEAD>
> <BODY>
> <?
> $form_block="
> <FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">
> <P><STRONG>Your Name:</STRONG><BR>
> <INPUT TYPE=\"text\" NAME=\"sender_name\" VALUE=\"$sender_name\" SIZE=30>
> </P>
> <P><STRONG>Your email address:</STRONG><BR>
> <INPUT TYPE=\"text\" NAME=\"sender_email\" VALUE=\"$sender_email\"
> SIZE=30> </P>
> <P><STRONG>Your message:</STRONG><BR>
> <TEXTAREA NAME=\"message\" COLS=30 ROWS=5 WRAP=VIRTUAL>
> $message</TEXTAREA></P>
> <INPUT TYPE=\"hidden\" NAME=\"op\" VALUE=\"ds\">
> <P> <INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Send this form\"></P>
> </FORM>
> ";
> if($op!="ds") {
> echo "$form_block";
> } else if ($op=="ds"){
> if ($sender_name==""){
> $name_err="<font color=red>Please enter your name!</font><br>";
> $send="no";
> }
> if($sender_email==""){
> $email_err="<font color=red> Please enter your email address! </font>
> <br>";
> $send="no";
> }
> if($message==""){
> $message_err="<font color=red> Please enter a message! </font><br>";
> $message="no";
> }
> if (send!="no"){
> $msg="This email is being sent from\n";
> $msg.="Sender's name: $sender_name\n";
> $msg.="Sender's email address: $sender_email\n";
> $msg.="Message: $message\n\n";
> $to="[EMAIL PROTECTED]";
> $subject="All in one";
> $mailheaders="From: My website<>\n";
> $mailheaders.="Reply-To: $sender_email\n\n";
> mail($to, $subject, $msg, $mailheaders);
> echo "<P>Mail has been sent! </P>";
> } else if ($send=="no"){
> echo "$name_err";
> echo "$email_err";
> echo "$message_err";
> echo "$form_block";
> }
> }
> ?>
> </BODY>
> </HTML>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Thanks Ross.
It works fine.
TR
--- End Message ---
--- Begin Message ---
as some of you may have noticed over the last few days, a new method of
spam protection has been implemented on lists.php.net.
if you post to one of the lists.php.net lists (via mail or the news
server at news.php.net) from a mail address that is not subscribed to
the mailing list, you will receive an email with information on how to
confirm that you are a real person trying to send mail to the list, and
not just some drive-by spammer. once you have responded to the
confirmation, your original message to the list will be let through to
the list, and your email address will be stored as one that is allowed
to post so that future postings from you to any of the lists.php.net
lists will be passed through without requiring confirmation.
note that this means it is no longer possible to post to the list using
an invalid smtp sender (or using an invalid email address in the 'From'
header of a post via the news server).
if you encounter problems posting to the list, feel free to drop a note
to the list administrators at [EMAIL PROTECTED]
jim
--- End Message ---
--- Begin Message ---
I've got a file that already exists called:
mydata1.txt
I'm trying to test the code below so that if the file is found it will say:
File Exists
When I run the following script, it doesn't write out:
File Exists...
I get nothing on the screen.
eventhough I thought the code below would work.
Any advice would be greatly appreciated.
Tony Ritter
...........................................................
<?
$filename="C:\My Documents\Linda\mydata1.txt";
if(file_exists($filename))
{
$msg="<P>File Exists!</P>";
}
else
{
$newfile=fopen($filename, "w+")or die("Couldn't create the file!");
}
?>
<HTML>
<HEAD>
<TITLE Creating a New File </TITLE>
</HEAD>
<BODY>
<? echo "$msg"; ?>
</BODY>
</HTML>
--- End Message ---
--- Begin Message ---
You need to escape the back slashes like this:
$filename="C:\\My Documents\\Linda\\mydata1.txt";
> -----Original Message-----
> From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 12 December 2001 12:22 p.m.
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Existing File...
>
>
> I've got a file that already exists called:
>
> mydata1.txt
>
> I'm trying to test the code below so that if the file is
> found it will say:
> File Exists
>
> When I run the following script, it doesn't write out:
> File Exists...
> I get nothing on the screen.
>
> eventhough I thought the code below would work.
>
> Any advice would be greatly appreciated.
> Tony Ritter
> ...........................................................
>
> <?
> $filename="C:\My Documents\Linda\mydata1.txt";
> if(file_exists($filename))
> {
> $msg="<P>File Exists!</P>";
> }
> else
> {
> $newfile=fopen($filename, "w+")or die("Couldn't create the file!");
> }
> ?>
>
> <HTML>
> <HEAD>
> <TITLE Creating a New File </TITLE>
> </HEAD>
> <BODY>
> <? echo "$msg"; ?>
> </BODY>
> </HTML>
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
--- End Message ---
--- Begin Message ---
Got it to work using the code below.
I forgot the to put in the fclose ()function before the closing brace in my
first post.
Thank you D.
................................
<?
$filename="C:/My Documents/Linda/mydataz.txt";
if(file_exists($filename))
{
$msg="This file already exists.";
}
else
{
$newfile=@fopen($filename, "w+") or die("Couldn't create the file!");
fclose($newfile);
}
?>
<HTML>
<HEAD>
<TITLE>Creating a new file </TITLE>
</HEAD>
<BODY>
<? echo "$msg"; ?>
</BODY>
</HTML>
--- End Message ---
--- Begin Message ---
If at first you don't succeed....
Julian Easterling wrote:
>
> unsubscribe
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Recently when using linux, I came across a command called mswordview which
does exactly that. I'm sure there must be a windows equivalent somewhere,
so you might try searching mswordview on google or something. The man page
for mswordview gives
http://www.csn.ul.ie/~caolan/
as the authors page, so you might like to take a look there.
Good luck
Ross
-----Original Message-----
From: Ryan Marrs [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2001 21:41
To: '[EMAIL PROTECTED]'
Subject: [PHP-WIN] Microsoft Word .doc to HTML
I'm not entirely where to begin because I am not a VB Developer in anyway
shape or form, but I know how to use COM Objects with PHP. I am attempting
to read Word Documents and save them as an HTML. I've read through a few
messages that have already been brought up on this topic and I am still not
getting it. Does anyone have any reference code or a link to a tutorial I
could take a look at?
Thanks!
Ryan
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hi...I'm new to php and mysql so please bear with me. I am having a
problem connecting to mysql through php. If I go into the mysql
monitor, the username and password that I set up are present in the user
db, and my scripts using $connection = mysql_connect("localhost",
"myusername", "mypassword"); have sometimes connected me, but sometimes
I get cutoff at the past with this:
Warning: MySQL Connection Failed: Can't connect to MySQL server on
'localhost' (10061) in c:\program files\apache
group\apache\htdocs\db_connect.php on line 3
I'm using Meloni's "PHP - Fast and Easy" as my reference tool. I've got
Apache1.3.12 running on win95.
Any help would be greatly appreciated...Tonloc
--- End Message ---