[PHP] I need answers for the questions

2003-11-18 Thread Arivazhagi Govindarajan
   PHP Questions

1. Explain about session management and cookies ? In PHP how we can maintain 
a session

2. What is HTTP tunneling

3. How to enable PHP in Apache server manually?

4. When we upload a file using  tag of the type FILE what are global 
variables become available for use in PHP

5. Explain SQL injections ? How we can avoid this

6. Write a small script to connect a MYSQL server in PHP

7. Given a class B network with subnet mask of 255.255.248.0 and a packet 
addressed to 130.40.32.16 whatis subnet address

8. Using single Apache server can we host multiple sites . If yes how can we 
do this if no why it is not possible

9. what is search engine optimization ? In HTML using which tag we can 
attain this?

10. Write a function in PHP script to check whether string is a valid email 
id or not?

_
Garfield on your mobile. Download now. http://server1.msn.co.in/sp03/gprs/ 
How cool can life get?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] E-mail Gateway

2003-11-18 Thread Jason Williard
I am in the beginning phases of developing a support system.  I would
like the program to be able to receiving and process e-mails.  However,
I am at a loss as to where to start.

The main roadblock, at this point, is how to best receive and process
the e-mail.  I have looked at 2 options.

1) Use a cron job to execute a php script every x minutes.
2) Create a script where mail can be piped to.  This is a method that I
have used previously with a cgi app called PerlDesk.

While I could develop the first option, the second option is the method
of choice, but I have no clue how to implement that.  Would anyone
happen to have any suggestions on where to start?  Perhaps, someplace
where I could go for further research?

Thank You,
Jason Williard

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ereg_replace help

2003-11-18 Thread Eugene Lee
On Tue, Nov 18, 2003 at 04:37:52PM +1100, Martin Towell wrote:
: 
: I have an array of strings in the following format:
:   "abcd - rst"
:   "abcd - uvw"
:   "abcd - xyz"
:   "foobar - rst"
:   "blah - rst"
:   "googol - uvw"
: 
: What I want to do is strip everything from the " - " bit of the string to
: the end, _but_ only for the strings that don't start with "abcd"
: 
: I was thinking something like the following:
:   echo ereg_replace("(!abcd) - xyz", "\\1", $str)."\n";
: but obviously this doesn't work, otherwise I wouldn't be emailing the
: list...

You can't use "!" because it's not a valid special character in regular
expressions.  It's really hard to craft do-not-match-this-word patterns.
You're better off separating the two pieces of logic.

$arr = array(
"abcd - rst",
"abcd - uvw",
"abcd - xyz",
"foobar - rst",
"blah - rst",
"googol - uvw"
);

reset($arr);
while (list($key, $value) = each($arr))
{
if (substr($value, 0, 5) != 'abcd ')
{
$arr[$key] = ereg_replace('^(.*) - .*$', '\1', $value);
}
}

print_r($arr);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I need answers for the questions

2003-11-18 Thread Henrik Hudson
On Tuesday 18 November 2003 01:12,
"Arivazhagi Govindarajan" <[EMAIL PROTECTED]> sent a missive stating:

> PHP Questions
>
> 1. Explain about session management and cookies ? In PHP how we can
> maintain a session

http://us3.php.net/session

> 3. How to enable PHP in Apache server manually?

http://us3.php.net/manual/en/installation.php


> 4. When we upload a file using  tag of the type FILE what are global
> variables become available for use in PHP

http://us2.php.net/features.file-upload

> 5. Explain SQL injections ? How we can avoid this

See various web docs. Try Google or PHP site. PLenty of info.

> 6. Write a small script to connect a MYSQL server in PHP

http://us2.php.net/function.mysql-connect

> 8. Using single Apache server can we host multiple sites . If yes how can
> we do this if no why it is not possible

Yes. 
http://httpd.apache.org/docs/   or   http://httpd.apache.org/docs-2.0/


> 10. Write a function in PHP script to check whether string is a valid email
> id or not?

Lookup email and regular expression checking. About 10 examples are here as 
well:
http://us2.php.net/ereg



Henrik
-- 
Henrik Hudson
[EMAIL PROTECTED]

"`If there's anything more important than my ego
around, I want it caught and shot now.'" 
--Hitchhikers Guide to the Galaxy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] E-mail Gateway

2003-11-18 Thread Henrik Hudson
On Tuesday 18 November 2003 01:21,
"Jason Williard" <[EMAIL PROTECTED]> sent a missive stating:

> 1) Use a cron job to execute a php script every x minutes.
> 2) Create a script where mail can be piped to.  This is a method that I
> have used previously with a cgi app called PerlDesk.
>
> While I could develop the first option, the second option is the method
> of choice, but I have no clue how to implement that.  Would anyone
> happen to have any suggestions on where to start?  Perhaps, someplace
> where I could go for further research?

Although you could use CLI PHP for this, I would use Perl or even better, C. 
PHP is really meant to run via a web browser and what you're talking about is 
all backend code. Look into playing with procmail and Perl or C.


Henrik
-- 
Henrik Hudson
[EMAIL PROTECTED]

"`If there's anything more important than my ego
around, I want it caught and shot now.'" 
--Hitchhikers Guide to the Galaxy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ereg_replace help

2003-11-18 Thread Jason Wong
On Tuesday 18 November 2003 13:37, Martin Towell wrote:

> I have an array of strings in the following format:
>   "abcd - rst"
>   "abcd - uvw"
>   "abcd - xyz"
>   "foobar - rst"
>   "blah - rst"
>   "googol - uvw"
>
> What I want to do is strip everything from the " - " bit of the string to
> the end, _but_ only for the strings that don't start with "abcd"
>
> I was thinking something like the following:
>   echo ereg_replace("(!abcd) - xyz", "\\1", $str)."\n";
> but obviously this doesn't work, otherwise I wouldn't be emailing the
> list...
>
> Can anyone help? I need to use ereg_replace() because it's part of our code
> library and therefore can't change :(

May be quicker (definitely easier) to explode() on ' - '.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The giraffe you thought you offended last week is willing to be nuzzled today.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ereg_replace help

2003-11-18 Thread Henrik Hudson
On Monday 17 November 2003 23:37,
Martin Towell <[EMAIL PROTECTED]> sent a missive stating:

> Hi All,
>
> I have an array of strings in the following format:
>   "abcd - rst"
>   "abcd - uvw"
>   "abcd - xyz"
>   "foobar - rst"
>   "blah - rst"
>   "googol - uvw"
>
> What I want to do is strip everything from the " - " bit of the string to
> the end, _but_ only for the strings that don't start with "abcd"
>
> I was thinking something like the following:
>   echo ereg_replace("(!abcd) - xyz", "\\1", $str)."\n";
> but obviously this doesn't work, otherwise I wouldn't be emailing the
> list...
>
> Can anyone help? I need to use ereg_replace() because it's part of our code
> library and therefore can't change :(
>
> TIA
> Martin

Possibly have to do a if statement, ereg for the abcd and then if ture, do 
your ereg replace? I can't logically think how that would work in one regex, 
since you want to match first and then replace...but my regex skills aren't 
top notch either :)

Henrik
-- 
Henrik Hudson
[EMAIL PROTECTED]

"`If there's anything more important than my ego
around, I want it caught and shot now.'" 
--Hitchhikers Guide to the Galaxy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] E-mail Gateway

2003-11-18 Thread Jason Wong
On Tuesday 18 November 2003 15:21, Jason Williard wrote:
> I am in the beginning phases of developing a support system.  I would
> like the program to be able to receiving and process e-mails.  However,
> I am at a loss as to where to start.

[snip]

> 2) Create a script where mail can be piped to.  This is a method that I
> have used previously with a cgi app called PerlDesk.
>
> While I could develop the first option, the second option is the method
> of choice, but I have no clue how to implement that.  Would anyone
> happen to have any suggestions on where to start?  Perhaps, someplace
> where I could go for further research?

As usual, if you can think of a question, chances are it has already been 
asked and answered before. So your first port of call is either google or the 
list archives. "php process mail" would be an obviously good search term.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Money cannot buy love, nor even friendship.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Search For File

2003-11-18 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hello,

I am trying to write a simple application using PHP on a Windows 2000
server.  There is one text box for input and one search button.  Basically
the user would input a file name (for example "help.pdf") and then the php
script would search a directory (for example "c:\help\") and subfolders
for that file.  If the file is found, I would like to automatically
display the file using Adobe Acrobat.  Ideally I would like to be able to
use wildcards and obtain a list of results linking to the files.  Any
ideas on a good way to do this?  I am mainly interested in how the search
should work.

Thanks

Jamie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] E-mail Gateway

2003-11-18 Thread Robert Cummings
On Tue, 2003-11-18 at 02:19, Henrik Hudson wrote:
> On Tuesday 18 November 2003 01:21,
> "Jason Williard" <[EMAIL PROTECTED]> sent a missive stating:
> 
> > 1) Use a cron job to execute a php script every x minutes.
> > 2) Create a script where mail can be piped to.  This is a method that I
> > have used previously with a cgi app called PerlDesk.
> >
> > While I could develop the first option, the second option is the method
> > of choice, but I have no clue how to implement that.  Would anyone
> > happen to have any suggestions on where to start?  Perhaps, someplace
> > where I could go for further research?
> 
> Although you could use CLI PHP for this, I would use Perl or even better, C. 
> PHP is really meant to run via a web browser and what you're talking about is 
> all backend code. Look into playing with procmail and Perl or C.

Ummm, I've been using PHP for shell based scripts for years now. Are you
telling me all the re-usable power of my InterJinn web scripts is
foolish and that I should recode them as Perl or C? Eeeek, I though the
whole point of CLI was to empower non-web application programming with
PHP.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ereg_replace help

