php-general Digest 27 Dec 2003 06:34:41 -0000 Issue 2496
Topics (messages 173337 through 173354):
Re: Migrating from SSI and Perl
173337 by: Radek Zajkowski
173338 by: Pablo Gosse
173344 by: Philip Pawley
Re: Apache 2 and PHP
173339 by: Per Jessen
Re: How New Is <<<HERE?
173340 by: stiano.Optonline.net
173341 by: Cesar Cordovez
173348 by: stiano.Optonline.net
173349 by: David T-G
Re: magic_quotes_gpc setting question.
173342 by: Marek Kilimajer
Problem with "switch ($to)"..
173343 by: Labunski
173345 by: Rolf Brusletto
Object Oriented Programming Book(s)?
173346 by: CF High
173347 by: Manuel Lemos
Re: Insert into array...
173350 by: Marek Kilimajer
possible bug in PHP function mysql_query() ?
173351 by: Peter Walter
Maths dumbass
173352 by: Ryan A
173353 by: Mike Brum
File Uploads
173354 by: Jough Jeaux
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 ---
Check out shell_exec() and its siblings. I'd likely use it like so $output =
shell_exec("perl myscript.pl"); and then do something with the $output
variable
R>
> -----Original Message-----
> From: Philip Pawley [mailto:[EMAIL PROTECTED]
> Sent: December 26, 2003 12:07 PM
> To: php-general
> Subject: [PHP] Migrating from SSI and Perl
>
>
> I am new to php.
>
> My site, at the moment, uses SSI to call a Perl browser-sniffing script.
>
> I would like to:
> 1. use php to call the Perl script.
> 2. then save the values the Perl script outputs as php variables.
>
> Can this be done? If so, how?
>
> Thanks,
>
> Philip Pawley
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
<snip>
My site, at the moment, uses SSI to call a Perl browser-sniffing script.
I would like to:
1. use php to call the Perl script.
2. then save the values the Perl script outputs as php variables.
Can this be done? If so, how?
</snip>
Hi, Philip. If you are not 100% stuck on using a perl script to sniff
the browser, you might want to use Phpsniff, a class available on
sourceforge:
http://phpsniff.sourceforge.net
I've used it in many of my applications with excellent results.
Cheers,
Pablo
--- End Message ---
--- Begin Message ---
Hi Radek,
I tried to do something with this and failed dismally.
Is it possible for you to give me a really basic working example of what you suggest?
Thanks,
Philip Pawley
At 26/12/03 12:29 -0500, you wrote:
>Check out shell_exec() and its siblings. I'd likely use it like so $output =
>shell_exec("perl myscript.pl"); and then do something with the $output
>variable
>
>R>
>
>> -----Original Message-----
>> From: Philip Pawley [mailto:[EMAIL PROTECTED]
>> Sent: December 26, 2003 12:07 PM
>> To: php-general
>> Subject: [PHP] Migrating from SSI and Perl
>>
>>
>> I am new to php.
>>
>> My site, at the moment, uses SSI to call a Perl browser-sniffing script.
>>
>> I would like to:
>> 1. use php to call the Perl script.
>> 2. then save the values the Perl script outputs as php variables.
>>
>> Can this be done? If so, how?
>>
>> Thanks,
>>
>> Philip Pawley
--- End Message ---
--- Begin Message ---
Radek Zajkowski wrote:
> A few months back the official PHP website still warned againts PHP and
> Apache 2. I am wondering about the current status of these two
> technologies when used together. I am about to configure a web server and
> was going to use Apache 1.3 with PHP4+ as opposed to Apache 2 with PHP4+.
> What are your opinions, thoughts and experiences.
I've been using apache 2.0 and php 4.x for quite some time now, and have
really only seen very minor problems. I did run into some odd problem a
while back, and asked about here - got the standard message about "don't
expect php to work in apache 2.0". It was something to do with
error-handling and timeout, IIRC.
Why not go with Apache 2.0? If you should run into some showstopper, revert
to 1.3 - it's not that much of an effort (provided you don't start using
apache 2.0-only features).
/Per
--
Per Jessen, Zurich
http://timian.jessen.ch - an analog report formatter using XSLT.
http://www.dansklisten.org -- for alle danskere i udlandet.
--- End Message ---
--- Begin Message ---
Thanks very much, and Merry Christmas to all--rather rude of me to've been
whining for help all this time and not remembering the courtesy of holiday
wishes.
Okay, I made the change to:
$txtBoxCounter = $_POST['txtBoxCounter'];
$hdnCounter = $_POST['hdnCounter'];
Now I get:
parse error: parse error, unexpected $ in [my path to this file] on line 34
I'm still missing the big picture.
Steve Tiano
-----------------
Change:
$txtBoxCounter = $_POST['txtBoxCounter]
$hdnCounter = $_POST['hdnCounter]
to
$txtBoxCounter = $_POST['txtBoxCounter'];
$hdnCounter = $_POST['hdnCounter'];
(Notice the ' at the end of txtBoxCounter and hdnCounter.
Merry X'mas
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
--- End Message ---
--- Begin Message ---
Please post your code from line 30 to 40. Place a mark in line 34.
=)
[EMAIL PROTECTED] wrote:
parse error: parse error, unexpected $ in [my path to this file] on line 34
--- End Message ---
--- Begin Message ---
Cesar,
Sorry to have taken so long to answer. My day got complicated. Anyway,
here's the code all over again, with the last changes I was advised to
make. I took out the line spaces and added line numbers. But first, the
latest error message:
Parse error: parse error, unexpected T_VARIABLE in [path to file] on
line 11
The code:
1 <html>
2 <head>
3 <title>
4 persistence demo
5 </title>
6 </head>
7 <body>
8 <h1>Persistence Demo</h1>
9 <form>
10 <?php
11 $txtBoxCounter = $_POST['txtBoxCounter'];
12 $hdnCounter = $_POST['hdnCounter'];
13 //increment the counters
14 $txtBoxCounter++;
15 $hdnCounter++;
16 print <<<HERE
17 <input type = "text"
18 name = "txtBoxCounter"
19 value = $txtBoxCounter>
20 <input type = "hidden"
21 name = "hdnCounter"
22 value = $hdnCounter>
23 <h3>The hidden value is $hdnCounter</h3>
24 <input type = "submit"
25 value = "click to increment counters">
26 HERE;
27 ?>
28 </form>
29 </body>
30 </html>
---------------------------------------------------------------------------
Please post your code from line 30 to 40. Place a mark in line 34.
=)
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
--- End Message ---
--- Begin Message ---
Steve --
...and then [EMAIL PROTECTED] said...
%
% Parse error: parse error, unexpected T_VARIABLE in [path to file] on
% line 11
%
% The code:
%
...
% 10 <?php
% 11 $txtBoxCounter = $_POST['txtBoxCounter'];
That certainly looks innocuous enough.
Just for fun, strip out the <<<HERE print statement and see if the code
is OK. I can't see how it on line 16 would affect this on line 11 (or
even anything wrong with it), but let's start with a small case that
works and build up from there.
HTH & HAND & Happy Holidays
:-D
--
David T-G * There is too much animal courage in
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
pgp00000.pgp
Description: PGP signature
--- End Message ---
--- Begin Message ---
Rajesh Kumar wrote:
Hello,
Here I've got a few related questions, which are not stated explicitly
in the manual.
1. The manual says that the magic_quotes_gpc setting cannot be set at
runtime. Is it not possible to set this setting in an ini file, and
parse it with the parse_ini_file() function? Also, if this was
possible, what will PHP do to the modified variables? Run the
stripslashes() functions on all of them?
No, this would be the same as runtime.
2. On a related line, are we allowed to use ini values in our ini file
that contradict the defined ini values in php.ini? Won't this confuse
the parser?
No, this will not confuse the parser. And it will not have any effect on
php settings.
3. What would I do if I didn't have access to my own custom ini file,
but could somehow get the file either by using fopen(), file() or
file_get_contents()? Can I parse a string (or array) like an ini
file?
You can do with a file whatever you are allowed to do, but it will not
have any effect on php settings unless you use ini_set() function. Still
you will be able to change only settings that can be changed during runtime.
4. Does parse_ini_file() allow us to specify absolute filenames of the
form "scheme://..." from another server, if our allow_url_fopen
is TRUE?
I don't know. Why don't you try it?
Thank You.
You can use .htaccess files to change php settings as described in the
documentation.
--- End Message ---
--- Begin Message ---
Hello, thanks in advice and Merry Christmas!
I'm a newbie in PHP, so I can't imagine how to add the "Part 1" to the "Part
2"..
/// Part 1 ////////////
switch ($to)
{
case "roman":
$to = $address;
break;
case "none":
// here should go the "Part 2", but I don't know how!
break;
}
/// Part 2 ///////////
(empty($from) || empty($message)) {
header( "Location: ../eng/contact.htm" );
}
Sorry for my bad english,
Lab.
--- End Message ---
--- Begin Message ---
Labunski wrote:
Hello, thanks in advice and Merry Christmas!
I'm a newbie in PHP, so I can't imagine how to add the "Part 1" to the "Part
2"..
/// Part 1 ////////////
switch ($to)
{
case "roman":
$to = $address;
break;
case "none":
// here should go the "Part 2", but I don't know how!
break;
}
/// Part 2 ///////////
(empty($from) || empty($message)) {
header( "Location: ../eng/contact.htm" );
}
Sorry for my bad english,
Lab.
Lab - its pretty simple actually...
switch ($to)
{
case "roman":
$to = $address;
break;
case "none":
if (empty($from) || empty($message)) {
header( "Location: ../eng/contact.htm" );
}
break;
}
Hope this helps..
Happy holidays!
--
Rolf Brusletto
rolf[at]emailfeeds[dot]com
http://www.emailfeeds.com
--- End Message ---
--- Begin Message ---
Hey all.
I've got the O'Reilly "Programming PHP" & "PHP Cookbook" PHP books --
excellent PHP Resources -- however, the OOP sections are rather short.
I'm hoping to get my hands on a relatively in-depth OOP book.
It doesn't look like there are any PHP specific OOP books out there yet, so
any OOP books that will help a developing PHP programmer are much
appreciated....
TIA & Happy Holidays,
--Noah
--
--- End Message ---
--- Begin Message ---
Hello,
On 12/26/2003 09:06 PM, Cf High wrote:
I've got the O'Reilly "Programming PHP" & "PHP Cookbook" PHP books --
excellent PHP Resources -- however, the OOP sections are rather short.
I'm hoping to get my hands on a relatively in-depth OOP book.
It doesn't look like there are any PHP specific OOP books out there yet, so
any OOP books that will help a developing PHP programmer are much
appreciated....
Yes, you are right, there are no OOP specific books. However most books
that tend to be general have good coverage of PHP OOP capabilities.
You may want to take a look here where you may find the latest PHP
books. Some are already reviewed:
http://www.phpclasses.org/products.html/products.html
--
Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---
Please don't start a new thread by hijacking an existing thread. Always
start with "new massage".
Simple answer for your question is:
foreach($orders as $order_key => $dummy) {
$orders[$order_key]['Newitem'] = "something";
}
Andras Kende wrote:
Hello All,
I would like to put 1 new field into this multidimensional array...
$orders =
1 => Array (11)
Name => JUDY
Order => 334455
2 => Array (11)
Name => MARY
Order => 12590
TO:
$orders =
1 => Array (11)
Name => JUDY
Order => 334455
Newitem => someting
2 => Array (11)
Name => MARY
Order => 12590
Newitem => something
I can do one at the time like:
$orders[1]['Newitem'] = "something";
But not for the whole array....
Thanks,
Andras Kende
--- End Message ---
--- Begin Message ---
MySQL version: 4.0.16
PHP version: 4.3.2
Problem code:
$query = "SELECT * FROM tablename
WHERE columnname LIKE '%<any_eight_digits>%'";
mysql_query($query);
Results:
query fails, mysql_errno() returns 1064 (syntax error)
I have tracked the problem down to the WHERE clause; using any other
number of digits (except eight), the query suceeds. It seems to be a
problem with the comparison logic, because other comparison operators
also fail; specifically, I have tested
WHERE columnname = <any_eight_digits>
and
WHERE columnname = '<any_eight_digits>'
When running the identical query in PhpMyAdmin 2.5.5 RC1, or at the
MySQL command line, the query works without a problem.
I am a PHP/MySQL newbie. Before I rush off and report this as a PHP bug,
can anyone else confirm this behavior, or explain what I am doing wrong?
Peter
--- End Message ---
--- Begin Message ---
Hi guys,
Its not 5am here and have started on a blasted problem where am feeling like
a maths dumbass...the old noodle is just not working, any help appreciated.
Problem, selling 4 packages rangeing from $27.50-$99.00 a month...the
subscriber can change anytime he wants from one package to the other
(upgrade), if so I have to calculate how many days he has is with us and
then he just pays the balance...
eg:
if he is on the smallest package ($27.50)
and the month has 30 days,
and 15 days are up,
(means 50% is used and that translates to 13.75$)
and he wants to upgrade to the next higher package ($43.00) he just has to
pay $29.25
Can you give me a clue on how to calculate that depending on the 12 months
and 4 packages?
Thanks in advance,
-Ryan
--- End Message ---
--- Begin Message ---
Basically, have an array of # of days per month. Do a quick compare given
the month for the # of days. For the sake of example, we'll assume the month
in question has 31 days. So, here's some givens:
$month_days = 31;
$former_plan_days = $current_date;
$new_plan_days = ($current_date - $month_days);
Now, to get the values:
$former_plan_bill = ($full_former_price * ($former_plan_days /
$month_days));
$new_plan_bill = ($full_new_price * ($new_plan_days / $month_days));
$total_month_bill = ($former_plan_bill + $new_plan_bill);
There you have it. This should work no matter if they get an "upgrade" or
"downgrade" in service because it just takes the ratio of days to get the
percentage of the price that's owed and then multiplies the full price to
get the percentage that's owed.
Make sense? :)
-M
-----Original Message-----
From: Ryan A [mailto:[EMAIL PROTECTED]
Sent: Friday, December 26, 2003 11:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Maths dumbass
Hi guys,
Its not 5am here and have started on a blasted problem where am feeling like
a maths dumbass...the old noodle is just not working, any help appreciated.
Problem, selling 4 packages rangeing from $27.50-$99.00 a month...the
subscriber can change anytime he wants from one package to the other
(upgrade), if so I have to calculate how many days he has is with us and
then he just pays the balance...
eg:
if he is on the smallest package ($27.50) and the month has 30 days, and 15
days are up, (means 50% is used and that translates to 13.75$) and he wants
to upgrade to the next higher package ($43.00) he just has to pay $29.25
Can you give me a clue on how to calculate that depending on the 12 months
and 4 packages?
Thanks in advance,
-Ryan
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Greetings all, I want to allow users to upload images
to an online profile. Anyone know how to let the user
browse his/her local filesystem from the web page?
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
--- End Message ---