php-windows Digest 1 May 2002 19:48:38 -0000 Issue 1122
Topics (messages 13450 through 13464):
JUST A TEST
13450 by: theN
13452 by: theN
Re: Question installing and running php
13451 by: theN
13453 by: Steve Bradwell
Re: Carriage Return and Line Feed
13454 by: Mike Flynn
Re: php won't "process" forms anymore
13455 by: Mike Flynn
Premature end of script headers: c:/php/php.exe
13456 by: Dean Sadler
13457 by: Mike Flynn
13458 by: Dean Sadler
13459 by: Dean Sadler
Re: USER_AGENT wrong thanks to proxy cache! Help!
13460 by: Roderick Martin
Re: PHP generation of <select> fields
13461 by: Dash McElroy
problem solved
13462 by: Erik
13463 by: Dash McElroy
13464 by: Dash McElroy
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 ---
JUST A TEST
--- End Message ---
--- Begin Message ---
just a test
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] (James Ku-Ok Chung) wrote in
news:[EMAIL PROTECTED]:
> hello,
> I am having trouble with the php.
>
> on a apache 1.3.12 and php4 (also tried php3)
>
> and followed all the directions of .ini and stuff...
>
> when I run the sample php on the web browser.. I don't get what I want
> but it appears <? phpinfo() ?> the script itself...
>
> meaning it doesn't run the script but it just shows me the script code
> on the
> browser.
>
> any hints of what I have done wrong?
>
> james
> [EMAIL PROTECTED]
>
>
I guess apache is not set up to parse PHP scripts. I would suggest that you
please take a look at Apache's httpd.conf again.
--- End Message ---
--- Begin Message ---
I am fairly new to php to, when I did my first install, I had to learn how
to set up the httpd.conf file and the php.ini file, also httpd.conf has to
be in windows system dir. And after I finally figured that out, I realized
that I had my php file named test.php.txt. HA!
If this doesn't help then what do you have php running as, cgi or module?
-Steve
-----Original Message-----
From: theN [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 8:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: Question installing and running php
[EMAIL PROTECTED] (James Ku-Ok Chung) wrote in
news:[EMAIL PROTECTED]:
> hello,
> I am having trouble with the php.
>
> on a apache 1.3.12 and php4 (also tried php3)
>
> and followed all the directions of .ini and stuff...
>
> when I run the sample php on the web browser.. I don't get what I want
> but it appears <? phpinfo() ?> the script itself...
>
> meaning it doesn't run the script but it just shows me the script code
> on the
> browser.
>
> any hints of what I have done wrong?
>
> james
> [EMAIL PROTECTED]
>
>
I guess apache is not set up to parse PHP scripts. I would suggest that you
please take a look at Apache's httpd.conf again.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
If you look at the output on your page when you output the contents of the
mysql text field, you'll notice that the textarea contents is being
returned EXACTLY how it was entered. That is to say, the carriage returns
and linefeeds are definitely there. However, as in normal HTML, they (\n
characters) are considered as white space and not processed as <br> tags,
just white space in the code. What you want is a function to convert
newline characters to <br> tags.
Luckily, such a function exists!
http://www.php.net/manual/en/function.nl2br.php
-Mike
At 11:20 PM 4/30/2002 -0400, you wrote:
>When I use a textarea html tag to put some data into mysql, when I
>output it the carriage return and laine feed characters from the form do
>not stick after they are put into mysql text field. Is there a way to
>out the data with the carriage returns and linefeeds being read?
>
>Matt Babineau
>Freelance Internet Developer
>e: <mailto:[EMAIL PROTECTED]>
>[EMAIL PROTECTED]
>p: 603.943.4237
>w: <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
>
>
Mike Flynn - Burlington, VT
http://www.mikeflynn.net/ - [EMAIL PROTECTED]
home=>work=>home=>store=>home [repeat daily]
--- End Message ---
--- Begin Message ---
You need to do more work debugging the issue before asking your question here.
1. Is the form in the same .php file as the form handling?
2. What does the source code for the form handler page look like when you
submit the form?
3. What is your code?
-Mike
At 09:19 AM 5/1/2002 +0200, Erik wrote:
>hi,
>
>when i have a page tht handles forms with php it doesn't work i don't get
>any error message it just shows me the same page over and over again i even
>added
>error_reporting(15); at the top of the script no luck windows always shows
>me the same page i may click submit a douzend of times it always show the
>same
>
>any solution for this issue ?
>
>thanks
>Erik
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
Mike Flynn - Burlington, VT
http://www.mikeflynn.net/ - [EMAIL PROTECTED]
home=>work=>home=>store=>home [repeat daily]
--- End Message ---
--- Begin Message ---
I am having troubles with the following script. When executed I get the 500
internal server error page and an error: Premature end of script headers:
c:/php/php.exe in the log files. If I comment out the header() line it
works fine. I would like to redirect to the proper page based on login
pass/fail. Can any one see what I am doing wrong?
<?
// Login script
//authenticate using form variables
$status = authenticate($f_user, $f_pass);
// if user/pass is correct
if ($status == 1)
{
//initiate a session
session_start();
//register some session variables
session_register("SESSION");
//including the username
session_register("SESSION_UNAME");
$SESSION_UNAME = $f_user;
//redirect to page
header("Location: /worked.php"); //<-- problem area.
exit();
}
else
// user/pass failed
{
//redirect to error page
header("Location: /failed.php");
exit();
}
---snip---
--- End Message ---
--- Begin Message ---
1. Is there any whitespace before the first <? tag?
2. Where is the authenticate function defined -- what does it do, what's
its code, etc? Could it be returning HTML prematurely?
Otherwise everything looks ok.
-Mike
At 11:03 AM 5/1/2002 -0400, Dean Sadler wrote:
>I am having troubles with the following script. When executed I get the 500
>internal server error page and an error: Premature end of script headers:
>c:/php/php.exe in the log files. If I comment out the header() line it
>works fine. I would like to redirect to the proper page based on login
>pass/fail. Can any one see what I am doing wrong?
>
><?
>// Login script
>//authenticate using form variables
>$status = authenticate($f_user, $f_pass);
>
>// if user/pass is correct
>if ($status == 1)
>{
> //initiate a session
> session_start();
>
> //register some session variables
> session_register("SESSION");
>
> //including the username
> session_register("SESSION_UNAME");
> $SESSION_UNAME = $f_user;
>
> //redirect to page
> header("Location: /worked.php"); //<-- problem area.
> exit();
>}
>else
>// user/pass failed
>{
> //redirect to error page
> header("Location: /failed.php");
> exit();
>}
>
>---snip---
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
Mike Flynn - Burlington, VT
http://www.mikeflynn.net/ - [EMAIL PROTECTED]
home=>work=>home=>store=>home [repeat daily]
--- End Message ---
--- Begin Message ---
No white space at top. Authentication function is in the same script. Here
is the rest of it. PHP 4.1.1, Apache 1.3.23.
function authenticate($user, $pass)
{
// move this to the config.php file
$db_host = "localhost";
$db_user = "user";
$db_pass = "password";
$db_name = "database";
//check login and password
//connect and execute query
$connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable
to connect!");
$query = "SELECT ID from users WHERE login = '$user' AND pass =
PASSWORD('$pass')";
mysql_select_db($db_name);
$result = mysql_query($query, $connection) or die ("Error in query: $query
. " . mysql_error());
// if row exists -> user/pass combination is correct
if (mysql_num_rows($result) == 1)
{
return 1;
}
// user/pass combination is wrong
else
{
return 0;
}
}
// close database connection
mysql_close($connection);
?>
-----Original Message-----
From: Mike Flynn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 11:08 AM
To: [EMAIL PROTECTED]; PHP Win32 (E-mail)
Subject: Re: [PHP-WIN] Premature end of script headers: c:/php/php.exe
1. Is there any whitespace before the first <? tag?
2. Where is the authenticate function defined -- what does it do, what's
its code, etc? Could it be returning HTML prematurely?
Otherwise everything looks ok.
-Mike
At 11:03 AM 5/1/2002 -0400, Dean Sadler wrote:
>I am having troubles with the following script. When executed I get the
500
>internal server error page and an error: Premature end of script headers:
>c:/php/php.exe in the log files. If I comment out the header() line it
>works fine. I would like to redirect to the proper page based on login
>pass/fail. Can any one see what I am doing wrong?
>
><?
>// Login script
>//authenticate using form variables
>$status = authenticate($f_user, $f_pass);
>
>// if user/pass is correct
>if ($status == 1)
>{
> //initiate a session
> session_start();
>
> //register some session variables
> session_register("SESSION");
>
> //including the username
> session_register("SESSION_UNAME");
> $SESSION_UNAME = $f_user;
>
> //redirect to page
> header("Location: /worked.php"); //<-- problem area.
> exit();
>}
>else
>// user/pass failed
>{
> //redirect to error page
> header("Location: /failed.php");
> exit();
>}
>
>---snip---
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
Mike Flynn - Burlington, VT
http://www.mikeflynn.net/ - [EMAIL PROTECTED]
home=>work=>home=>store=>home [repeat daily]
--- End Message ---
--- Begin Message ---
Solved. I feel like an idiot.
Here is what I was going wrong.
//redirect to protected page
header("Location: /worked.php <- should be .htm");
exit();
Thanks,
Dean
--- End Message ---
--- Begin Message ---
The proxy server is a Compaq TaskSmart server (C1500) with the latest updates.
--- End Message ---
--- Begin Message ---
Thanks. Works like a charm.
-Dash
-----Original Message-----
From: Kriegers Horst [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 1:19 AM
To: Php
Subject: RE: [PHP-WIN] PHP generation of <select> fields
In the if condition, you must use a double equal (==)
and add an else condition to reset the $select variable to "".
Try this:
for ($i=01;$i<=12;$i++) {
if($i == date(m)) {
$selected = " selected";
}else{
$selected = "";
}
print "<option
value=\"".date(m,mktime(0,0,0,$i))."\"$selected>".date(F,mktime(0,0,0,$i))."
</option>\n";
}
Regards
Horst
> -----Message d'origine-----
> De: Dash McElroy [SMTP:[EMAIL PROTECTED]]
> Date: mercredi, 1. mai 2002 04:56
> À: Php
> Objet: [PHP-WIN] PHP generation of <select> fields
>
> I am trying to use PHP to generate and automatically select the current
> month in an HTML Form. Here is the code that flails:
>
> for ($i=01;$i<=12;$i++) {
> if($i = date(m)) {
> $selected = " selected";
> }
> print "<option
> value=\"".date(m,mktime(0,0,0,$i))."\"$selected>".date(F,mktime(0,0,0,$i))
> ."
> </option>\n";
> }
>
> The output is a large amount of April's in the Select dropdown box - my
> machine then goes crazy for a while whilst the hard drive chunks like mad.
>
> Thanks.
>
> -Dash
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
hi,
all the trouble i had it with php has been solved php is up and running
without errors now.Mike you where wrong my code was correct but
register_globals was not set to on in php.ini and this caused the problem
also the user authentication issue has been fixed i installed php as apache
module and moved "php4ts.dll" to winnt\system 32 and
LoadModule php4_module c:/php/sapi/php4apache.dll
AddMdule mod-PHP4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
that solved all the trouble i had after reading the php manual it says
register_globals=on can cause securty issues but if i said it to off nothing
works anymore.
cheers
Erik
--- End Message ---
--- Begin Message ---
Erik,
I'm having lots of luck with the 'import_request_variables' command
(www.php.net/import_request_variables). It's a rather lazy way to do it, but
I don't want to rewrite all of my PHP code to do the 'register_global=off'
compliant method.
p.s. I have my servers set up to parse .html files as well - I've found it
immensely helpful sometimes to be able to add a bit of PHP to a file without
having to relink every page that links to it...
-Dash
-----Original Message-----
From: Erik [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 11:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] problem solved
hi,
all the trouble i had it with php has been solved php is up and running
without errors now.Mike you where wrong my code was correct but
register_globals was not set to on in php.ini and this caused the problem
also the user authentication issue has been fixed i installed php as apache
module and moved "php4ts.dll" to winnt\system 32 and
LoadModule php4_module c:/php/sapi/php4apache.dll
AddMdule mod-PHP4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
that solved all the trouble i had after reading the php manual it says
register_globals=on can cause securty issues but if i said it to off nothing
works anymore.
cheers
Erik
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
While you may be correct - there are undoubtedly sites out there (like our
beloved php.net) that almost every page is processed by PHP. It may only
make a real difference on huge traffic sites or underpowered machines.
-Dash
-----Original Message-----
From: Ross Fleming [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 12:35 PM
To: Dash McElroy; php-windows
Subject: RE: [PHP-WIN] problem solved
Importance: High
It's also immensely inefficient to have your server parse every single
webpage...
Ross
>===== Original Message From Dash McElroy <[EMAIL PROTECTED]> =====
>Erik,
>
>I'm having lots of luck with the 'import_request_variables' command
>(www.php.net/import_request_variables). It's a rather lazy way to do it,
but
>I don't want to rewrite all of my PHP code to do the 'register_global=off'
>compliant method.
>
>p.s. I have my servers set up to parse .html files as well - I've found it
>immensely helpful sometimes to be able to add a bit of PHP to a file
without
>having to relink every page that links to it...
>
>-Dash
>
>-----Original Message-----
>From: Erik [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, May 01, 2002 11:43 AM
>To: [EMAIL PROTECTED]
>Subject: [PHP-WIN] problem solved
>
>
>hi,
>
>all the trouble i had it with php has been solved php is up and running
>without errors now.Mike you where wrong my code was correct but
>register_globals was not set to on in php.ini and this caused the problem
>also the user authentication issue has been fixed i installed php as apache
>module and moved "php4ts.dll" to winnt\system 32 and
>LoadModule php4_module c:/php/sapi/php4apache.dll
>AddMdule mod-PHP4.c
>AddType application/x-httpd-php .php
>AddType application/x-httpd-php .php3
>AddType application/x-httpd-php .phtml
>
>that solved all the trouble i had after reading the php manual it says
>register_globals=on can cause securty issues but if i said it to off
nothing
>works anymore.
>
>cheers
>Erik
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---