2003-11-18 Thread Robert Cummings
On Tue, 2003-11-18 at 02:30, Jason Wong wrote:
> On Tuesday 18 November 2003 13:37, Martin Towell wrote:
> 
> > I have an array of strings in the following format:
> > "abcd - rst"
> > "abcd - uvw"
> > "abcd - xyz"
> > "foobar - rst"
> > "blah - rst"
> > "googol - uvw"
> >
> > What I want to do is strip everything from the " - " bit of the string to
> > the end, _but_ only for the strings that don't start with "abcd"
> >
> > I was thinking something like the following:
> > echo ereg_replace("(!abcd) - xyz", "\\1", $str)."\n";
> > but obviously this doesn't work, otherwise I wouldn't be emailing the
> > list...
> >
> > Can anyone help? I need to use ereg_replace() because it's part of our code
> > library and therefore can't change :(
> 
> May be quicker (definitely easier) to explode() on ' - '.

The following is untested:

---

foreach( $myArray as $id => $entry )
{
if( ($pos = strpos( 'abcd' ) !== false && $pos === 0 )
{
$parts = explode( ' - ', $entry );
$myArray[$id] = $parts[0];
}
}

print_r( $myArray );

---

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: E-mail Gateway

2003-11-18 Thread Brian M McGarvie
> 2) Create a script where mail can be piped to.  This is a method that I
> have used previously with a cgi app called PerlDesk.

In answer to Point 2...

If you are in a position to edit your 'aliases file' you can feed email to a
program using PHP quite easily. I am doing it and works quite well.

So, 1st, edit your file (generally in /etc/mail/aliases) and add the line:

testit: "|/usr/local/bin/php /path/to/your/php/file/processmail.php"

(making sure this is the path to php etc)

Below is an example how to capture the mail, the following simply reads the
email into $buffer and emails it, this should hopefully point yu in the
right direction...



- Brian M McGarvie - IT Manager (e-loanshop.com).
- www.devdojo.com (Developer Community)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Search For File

2003-11-18 Thread Burhan Khalid
PHPDiscuss - PHP Newsgroups and mailing lists wrote:
Hello,

I am trying to write a simple application using PHP on a Windows 2000
server.  There is one text box for input and one search button.  Basically
the user would input a file name (for example "help.pdf") and then the php
script would search a directory (for example "c:\help\") and subfolders
for that file.  If the file is found, I would like to automatically
display the file using Adobe Acrobat.  Ideally I would like to be able to
use wildcards and obtain a list of results linking to the files.  Any
ideas on a good way to do this?  I am mainly interested in how the search
should work.
You could use the filesystem functions and read the directory's contents 
into an array and search that array for your file. Look up 
http://www.php.net/filesystem

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
"Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] About iMail Help

2003-11-18 Thread Derek Ford
D. Jame wrote:

Hi,

Anyone know about imail.?



 

could you be any more vague?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [Q] Development Best Practices

2003-11-18 Thread Chris Hayes
At 04:20 18-11-03, you wrote:
Adam wrote:

My question, how do you guys build your pages? Do your scripts generate 
all the HTML? I'm looking for tips and resources. Remember for my first 
site I've embarked on a fairly large site. Code maintenance will be an 
issue for me as I need to enhance and fix it later on.
My mistake in coding is that I always start with the parts I know I can do, 
then slowly add the other functionality. I would call this an organic way 
of coding, and the more additions I make, the more little changes i need to 
make to the existing code until it is full of extra conditions. This is 
partly because my chef keeps inventing new functionality, but mostly 
because I did not know how to write a proper plan (i did try).
I tried my own way, i tried Unified Modeling Language (UML) , but that was 
a bit too heavy for a one-person coding project.

Right now I am rigourously reorganising the whole mess, which would not 
have been necessary had I made better plan.
The most simple rule is: divide functionality. Do not mix logic with 
presentation. Have your SQL part, your logic part and your presentation part.
And of course add loads of comment while you are working. Best for the 
thinking process is to first make comments of the steps you want to make, 
and only then add the code. I noticed that while writing the comments, I 
would adjust my plans.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] diff

2003-11-18 Thread Decapode Azur
hello

Is there a php function close to the *nix diff comand?
(in order to compare 2 multi-lines strings)

thanx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] .html extension PHP page be interpret

2003-11-18 Thread BennyYim
I using WinXP + Apache 1.3.24 + PHP 4.3.3
 
My apache default will interpret .php extension file. (e.g.
index.php)

If I have a PHP page, but I want to use .html file extension (e.g. index.html).
what I need to set to make those html extension page be interpret by server.

I want those .html extension PHP page be interpret.

Thank You !


.---.
| Message Posted by NewsgroupXplorer|
| http://www.newsgroupxplorer.com   |
|   |
| Your newsreader in your browser.  |
`---'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] .html extension PHP page be interpret

2003-11-18 Thread Nathan Taylor
That's simple, just modify your Apache httpd.conf on the line where it says something 
along the lines of:

AddType application/x-httpd-php .php4 .php .php3 .inc

change it to:

AddType application/x-httpd-php .php4 .php .html .php3 .inc
  - Original Message - 
  From: BennyYim 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, November 18, 2003 5:46 AM
  Subject: [PHP] .html extension PHP page be interpret


  I using WinXP + Apache 1.3.24 + PHP 4.3.3
   
  My apache default will interpret .php extension file. (e.g.
  index.php)

  If I have a PHP page, but I want to use .html file extension (e.g. index.html).
  what I need to set to make those html extension page be interpret by server.

  I want those .html extension PHP page be interpret.

  Thank You !


  .---.
  | Message Posted by NewsgroupXplorer|
  | http://www.newsgroupxplorer.com   |
  |   |
  | Your newsreader in your browser.  |
  `---'

  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: I need answers for the questions

2003-11-18 Thread rush
"Arivazhagi Govindarajan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> PHP Questions

This would not be homework or exam questions, right?

rush
--
http://www.templatetamer.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] .html extension PHP page be interpret

2003-11-18 Thread Eugene Lee
On Tue, Nov 18, 2003 at 10:46:48AM -, BennyYim wrote:
: 
: I using WinXP + Apache 1.3.24 + PHP 4.3.3
:  
: My apache default will interpret .php extension file. (e.g.
: index.php)
: 
: If I have a PHP page, but I want to use .html file extension (e.g. index.html).
: what I need to set to make those html extension page be interpret by server.
: 
: I want those .html extension PHP page be interpret.

Look for the following line in your Apache configuration file and change
it thusly:

AddType application/x-httpd-php .php .html

See the online docs for more specifics:

http://www.php.net/manual/en/install.apache.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] rmdir withour rmdir function.

2003-11-18 Thread Marek Kilimajer
Vincent M. wrote:
I'm not lucky, there is no ftp access to the server. This can sound a 
little strange, but there is no... :(

Either talk to your host to change their policy or change the host. I 
don't see any reason why rmdir should be disabled.

Or you can use smtp mail class to send mail to [EMAIL PROTECTED] saying 
"Please, remove this directory" ;)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] .html extension PHP page be interpret

2003-11-18 Thread Wouter van Vliet

> -Oorspronkelijk bericht-
> That's simple, just modify your Apache httpd.conf on the line
> where it says something along the lines of:
>
> AddType application/x-httpd-php .php4 .php .php3 .inc
>
> change it to:
>
> AddType application/x-httpd-php .php4 .php .html .php3 .inc

And please, PLEASE remove ".inc" from the list, and add smth like


Deny from all


I'm not sure about the syntax, but believe me .. what I am telling you is
what you want :D:D

Wouter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't fetch HTTP POST data in PHP?

2003-11-18 Thread Arne Rusek
On Mon, 17 Nov 2003 15:30:43 +, Curt Zirzow wrote:

> * Thus wrote Arne Rusek ([EMAIL PROTECTED]):

> Your problem exists here:
> 
> Server API => Command Line Interface
> _ENV["SERVER_SOFTWARE"] => Boa/0.94.13
> 
> Seeing this tells me your webserver is not configured correctly,
> Boa should not be using the CLI version of php it should be using
> the CGI version.

Thank you, that was it. Boa can't run php directly. So i made php files
executable and added '#!/usr/bin/php4' at the beginning of the script.
Instead of that I should have used the cgi version, as you suggested,
which was /usr/lib/cgi-bin/php4.

Take care.

Arne Rusek

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] easy and simple way to read xml into array

2003-11-18 Thread Victor Spång Arthursson
2003-11-17 kl. 17.06 skrev Chris Hayes:

Need to read a xml-file into an array, but searching around I havent 
found a way that's easy and simple… Arent there an easy way in PHP to 
accomplish this?
have you been at http://se.php.net/xml ?
Well, I've, and I also have to say that the XML-support in PHP lacks 
any usability…

2 pages code later I still cannot get it to work, and the manual is 
pretty thin on this chapter...

For example, I've the following XML:

		
			1234
			3,4
			kg
		

Here I thought that the startelementfunction should be called upon 
every start tag, the character_data_handler on every text string and 
the endelement function on every endelement.

But what seems to happen is that the character data handler is called 
to randomly number of times, and if I output the current element every 
time it gets called I get the following output for the xml above:

ingrediens
ingrediens
ingrediens
ingrediensnummer
ingrediensnummer
ingrediensnummer
ingrediensnummer
maengde
maengde
maengde
maengde
enhed
enhed
enhed
enhed
enhed
enhed
What I expected to get was:

ingrediensnummer
maengde
enhed
So, couldnt anyone please bring some clarity into this matter?

Sincerely

Victor
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] sorting an array of regexes

2003-11-18 Thread Adam i Agnieszka Gasiorowski FNORD

There is an array of regexes, for example

 $array = array('moon', '[wh]ood', '[^as]eed' ...
 (about 300 entries). 

I want to sort it comparing to the
 character lenght of a regex. For example
 [wh]ood is 4 characters, moon is 4 characters.
 There are only letters of the alphabet and
 letter ranges present in those regexes. I
 want the "longest" ones first.

How would you write the sorting function?

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] diff

