php-general Digest 21 May 2002 15:58:17 -0000 Issue 1358

Topics (messages 98557 through 98607):

Re: MySQL and sorting
        98557 by: Miguel Cruz
        98558 by: Tyler Longren
        98559 by: Jason Wong
        98562 by: David Freeman

Smart quote algorithm
        98560 by: Miguel Cruz

Re: php4.2.0 (win) error message question
        98561 by: Rasmus Lerdorf

Re: exec() sytem() problem with starting ext. prg
        98563 by: Alexander Saupe

PHP & QUERY_STRING
        98564 by: Stavros Patiniotis
        98565 by: Rasmus Lerdorf
        98566 by: Stavros Patiniotis

Informix Abstraction Class the PHPLIB Way
        98567 by: Martin Cabrera Diaubalick

how to configure PHP (.ini) so I can use include() from any directory
        98568 by: Wilbert Enserink
        98572 by: Tom Rogers

Re: timezone problem
        98569 by: Baba Buehler

array empty after use
        98570 by: Web
        98571 by: Tom Rogers

Searching for any number in a mysql query
        98573 by: webmaster.tececo.com
        98574 by: liljim
        98586 by: John Holmes

Reverse mySQL date
        98575 by: webmaster.tececo.com
        98576 by: liljim

XML Transformation
        98577 by: José León Serna

file functions and clearstatcache
        98578 by: Gerard Samuel

PHP & form data
        98579 by: Stavros Patiniotis
        98583 by: Stavros Patiniotis

Accessing PHP globals from a module.
        98580 by: Eric Veldhuyzen
        98581 by: Eric Veldhuyzen
        98605 by: Rasmus Lerdorf

dbase
        98582 by: eoghan

<< and >> Operators
        98584 by: Jonathan Rosenberg

php+oracle
        98585 by: Mauricio

Re: what does the & sign do
        98587 by: Wilbert Enserink
        98590 by: Adam Alkins

XML parser vs objects
        98588 by: Mirek Novak

Re: Getting PHP on FreeBSD to talk to MSSQL Server 7...
        98589 by: Andrew Hill

Full-Duplex communication
        98591 by: Vinod  Panicker
        98594 by: Manuel Lemos
        98597 by: Bogdan Stancescu
        98600 by: Vinod  Panicker

Re: [php-objects] XML parser vs objects
        98592 by: Fredrik Davidsson

Re: eregi(mail)
        98593 by: Denis L. Menezes

Secure eval();
        98595 by: Chris Boget
        98598 by: John Holmes
        98601 by: Chris Boget
        98603 by: John Holmes
        98604 by: Chris Boget
        98606 by: John Holmes

PHP 4.2.1 install
        98596 by: Conover, Ryan

Java PHP Integration
        98599 by: Conover, Ryan

unknown problem of script
        98602 by: erich
        98607 by: Analysis & Solutions

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 ---
On Mon, 20 May 2002, Cleeker wrote:
> Is there a way to extract lets say a bunch of dates from a mysql db, and
> the sort them in order from newest to oldest? Also how would you sort
> names in alphabetical order?

Read the section of the MySQL manual that covers "ORDER BY" clauses.

miguel

--- End Message ---
--- Begin Message ---
The MySQL manual will explain this in great detail.

To sort by date:
SELECT * FROM table ORDER BY date ASC;

for that to work, all the values in date should be a timestamp (ex:
20020520000000)

To sort by names:
SELECT  * FROM table ORDER BY name ASC;

If you want reverse the order, replace the 'ASC' with 'DESC'.

Tyler Longren
Captain Jack Communications
www.captainjack.com
[EMAIL PROTECTED]
----- Original Message -----
From: "Cleeker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 9:11 PM
Subject: [PHP] MySQL and sorting


> Is there a way to extract lets say a bunch of dates from a mysql db, and
> the sort them in order from newest to oldest? Also how would you sort
> names in alphabetical order?
>
> ~Cleeker
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
On Tuesday 21 May 2002 10:11, Cleeker wrote:
> Is there a way to extract lets say a bunch of dates from a mysql db, and
> the sort them in order from newest to oldest? Also how would you sort
> names in alphabetical order?

Yes, look at the date/time functions in the (mysql) manual.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Not one hundred percent efficient, of course ... but nothing ever is.
                -- Kirk, "Metamorphosis", stardate 3219.8
*/

--- End Message ---
--- Begin Message ---

 > Is there a way to extract lets say a bunch of dates from a 
 > mysql db, and the sort them in order from newest to oldest? 
 > Also how would you sort names in alphabetical order?

Yes, and a php list is obviously a good place to ask an sql question.

In any case, you want to examine your favourite mysql manual for the
'order by' part, particularly the bit about using 'asc' and 'desc'.

CYA, Dave


