php-windows Digest 31 May 2002 06:31:06 -0000 Issue 1170
Topics (messages 14025 through 14037):
Re: GD & Freetype on W2K/Apache1.3.2/PHP4.2.0
14025 by: Michael Davey
Somebody please help beginner with variable problem
14026 by: Sim
14027 by: Michael Davey
14028 by: Luis Ferro
Re: Apache2 and PHP4
14029 by: PHPGeek
PHP.INI Lockdown
14030 by: David Redmond
14031 by: David Redmond
Change Password E-mail
14032 by: Cokis
Line feeds and WRAP="soft" TEXTAREA element
14033 by: Matt Babineau
14034 by: Michael Reynolds
14035 by: Michael Reynolds
14036 by: Ross Fleming
14037 by: Nikolai Jeliazkov
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 ---
OK, have found some stuff on the site regarding where the fonts should be
located (i.e <script-drive>:/dir/<font>.ttf) and also that I should use a
Unix style path, however, this still doesn't work - all I get is empty space
where the font should be and a warning that it couldn't find the font...
:-(
"Michael Davey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi there!
>
> Sorry if this has been posted a hundred times already - but I am trying to
> use TrueType fonts with GD.
>
> I can create images fine, and have managed to gather from previous
postings
> that there was an error with post-4.0.5 versions of php_gd.dll that cause
> Freetype to fail, but the install of PHP I have installs php_gd2.dll and
any
> attempts to use php_gd.dll fail when I restart the server.
>
> Has anyone else has experience of this issue?
>
> Mikey
>
>
>
>
--- End Message ---
--- Begin Message ---
Hi,
Please don't reply with RTFM. I just installed Apache 2.0.36 and PHP
4.2 in Win XP Pro. Apache is running fine */localhost/ is working* and
<? phpinfo() ?> is showing the config. I have set register_globals =
On. So I practice following the source code from the book (and even
used the book's files), it seems that the form (in html) does not pass
the variable to the php file, all I can see is the html with the current
time (**echo date("H:i, jS F"); **). So if I can see the time output in
html that means PHP is working but why aren't the variables
passed/shown? I have been looking all over the mailing lists and I
can't find anybody with the exact same problem.
--------------
HTML FILE:
--------------
<html>
<head>
<title>Bob's Auto Parts</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Form</h2>
<form action="processorder.php" method=post>
<table border=0>
<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantity</td>
</tr>
<tr>
<td>Tyres</td>
<td align=center><input type="text" name="tyreqty" size=3
maxlength=3></td>
</tr>
<tr>
<td>Oil</td>
<td align=center><input type="text" name="oilqty" size=3
maxlength=3></td>
</tr>
<tr>
<td>Spark Plugs</td>
<td align=center><input type="text" name="sparkqty" size=3
maxlength=3></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Submit
Order"></td>
</tr>
</table>
</form>
</body>
</html>
-------------------
PHP FILE:
-------------------
<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?
echo "<p>Order processed at "; // Start printing order
echo date("H:i, jS F");
echo "<br>";
echo "<p>Your order is as follows:";
echo "<br>";
echo $tyreqty." tyres<br>";
echo $oilqty." bottles of oil<br>";
echo $sparkqty." spark plugs<br>";
$totalqty = 0;
$totalamount = 0.00;
define("TYREPRICE", 100);
define("OILPRICE", 10);
define("SPARKPRICE", 4);
$totalqty = $tyreqty + $oilqty + $sparkqty;
$totalamount = $tyreqty * TYREPRICE
+ $oilqty * OILPRICE
+ $sparkqty * SPARKPRICE;
echo "<br>\n";
echo "Items ordered: ".$totalqty."<br>\n";
echo "Subtotal: $";
echo number_format($totalamount, 2);
echo "<br>\n";
$taxrate = 0.10; // local sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
$totalamount = number_format($totalamount, 2);
echo "Total including tax: $".$totalamount."<br>\n";
?>
</body>
</html>
-----------------
Result:
-----------------
Bob's Auto Parts
Order Results
Order processed at 16:54, 30th May
Your order is as follows:
tyres
bottles of oil
spark plugs
Items ordered: 0
Subtotal: $0.00
Total including tax: $0.00
Sim
--- End Message ---
--- Begin Message ---
Hmm - I would check your config again as I have just run your code on my
server and it works without any problems...
regards,
Mikey
"Sim" <[EMAIL PROTECTED]> wrote in message
000001c2081c$ac9b7190$6401a8c0@athlon">news:000001c2081c$ac9b7190$6401a8c0@athlon...
> Hi,
>
> Please don't reply with RTFM. I just installed Apache 2.0.36 and PHP
> 4.2 in Win XP Pro. Apache is running fine */localhost/ is working* and
> <? phpinfo() ?> is showing the config. I have set register_globals =
> On. So I practice following the source code from the book (and even
> used the book's files), it seems that the form (in html) does not pass
> the variable to the php file, all I can see is the html with the current
> time (**echo date("H:i, jS F"); **). So if I can see the time output in
> html that means PHP is working but why aren't the variables
> passed/shown? I have been looking all over the mailing lists and I
> can't find anybody with the exact same problem.
>
> --------------
> HTML FILE:
> --------------
> <html>
> <head>
> <title>Bob's Auto Parts</title>
> </head>
> <body>
> <h1>Bob's Auto Parts</h1>
> <h2>Order Form</h2>
>
> <form action="processorder.php" method=post>
> <table border=0>
> <tr bgcolor=#cccccc>
> <td width=150>Item</td>
> <td width=15>Quantity</td>
> </tr>
> <tr>
> <td>Tyres</td>
> <td align=center><input type="text" name="tyreqty" size=3
> maxlength=3></td>
> </tr>
> <tr>
> <td>Oil</td>
> <td align=center><input type="text" name="oilqty" size=3
> maxlength=3></td>
> </tr>
> <tr>
> <td>Spark Plugs</td>
> <td align=center><input type="text" name="sparkqty" size=3
> maxlength=3></td>
> </tr>
> <tr>
> <td colspan=2 align=center><input type=submit value="Submit
> Order"></td>
> </tr>
> </table>
> </form>
> </body>
> </html>
>
> -------------------
> PHP FILE:
> -------------------
> <html>
> <head>
> <title>Bob's Auto Parts - Order Results</title>
> </head>
> <body>
> <h1>Bob's Auto Parts</h1>
> <h2>Order Results</h2>
> <?
> echo "<p>Order processed at "; // Start printing order
>
> echo date("H:i, jS F");
> echo "<br>";
> echo "<p>Your order is as follows:";
> echo "<br>";
> echo $tyreqty." tyres<br>";
> echo $oilqty." bottles of oil<br>";
> echo $sparkqty." spark plugs<br>";
>
> $totalqty = 0;
> $totalamount = 0.00;
>
> define("TYREPRICE", 100);
> define("OILPRICE", 10);
> define("SPARKPRICE", 4);
>
> $totalqty = $tyreqty + $oilqty + $sparkqty;
> $totalamount = $tyreqty * TYREPRICE
> + $oilqty * OILPRICE
> + $sparkqty * SPARKPRICE;
>
> echo "<br>\n";
> echo "Items ordered: ".$totalqty."<br>\n";
> echo "Subtotal: $";
> echo number_format($totalamount, 2);
> echo "<br>\n";
>
> $taxrate = 0.10; // local sales tax is 10%
> $totalamount = $totalamount * (1 + $taxrate);
> $totalamount = number_format($totalamount, 2);
> echo "Total including tax: $".$totalamount."<br>\n";
>
> ?>
> </body>
> </html>
> -----------------
> Result:
> -----------------
>
>
> Bob's Auto Parts
>
>
> Order Results
>
> Order processed at 16:54, 30th May
> Your order is as follows:
> tyres
> bottles of oil
> spark plugs
>
> Items ordered: 0
> Subtotal: $0.00
> Total including tax: $0.00
>
> Sim
>
>
--- End Message ---
--- Begin Message ---
It seams that PHP isn't set to process the vars. It is needed to change
the php.ini in some place where there is the following:
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily
lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off
For your script to work as is, replace the Off with On.
However, bear in mind the security problems, because it very easy to
"emulate" a web page and feed it with the data one wants.
I would recomend that you use the arrays $_GET and $_POST to get the
specific var (depending on the method used in the form page) and more,
perform a expretion evaluation with regarding to the vars values (to
ensure that the values are ok (like be numeric so the multiplication
with the unit price will give the correct ammout).
Be ware also that when "re-posting" the data for the execution page,
never reuse totals and values processed by the previous page... because
would be easy to send a $1 dollar bill for all those stuff in your store!
Cheers,
Luis Ferro
TelaDigital.net
Sim wrote:
>Hi,
>
>Please don't reply with RTFM. I just installed Apache 2.0.36 and PHP
>4.2 in Win XP Pro. Apache is running fine */localhost/ is working* and
><? phpinfo() ?> is showing the config. I have set register_globals =
>On. So I practice following the source code from the book (and even
>used the book's files), it seems that the form (in html) does not pass
>the variable to the php file, all I can see is the html with the current
>time (**echo date("H:i, jS F"); **). So if I can see the time output in
>html that means PHP is working but why aren't the variables
>passed/shown? I have been looking all over the mailing lists and I
>can't find anybody with the exact same problem.
>
>--------------
>HTML FILE:
>--------------
><html>
><head>
> <title>Bob's Auto Parts</title>
></head>
><body>
><h1>Bob's Auto Parts</h1>
><h2>Order Form</h2>
>
><form action="processorder.php" method=post>
><table border=0>
><tr bgcolor=#cccccc>
> <td width=150>Item</td>
> <td width=15>Quantity</td>
></tr>
><tr>
> <td>Tyres</td>
> <td align=center><input type="text" name="tyreqty" size=3
>maxlength=3></td>
></tr>
><tr>
> <td>Oil</td>
> <td align=center><input type="text" name="oilqty" size=3
>maxlength=3></td>
></tr>
><tr>
> <td>Spark Plugs</td>
> <td align=center><input type="text" name="sparkqty" size=3
>maxlength=3></td>
></tr>
><tr>
> <td colspan=2 align=center><input type=submit value="Submit
>Order"></td>
></tr>
></table>
></form>
></body>
></html>
>
>-------------------
>PHP FILE:
>-------------------
><html>
><head>
> <title>Bob's Auto Parts - Order Results</title>
></head>
><body>
><h1>Bob's Auto Parts</h1>
><h2>Order Results</h2>
><?
> echo "<p>Order processed at "; // Start printing order
>
> echo date("H:i, jS F");
> echo "<br>";
> echo "<p>Your order is as follows:";
> echo "<br>";
> echo $tyreqty." tyres<br>";
> echo $oilqty." bottles of oil<br>";
> echo $sparkqty." spark plugs<br>";
>
> $totalqty = 0;
> $totalamount = 0.00;
>
> define("TYREPRICE", 100);
> define("OILPRICE", 10);
> define("SPARKPRICE", 4);
>
> $totalqty = $tyreqty + $oilqty + $sparkqty;
> $totalamount = $tyreqty * TYREPRICE
> + $oilqty * OILPRICE
> + $sparkqty * SPARKPRICE;
>
> echo "<br>\n";
> echo "Items ordered: ".$totalqty."<br>\n";
> echo "Subtotal: $";
> echo number_format($totalamount, 2);
> echo "<br>\n";
>
> $taxrate = 0.10; // local sales tax is 10%
> $totalamount = $totalamount * (1 + $taxrate);
> $totalamount = number_format($totalamount, 2);
> echo "Total including tax: $".$totalamount."<br>\n";
>
>?>
></body>
></html>
>-----------------
>Result:
>-----------------
>
>
>Bob's Auto Parts
>
>
>Order Results
>
>Order processed at 16:54, 30th May
>Your order is as follows:
>tyres
>bottles of oil
>spark plugs
>
>Items ordered: 0
>Subtotal: $0.00
>Total including tax: $0.00
>
>Sim
>
>
>
>
--- End Message ---
--- Begin Message ---
My writeup of Apache2/PHP4.
http://www.phpgeek.com/articles.php?content_id=3
Felionious wrote:
> After i switched from the IIS that came with windows 2000 server and went to
> Apache2 none of my php are loading correctly. The server doesnt fault at
> all, it just shows my php pages in text form when you surf to them. I have
> followed all suggestion on the FAQ page at php.net.
>
> Thanks
> Fel
>
>
--- End Message ---
--- Begin Message ---
Hi All, is there anyway to lockdown the PHP.INI file so that only the one
stored in C:\WinNT\ is read in by PHP?
As it stands, you can place a copy of the INI file into the same directory
as the script that your browsing to, and PHP will use that as its
configuration file, rather than the one in C:\WinNT\.
Cheers
--- End Message ---
--- Begin Message ---
Although "php.exe -c c:\winnt\" works from the console, it doesnt seem to
work through IIS. Entry in IIS is;
e:\php\php.exe -c "c:\winnt\" %s
Cheers
-----Original Message-----
From: David Redmond
Sent: Friday, 31 May 2002 12:13 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP-WIN] PHP.INI Lockdown
Hi All, is there anyway to lockdown the PHP.INI file so that only the one
stored in C:\WinNT\ is read in by PHP?
As it stands, you can place a copy of the INI file into the same directory
as the script that your browsing to, and PHP will use that as its
configuration file, rather than the one in C:\WinNT\.
Cheers
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Dear php windows groups,
Can change password email with php scripts (not ASP scripts) ?
My system NT 4.0 Server and MS-Exchange 5.5.
Thanks
Hotma MS
--- End Message ---
--- Begin Message ---
Is there any way to detect linefeeds and replace them with <BR> for
output in html?
Matt Babineau
Freelance Internet Developer
-----------------------------------------
e: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
p: 603.943.4237
w: <http://www.criticalcode.com/> http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105
--- End Message ---
--- Begin Message ---
--- Matt Babineau <[EMAIL PROTECTED]> wrote:
> Is there any way to detect linefeeds and replace them with <BR> for
> output in html?
>
$data=explode("\n",$data);
foreach ($data as $line) {
print($data."<br>\n");
}
$data=implode("\n",$data);
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--- End Message ---
--- Begin Message ---
--- Michael Reynolds <[EMAIL PROTECTED]> wrote:
>
> --- Matt Babineau <[EMAIL PROTECTED]> wrote:
> > Is there any way to detect linefeeds and replace them with <BR> for
> > output in html?
> >
>
> $data=explode("\n",$data);
> foreach ($data as $line) {
> print($data."<br>\n");
(oops) replace that with:
print($line."<br>\n");
> }
> $data=implode("\n",$data);
>
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--- End Message ---
--- Begin Message ---
Thanks for that, if only because I didn't know PHP included the "foreach"
function, useful to know. :)
Ross
>-----Original Message-----
>From: Michael Reynolds [mailto:[EMAIL PROTECTED]]
>Sent: 31 May 2002 04:36
>To: [EMAIL PROTECTED]
>Subject: Re: [PHP-WIN] Line feeds and WRAP="soft" TEXTAREA element
>
>
>
>--- Michael Reynolds <[EMAIL PROTECTED]> wrote:
>>
>> --- Matt Babineau <[EMAIL PROTECTED]> wrote:
>> > Is there any way to detect linefeeds and replace them with <BR> for
>> > output in html?
>> >
>>
>> $data=explode("\n",$data);
>> foreach ($data as $line) {
>> print($data."<br>\n");
>
>(oops) replace that with:
>print($line."<br>\n");
>
>> }
>> $data=implode("\n",$data);
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! - Official partner of 2002 FIFA World Cup
>http://fifaworldcup.yahoo.com
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
try nl2br
http://www.php.net/manual/en/function.nl2br.php
Nikolai Jeliazkov
Ross Fleming wrote:
> Thanks for that, if only because I didn't know PHP included the "foreach"
> function, useful to know. :)
>
> Ross
>
>
>>-----Original Message-----
>>From: Michael Reynolds [mailto:[EMAIL PROTECTED]]
>>Sent: 31 May 2002 04:36
>>To: [EMAIL PROTECTED]
>>Subject: Re: [PHP-WIN] Line feeds and WRAP="soft" TEXTAREA element
>>
>>
>>
>>--- Michael Reynolds <[EMAIL PROTECTED]> wrote:
>>
>>>--- Matt Babineau <[EMAIL PROTECTED]> wrote:
>>>
>>>>Is there any way to detect linefeeds and replace them with <BR> for
>>>>output in html?
>>>>
>>>
>>>$data=explode("\n",$data);
>>>foreach ($data as $line) {
>>>print($data."<br>\n");
>>
>>(oops) replace that with:
>>print($line."<br>\n");
>>
>>
>>>}
>>>$data=implode("\n",$data);
>>>
>>
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Yahoo! - Official partner of 2002 FIFA World Cup
>>http://fifaworldcup.yahoo.com
>>
>>--
>>PHP Windows Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>
--- End Message ---