2003-11-18 Thread Jay Blanchard
[snip]
Is there a php function close to the *nix diff comand?
(in order to compare 2 multi-lines strings)
[/snip]

http://us2.php.net/manual/en/function.strcmp.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] .html extension PHP page be interpret

2003-11-18 Thread Jay Blanchard
[snip]
I using WinXP + Apache 1.3.24 + PHP 4.3.3
 
My apache default will interpret .php extension file. (e.g.
index.php)

If I have a PHP page, but I want to use .html file extension (e.g.
index.html).
what I need to set to make those html extension page be interpret by
server.

I want those .html extension PHP page be interpret.
[/snip]

Answered once in the last 24 hoursadd the following line to your
httpd.conf and then restart Apache

AddType application/x-httpd-php .php .html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sorting an array of regexes

2003-11-18 Thread Eugene Lee
On Tue, Nov 18, 2003 at 01:15:32PM +0100, Adam i Agnieszka Gasiorowski FNORD wrote:
: 
:   There is an array of regexes, for example
: 
:  $array = array('moon', '[wh]ood', '[^as]eed' ...
:  (about 300 entries). 
: 
:   I want to sort it comparing to the
:  character lenght of a regex. For example
:  [wh]ood is 4 characters, moon is 4 characters.
:  There are only letters of the alphabet and
:  letter ranges present in those regexes. I
:  want the "longest" ones first.
: 
:   How would you write the sorting function?

This might be the most functionally correct, although it's definitely
not the fastest route.

function re_len($pat)
{
return strlen(preg_replace('/\[[^]]+]/', '_', $pat));
}

function re_sort($a_pat, $b_pat)
{
$a = re_len($a_pat);
$b = re_len($b_pat);
if ($a == $b)
{
return 0;
}
return ($a < $b ) ? -1 : 1;
}

usort($array, 're_sort');

BTW, re_len() will bomb on certain oddball patterns with strange ranges.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sorting an array of regexes

2003-11-18 Thread Wouter van Vliet
> -Oorspronkelijk bericht-
> Van: Eugene Lee [mailto:[EMAIL PROTECTED]
> On Tue, Nov 18, 2003 at 01:15:32PM +0100, Adam i Agnieszka
> Gasiorowski FNORD wrote:
> :
> : There is an array of regexes, for example
> :
> :  $array = array('moon', '[wh]ood', '[^as]eed' ...
> :  (about 300 entries).
> :
> : I want to sort it comparing to the
> :  character lenght of a regex. For example
> :  [wh]ood is 4 characters, moon is 4 characters.
> :  There are only letters of the alphabet and
> :  letter ranges present in those regexes. I
> :  want the "longest" ones first.
> :
> : How would you write the sorting function?
>
> This might be the most functionally correct, although it's definitely
> not the fastest route.
>
>   function re_len($pat)
>   {
>   return strlen(preg_replace('/\[[^]]+]/', '_', $pat));

I think you meant:

/\[[^\]]+]/

as regex ;) Not sure, but I think one more block-bracked needed to be
escaped ;)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to get the key of a specific index of array?

2003-11-18 Thread PhiSYS
How to get the key of a specific index of array?

It seems that key($_POST[$i]) is a wrong syntax.

I've worked around like this:

  $allkeys = array_keys($_POST);
  $allvalues = array_values($_POST);

  for($I=3; $I < count($_POST); $I++) {
echo $allkeys[$I];
echo $allvalues[$I];
  }

But I think that it will use the double of memory. And that won't be good 
for long arrays.
So the cuestion is... Is there a PHP function to do this?
I successfully did it with ASP using Request.Form.Key(I) but I really do 
prefer PHP when I'm free to choose the language.

Or how can I move the internal array pointer to a specified position to 
be able to use the key() function?

As you probably noticed I started the $I counter at 3 because the first 3 
values of the array will be used for other purposes. That's why I don't 
want to use a foreach().

Thank you all!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: confirm unsubscribe from php-general@lists.php.net

2003-11-18 Thread Hidekazu Nakamura
On 18 Nov 2003 13:17:01 -
[EMAIL PROTECTED] wrote:

> Hi! This is the ezmlm program. I'm managing the
> [EMAIL PROTECTED] mailing list.
> 
> I'm working for my owner, who can be reached
> at [EMAIL PROTECTED]
> 
> To confirm that you would like
> 
>[EMAIL PROTECTED]
> 
> removed from the php-general mailing list, please send an empty reply 
> to this address:
> 
>[EMAIL PROTECTED]
> 
> Usually, this happens when you just hit the "reply" button.
> If this does not work, simply copy the address and paste it into
> the "To:" field of a new message.
> 
> or click here:
>   mailto:[EMAIL PROTECTED]
> 
> PLEASE NOTE: I haven't checked whether your address is currently
> on the mailing list.  To see what address you used to subscribe,
> look at the messages you are receiving from the mailing list. Each
> message has your address hidden inside its return path; for
> example, [EMAIL PROTECTED] receives messages with return path:
> [EMAIL PROTECTED]
> 
> Some mail programs are broken and cannot handle long addresses. If you
> cannot reply to this request, instead send a message to
> <[EMAIL PROTECTED]> and put the entire address listed above
> into the "Subject:" line.
> 
> 
> --- Administrative commands for the php-general list ---
> 
> I can handle administrative requests automatically. Please
> do not send them to the list address! Instead, send
> your message to the correct command address:
> 
> For help and a description of available commands, send a message to:
><[EMAIL PROTECTED]>
> 
> To subscribe to the list, send a message to:
><[EMAIL PROTECTED]>
> 
> To remove your address from the list, just send a message to
> the address in the ``List-Unsubscribe'' header of any list
> message. If you haven't changed addresses since subscribing,
> you can also send a message to:
><[EMAIL PROTECTED]>
> 
> or for the digest to:
><[EMAIL PROTECTED]>
> 
> For addition or removal of addresses, I'll send a confirmation
> message to that address. When you receive it, simply reply to it
> to complete the transaction.
> 
> If you need to get in touch with the human owner of this list,
> please send a message to:
> 
> <[EMAIL PROTECTED]>
> 
> Please include a FORWARDED list message with ALL HEADERS intact
> to make it easier to help you.
> 
> --- Enclosed is a copy of the request I received.
> 
> Return-Path: <[EMAIL PROTECTED]>
> Received: (qmail 78221 invoked by uid 1010); 18 Nov 2003 13:17:01 -
> Delivered-To: [EMAIL PROTECTED]
> Delivered-To: [EMAIL PROTECTED]
> Received: (qmail 78091 invoked from network); 18 Nov 2003 13:17:00 -
> Received: from unknown (HELO rn2.php.net) (67.72.78.18)
>   by pb1.pair.com with SMTP; 18 Nov 2003 13:17:00 -
> Received: (qmail 6616 invoked by uid 522); 18 Nov 2003 13:14:57 -
> Date: 18 Nov 2003 13:14:57 -
> Message-ID: <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: PHP Mailing List Website Subscription
> From: [EMAIL PROTECTED]
> 
> 
> This was a request generated from the form at http://jp.php.net/mailing-lists.php by 
> 219.5.245.182.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to get the key of a specific index of array?

2003-11-18 Thread Marek Kilimajer
PhiSYS wrote:
How to get the key of a specific index of array?

It seems that key($_POST[$i]) is a wrong syntax.
$i is the key, key is the index.

I think you are overcomplicating it. Tell us what you want to achieve 
and someone might come out with a better solution.

Marek

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] How to get the key of a specific index of array?

2003-11-18 Thread Jay Blanchard
[snip]
How to get the key of a specific index of array?
[/snip]

http://us2.php.net/manual/en/function.array-keys.php

That manualamazing, no?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] How to get the key of a specific index of array?

2003-11-18 Thread Wouter van Vliet
> -Oorspronkelijk bericht-
> Van: PhiSYS [mailto:[EMAIL PROTECTED]
>
> How to get the key of a specific index of array?
>
> It seems that key($_POST[$i]) is a wrong syntax.
>
> I've worked around like this:
>
>   $allkeys = array_keys($_POST);
>   $allvalues = array_values($_POST);
>
>   for($I=3; $I < count($_POST); $I++) {
> echo $allkeys[$I];
> echo $allvalues[$I];
>   }
>

First of all, you said to use the first three values of the array for anoter
reason .. well the, what I'd do is this:

$FirstThree = array_splice($_POST, 0, 3);

Which will give you the first three elements of the array, and leave you
with a $_POST array you can do foreach with.

Second, to manually loop through an array, use:
http://nl.php.net/manual/en/function.prev.php
http://nl.php.net/manual/en/function.next.php
http://nl.php.net/manual/en/function.current.php
http://nl.php.net/manual/en/function.reset.php
http://nl.php.net/manual/en/function.end.php

Third, don't rely on the order your array elements are given to you by post
data. Rather just use foreach() and (ignore|do something else with) the
key-value pairs you don't want for this thing.

Fourth, I hope I'm not spoiling Jay Blanchard statement on how uncredibly
great this online PHP Manual is since you could probably find all the
answers to array related questions right here:
http://nl.php.net/manual/en/ref.array.php

And all you other answers around here:
http://nl.php.net/docs.php
and here
http://www.google.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I need answers for the questions

2003-11-18 Thread John Nichel
Arivazhagi Govindarajan wrote:
   PHP Questions

1. Explain about session management and cookies ? In PHP how we can 
maintain a session

2. What is HTTP tunneling

3. How to enable PHP in Apache server manually?

4. When we upload a file using  tag of the type FILE what are 
global variables become available for use in PHP

5. Explain SQL injections ? How we can avoid this

6. Write a small script to connect a MYSQL server in PHP

7. Given a class B network with subnet mask of 255.255.248.0 and a 
packet addressed to 130.40.32.16 whatis subnet address

8. Using single Apache server can we host multiple sites . If yes how 
can we do this if no why it is not possible

9. what is search engine optimization ? In HTML using which tag we can 
attain this?

10. Write a function in PHP script to check whether string is a valid 
email id or not?
Anything else?  Do you need your car washed too?

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] [Q] Development Best Practices