--- End Message ---
--- Begin Message ---
I have an application where I need to take some text that may contain inch
and foot marks (aka ASCII quotes, ' and ") and change them to typesetters'
quotes prior to exporting as an RTF.

I poked around a little and didn't have much luck; I wonder if anyone has 
already implemented the required algorithm in PHP. If so, that would save 
me some time - since it's not a trivial undertaking, what with nested 
quotes, contractions, contracted numbers like "'70s", old-fashioned 
paragraphs without closing quotes, inch and foot measurements, etc.

If not, I guess I'll do it and share the results.

miguel

--- End Message ---
--- Begin Message ---
Hebrew

On Tue, 21 May 2002, Martin Towell wrote:

> I understand that I put :: when I shouldn't have. But why is it called
> T_PAAMAYIM_NEKUDOTAYIM and not T_DOUBLE_COLON or something else? It's not
> latin or something is it?
>
> -----Original Message-----
> From: Peter [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 21, 2002 1:19 PM
> To: Php
> Subject: RE: [PHP] php4.2.0 (win) error message question
>
>
>
> try looking it up in the manual on php.net i just did a search for it and
> found a few results such as
> http://www.php.net/manual/en/tokens.php#AEN98855  which leads to (when you
> find it in the table)
>
> http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php
>
> -----Original Message-----
> From: Martin Towell [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 21 May 2002 12:55 PM
> To: '[EMAIL PROTECTED]'
> Subject: [PHP] php4.2.0 (win) error message question
>
>
> Just thought I'd try defining a class method outside of the class definition
> block.
> Here's the code
>
> <?
> class test
> {
>   function test() { echo "In constructor\n"; }
> }
>
> function test::blah() { echo "hello world\n"; }
>
> $x = new test();
> $x->blah();
> ?>
>
> Here's the error I got
>
> Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting '('
> in C:\WINNT\Profiles\mtowell\Desktop\test1.html on line 7
>
> So, okay, I can't do that. I'd have to define "blah()" inside the "class
> test{}" block
>
> But my question is: what does "T_PAAMAYIM_NEKUDOTAYIM" mean?
>
> --
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
What is a TTY (see below)?


----- Original Message -----
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "Alexander Saupe" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 2:06 PM
Subject: Re: [PHP] exec() sytem() problem with starting ext. prg


> su - nobody (substitute your web server user id)
> then try to run the command
>
> The other problem can be that the app requires a TTY.
>
> -Rasmus
>
> On Mon, 20 May 2002, Alexander Saupe wrote:
>
> > Hello php-general,
> >
> > on a LAMP server I have the following problem:
> >
> > 1. playing around I tried to execute the linux df (diskfree) command
with
> > exec() or system() - no problem, works fine!
> > 2. trying to start an application did not work!
> > - the application which I am trying to start can be started by anyone,
here
> > are the user rights: -rwxrwxrwx    1 10575    21129     1052648 M?r 13
16:31
> > mldonkey
> > - the application is normally (from the console, no gui) started like
this:
> > mldonkey > mldonkey.log &
> > - for testing I configured the Apache (in httpd.conf) as a user
> > - doing a little research (http://www.php.net/manual/en/ref.exec.php) I
> > tried this:
> > exec("php script.php parameters 2>dev/null >&- <&-
> > >/dev/null &");
> > Where...
> > ...php is the path to your php script executer (php has to be
specifically
> > complied to be to do this)
> > ...script.php is the script
> > ...parameters are none or more parameters
> > ...2>dev/null redirects the stderr to a file
> > ...<&- switches off the stdin
> > ...>&- switches off the stdout
> > ...>dev/null redirects all other output to the file dev/null
> > ...& direct script to run in background
> > - played a little with the parameters and... nothing happened! ;-(
> >
> > Help me please!
> >
> > Maybe anybody knows, if this has something to do with user rights (I
think
> > not)?
> > What do I have to do, if I want to send e.g. 'kill PID' Linux command
(no
> > success here either)?
> >
> > Thank's a lot, Alex
> >
> >
> >
> > --
> > 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
>
>


--- End Message ---
--- Begin Message ---
Hello,

My web server hdd just crashed, and I have replaced and rebuilt it with a
new drive.

All of my websites have been transferred over the the new site from
backup, and I am having a problem with PHP seeing GET variables.

My searching says that I should look in the php.ini file, but cannot
see any settings that would apply.

Can any one help, eg


http://webserver/stav.php?Action=Run



stav.php
<?
//test

print "Action is $Action";

?>


Any suggestions or pointers would be much appreciated.




Kind Regards,


0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0
                             escape net
      m a k i n g   t h e   n e t  w o r k   f o r   y o u

465b South Road                                     ph 8293 2526
KESWICK SA 5035                                     fx 8293 2949
0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0

--- End Message ---
--- Begin Message ---
register_globals

On Tue, 21 May 2002, Stavros Patiniotis wrote:

> Hello,
>
> My web server hdd just crashed, and I have replaced and rebuilt it with a
> new drive.
>
> All of my websites have been transferred over the the new site from
> backup, and I am having a problem with PHP seeing GET variables.
>
> My searching says that I should look in the php.ini file, but cannot
> see any settings that would apply.
>
> Can any one help, eg
>
>
> http://webserver/stav.php?Action=Run
>
>
>
> stav.php
> <?
> //test
>
> print "Action is $Action";
>
> ?>
>
>
> Any suggestions or pointers would be much appreciated.
>
>
>
>
> Kind Regards,
>
>
> 0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0
>                              escape net
>       m a k i n g   t h e   n e t  w o r k   f o r   y o u
>
> 465b South Road                                     ph 8293 2526
> KESWICK SA 5035                                     fx 8293 2949
> 0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---

Hello,

Great stuff!

Thank you!

Kind Regards,


0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0
                             escape net
      m a k i n g   t h e   n e t  w o r k   f o r   y o u

465b South Road                                     ph 8293 2526
KESWICK SA 5035                                     fx 8293 2949
0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0

On Tue, 21 May 2002, Rasmus Lerdorf wrote:

> register_globals


--- End Message ---
--- Begin Message ---
Hello everyone,

I'm starting to work with Informix 9.3 and I was wondering if someone has
created a class in the phplib way using the same methods.

My knowledge of Informix is less than zero, so if you could point me to
another DB abstraction system that uses Informix and classes, I will
appreciate it! :-)

Thanks in advance
Regards


--- End Message ---
--- Begin Message ---
Hi all,


anybody knows how to configure PHP (.ini) so I can use include() from any directory 
instead of declaring specified "paths" in php.ini? 

I'm currently using php 4.05 with apache 1.3 something on a winXP test machine

regards. Wilbert



-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-------------------------
--- End Message ---
--- Begin Message ---
Hi
I use this at the start of my pages, it adds the original path to the extra 
one: (keeps the include files out of the web servers view :)

ini_set ("include_path",ini_get("include_path").":../include");

Tom



At 06:47 PM 21/05/2002, Wilbert Enserink wrote:
>Hi all,
>
>
>anybody knows how to configure PHP (.ini) so I can use include() from any 
>directory instead of declaring specified "paths" in php.ini?
>
>I'm currently using php 4.05 with apache 1.3 something on a winXP test machine
>
>regards. Wilbert
>
>
>
>-------------------------
>Pas de Deux
>Van Mierisstraat 25
>2526 NM Den Haag
>tel 070 4450855
>fax 070 4450852
>http://www.pdd.nl
>[EMAIL PROTECTED]
>-------------------------

--- End Message ---
--- Begin Message ---
Miguel Cruz wrote:
> 
> In short, I believe it's an OS rather than a PHP thing.
> 

time zones can be a messy and tricky beast.  all the PHP functions rely on 
the underlying OS implementation of time zone information.  sometimes this 
is controlled by the TZ environment variable, sometimes it is not.

my solution was to extract as much info as reasonable from the zoneinfo 
database and manipulate it in PHP directly.  the solution is not perfect, 
but is probably the best that can be done without more PHP access to the 
underlying zoneinfo implementation.

my code (with all the time zone data & zone IDs) is in PEAR:
http://pear.php.net/package-info.php?pacid=57


thanks,
baba

--- End Message ---
--- Begin Message ---
Hi there.

When an array is 'used' with something like do while I can't re-access it
later in the page.  It is as if the array gets used up and doesn't exist.
The array is from a select statement using myself.  I have inserted a
duplicate array with a different name to get around this but figure there
must be a simpler way.

Any ideas please?

Thanks
Kevin

--- End Message ---
--- Begin Message ---
Hi
You just need to reset the array pointer with reset($array_name)
Tom

At 07:47 PM 21/05/2002, Web wrote:
>Hi there.
>
>When an array is 'used' with something like do while I can't re-access it
>later in the page.  It is as if the array gets used up and doesn't exist.
>The array is from a select statement using myself.  I have inserted a
>duplicate array with a different name to get around this but figure there
>must be a simpler way.
>
>Any ideas please?
>
>Thanks
>Kevin
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
This isn't a one hundred percent PHP Q but here I go.
 
If I have the following query:

$query = "SELECT code FROM links WHERE ".$text." like '".$l."%' ORDER BY sort_text";

and define the letter a letter i.e x.

it works fine.

I am not sure what to do if I want to say get something that starts with (from one to ten).

I want to say all the numbers at once, not one at a time.

Any help appreciated,

JJ Harrison
[EMAIL PROTECTED]
www.tececo.com

--- End Message ---
--- Begin Message ---
Hi,

try something like this:

"select [fields] from [table(s)] where [fieldtosearch] regexp
"^([1-9]{1}|10)";

~James

<[EMAIL PROTECTED]> wrote in message
003901c200b2$27ccff40$0100a8c0@JohnH">news:003901c200b2$27ccff40$0100a8c0@JohnH...
This isn't a one hundred percent PHP Q but here I go.

If I have the following query:
$query = "SELECT code FROM links WHERE ".$text." like '".$l."%' ORDER BY
sort_text";
and define the letter a letter i.e x.
it works fine.
I am not sure what to do if I want to say get something that starts with
(from one to ten).
I want to say all the numbers at once, not one at a time.
Any help appreciated,
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com


--- End Message ---
--- Begin Message ---
Use regular expressions or LEFT. This might work
 
SELECT code FROM links WHERE LEFT($text,1) IN (1,2,3,4,5,6,7,8,9,0);
 
Check the manual for regular expression examples. They will probably
work better.
 
---John Holmes.
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 21, 2002 6:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Searching for any number in a mysql query
 
This isn't a one hundred percent PHP Q but here I go.
 
If I have the following query:
$query = "SELECT code FROM links WHERE ".$text." like '".$l."%' ORDER BY
sort_text";
and define the letter a letter i.e x.
it works fine.
I am not sure what to do if I want to say get something that starts with
(from one to ten).
I want to say all the numbers at once, not one at a time.
Any help appreciated,
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com
--- End Message ---
--- Begin Message ---
How can I reverse the date coming out of mySQL?
 
 
ie 2002-05-21
 
becomes 21-05-2002
 
Can do it in the mySQL query or do I need to use PHP?
 
Thanks in advance,
 
--- End Message ---
--- Begin Message ---
Hello,

use DATE_FORMAT

"select date_format(datefield, '%d-%m-%Y') as mydate from table";

~James


<[EMAIL PROTECTED]> wrote in message
005e01c200b5$194184c0$0100a8c0@JohnH">news:005e01c200b5$194184c0$0100a8c0@JohnH...
How can I reverse the date coming out of mySQL?


ie 2002-05-21

becomes 21-05-2002

Can do it in the mySQL query or do I need to use PHP?

Thanks in advance,

JJ Harrison
[EMAIL PROTECTED]
www.tececo.com


--- End Message ---
--- Begin Message ---
Hello:
    I would like to perform XML transformations on my website, I have the
xml file in a string and the xsl file in another string, I have tested
sablotron, but it give me parse and encoding problems. Is there any "good"
solution out there?

By "good" I mean portable and reliable solutions, this module is going to be
on a intranet and the xml files are going to be uploaded to be transformed
to HTML.

Best Regards.
----------------------------------------------------
QaDRAM Studio, RAD Development for the WEB
http://studio.qadram.com

--- End Message ---
--- Begin Message ---
Im just double checking on the use of clearstatcache.

I have a function that checks whether a file exists and loads it like so

function foo($bar)
{
    if (file_exists($bar))
    {
         include($bar);
    }
}

According to clearstat cache, its use is for files that change often. 
 In my case the files are static,
so I wanted to be clear, as to whether I should/shouldn't be using 
clearstatcache() in my sudo function??

Thanks

--- End Message ---
--- Begin Message ---

Hello,

I am experiencing problems with receiving form data into my
scripts.  The phpinfo() function shows me:

PHP_SELF
_POST["Action"]                 checkEmail 
_POST["emailAddress"]           st 
_POST["submit"]                 Next >> 
_COOKIE["uid"]
_COOKIE["emailAddress"]
_COOKIE["testCookie"]           Success 


However, I can only see $Action in my script, if I try to access
$emailAddress, it doesn't work.

Any pointers, or documents to refer me to??


Kind Regards,


0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0
                             escape net
      m a k i n g   t h e   n e t  w o r k   f o r   y o u

465b South Road                                     ph 8293 2526
KESWICK SA 5035                                     fx 8293 2949
0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0

--- End Message ---
--- Begin Message ---
 
> I am experiencing problems with receiving form data into my
> scripts.  The phpinfo() function shows me:
> 
> PHP_SELF
> _POST["Action"]                       checkEmail 
> _POST["emailAddress"]         st 
> _POST["submit"]                       Next >> 
> _COOKIE["uid"]
> _COOKIE["emailAddress"]
> _COOKIE["testCookie"]         Success 
> 

Further to my last email, I'd just like to point out that the scripts that
I am using used to work with an older php4 version (not sure of the
version number).

I'd also like to point out how the script works:

(1) joinup.php
   -set test cookie
   -delete emailAddress cookie
   -redirect to joinup1.php

(2) joinup1.php
   -if test cookie
   -ask for email/passwd ->submit
   -sumbits to self with Action=checkEmail
   -checkemail is failing due to this "problem".

So basically the $emailAddress variable is being overwritten by the
emailAddress cookie in (1).  How can I prevent this?  Remember that I need
to delete the emailAddress cookie as the user will not be able to sign in
in (2) when they to use a different email address (which is required).


Thanks.

--- End Message ---
--- Begin Message ---
Hi,

I have just written a module for PHP (in C, linked with PHP statically).
Now I need to access session variables and other globals from whithin my
module. But I can't find how I should do this, I see documentation on how
to call user functions, and how to create new global varables, but now
how to access existing globals. Could somebody please tell me where
tell me where this is documented if it is documented at all, or explain
it to me if it is not documented yet?

-- 
#!perl #                       Life ain't fair, but root passwords help.
# Eric Veldhuyzen                              [EMAIL PROTECTED]
$!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~                   # Perl Monger
/.(.)...(.)(.)....(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_>&$;`
--- End Message ---
--- Begin Message ---
Hi,

I have just written a module for PHP (in C, linked with PHP statically).
Now I need to access session variables and other globals from whithin my
module. But I can't find how I should do this, I see documentation on
how
to call user functions, and how to create new global varables, but now
how to access existing globals. Could somebody please tell me where
tell me where this is documented if it is documented at all, or explain
it to me if it is not documented yet?

-- 
#!perl #                       Life ain't fair, but root passwords help.
# Eric Veldhuyzen                              [EMAIL PROTECTED]
$!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~                   # Perl Monger
/.(.)...(.)(.)....(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_>&$;`
--- End Message ---
--- Begin Message ---
Depends a bit on what sort of globals you are after.  If you mean a global
variable set by the user in the global symbol table you would do:

  pval **tmp;
  if(zend_hash_find(&EG(symbol_table), "foo", 3, (void **)&tmp) == SUCCESS) {
    RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
  } else {
    RETURN_FALSE;
  }

Would fetch $foo from the global symbol table, stick it in tmp and return
it from your function.

-Rasmus

On Tue, 21 May 2002, Eric Veldhuyzen wrote:

> Hi,
>
> I have just written a module for PHP (in C, linked with PHP statically).
> Now I need to access session variables and other globals from whithin my
> module. But I can't find how I should do this, I see documentation on
> how
> to call user functions, and how to create new global varables, but now
> how to access existing globals. Could somebody please tell me where
> tell me where this is documented if it is documented at all, or explain
> it to me if it is not documented yet?
>
> --
> #!perl #                       Life ain't fair, but root passwords help.
> # Eric Veldhuyzen                              [EMAIL PROTECTED]
> $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~                   # Perl Monger
> /.(.)...(.)(.)....(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_>&$;`
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
anyone ther eused dbase with php.
was looking for best pratices on 
searching... any code snippets appreciated.

thanks...


--- End Message ---
--- Begin Message ---
Are the << and >> operators identical in semantics to those
operators in C?  In particular, do they handle sign extension in
the same manner?

--
JR

--- End Message ---
--- Begin Message ---
Hi for all.
I have php+apache+win2000+client oracle in my machine.
I configured my php.ini with:
extension_dir and uncomment extensions in php_oci8.dll
But, when I restart my apache, I receive the following error:

Unable to load dynamic library "c:\php\extensions/php_oci8.dll". It was not
possible to find the specified procedure.
Can anyone help me with the configuration of php+oracle?

--
Mauricio
+55 - (041) - 219-5246
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Hi all,


maybe this is a stupid Q, but lately I'm diving into OOP. Below you can see a piece of 
example code from the manual. 
my Q: what does the & sign do in functioncb_modify( &$item,$key) ??

I noticed this sign is used more, so it should be handy, but hwat does it do?

thx Wilbert

-----------------------------


class mod {
    var $thearray;
    function mod( $a ) {
      $this->thearray = $a;
    }
    function cb_modify( &$item, $key ) {
      $item = "pref_".$item;
    }
    function modify() {
      array_walk( $this->thearray, array( $this, 'cb_modify' ) );
    }
  }
  $m = new mod(array("one","two","three"));
  $m->modify();
  print_r($m);

which prints out:

  mod Object
  (
      [thearray] => Array
          (
              [0] => pref_one
              [1] => pref_two
              [2] => pref_three
          )
  )




-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-------------------------
--- End Message ---
--- Begin Message ---
Its a Reference Operator. You can use it to reference variables to one
another, like $a = &$b; meaning that anytime you change the value of $a it
would change the value of $b....

Used for functions works in the same way. Its a way of improving the scope
of a variable. Instead of passing a value to the function and working with
that value only in the function, its a reference to a global function and
will change the value outside the function.

-Adam

----- Original Message -----
From: "Wilbert Enserink" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 21, 2002 8:32 AM
Subject: [PHP] SQ: what does the & sign do


Hi all,


maybe this is a stupid Q, but lately I'm diving into OOP. Below you can see
a piece of example code from the manual.
my Q: what does the & sign do in functioncb_modify( &$item,$key) ??

I noticed this sign is used more, so it should be handy, but hwat does it
do?

thx Wilbert

-----------------------------


class mod {
    var $thearray;
    function mod( $a ) {
      $this->thearray = $a;
    }
    function cb_modify( &$item, $key ) {
      $item = "pref_".$item;
    }
    function modify() {
      array_walk( $this->thearray, array( $this, 'cb_modify' ) );
    }
  }
  $m = new mod(array("one","two","three"));
  $m->modify();
  print_r($m);

which prints out:

  mod Object
  (
      [thearray] => Array
          (
              [0] => pref_one
              [1] => pref_two
              [2] => pref_three
          )
  )




-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-------------------------

--- End Message ---
--- Begin Message ---
Hi,
   is it possible to use methods of a class as a handlers in 
xml_set_element_handler(...)? How it can be done?
TIA,
   M.N.

--- End Message ---
--- Begin Message ---
And you can also use ODBC Drivers, after linking --with-iodbc as per the
HOWTO's on www.iodbc.org.  You may obtain drivers from OpenLink.

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access & Virtuoso Universal Server
 

-----Original Message-----
From: Danny Shepherd [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 15, 2002 3:29 PM
To: [EMAIL PROTECTED]; Michael Kimsal
Subject: Re: [PHP] Re: Getting PHP on FreeBSD to talk to MSSQL Server
7...

In my expierence you'll have much greater chance of sucess if you
compile
with --with-sybase-ct :)

I just used --with-sybase-ct=/usr/local  - I didn't bother with
--with-mssql
or --with-sybase

Paticulars:
FreeBSD 4.5
PHP 4.2.0
FreeTDS 0.53

Of course, using this methods means you also have to use the sybase
commands
not the mssql commands but they're pretty much identical in function -
just
the names that are different.

HTH

Danny.

----- Original Message -----
From: "Michael Kimsal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 11, 2002 2:08 AM
Subject: [PHP] Re: Getting PHP on FreeBSD to talk to MSSQL Server 7...


> Glenn Sieb wrote:
> > Hi.. it's me again :)
> >
> > We have a few different servers here, most of which are FreeBSD,
> > including our internal web server (Apache 1.3.24). We have PHP 4.2.0
> > installed as well.
> >
> > Currently I'm running my MSSQL query scripts on a Win2k webserver,
as I
> > can't seem to get PHP to talk to MSSQL on the FreeBSD side. I'd
really
> > prefer to have my PHP scripts all running on the FreeBSD side,
rather
> > than on Win2k.
> >
> > We do have Perl able to talk to the MSSQL server using FreeTDS and
the
> > DBI::Sybase package on the same FreeBSD machine.
> >
> > My ./configure:
> >
> >  ./configure --prefix=/usr/local
> > --with-apache=/home/src/Apache/Apachetoolbox
> > -1.5.56/apache_1.3.24 --enable-exif --enable-track-vars
> > --with-calendar=shared -
> > -enable-safe-mode --enable-magic-quotes --enable-trans-sid
--enable-wddx
> > --enabl
> > e-ftp --with-gd=/usr/local --with-zlib --enable-gd-native-tt
> > --with-t1lib=/usr/l
> > ocal --with-jpeg-dir=/usr/local --with-png-dir=/usr/local
> > --with-zlib-dir=/usr -
> > -with-ttf --with-freetype-dir=/usr/local
> > --with-unixodbc=/usr/local/unixODBC --w
> > ith-openssl=/usr/local --with-curl=/usr/local --enable-apc
> > --with-mysql=/sw/mysq
> >
l --with-mssql=/usr/local/etc/freetds
--with-sybase=/usr/local/etc/freetds
> >
> > (built using ApacheToolbox, 1.5.56)
> >
> > FreeTDS' interfaces file is located in /usr/local/etc/freetds, which
it
> > is/was my understanding that this is what's supposed to be there.
Yet
> > not only does PHP give me:
>
> the --with-sybase= line needs to point to where freetds was compiled,
> not the interfaces file.  We don't use the interfaces file, which
seems
> to be primarily a way to map names to IPs.  We just use the IP address
> directly in the mssql_connect() functions and it works.
>
> Michael Kimsal
> http://www.phphelpdesk.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




--- End Message ---
--- Begin Message ---
Hi,

We have developed a client-server application where the server 
needs to send asynchronous data to the client.  Now since we are 
using Apache/PHP/MySQL, the client needs to poll the server 
periodically for information.

I was thinking if there was some way to get around this basic 
problem.  I understand that this is how things are supposed to 
work, but it would be just great if i could PUSH data from the 
server to the client, using HTTP.

Since HTTP is a request/response based protocol, Apache would not 
send any data to the client asynchronously.  So what i was 
thinking was - If i tell the server to allow Keep-Alive 
connections, and increase the timeout value and max requests, I 
would effectively have a constant TCP connection.  Now the only 
problem would be of sending asynchronous data to the client.  
Solution?  Here goes - If there was some way in which i could get 
hold of the file descriptor(socket) that is being used by apache 
to write data to the client, then i could, from a PHP script also 
send any data to the client using the socket functions of PHP 
since i already have the socket with me.

This would mean that the client doesnt have to poll the server for 
data any more... and if the connection does get closed, the client 
could reconnect to the server asking for another keep-alive 
connection.

Now I know that this is probably the wrong place to put such a 
query - maybe the apache list would have been better.  But since 
I'm using PHP out here, i thought i'd give it a try.

Does the solution sound very outlandish?  Are there any pitfalls?  
And finally, how do i get hold of the socket?

Tx in advance,
Vinod.
_________________________________________________________
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs

--- End Message ---
--- Begin Message ---
Hello,

On 05/21/2002 10:20 AM, Vinod Panicker wrote:
> Does the solution sound very outlandish?  Are there any pitfalls?  And 
> finally, how do i get hold of the socket?

Why don't you just use echo and flush() like PHP chat programs do?



-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
Hi!

I'm looking for an answer to your questions as well, so if you do find a 
solution on other lists, could you please post it here as well?

Regarding the issue, your proposal wouldn't make for full-duplex as far 
as I understand since I don't see how the client would be able to send 
any data on the same connection _after_ getting connected.

What are you using on the other end of the pipe (on the client)? Plain 
HTML? Flash? Java? Something else?

Bogdan

Vinod Panicker wrote:

> Hi,
>
> We have developed a client-server application where the server needs 
> to send asynchronous data to the client.  Now since we are using 
> Apache/PHP/MySQL, the client needs to poll the server periodically for 
> information.
>
> I was thinking if there was some way to get around this basic 
> problem.  I understand that this is how things are supposed to work, 
> but it would be just great if i could PUSH data from the server to the 
> client, using HTTP.
>
> Since HTTP is a request/response based protocol, Apache would not send 
> any data to the client asynchronously.  So what i was thinking was - 
> If i tell the server to allow Keep-Alive connections, and increase the 
> timeout value and max requests, I would effectively have a constant 
> TCP connection.  Now the only problem would be of sending asynchronous 
> data to the client.  Solution?  Here goes - If there was some way in 
> which i could get hold of the file descriptor(socket) that is being 
> used by apache to write data to the client, then i could, from a PHP 
> script also send any data to the client using the socket functions of 
> PHP since i already have the socket with me.
>
> This would mean that the client doesnt have to poll the server for 
> data any more... and if the connection does get closed, the client 
> could reconnect to the server asking for another keep-alive connection.
>
> Now I know that this is probably the wrong place to put such a query - 
> maybe the apache list would have been better.  But since I'm using PHP 
> out here, i thought i'd give it a try.
>
> Does the solution sound very outlandish?  Are there any pitfalls?  And 
> finally, how do i get hold of the socket?
>
> Tx in advance,
> Vinod.
> _________________________________________________________
> Click below to visit monsterindia.com and review jobs in India or Abroad
> http://monsterindia.rediff.com/jobs
>
>



--- End Message ---
--- Begin Message ---
Hi,

Tx for your very prompt reply.

Yeah, I'll post the solution as soon as I find it someplace.

Let me outline the problem in more detail -

Client (VC++) calls a PHP script on the server, specifies the 
connection type as Keep-Alive.  The PHP script, somehow (still a 
big question) gets the socket on which the apache server has 
received the client request (so that it can send data to the 
client later) and stores it in a database.

Now whenever another PHP script wants to send data asynchronously 
to the client, it gets the socket from the database, and just 
calls a write() on it.  Since the connection is still open 
(Keep-Alive), the client receives the information, and doesnt have 
to poll the server periodically.

The application of this is indeed destined for a messaging 
product, and could benefit a lot of other areas as well.

The only thing that is needed is the socket from apache.

Someone somewhere knows how to get this done, i'm sure :)

Possibly a hack into the PHP module can get this done, i'm open to 
suggestions.

Tx,
Vinod.

On Tue, 21 May 2002 Bogdan Stancescu wrote :
>Hi!
>
>I'm looking for an answer to your questions as well, so if you do 
>find a solution on other lists, could you please post it here as 
>well?
>
>Regarding the issue, your proposal wouldn't make for full-duplex 
>as far as I understand since I don't see how the client would be 
>able to send any data on the same connection _after_ getting 
>connected.
>
>What are you using on the other end of the pipe (on the client)? 
>Plain HTML? Flash? Java? Something else?
>
>Bogdan
>
>Vinod Panicker wrote:
>
>>Hi,
>>
>>We have developed a client-server application where the server 
>>needs to send asynchronous data to the client.  Now since we are 
>>using Apache/PHP/MySQL, the client needs to poll the server 
>>periodically for information.
>>
>>I was thinking if there was some way to get around this basic 
>>problem.  I understand that this is how things are supposed to 
>>work, but it would be just great if i could PUSH data from the 
>>server to the client, using HTTP.
>>
>>Since HTTP is a request/response based protocol, Apache would 
>>not send any data to the client asynchronously.  So what i was 
>>thinking was - If i tell the server to allow Keep-Alive 
>>connections, and increase the timeout value and max requests, I 
>>would effectively have a constant TCP connection.  Now the only 
>>problem would be of sending asynchronous data to the client.  
>>Solution?  Here goes - If there was some way in which i could 
>>get hold of the file descriptor(socket) that is being used by 
>>apache to write data to the client, then i could, from a PHP 
>>script also send any data to the client using the socket 
>>functions of PHP since i already have the socket with me.
>>
>>This would mean that the client doesnt have to poll the server 
>>for data any more... and if the connection does get closed, the 
>>client could reconnect to the server asking for another 
>>keep-alive connection.
>>
>>Now I know that this is probably the wrong place to put such a 
>>query - maybe the apache list would have been better.  But since 
>>I'm using PHP out here, i thought i'd give it a try.
>>
>>Does the solution sound very outlandish?  Are there any 
>>pitfalls?  And finally, how do i get hold of the socket?
>>
>>Tx in advance,
>>Vinod.
>>_________________________________________________________
>>Click below to visit monsterindia.com and review jobs in India 
>>or Abroad
>>http://monsterindia.rediff.com/jobs
>>
>>
>
>
>

_________________________________________________________
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs

--- End Message ---
--- Begin Message ---
Dear Mirek,

This is how we use the handler for our XML class.
Hope it helps!

class XML
{
function parseXML()
        {
        
/****************************************************************
                Parse string XML data.
        
****************************************************************/
        $parser = xml_parser_create(); 
        xml_set_object($parser, &$this);
        xml_set_element_handler($parser, "start_element",
"stop_element");
        }

function start_element($parser, $name, $attrs) 
        { 
        /***************************************************************
                Handles opening tags
****************************************************************/
        }

function stop_element($parser, $name) 
        { 
        
/****************************************************************
                Handles closing of  tags!
        
****************************************************************/
        }
}

Best regards

Fredrik Davidsson
Alfaproject AB


-----Original Message-----
From: Mirek Novak [mailto:[EMAIL PROTECTED]] 
Sent: den 21 maj 2002 14:52
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [php-objects] XML parser vs objects

Hi,
   is it possible to use methods of a class as a handlers in
xml_set_element_handler(...)? How it can be done?
TIA,
   M.N.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Tied to your PC? Cut Loose and
Stay connected with Yahoo! Mobile
http://us.click.yahoo.com/QBCcSD/o1CEAA/sXBHAA/saFolB/TM
---------------------------------------------------------------------~->

Look here for Free PHP Classes of objects:
http://phpclasses.UpperDesign.com/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

 

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ 

--- End Message ---
--- Begin Message ---
Hello friends,

I use the following code, but it does not work. Is there something wrong?

If
(ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a
-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
$email_address))
){
  Print ("Sorry, the email address seems to be invalid.");
  exit;
  }

Please help.
Denis
----- Original Message -----
From: "Steve Buehler" <[EMAIL PROTECTED]>
To: "Kevin Stone" <[EMAIL PROTECTED]>
Cc: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, May 11, 2002 2:45 AM
Subject: Re: [PHP] eregi(mail)


> Either Google is wrong (probably) or they are now allowing things like
> spaces into an email address.  There are actually several things that are
> not allowed in a standard email address.  Here is the code that I use.
>
ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-
z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
> $subarray))
> I am honestly not sure where I got this code, but it has always worked for
> me and I have not found any YET that are good address that this kills.  I
> have also not found any bad ones YET that this lets through (unless the
> domain or user doesn't exist, of course).
>
> Steve
>
> At 01:26 PM 5/10/2002, you wrote:
> >I had always been suspicious about email validators so I did a big long
> >search on Google about standard address formats.  It turns out that aside
> >from the @ symbol emails have no standard format whatsoever.  So
ereg('@',
> >$email) is really the only functional email validator.
> >
> >You also have to think about what kind of email validation you need.  Do
you
> >really need to control the format of the emails being stored in your
> >database?  Or do you need to control the validity of the emails being
stored
> >in your database?  There is a big difference.  A valid email address
isn't
> >necessarily one that is formated in the way you expect.  It is one that
is
> >active and can be mailed to.  There are a number of techniques you can
use
> >to determine that.
> >
> >Well.. anyway sorry for going off on a tangent there.  In your search for
an
> >email validator you got a bit more information than you expected.  I hope
it
> >was useful in some tiny miniscule sort of way.  :)
> >
> >--
> >Kevin Stone
> >[EMAIL PROTECTED]
> >
> >
> >----- Original Message -----
> >From: "Analysis & Solutions" <[EMAIL PROTECTED]>
> >To: "PHP List" <[EMAIL PROTECTED]>
> >Sent: Friday, May 10, 2002 10:59 AM
> >Subject: Re: [PHP] eregi(mail)
> >
> >
> > > Hi Liam:
> > >
> > > On Fri, May 10, 2002 at 09:48:58AM -0700, Liam Gibbs wrote:
> > > > Does anyone have a decent eregi statement for
> > > > validating e-mail addresses?
> > >
> > > eregi('^[a-z0-9_.=+-]+@([a-z0-9-]+\.)+([a-z]{2,6})$', $Email);
> > >
> > > Enjoy,
> > >
> > > --Dan
> > >
> > > --
> > >                PHP classes that make web design easier
> > >         SQL Solution  |   Layout Solution   |  Form Solution
> > >     sqlsolution.info  | layoutsolution.info |  formsolution.info
> > >  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
> > >  4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
> > >
> > > --
> > > 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
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I need to store equations in a DB for later use.  For example,
something like the following might appear in one of the fields:

(( 2 * 3 ) + 7 ) / ( 8 / 4 )

So I want to eval() *only* equations.  However, there is nothing
stoping someone from entering in a valid PHP command that
accesses the file system.  While only a certain class of user
will be able to access the page that allows the input of this 
of this equation, there isn't anything to stop them from entering
malicious code.
So my question, aside from parsing the value of the field, is there
any way to run eval so that it won't run system commands?  So
that it will only run mathematical equations?  Has anyone already
come up with this kind of code?  Suggestions?  Ideas?

thnx,
Chris

--- End Message ---
--- Begin Message ---
You'll have to come up with a regular expression to check for bad
characters. How complex are the equations? If they are like your example,
you can just check that the equation doesn't have any letters and is only
made up of [0-9+*-/()] characters.

---John Holmes...

----- Original Message -----
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Tuesday, May 21, 2002 9:47 AM
Subject: [PHP] Secure eval();


> I need to store equations in a DB for later use.  For example,
> something like the following might appear in one of the fields:
>
> (( 2 * 3 ) + 7 ) / ( 8 / 4 )
>
> So I want to eval() *only* equations.  However, there is nothing
> stoping someone from entering in a valid PHP command that
> accesses the file system.  While only a certain class of user
> will be able to access the page that allows the input of this
> of this equation, there isn't anything to stop them from entering
> malicious code.
> So my question, aside from parsing the value of the field, is there
> any way to run eval so that it won't run system commands?  So
> that it will only run mathematical equations?  Has anyone already
> come up with this kind of code?  Suggestions?  Ideas?
>
> thnx,
> Chris
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
> You'll have to come up with a regular expression to check for bad
> characters. How complex are the equations? If they are like your example,
> you can just check that the equation doesn't have any letters and is only
> made up of [0-9+*-/()] characters.

It's pretty complex.  What I gave was a very simplistic example.  The numbers
are actually going to be table.fieldnames and the values in those fields are going
to be referenced to get the actual number used in the equation.  However, once
I interpolate the fieldnames to numbers I guess I could run the equation against
some sort of regex to make sure that it's valid.
hmmm....  Might be easier than I thought.

Thanks for the input!

Chris

--- End Message ---
--- Begin Message ---
Are you sure you have to run it through eval()? It sounds like you're
creating a query. Couldn't you just create the query dynamically, then put
it in a mysql_query() function? (or whatever DB you're using) Then, even if
they try some kung fu on you, it'll just result in a bad query, not some
rogue code being executed.

---John Holmes...

----- Original Message -----
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "1LT John W. Holmes" <[EMAIL PROTECTED]>; "PHP General"
<[EMAIL PROTECTED]>
Sent: Tuesday, May 21, 2002 10:17 AM
Subject: Re: [PHP] Secure eval();


> > You'll have to come up with a regular expression to check for bad
> > characters. How complex are the equations? If they are like your
example,
> > you can just check that the equation doesn't have any letters and is
only
> > made up of [0-9+*-/()] characters.
>
> It's pretty complex.  What I gave was a very simplistic example.  The
numbers
> are actually going to be table.fieldnames and the values in those fields
are going
> to be referenced to get the actual number used in the equation.  However,
once
> I interpolate the fieldnames to numbers I guess I could run the equation
against
> some sort of regex to make sure that it's valid.
> hmmm....  Might be easier than I thought.
>
> Thanks for the input!
>
> Chris
>

--- End Message ---
--- Begin Message ---
> Are you sure you have to run it through eval()? It sounds like you're
> creating a query. Couldn't you just create the query dynamically, then put
> it in a mysql_query() function? (or whatever DB you're using) Then, even if
> they try some kung fu on you, it'll just result in a bad query, not some
> rogue code being executed.

Try some kung fu?  Never heard it put like that before. :P

I am kind of creating a query.  The equation is going to look something like
this:

(({table1.field1} * {table2.field2}) + {table3.field3})

Then I'm going to get the values in those fields and parse the above as if they
were macros (which, in a sense, they are).  That could yield something like:

((8 * 5) + 3)

and it is that equation that I'm going to need to eval.  So I don't think I'll be able
to do this in a query.

Chris

--- End Message ---
--- Begin Message ---
Why don't you just do it all in your query??

SELECT (({table1.field1} * {table2.field2}) + {table3.field3}) FROM table1,
table2, table3 WHERE  ...

---John Holmes...

----- Original Message -----
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "1LT John W. Holmes" <[EMAIL PROTECTED]>; "PHP General"
<[EMAIL PROTECTED]>
Sent: Tuesday, May 21, 2002 10:53 AM
Subject: Re: [PHP] Secure eval();


> > Are you sure you have to run it through eval()? It sounds like you're
> > creating a query. Couldn't you just create the query dynamically, then
put
> > it in a mysql_query() function? (or whatever DB you're using) Then, even
if
> > they try some kung fu on you, it'll just result in a bad query, not some
> > rogue code being executed.
>
> Try some kung fu?  Never heard it put like that before. :P
>
> I am kind of creating a query.  The equation is going to look something
like
> this:
>
> (({table1.field1} * {table2.field2}) + {table3.field3})
>
> Then I'm going to get the values in those fields and parse the above as if
they
> were macros (which, in a sense, they are).  That could yield something
like:
>
> ((8 * 5) + 3)
>
> and it is that equation that I'm going to need to eval.  So I don't think
I'll be able
> to do this in a query.
>
> Chris
>

--- End Message ---
--- Begin Message ---
What do I set cgi_redirect var in the php.ini if I install php 4.2.1 under
win2k/iis5.

Ryan Conover
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.pitt.edu/~rscst25/


--- End Message ---
--- Begin Message ---
I was wondering if anyone uses php to call enterprise javabeans?

I wrote a java class that is accessed by some php code.  This java class
calls an EJB and gets a custom object returned to the java class called
report.  When I returned the custom object to php to reference, everything I
try to ouput in the object gets outputed as "Object".

Tried this way
$Client = new Java("Custom.Client");
$Report=$Client->getTheReport(String str);
 echo($Report->Jobs[0]->getjobnum());

And this way 
$Client = new Java("Custom.Client");
$Client->getTheReport(String str);
 echo($Client->thereport->Jobs[0]->getjobnum());


Any help or links to anyone that tried this would be useful.


Ryan Conover
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.pitt.edu/~rscst25/


--- End Message ---
--- Begin Message ---
i run a install.php, the server says the following statement,
Warning: Undefined index: install in d:\wwwroot\program_files\install.php on
line 14

the strange things is when i install the php program, it does not have
outputted this warning, but this warning occurs when i put all the files to
a remote server

the install.php source is as follows:
<?php

// include config, functions, common and header
include ("./include/config.php");
include ("./include/functions.php");
include ("./include/common.php");
include ("./include/header_admin.php");

// variables:
// GET
// POST
// $install from install.php (set to 1 when user click on install)

$install = $HTTP_POST_VARS["install"];

if ($table_name != "" and $table_internal_name != "") {
 if ($install == "1") {

  $unique_field_name = get_unique_field($conn, $db_name, $table_name);

  // get the array containing the names of the fields
  $fields_names_ar = build_fields_names_array($conn, $db_name, $table_name);

  // drop (if present) the old internal table and create the new one.
  create_internal_table($conn, $table_internal_name);

  echo "<p>Internal table <b>$table_internal_name</b> correctly
created......";

  for ($i=0; $i<count($fields_names_ar); $i++){
   // insert a new record in the internal table with the name of the field
as name and label
   $sql = "insert into $table_internal_name (name_field, label_field,
order_form_field) values ('$fields_names_ar[$i]', '$fields_names_ar[$i]',
'".($i+1)."')";

   $res_insert = execute_db("$sql", $conn);
  } // end for
  echo "<p>......The system is correctly installed!!";
  echo "<p>You can now manage your table <b>$table_name</b>, starting from
<a href=\"index.php\">index.php</a>";
  echo "<p>In order to customize the internal db you have to use the <a
href=\"admin.php\">administration page</a>.";

  if ($unique_field_name == ""){
   echo "<p>Your table <b>$table_name</b> hasn't any primary keys set, if
you don't set a primary key  won't show the edit/delete/details buttons.";
  } // end if
 } // end if ($install == "1")
 else{
  echo "<form name=\"install_form\" action=\"install.php\"
method=\"post\">";
  echo "<input type=\"hidden\" name=\"install\" value=\"1\">";
  echo "<input type=\"submit\" value=\"Click this button to install\">";
  echo "</form>";
 } // end else
} // end if ($table_name != "" and $table_internal_name != "")
else{
 echo "<p>Please specify table_name and table_internal_name in config.php";
} // end else

// include footer
include ("./include/footer_admin.php");
?>


--- End Message ---
--- Begin Message ---
Erich:

On Tue, May 21, 2002 at 10:22:10PM +0800, erich wrote:
> Warning: Undefined index: install in d:\wwwroot\program_files\install.php
> on line 14

Undefined index means that the index you requested from an array doesn't 
exist.


> <?php
> 
> $install = $HTTP_POST_VARS["install"];

That's line 14.  So, "install" isn't set, but you're using it as if it 
was.


> the strange things is when i install the php program, it does not have
> outputted this warning, but this warning occurs when i put all the files
> to a remote server

You have different error reporting levels on the different servers.

One option to solve the problem is change error reporting.  The more
preferable thing to do is this:

   if ( empty($_POST['install']) ) {
      $install = '';
   } else {
      $install = $_POST['install'];
   }

Enjoy,

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
--- End Message ---

Reply via email to