2003-11-18 Thread Luis Lebron
Before considering using templates you may want to take a look at 

http://www.phppatterns.com/index.php/article/articleview/4/1/1/


Luis


-Original Message-
From: Adam [mailto:[EMAIL PROTECTED]
Sent: Monday, November 17, 2003 7:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] [Q] Development Best Practices


All,

I'm not new to programing or web development but I am new to creating 
dynamic pages.

I've read through a couple books. I've worked through problems and 
exercises. Installed and configured the software a few different times 
in Win32 and OS X. At this point, I feel I have a good handle on the 
environment and lexical structure. What I don't have is a grasp on best 
practices. For real sites I'm a little confused on how to implement all 
this new knowledge. For example, I've got a site that was static with 
bits of CGI to PHP. I was going to generate all the HTML from a PHP 
script, but that turned into a mess. So I tried creating the pages is 
mostly HTML with little bits of PHP. Placing the logic in another file 
and linking the two pages. I'm not really sure if that is the best 
approach.

My question, how do you guys build your pages? Do your scripts generate 
all the HTML? I'm looking for tips and resources. Remember for my first 
site I've embarked on a fairly large site. Code maintenance will be an 
issue for me as I need to enhance and fix it later on.

Thanks guys!

Regards,
Adam

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [Q] Development Best Practices

2003-11-18 Thread pete M
definately take a look at smarty.php.net

Might take a day or so to get used to the concept bit it makes maintaing 
and creating large sites (and small) a doddle.

Main thing is that it seperated php code from html

can't imagine not using it on any site anymore..

pete

Adam wrote:

All,

I'm not new to programing or web development but I am new to creating 
dynamic pages.

I've read through a couple books. I've worked through problems and 
exercises. Installed and configured the software a few different times 
in Win32 and OS X. At this point, I feel I have a good handle on the 
environment and lexical structure. What I don't have is a grasp on best 
practices. For real sites I'm a little confused on how to implement all 
this new knowledge. For example, I've got a site that was static with 
bits of CGI to PHP. I was going to generate all the HTML from a PHP 
script, but that turned into a mess. So I tried creating the pages is 
mostly HTML with little bits of PHP. Placing the logic in another file 
and linking the two pages. I'm not really sure if that is the best 
approach.

My question, how do you guys build your pages? Do your scripts generate 
all the HTML? I'm looking for tips and resources. Remember for my first 
site I've embarked on a fairly large site. Code maintenance will be an 
issue for me as I need to enhance and fix it later on.

Thanks guys!

Regards,
Adam
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] I need answers for the questions

2003-11-18 Thread Wouter van Vliet
> -Oorspronkelijk bericht-
> Van: John Nichel [mailto:[EMAIL PROTECTED]
>
> Arivazhagi Govindarajan wrote:
> >PHP Questions
> >
> > 1. Explain about session management and cookies ? In PHP how we can
> > maintain a session

While writing PHP code you put your body in risk of getting "work related
problems". Manage your PHP Code Writing sessions so that you do not spend
too much time behind your screen. Read about PHP in a book too sometimes, or
print several pages of the online PHP reference manual.

> >
> > 2. What is HTTP tunneling
HTTP is a new brand of car. Drive one through a tunnel and you are "HTTP
Tunneling"

> >
> > 3. How to enable PHP in Apache server manually?
Ramble your server box several times.

> >
> > 4. When we upload a file using  tag of the type FILE what are
> > global variables become available for use in PHP
None, since any self respecting PHP Scripter has "register_globals" set to
"Off"

> >
> > 5. Explain SQL injections ? How we can avoid this
A new method exposed by the US and Iraqi government for proteting their
citizens for eachothers weapons of mass desctruction. Expanded to: Single
Query Lineup

> >
> > 9. what is search engine optimization ? In HTML using which tag we can
> > attain this?
It's mostly about asking the right questions to Jeeves.com. Make sure you
don't ask him HTML specific questions, since he tends to give you false
answers on that

Here you have it .. I've given you most of the answers, you should be able
to figure the rest out on your own. Make sure to post your grade on the list
to. Especially mail it to me at [EMAIL PROTECTED] cuz I'm rather interested
in how good you did with my answers.

Wouter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mcrypt libraries?

2003-11-18 Thread Curt Zirzow
* Thus wrote Jas ([EMAIL PROTECTED]):
> I am not sure if I should post my question here but I will anyways.
> 
> Ok, I have compiled the mcrypt libraries on a Redhat 9 box running 
> apache 2 with php4.  And I need to know the next step(s) in getting php 
> to use the libmcrypt libraries.  If anyone has set this up in the past 
> or has some pointers (other than reading the manual) I would appreciate it.

Did you read the next step: Installation
  http://php.net/mcrypt


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] I need answers for the questions

2003-11-18 Thread chris . neale
Ha ha. This looks like your homework. At school some people used to pay
money for other people to do their homework for them (which may have
inspired 'sub-contracting' and consultancy).

Minimal research will get you the answers. RTFM, look on Google, buy a book,
try it for yourself, use your initiative.

C


-Original Message-
From: Arivazhagi Govindarajan [mailto:[EMAIL PROTECTED]
Sent: 18 November 2003 07:12
To: [EMAIL PROTECTED]
Subject: [PHP] I need answers for the questions


PHP Questions

1. Explain about session management and cookies ? In PHP how we can maintain

a session

2. What is HTTP tunneling

3. How to enable PHP in Apache server manually?

4. When we upload a file using  tag of the type FILE what are global 
variables become available for use in PHP

5. Explain SQL injections ? How we can avoid this

6. Write a small script to connect a MYSQL server in PHP

7. Given a class B network with subnet mask of 255.255.248.0 and a packet 
addressed to 130.40.32.16 whatis subnet address

8. Using single Apache server can we host multiple sites . If yes how can we

do this if no why it is not possible

9. what is search engine optimization ? In HTML using which tag we can 
attain this?

10. Write a function in PHP script to check whether string is a valid email 
id or not?

_
Garfield on your mobile. Download now. http://server1.msn.co.in/sp03/gprs/ 
How cool can life get?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: From form to an array

2003-11-18 Thread Curt Zirzow
* Thus wrote Jeff McKeon ([EMAIL PROTECTED]):
> 
> Form two has 2 fields for every line and the fields need to be kept in
> separate arrays.
> 
> /* form2.php */
> 
>   
>   
>   
> 
>   
>   

At this point I'm not sure what your question is now, but while I'm
here I would suggest to define your fields like this to make it
easier to handle:







Then in php:
$levels = $_POST['levels'];
foreach ($levels as $i => $level) {
  echo $level['tier'];
  echo $level['price'];
  ...
}


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] window.open problem

2003-11-18 Thread David R
I am using php and mysql and am having difficulty using window.open () . I
have cut the code down to the basics.
Why does a new window not open?
Thanks.
-David r



function boo() {
  window.open ("www.google.com");
}




  why does no window open?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] escaping ' when inside a " "

2003-11-18 Thread Curt Zirzow
* Thus wrote Marek Kilimajer ([EMAIL PROTECTED]):
> Adam Williams wrote:
> >If I have the SQL statement:
> >
> >$sql = "select subject from subwhile where subject = '*$var[0]*'";
> 
> Don't you want to do:
> $sql = "select subject from subwhile where subject LIKE '%$var[0]%'";

I think more precisely:
$sql = "select subject from subwhile where subject LIKE '%{$var[0]}%'";


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] window.open problem

2003-11-18 Thread Jay Blanchard
[snip]
I am using php and mysql and am having difficulty using window.open () .
I
have cut the code down to the basics. Why does a new window not open?
[/snip]

This is a JavaScript question...best asked on a JavaScript || ECMAScript
list. This has nothing to do with either PHP or MySQL.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I need answers for the questions

2003-11-18 Thread David T-G
Wouter, et al --

...and then Wouter van Vliet said...
% 
% > -Oorspronkelijk bericht-
% > Van: John Nichel [mailto:[EMAIL PROTECTED]
% >
% > Arivazhagi Govindarajan wrote:
% > >PHP Questions
% > >
% > > 1. Explain about session management and cookies ? In PHP how we can
% > > maintain a session
% 
% While writing PHP code you put your body in risk of getting "work related
% problems". Manage your PHP Code Writing sessions so that you do not spend
% too much time behind your screen. Read about PHP in a book too sometimes, or
% print several pages of the online PHP reference manual.
[snip]

ROFLMAO

*sniff*  Thanks!


HAND

:-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!



pgp0.pgp
Description: PGP signature


Re: [PHP] escaping ' when inside a " "

2003-11-18 Thread Marek Kilimajer
Curt Zirzow wrote:
Don't you want to do:
$sql = "select subject from subwhile where subject LIKE '%$var[0]%'";


I think more precisely:
$sql = "select subject from subwhile where subject LIKE '%{$var[0]}%'";
Either will work, as will
$sql = "... subject LIKE '%$var[string_index]%'";
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sorting an array of regexes

2003-11-18 Thread Adam i Agnieszka Gasiorowski FNORD
Eugene Lee wrote:
 
> On Tue, Nov 18, 2003 at 01:15:32PM +0100, Adam i Agnieszka Gasiorowski FNORD wrote:
> :
> :   There is an array of regexes, for example
> :
> :  $array = array('moon', '[wh]ood', '[^as]eed' ...
> :  (about 300 entries).
> :
> :   I want to sort it comparing to the
> :  character lenght of a regex. For example
> :  [wh]ood is 4 characters, moon is 4 characters.
> :  There are only letters of the alphabet and
> :  letter ranges present in those regexes. I
> :  want the "longest" ones first.
> :
> :   How would you write the sorting function?
> 
> This might be the most functionally correct, although it's definitely
> not the fastest route.

 Thank you, that will certainly work :8]. Does
 anyone have any thoughts how to make it faster? It is
 not VERY critical, because the calculation will be
 done only once, at initialization, but...well, you 
 know :8].

* * *

 How about...if I count the number of ']'
 in string and then add it to the strlen - (the
 number of ']' x 2)? There are no [ nor ] in these
 except in the character range parts. Does that
 look faster than applying regular expression?
 
> function re_len($pat)
> {
> return strlen(preg_replace('/\[[^]]+]/', '_', $pat));
> }
> 
> function re_sort($a_pat, $b_pat)
> {
> $a = re_len($a_pat);
> $b = re_len($b_pat);
> if ($a == $b)
> {
> return 0;
> }
> return ($a < $b ) ? -1 : 1;
> }
> 
> usort($array, 're_sort');
> 
> BTW, re_len() will bomb on certain oddball patterns with strange ranges.

Like? Sorry, I can't think of anything
 right now...

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] window.open problem

2003-11-18 Thread David Otton
On Tue, 18 Nov 2003 16:48:20 +0200, you wrote:

>I am using php and mysql and am having difficulty using window.open () . I
>have cut the code down to the basics.
>Why does a new window not open?

This is a model request for help - you've removed all code that isn't
directly related to the problem, you've written a test script, and your
question is succinct.

Unfortunately, it's not about PHP.

Having said that... maybe you should turn your pop-up blocker off while
testing pop-ups?

(This is one of the myriad reasons why pop-ups are a bad design decision,
BTW.)

>  window.open ("www.google.com");
window.open ("http://www.google.com/";);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] file descriptor problem with tcpclient

2003-11-18 Thread Raditha Dissanayake
Hi Bill,
Bill of Bill's qmail toaster I presume.Your article was pretty good.
I have seen a few cases where sessions gave problems when the session
tmp dir wasn't set in php.ini Not sure if that's the cause of your
problem though.




Bill Shupp wrote:

On Nov 17, 2003, at 4:49 PM, Bill Shupp wrote:

Hello,

I'm trying to use the program execution functions (like exec, system, 
passthru, etc) with tcpclient (from Dan Bernstein's ucspi-tcp command 
line tools), but get this error in the apache log with all of them:

tcpclient: fatal: unable to set up descriptor 7: file descriptor not 
open

Any idea why this descriptor is not accessible?  Here's what I'm 
running:

Apache/1.3.28 (Darwin) PHP/4.3.2


Ok, I have discovered that this ONLY occurs when I have started a 
session with session_start().  So, I'm assuming that session_start is 
using file descriptor 7.  Is there a way to control this?

Regards,

Bill Shupp



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] An array as an element of a function

2003-11-18 Thread Jeff McKeon
Is it possible to pass an array as an elemtent of a function??

Something like this:

$array1=array(1,2,3,4);
$array2=array(a,b,c,d);

Function Somefunction($var1,$var2)
{
someprocess using $array1 and array2;
}

Somefunction($array1,$array2);

Or does something special have to be done?

Thanks,

Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to get the key of a specific index of array?

2003-11-18 Thread Burhan Khalid
PhiSYS wrote:

How to get the key of a specific index of array?
Sorry, but an index is they key.

$foo = array(0 => "Apples", 1 => "Oranges", 2 => "Grapes");
$key = 2;
$value = $foo[$key];
echo $value; //you would get Grapes
//another way (maybe this is what you are after)

while(list($key,$value) = each($foo))
{
  echo "For key ".$key." the value is ".$value;
}
--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
"Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ereg_replace help

2003-11-18 Thread Curt Zirzow
* Thus wrote Martin Towell ([EMAIL PROTECTED]):
> Hi All,
> 
> I have an array of strings in the following format:
>   "abcd - rst"
>   "abcd - uvw"
>   "abcd - xyz"
>   "foobar - rst"
>   "blah - rst"
>   "googol - uvw"
> 
> What I want to do is strip everything from the " - " bit of the string to
> the end, _but_ only for the strings that don't start with "abcd"
> 
> I was thinking something like the following:
>   echo ereg_replace("(!abcd) - xyz", "\\1", $str)."\n";
> but obviously this doesn't work, otherwise I wouldn't be emailing the
> list...
> 

$newarray = preg_replace('/((? Can anyone help? I need to use ereg_replace() because it's part of our code
> library and therefore can't change :(

How do you mean its part of your code library? I would strongly
suggest using preg_* for its speed and capabilites.

Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] window.open problem

2003-11-18 Thread David R
My apologies for posting to the php group. I thought that perhaps using
javescript together with php was causing the problem.

btw I have no "pop-up blockers" running.

-david r


"David Otton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 18 Nov 2003 16:48:20 +0200, you wrote:
>
> >I am using php and mysql and am having difficulty using window.open () .
I
> >have cut the code down to the basics.
> >Why does a new window not open?
>
> This is a model request for help - you've removed all code that isn't
> directly related to the problem, you've written a test script, and your
> question is succinct.
>
> Unfortunately, it's not about PHP.
>
> Having said that... maybe you should turn your pop-up blocker off while
> testing pop-ups?
>
> (This is one of the myriad reasons why pop-ups are a bad design decision,
> BTW.)
>
> >  window.open ("www.google.com");
> window.open ("http://www.google.com/";);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] An array as an element of a function

2003-11-18 Thread Marek Kilimajer
Jeff McKeon wrote:

Is it possible to pass an array as an elemtent of a function??
Yes

Something like this:

$array1=array(1,2,3,4);
$array2=array(a,b,c,d);
Function Somefunction($var1,$var2)
{
someprocess using $array1 and array2;
}
Somefunction($array1,$array2);
This is the right way.

Or does something special have to be done?
No.

Thanks,

Jeff

You could have tried it yourself.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] An array as an element of a function

2003-11-18 Thread Raditha Dissanayake
Hi,
What do you mean by element of a function? usually functions take 
parametes (also known as arguments). elements are members of an array. 
In other words a collection of elements make up an array.



Jeff McKeon wrote:

Is it possible to pass an array as an elemtent of a function??

Something like this:

$array1=array(1,2,3,4);
$array2=array(a,b,c,d);
Function Somefunction($var1,$var2)
{
someprocess using $array1 and array2;
}
Somefunction($array1,$array2);

Or does something special have to be done?

Thanks,

Jeff

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] About iMail Help

2003-11-18 Thread Burhan Khalid
D. Jame wrote:

Hi,

Anyone know about imail.?

Read http://www.catb.org/~esr/faqs/smart-questions.html

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
"Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] An array as an element of a function

2003-11-18 Thread Jeff McKeon
Sorry, bad choice of words.  By element I meant parameter.

Jeff

> -Original Message-
> From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 18, 2003 10:35 AM
> To: Jeff McKeon; [EMAIL PROTECTED]
> Subject: Re: [PHP] An array as an element of a function
> 
> 
> Hi,
> What do you mean by element of a function? usually functions take 
> parametes (also known as arguments). elements are members of 
> an array. 
> In other words a collection of elements make up an array.
> 
> 
> 
> 
> Jeff McKeon wrote:
> 
> >Is it possible to pass an array as an elemtent of a function??
> >
> >Something like this:
> >
> >$array1=array(1,2,3,4);
> >$array2=array(a,b,c,d);
> >
> >Function Somefunction($var1,$var2)
> >{
> > someprocess using $array1 and array2;
> >}
> >
> >Somefunction($array1,$array2);
> >
> >Or does something special have to be done?
> >
> >Thanks,
> >
> >Jeff
> >
> >  
> >
> 
> 
> -- 
> Raditha Dissanayake.
> --
> --
> http://www.radinks.com/sftp/ | 
> http://www.raditha.com/megaupload
> Lean and mean Secure FTP 
> applet with | Mega Upload - PHP file uploader Graphical User 
> Inteface. Just 150 KB | with progress bar.
> 
> 
> 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sorting an array of regexes

2003-11-18 Thread Curt Zirzow
* Thus wrote Adam i Agnieszka Gasiorowski FNORD ([EMAIL PROTECTED]):
> Eugene Lee wrote:
>  
> > On Tue, Nov 18, 2003 at 01:15:32PM +0100, Adam i Agnieszka Gasiorowski FNORD wrote:
> > :
> > :   There is an array of regexes, for example
> > :
> > :  $array = array('moon', '[wh]ood', '[^as]eed' ...
> > :  (about 300 entries).
> > :
> > :   I want to sort it comparing to the
> > :  character lenght of a regex. For example
> > :  [wh]ood is 4 characters, moon is 4 characters.
> > :  There are only letters of the alphabet and
> > :  letter ranges present in those regexes. I
> > :  want the "longest" ones first.
> > :
> > :   How would you write the sorting function?
> > 
> > This might be the most functionally correct, although it's definitely
> > not the fastest route.
> 
>  Thank you, that will certainly work :8]. Does
>  anyone have any thoughts how to make it faster? It is
>  not VERY critical, because the calculation will be
>  done only once, at initialization, but...well, you 
>  know :8].

Do these change all the time or are they rather static?  I would
suggest using this routine to generate the list to be used in your
program, instead of doing this on the fly.


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] An array as an element of a function

2003-11-18 Thread Jeff McKeon
Thanks all..

Jeff

> -Original Message-
> From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 18, 2003 10:30 AM
> To: Jeff McKeon
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] An array as an element of a function
> 
> 
> Jeff McKeon wrote:
> 
> > Is it possible to pass an array as an elemtent of a function??
> Yes
> 
> > 
> > Something like this:
> > 
> > $array1=array(1,2,3,4);
> > $array2=array(a,b,c,d);
> > 
> > Function Somefunction($var1,$var2)
> > {
> > someprocess using $array1 and array2;
> > }
> > 
> > Somefunction($array1,$array2);
> This is the right way.
> 
> > 
> > Or does something special have to be done?
> No.
> 
> > 
> > Thanks,
> > 
> > Jeff
> > 
> 
> You could have tried it yourself.
> 
> 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] window.open problem

2003-11-18 Thread David Otton
On Tue, 18 Nov 2003 17:28:50 +0200, you wrote:

>My apologies for posting to the php group. I thought that perhaps using
>javescript together with php was causing the problem.
>
>btw I have no "pop-up blockers" running.

Are you /certain/? A software firewall maybe? Are you at a business site
where your sysadmin might be blocking junk? Which browser are you using?
Have you tested in other browsers/on other machines?

The following code works fine here (IE, Opera, Moz):




function boo() {
window.open ("http://www.google.com/";);
}



why does no window open?



This is well off-topic though. If you don't have any luck, contact me
off-list.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Question about empty();

2003-11-18 Thread John
Hi all

This function I don't get at all, I hear all the time, "if you want to
practice smart coding then turn register globals off, and be sure you keep
query data out of your script that is not set or defined with something
expected". So why would there be a function that returns true or false, $var
is empty even if $var is not defined! Now I know you can do bool(), but the
function name (empty()) really states one thing "Does it have a value or (!)
not have value" and not "Does have a value or does (!) not have a value and
may be undefined too!" If you don't want to correct it then at least give a
warning if the $var being tested is undefined!~

This is a function that does more than it should do, and in this case more
is bad!

C, Ya...

John

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about empty();

2003-11-18 Thread Curt Zirzow
* Thus wrote John ([EMAIL PROTECTED]):
> Hi all
> 
> This function I don't get at all, I hear all the time, "if you want to
> practice smart coding then turn register globals off, and be sure you keep
> query data out of your script that is not set or defined with something
> expected". So why would there be a function that returns true or false, $var
> is empty even if $var is not defined! Now I know you can do bool(), but the
> function name (empty()) really states one thing "Does it have a value or (!)
> not have value" and not "Does have a value or does (!) not have a value and
> may be undefined too!" If you don't want to correct it then at least give a
> warning if the $var being tested is undefined!~
> 

For the life of me I cant find your question in there.


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about empty();

2003-11-18 Thread Mike Migurski
>This function I don't get at all, I hear all the time, "if you want to
>practice smart coding then turn register globals off, and be sure you keep
>query data out of your script that is not set or defined with something
>expected". So why would there be a function that returns true or false, $var
>is empty even if $var is not defined!

It's just a shorthand that helps avoid tests like the one below, common in
a user input validation situation:

(!isset($_POST['var']) || ($_POST['var'] == ''))

Instead, you can use:

empty($_POST['var'])

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Include an encoder into PHP distribution?

2003-11-18 Thread John Smith
> Not at all.  If enough decide to include some other encoding engine
> in PHP then Zend can happily withdraw all of their support from PHP,
> perhaps making a new product called zPHP or such, and the PHP camp is
> not controlled in any way.  It seems a bit extreme and probably not
> worth it, but no materially different from supporting (insert your
> favorite and my least favorite cause here) and watching us part ways.

Just my last comment (probably) on this and then I stop, I think I don't
have anything more say:

Yes, I think it would be a good idea to make *PHP free*. IMHO, one company
has now too much control in it, it's not good for the language in general.
Unless, of course, you are willing to put the encoding feature into PHP core
by default.

JS

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Include an encoder into PHP distribution?

2003-11-18 Thread Jay Blanchard
[snip]
Yes, I think it would be a good idea to make *PHP free*. IMHO, one
company has now too much control in it, it's not good for the language
in general. Unless, of course, you are willing to put the encoding
feature into PHP core
by default.
[/snip]

This statement demonstrates a lack of understanding on your part. PHP is
free. Completely free. It costs nothing. Nada, zilch, zero. It is not
owned by any company or induhvidual. There are acknowledged leaders in
the community.

Zend does not control PHP. Zend has just invested a lot in the
technology. If PHP went away tomorrow Zend would focus their core on
something else. Likewise if Zend went away tomorrow PHP would continue
to grow and evolve.

Putting an encoding feature into the core of PHP would require actions
by those developing PHP, which you can take part in. Right now there are
several encoders available from other sources and it is up to each
induhvidual/team/organization to decide a. do we need to encode? and 2.
which encoder do we want to use? Just like you can choose to use MMTurke
or Zend Encoder or another encoder.

What is so hard to understand about this?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP command line vars

2003-11-18 Thread Shawn McKenzie
I have a script that I want to run on the windows command line, and it is
working fine.  What I want to do is pass vars to the script when I run it,
example:  php script.php $var=hello

I have read the docs but can't find the syntax to pass these in.  Also, how
to retrieve them in the script?  argv other?

TIA
-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] auto_prepend/append in htaccess....

2003-11-18 Thread Jonathan Villa
easy enough, thanks!
On Mon, 2003-11-17 at 19:47, Jason Wong wrote:
> On Tuesday 18 November 2003 06:46, Jonathan Villa wrote:
> > Thanks for the info, but I was hoping on getting some information as to
> > why the code configuration I posted is not working.
> 
> Because it's incorrect. Try:
> 
>   php_value auto_prepend_file header.inc
>   php_value auto_append_file footer.inc
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> May you live in uninteresting times.
>   -- Chinese proverb
> */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP command line vars

2003-11-18 Thread Marek Kilimajer
Shawn McKenzie wrote:

I have a script that I want to run on the windows command line, and it is
working fine.  What I want to do is pass vars to the script when I run it,
example:  php script.php $var=hello
The example will not work, command line arguments are traditionaly 
passed in the form of:
php script.php --long-name hello
or
php script.php -n hello

You will have to parse $argv array to get the command line arguments.

I have read the docs but can't find the syntax to pass these in.  Also, how
to retrieve them in the script?  argv other?
http://www.php.net/manual/en/features.commandline.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Arrays and performance

2003-11-18 Thread Kim Steinhaug
Something Ive wondered about as I started working with XML.
Importing huge XML files, and converting theese to arrays works
indeed very well. But I am wondering if there are any limits to
how many arrays the PHP can handle when performance is accounted for.

Say I create an array from a XML with lots of childs, say we are
talking of upto 10 childs, which would give 10 dimensional arrays.
Say we then have 10.000 records, or even 100.000 records.

Will this be a problem for PHP to handle, or should I break such
a prosess into lesser workloads (meaning lesser depth in the array)?

Anyone with some experience on this?

-- 
Kim Steinhaug
---
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Arrays and performance

2003-11-18 Thread Raditha Dissanayake
Hi,

I belive PHP should be able to handle it but it's a bad idea. The reason 
being your app will not scale. Because if you script consumes 2mb of 
memory on average, 100 users accesing it at the same time will be 200Mb. 
Of course if you expect only a small number of users it does not matter.

The biggest XML job i have handled with PHP is parsing the ODP RDF dump 
which is around 700MB. Obviously arrays are out of the question in such 
a scenario, even though only one user will be accessing the script at a 
given moment. the ODP dump has a couple of million records



Kim Steinhaug wrote:

Something Ive wondered about as I started working with XML.
Importing huge XML files, and converting theese to arrays works
indeed very well. But I am wondering if there are any limits to
how many arrays the PHP can handle when performance is accounted for.
Say I create an array from a XML with lots of childs, say we are
talking of upto 10 childs, which would give 10 dimensional arrays.
Say we then have 10.000 records, or even 100.000 records.
Will this be a problem for PHP to handle, or should I break such
a prosess into lesser workloads (meaning lesser depth in the array)?
Anyone with some experience on this?

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Arrays and performance

2003-11-18 Thread Pablo Gosse
Raditha Dissanayake wrote:

[snip]The biggest XML job i have handled with PHP is parsing the ODP RDF
dump which is around 700MB. Obviously arrays are out of the question in
such a scenario, even though only one user will be accessing the script
At a given moment. the ODP dump has a couple of million records[/snip]

What was your solution for this, Raditha?  How did you handle the
parsing of such a large job?

Cheers,
Pablo

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Arrays and performance

2003-11-18 Thread Raditha Dissanayake
hi,

In fact i had to handle the ODP dump on two occaisions the first time 
the results went into a mysql db, the second time it went into a series 
of files.

On both occaisions i used SAX parsers. DOM would just roll over and die 
with this much of data. I placed code in the end element handler that 
would either save the data into a db or would save it to a file. In 
either case i only kept the data in memory for a short period. ie from 
the time the start element was detected through the character data 
handling until the end element was detected. (Obviously  i am not 
talking of the root node here :-))

During the whole process you barely noticed the memory usage, however 
the disk usage still went up of course. Reading from disk 1 and writing 
to disk 2 does wonders!

please let me know if you need any further clarifications.

Pablo Gosse wrote:

Raditha Dissanayake wrote:

[snip]The biggest XML job i have handled with PHP is parsing the ODP RDF
dump which is around 700MB. Obviously arrays are out of the question in
such a scenario, even though only one user will be accessing the script
At a given moment. the ODP dump has a couple of million records[/snip]
What was your solution for this, Raditha?  How did you handle the
parsing of such a large job?
Cheers,
Pablo
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP and MySQL problem, please help

2003-11-18 Thread Mr. Bogomil Shopov
hi folks,
A query  in mysql become with STATE set to STATISTICS and all queries 
after this query are LOCKED.
What is the decision please.

Best Regards
Bogomil
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP and MySQL problem, please help

2003-11-18 Thread Jay Blanchard
[snip]
A query  in mysql become with STATE set to STATISTICS and all queries
after this query are LOCKED.What is the decision please.
[/snip]

The decision is to ask for a better description if possible, along with
some of the suspected code.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP command line vars

2003-11-18 Thread Shawn McKenzie
Thanks!  The link was just what I needed.

-Shawn

"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Shawn McKenzie wrote:
>
> > I have a script that I want to run on the windows command line, and it
is
> > working fine.  What I want to do is pass vars to the script when I run
it,
> > example:  php script.php $var=hello
> The example will not work, command line arguments are traditionaly
> passed in the form of:
> php script.php --long-name hello
> or
> php script.php -n hello
>
> You will have to parse $argv array to get the command line arguments.
>
> >
> > I have read the docs but can't find the syntax to pass these in.  Also,
how
> > to retrieve them in the script?  argv other?
>
> http://www.php.net/manual/en/features.commandline.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Front page validation to PHP

2003-11-18 Thread Graham Barlow
We use Frontpage to create forms and to add validation to data entry.  These
have been saved as html and put on a hosted server running apache and PHP.
They work fine.
 
Now we have added cookies using PHP code to the forms and renamed them .php
rather than html.
 
The cookies work fine so does data capture, but the validation no longer
works. Hence an enquirier can simply press submit and the form gets
submitted with no data if they have chosen not to enter any information.
 
What do I need to do to our Frontpage forms to ensure the validation works
again and we can force data to be entered.
 
Any ideas welcome.
 
Thanks, Graham


RE: [PHP] Front page validation to PHP

2003-11-18 Thread Chris W. Parker
Graham Barlow 
on Tuesday, November 18, 2003 7:57 AM said:

> What do I need to do to our Frontpage forms to ensure the validation
> works again and we can force data to be entered.

I haven't used frontpage in probably 2 years so my memory may be a
little foggy. But iirc frontpage uses some kind of proprietary code to
do that form validation. You'll basically have to rewrite the forms and
use regular server side validation and/or javascript (server side is
better for data security). Otherwise maybe it's possible to have
frontpage extensions (I think that's what the form validation is using)
and PHP work together on the same file???

Maybe you can tell php to parse .html files and rename all your files
back to .html?? I know php will parse .html files if you tell it to but
I don't know if there will be a conflict with frontpage extensions or
not.


HTH,
Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] =sessions / J. Meloni Textbook=

2003-11-18 Thread Anthony Ritter
Using mysql, apache and win98

The following code is from "PHP, mySQL and Apache" (SAMS) by Julie Meloni.

Page 338-339 (hour 16).

After choosing my selections in the form box and hitting submit I get:
...

Warning: Invalid argument supplied for foreach() in
c:\apache\htdocs\listing16.5.php on line 13
..

I checked her errata at thickbooks.com but there was nothing for this
chapter.

Any help will be greatly appreciated.
Thank you.
TR
---

// script 16.4.php



Listing 16.4 Storing an array with a session


Product Choice Page
Your products have been registered!";
}
?>

Select some products:

Sonic Screwdriver
Hal 2000
Tardis
ORAC
Transporter bracelet





content page


..


// script 16.5.php


Listing 16.5 Accessing session variables


 Content Page
Your cart:\n";
   foreach (unserialize($_SESSION[products]) as $p) {
   print "$p";
   }
   print "";
}
?>
Back to product choice page


...

Warning: Invalid argument supplied for foreach() in
c:\apache\htdocs\listing16.5.php on line 13

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Assigning command line vars in script

2003-11-18 Thread Shawn McKenzie
Does this look like a good way to retrieve command line variables and assign
them in a script, or am I reinventing something that is already in place???

for ($i = 1; $i < $argc; $i = $i + 2) {
$var = str_replace("-", "", $argv[$i]);
$$var = $argv[$i+1];
}

Thanks!
-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] =sessions / J. Meloni Textbook=

2003-11-18 Thread Giz
Try changing references to $_SESSION[products] to $_SESSION['products']

-Original Message-
From: Anthony Ritter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 18, 2003 10:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP] =sessions / J. Meloni Textbook=

Using mysql, apache and win98

The following code is from "PHP, mySQL and Apache" (SAMS) by Julie Meloni.

Page 338-339 (hour 16).

After choosing my selections in the form box and hitting submit I get:
...

Warning: Invalid argument supplied for foreach() in
c:\apache\htdocs\listing16.5.php on line 13
..

I checked her errata at thickbooks.com but there was nothing for this
chapter.

Any help will be greatly appreciated.
Thank you.
TR
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mkdir with PHP 4.3.4 and IIS 5.0 on Windows 2000

2003-11-18 Thread Dang Nguyen
I have a peculiar problem in one of my scripts.  I cannot mkdir from the
script, but from a test script, the same exact code works.

test.php contains:
\n";

mkdirs($directory,0755);



$dir_object = @dir ($directory) or die ("Could not open a directory stream
for $directory");

print_r($dir_object);

$dir_object->close();

?>

I have another script that takes some input from the user, namely to be a
new sub-folder to create on the destination directory.  Just to eliminate
the possibility that the code from my script is not the problem, I commented
out everything that had to do with what I really wanted.  In its place, I
substituted the above code from test.php.  When I call test.php, the
directory is created fine.  However, when I execute my problematic script,
which now contains the exact code, I get

Attempting to mkdir
Could not open a directory stream for \\seint16\TechComm\Ceos\Dang\

This is quite puzzling, since the exact same code should work in both
scripts, but it's not!  Any help, please!

Thanks,
Dang Nguyen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] =sessions / J. Meloni Textbook=

2003-11-18 Thread Burhan Khalid
Anthony Ritter wrote:

Using mysql, apache and win98

The following code is from "PHP, mySQL and Apache" (SAMS) by Julie Meloni.

Page 338-339 (hour 16).

After choosing my selections in the form box and hitting submit I get:
...
Warning: Invalid argument supplied for foreach() in
c:\apache\htdocs\listing16.5.php on line 13
..
[ snip ]

// script 16.5.php


Listing 16.5 Accessing session variables


 Content Page
Your cart:\n";
   foreach (unserialize($_SESSION[products]) as $p) {
   print "$p";
   }
   print "";
}
?>
Back to product choice page


you are missing session_start(); on 16.5 You need that in order to 
populate the $_SESSION array.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
"Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] mkdir with PHP 4.3.4 and IIS 5.0 on Windows 2000

2003-11-18 Thread Jay Blanchard
[snip]
mkdirs($directory,0755);
[/snip]

should be 
mkdir($directory,0755);

make sure the script has permission to make a directory, most scripts
run as 'nobody' and 'nobody' does not have permission to create a
directory

http://us3.php.net/mkdir

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] duvida com value

2003-11-18 Thread Carlos Eduardo
alguem poderia me ajudar na seguinte duvida..
em uma pagina php tenho esse campo nela.
nome>
para ele jogar o conteudo da linha nome para a proxima pagina
alterar.php..
mas ele joga apenas por ex:
se o nome é carlos eduardo
vai apenas
carlos , tudo que tem depois do espacamento nao vai para a pagina
alterar.php.
alguem poderia me ajudar com isso ?
Agradeço desde já

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mkdir with PHP 4.3.4 and IIS 5.0 on Windows 2000

2003-11-18 Thread Dang Nguyen
In my case, I've created a function called mkdirs that recursively checks
and does a mkdir on a given path.  So, if any of the folders in a given path
don't exist, then they will get created.  I include this at the top via
"include('func/mkdirs.php');".  I've used this mkdirs function in other
scripts, and I know it's working fine.

mkdirs.php contains:
 1) {
  $pStrPath = dirname($strPath);
  if (!mkdirs($pStrPath, $mode)) return false;
  }

  return mkdir($strPath,$mode);
}
?>

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2003 11:38 AM
To: Dang Nguyen; [EMAIL PROTECTED]
Subject: RE: [PHP] mkdir with PHP 4.3.4 and IIS 5.0 on Windows 2000


[snip]
mkdirs($directory,0755);
[/snip]

should be 
mkdir($directory,0755);

make sure the script has permission to make a directory, most scripts
run as 'nobody' and 'nobody' does not have permission to create a
directory

http://us3.php.net/mkdir


[PHP] Command line output

2003-11-18 Thread Shawn McKenzie
O.K.  I am just now experimenting with the CLI PHP and have another
question.  With the following code, none of the echo output is seen until
the script completes.  I even tried adding a flush() after the first echo
before the imap_open, but still the same behavior.  Any ideas?

echo "Connecting to $server: $mbox ...\n\n";
$conn = imap_open("{" . $server . ":143/notls/norsh}" . $mbox, $user,
$pass);

echo "Receiving messages ...\n\n";
for ($i = 1; $i <= imap_num_msg($conn); $i++) {
...etc...

Thanks!
-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mkdir with PHP 4.3.4 and IIS 5.0 on Windows 2000

2003-11-18 Thread Jay Blanchard
[snip]
In my case, I've created a function called mkdirs that recursively
checks and does a mkdir on a given path.  So, if any of the folders in a
given path don't exist, then they will get created.  I include this at
the top via "include('func/mkdirs.php');".  I've used this mkdirs
function in other scripts, and I know it's working fine. 
[/snip]
 
Then try doing it outside of the function (directly) to see if you spot
any problems


Re: [PHP] duvida com value

2003-11-18 Thread Cesar Cordovez
Mi portugues is very rusty, but I think the solution is:

$url = "";

and then print $url where ever you want.  Notice the quotes and single 
quotes around the url.

You can learn more about this on php.net/urlencode

Cesar

Carlos Eduardo wrote:

alguem poderia me ajudar na seguinte duvida..
em uma pagina php tenho esse campo nela.
nome>
para ele jogar o conteudo da linha nome para a proxima pagina
alterar.php..
mas ele joga apenas por ex:
se o nome é carlos eduardo
vai apenas
carlos , tudo que tem depois do espacamento nao vai para a pagina
alterar.php.
alguem poderia me ajudar com isso ?
Agradeço desde já
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] easy and simple way to read xml into array

2003-11-18 Thread Burhan Khalid
Victor Spång Arthursson wrote:

2003-11-17 kl. 17.06 skrev Chris Hayes:

Need to read a xml-file into an array, but searching around I havent 
found a way that's easy and simple… Arent there an easy way in PHP to 
accomplish this?


have you been at http://se.php.net/xml ?


Well, I've, and I also have to say that the XML-support in PHP lacks any 
usability…
Care to justify your statement? Because it doesn't work for you, it 
lacks usability? You are a usability expert?

2 pages code later I still cannot get it to work, and the manual is 
pretty thin on this chapter...

For example, I've the following XML:


1234
3,4
kg

Here I thought that the startelementfunction should be called upon every 
start tag, the character_data_handler on every text string and the 
endelement function on every endelement.

But what seems to happen is that the character data handler is called to 
randomly number of times, and if I output the current element every time 
it gets called I get the following output for the xml above:

ingrediens
ingrediens
ingrediens
ingrediensnummer
ingrediensnummer
ingrediensnummer
ingrediensnummer
maengde
maengde
maengde
maengde
enhed
enhed
enhed
enhed
enhed
enhed
What I expected to get was:

ingrediensnummer
maengde
enhed
So, couldnt anyone please bring some clarity into this matter?
1. Post some code.

2. Read a tutorial
   http://www.meidomus.com/node/view/21 (that's one I wrote)
   http://www.google.com/search?q=parsing+xml+php (some that I didn't)
--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
"Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sorting an array of regexes

2003-11-18 Thread Eugene Lee
On Tue, Nov 18, 2003 at 01:52:39PM +0100, Wouter van Vliet wrote:
: Eugene Lee suggested:
: > On Tue, Nov 18, 2003 at 01:15:32PM +0100, Adam i Agnieszka
: > Gasiorowski FNORD wrote:
: > :
: > :   There is an array of regexes, for example
: > :
: > :  $array = array('moon', '[wh]ood', '[^as]eed' ...
: > :  (about 300 entries).
: > :
: > :   I want to sort it comparing to the
: > :  character lenght of a regex. For example
: > :  [wh]ood is 4 characters, moon is 4 characters.
: > :  There are only letters of the alphabet and
: > :  letter ranges present in those regexes. I
: > :  want the "longest" ones first.
: > :
: > :   How would you write the sorting function?
: >
: > This might be the most functionally correct, although it's definitely
: > not the fastest route.
: >
: > function re_len($pat)
: > {
: > return strlen(preg_replace('/\[[^]]+]/', '_', $pat));
: 
: I think you meant:
: 
:   /\[[^\]]+]/
: 
: as regex ;) Not sure, but I think one more block-bracked needed to be
: escaped ;)

Nope.  My pattern is legitimate.  Within a range, if the first character
is a closing-square-bracket ']', it is treated as the literal character
and not as the end of range.  If the range starts with a negation '^',
then the same rule applies to the second character.

This is also a sad indication that I really know my regular expressions,
or I need a vacation.  :-)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] window.open problem

2003-11-18 Thread Eugene Lee
On Tue, Nov 18, 2003 at 04:48:20PM +0200, David R wrote:
: 
: I am using php and mysql and am having difficulty using window.open () . I
: have cut the code down to the basics.
: Why does a new window not open?
: 
: 
: 
: function boo() {
:   window.open ("www.google.com");
: }
: 
: 
: 
: 
:   why does no window open?
: 
: 

1. try window.open("http://www.google.com/";)

2. try onload='window.open("http://www.google.com/";);'

3. what browser are you using?

4. have you tried the same browser on other machines?

5. have you tried different browsers?

6. have you tried different browsers on other machines?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] how to trap eval error?

2003-11-18 Thread david
Hi, 
i am new to this list as well as to PHP. i am in a situatin where i want to 
eval a string like:

eval('$return = $function($input);');

where $function is a string specify a function to call and $input is the 
input parameter for the function. $return is just whatever is returned by 
the $function. my problem is that if $function is NOT defined anywhere, i 
got a fatal error like:

Fatal error: Call to undefined function: ... 

does anyone who how to trap this error if it can be trap at all? what i have 
done so far is something similar to:

set_error_handler('myHandler');
eval('$return = $function($input);');

that doesn't seem to work at all as 'myHandler' is never called. i have 
alose tried to check $php_errormsg but that doesn't seem to be helpful as 
well. as a last resort, i tried:

error_reporting(E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE);
set_error_handler('myHandler');
eval('$return = $function($input);');

that does seem to make the error stop appearing but my handler is still not 
called. any idea?

thanks!
david

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] how to trap eval error?

2003-11-18 Thread Jay Blanchard
[snip]
eval('$return = $function($input);');
[/snip]

The problem is the quotes...the string is not truly being eval'd. Change
to double quotes

eval("$return = $function($input);");

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] how to trap eval error?

2003-11-18 Thread david
Jay Blanchard wrote:

> [snip]
> eval('$return = $function($input);');
> [/snip]
> 
> The problem is the quotes...the string is not truly being eval'd. Change
> to double quotes
> 
> eval("$return = $function($input);");

thanks for the tip but i am sure you mean:

eval("\$return = \$function(\$input);");

otherwise the variables gets expanded before they get to eval and i end up 
with a syntax error. i found a solution (hopefully) with:

if(function_exists($function)){
eval('$return = $function($input);');
}else{
// function does not exists
}

which works quit nicely for now. not sure if that's a good thing to do.

thanks!
david

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Prefilled forms

2003-11-18 Thread b b

 Hi there,
 I have installed linux/apache/php (again) recently on
my machine. When I run an application off my server,
fill out a form, submit it and then click back to edit
some entries, the form comes up blank. This happen for
apps running off my server only. Is it something with
my php.ini, or is it an apache setting ... It is
making debugging very hard. Anybody seen this problem
before?

 Thankyou dearly.


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 4.3.1 (Suse 8.2 RPM) and LDAP problem

2003-11-18 Thread Patrique Wolfrum
Hello,

My PHP-problem is, that I can't bind to a LDAP-Server, although 
ldap_connect seems to work. The script is intended for an 
authentification of web-users (which enter their username and password) 
by sending this data to a central ldap-server.
Openldap 2.1.12+Libs (Suse RPM) and OpenSSL (Suse RPM) are installed.

On the server which acted as "authentification server" (Redhat 9.0 (php 
4.2.2)) the same script works quite fine.

The firewall we use is configured with the same settings for our main 
server which I used for the "authentification server", so the connection 
should work from that part. The ports 389 and 636 are free if the 
connection goes to one of the two ldap-servers mentioned below.

My script looks the following way:

---

$uid = $HTTP_POST_VARS['uid'];
$ldappass = $HTTP_POST_VARS['passwd'];
$basedn = 'dc=xxx, dc=de';
$ldaprdn  = 'uid='.$uid.', ou=xxx, dc=xxx, dc=de';
$ldapserver1 = 'ldaps://xxx.xxx.xxx.de';
$ldapserver2 = 'ldaps://xxx.xxx.xxx.de';

// connect to ldap server
$ldapconn = ldap_connect($ldapserver1) or die("Es konnte keine 
Verbindung mit dem LDAP-Server aufgebaut werden. Versuchen Sie es bitte 
spaeter nochmals");

if ($ldapconn) {

$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);

if ($ldapbind) { 



Beyond the $ldapbind line, several attributes are requested from the 
LDAP-server and used for statistical-information.

The script works until it reaches the $ldapbind = ldap_bind line, then I 
get the following message:



Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP 
server in //authenticate.php on line 22



Tests with ldap_error show the following results:

ldap_connect: A resource ID
ldap_bind: success

(The latter is the most confusing one for me)

I looked at the PHP-documentation and searched via google, but I could 
find any clue, which could get this script going again.

How can I further determine, why the ldap_bind doesn't work properly ?

Thank you very much in advance.

With best regards.
Patrique Wolfrum

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Prefilled forms

2003-11-18 Thread Jay Blanchard
[snip]
 I have installed linux/apache/php (again) recently on my machine. When
I run an application off my server, fill out a form, submit it and then
click back to edit some entries, the form comes up blank. This happen
for apps running off my server only. Is it something with my php.ini, or
is it an apache setting ... It is making debugging very hard. Anybody
seen this problem before?
[/snip]

Yes, several of us have seen it, many times in fact. Imagine that.
Browsers, being the stateless wonders that they are, do not 'maintain'
the information. You have some choices through. Retrieve the variables
from the database, save them in a session variable and retrieve them
from there, or do some other imaginative method of 'maintaining' the
variables until you are done with this particular group of variables.

I invite you to STFW and STFA for the answers to your dilemna. Have a
pleasant day and happy coding!!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] what ever happened to http referrer

2003-11-18 Thread Jonathan Villa
I'm running php 4.3.4 and do not see any mention of HTTP_REFERRER.  I
tried $_SERVER['HTTP_REFERRER'] which is what I thought it was but to no
avail.

Any comments on the location/status of this?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] what ever happened to http referrer

2003-11-18 Thread Johnson, Kirk
> I'm running php 4.3.4 and do not see any mention of HTTP_REFERRER.  I
> tried $_SERVER['HTTP_REFERRER'] which is what I thought it 
> was but to no
> avail.
> 
> Any comments on the location/status of this?

You spell too well, try "HTTP_REFERER", without the double "R" ;)

Kirk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] what ever happened to http referrer

2003-11-18 Thread Jonathan Villa
nevermind...

doh!

On Tue, 2003-11-18 at 14:44, Jonathan Villa wrote:
> I'm running php 4.3.4 and do not see any mention of HTTP_REFERRER.  I
> tried $_SERVER['HTTP_REFERRER'] which is what I thought it was but to no
> avail.
> 
> Any comments on the location/status of this?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   >