Re: [PHP] Re: help condensing regular expressions

2002-04-05 Thread Chris Adams

In article <[EMAIL PROTECTED]>, Tom
Rogers wrote:
> Thats what I was after :)

Glad I could help.

> At the top of each page I now do
> 
> $reltoroot = preg_replace("|/[^/]+|", "../", dirname($_SERVER['PHP_SELF']));
> ini_set ("include_path",ini_get("include_path").":".$reltoroot."../include");
> 
> which takes care of the include path

Out of curiosity, couldn't you put something like
php_value include_path .:/document/root/include:/usr/lib/php

in a .htaccess file? Or has your ISP disabled .htaccess files?

Chris

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




[PHP] ANN: QaDRAM Software releases QaDRAM Studio 1 Pre-Release 1 Build 770

2002-04-05 Thread José León Serna

QaDRAM Studio enables Rapid Application Development for Web applications
http://studio.qadram.com

ELCHE, Spain - April 6, 2002 - QaDRAM Software today announced the next
release of QaDRAM Studio 1 for Rapid Web Application Development. QaDRAM
Studio enables web developers to build and debug web applications using
their server scripting language of choice. The current pre-release only
supports PHP, but ASP, Perl, JSP and other languages are also planned.
QaDRAM Studio incorporates an unique plug-in technology to enable
third-party developers to add support for any scripting language. This
release includes some components for you to play with it, it's not still
productive as designer, but it could be useful as editor.

QaDRAM Studio is free for both personal and commercial use, it is not Open
Source, but several parts will be released under an OpenSource license, for
example the QCL (QaDRAM Component Library) and the plug-in SDK that allow
third-parties to add support for another scripting languages.

QaDRAM Studio is a Windows program, but a Linux version is planned after the
final release, so QaDRAM Studio will become the most powerful web
application development platform.

The direct link to download is:
http://studio.qadram.com/download.php?op=getit&lid=11

About QaDRAM Software
QaDRAM Software started operation with the purpose to bring RAD techniques
to the web application world. Founded in 2001, QaDRAM Software is
headquartered in Elche, Spain. To learn more, visit http://www.qadram.com





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




Re: [PHP] Re: help condensing regular expressions

2002-04-05 Thread Tom Rogers

Thanks Chris
Thats what I was after :)
At the top of each page I now do

$reltoroot = preg_replace("|/[^/]+|", "../", dirname($_SERVER['PHP_SELF']));
ini_set ("include_path",ini_get("include_path").":".$reltoroot."../include");

which takes care of the include path

I use the path translated info for pages that are sym linked across virtual 
domains such as admin pages.
Thanks again
Tom

At 03:49 PM 6/04/2002, Chris Adams wrote:
>In article <[EMAIL PROTECTED]>, Tom
>Rogers wrote:
> > I am trying to calculate how far into a directory structure I am so that I
> > can include images and include files without having to hard code them.
> > I need to turn $PHP_SELF which could be /admin/emails/index.php into 
> ../../
> > which I can then use to get to any directory from root.
>
>Here's a more compact regexp:
>
>preg_replace("|/[^/]+|", "../", dirname($_SERVER['PHP_SELF']));
>
>dirname() returns only the directory part of a filename (e.g. "/~chris"
>from "/~chris/myfile.php").
>
>Using | instead of the usual / to delimit the regular expression just
>saves a bit of typing.
>
>(Note that for includes, you'd be better off setting include_path in
>php.ini or .htaccess - that avoids the need to worry about where the
>files are physically located)
>
>If you need the local file path and you're using Apache, the
>PATH_TRANSLATED variable can tell you where your files are:
>$current_dir = dirname($PATH_TRANSLATED) . "/";
>
>This could be used to construct absolute paths internally - I use it in
>my photo gallery code when creating thumbnails & such with convert.
>Using it with DOCUMENT_ROOT can help if you need to construct things
>like directory listings.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Miguel Cruz

On Sat, 6 Apr 2002, Justin French wrote:
> on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED]) wrote:
>> It DOES NOT work fine in every browser. I'd love to give you a prov, but
>> because I am lazy I will just tell you this formula:
> 
> Again.  I was only stating MY experience.  "Every browser I can get my hands
> on".  I do extensive testing, and have never seen a  or  or 
> misbehave.
> 
> If you have seen it perform unexpectedly, I'm keen to hear about.

For what it's worth, I just tried on the following browsers (all I have at
my disposal at home) and it works fine:

links 0.96
lynx 2.8.3
Opera 5.0.498 (Mac)
IE 5.1.3 (Mac)
Mozilla 0.9.9 (Mac)
Netscape 6.1 (Mac)

miguel


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




[PHP] Re: help condensing regular expressions

2002-04-05 Thread Chris Adams

In article <[EMAIL PROTECTED]>, Tom
Rogers wrote:
> I am trying to calculate how far into a directory structure I am so that I 
> can include images and include files without having to hard code them.
> I need to turn $PHP_SELF which could be /admin/emails/index.php into ../../ 
> which I can then use to get to any directory from root.

Here's a more compact regexp:

preg_replace("|/[^/]+|", "../", dirname($_SERVER['PHP_SELF']));

dirname() returns only the directory part of a filename (e.g. "/~chris"
from "/~chris/myfile.php").

Using | instead of the usual / to delimit the regular expression just
saves a bit of typing.

(Note that for includes, you'd be better off setting include_path in
php.ini or .htaccess - that avoids the need to worry about where the
files are physically located)

If you need the local file path and you're using Apache, the
PATH_TRANSLATED variable can tell you where your files are:
$current_dir = dirname($PATH_TRANSLATED) . "/";

This could be used to construct absolute paths internally - I use it in
my photo gallery code when creating thumbnails & such with convert.
Using it with DOCUMENT_ROOT can help if you need to construct things
like directory listings.

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




[PHP] Re: MySQL - UPDATE & INSERT

2002-04-05 Thread Chris Adams

In article <[EMAIL PROTECTED]>, Phil Schwarzmann wrote:
> $query = "UPDATE table SET (var1, var2, var3) VALUES ($var1, $var2,
> $var3) WHERE username='$username'";
>  
>  
> Im wondering cause I have an INSERT query
>  
> $query = "INSERT INTO table (var1, var2, var3) VALUES ($var1, $var2,
> $var)";
>  
> ...but only there are like 150 different variables and it will take me
> forever to write a query like

Unfortuantely, UPDATE syntax is in fact completely different. This is
usually a good thing - imagine counting commas with those 150 columns to
see if you put #93 in the 93rd or 94th spot!

It sounds like you need to normalize your data more. I can't imagine
anything which would require that many columns in one table and it's
usually better to break things into multiple tables where possible. If
you can, see if you can't restructure the database considerably - you'll
save yourself a great deal of work later.

Assuming you can't avoid setting that many variables at once, you can
use a PHP script like this to generate some statements programatically:

 1) print ",";
print "\n";
}

print "WHERE ...\n";
?>

(As a side note, MySQL supports the UPDATE style syntax for INSERT and
has a REPLACE command which will UPDATE if the record exists and INSERT
if it doesn't - this can help you maintain only one query)

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




Re: [PHP] Can't get this code to work...

2002-04-05 Thread Analysis & Solutions

On Fri, Apr 05, 2002 at 09:42:37PM -0500, Analysis & Solutions wrote:

> If you want to evaluate the variable $checkboxName, you need to write:
>
>$var = "checkbox$cb[$i]";
>if ($$var == 'validate')
> 
> But, of course, that assumes you actually set the name of your 
> checkbox to "checkboxName" and the value of that checkbox to "validate"

Pardon my following up to myself, but I figured it'd be a good idea to  
do so.  I was initially going to suggest your method of coding seems
quite wacky.  Then, I figured, hey, let them do what they want.  Now,   
I've thought better of it.  A far simpler way to achieve what it seems
you're trying to do is to use an array in the first place.



Then in your receiving code, you could just do

if ($checkbox['Name'] == 'validate') {

Or,  if you want to loop through each item, as you were in your original 
code:

while ( list($Key,$Val) = each($checkbox) ) {
   if ($Val = 'validate) {
  $msg .= "$Key : $Val\n";
  # or whatever it was you were trying to do...
   }
}

WAY cleaner and WAY more flexible.  Now you can add new items to the 
form without having to name them in your $cb[] array.

Also, FYI, there was no need to set the array using $cb[$i].  Just
doing something like 
   $cb[] = 'some value'; works just fine, with the key being
automatically numbered/incremented, starting at 0.

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




Re: [PHP] MYSQL maximum query size?

2002-04-05 Thread Bob

I noticed today that UPDATE will behave like that if you are running it on
an empty table.. I'm certain you would get an error if your query was too
large.

Bob

- Original Message -
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 05, 2002 3:01 PM
Subject: [PHP] MYSQL maximum query size?


> Is there a maximum number of characters you can use in a query?
>
> I have a giant query using the UPDATE command (updating about 120
> different columns).
>
> I run this query of mine and nothing happens.  No errors.  No updates
> either.
>
> Thanks!!
> Phil
>


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




Re: [PHP] newbie configuration question

2002-04-05 Thread Bob

Just install the source RPM, change the option and rebuild the RPM..
Then -Fvh it and it should be the way you want it. This is after all the
reason they include the source files with Linux..

Later,

Bob
- Original Message -
From: "Eric Kilgore" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 05, 2002 10:19 PM
Subject: RE: [PHP] newbie configuration question


> Interestingly, php-mysql-4.0.6-7.i38.rpm is installed, but phpinfo still
> shows --without-mysql
>
>
> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 05, 2002 9:05 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] newbie configuration question
>
>
> On Saturday 06 April 2002 11:12, Eric Kilgore wrote:
> > I'm a newbie to Linux and Apache, not so new to php itself. I'm using
Red
> > Hat 7.2. The RPM installs apache with php, etc. as part of the standard
> > install but --without-mysql in the configuration. I've read quit a bit
on
> > how you are supposed to be able to update the configuration etc.
> > ./configure --with-mysql=/usr/bin/mysql etc. The trouble is I have no
clue
> > as to what directory I'm suppose to be running this in. I'm tempted to
> > install a newer version of PHP (Red Hat 7.2 comes with 4.0.6) as the
> > documentation on installing from source code seems to be a bit clearer.
> Can
> > I install over the top of the existing module or would I have to
uninstall
> > that package first?
>
> If all you want is to add mysql support in php then its just a matter of
> installation relevant RPM(s) which for RH7.2 is
php-mysql-4.0.6-7.i386.rpm.
>
> I would advise against mixing RPM and source installs for Apache-PHP. My
own
> preference is to install AMP (Apache, MySQL, PHP) from source. Search
google
> for 'lamp php apache' to find the LAMP guide which shows you how to
install
> all 3 from source. DevShed also has a nice guide called "The Soothingly
> Seamless Setup of Apache, SSL, MySQL ,and PHP".
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> As Zeus said to Narcissus, "Watch yourself."
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




RE: [PHP] newbie configuration question

2002-04-05 Thread Eric Kilgore

Interestingly, php-mysql-4.0.6-7.i38.rpm is installed, but phpinfo still
shows --without-mysql


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 9:05 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] newbie configuration question


On Saturday 06 April 2002 11:12, Eric Kilgore wrote:
> I'm a newbie to Linux and Apache, not so new to php itself. I'm using Red
> Hat 7.2. The RPM installs apache with php, etc. as part of the standard
> install but --without-mysql in the configuration. I've read quit a bit on
> how you are supposed to be able to update the configuration etc.
> ./configure --with-mysql=/usr/bin/mysql etc. The trouble is I have no clue
> as to what directory I'm suppose to be running this in. I'm tempted to
> install a newer version of PHP (Red Hat 7.2 comes with 4.0.6) as the
> documentation on installing from source code seems to be a bit clearer.
Can
> I install over the top of the existing module or would I have to uninstall
> that package first?

If all you want is to add mysql support in php then its just a matter of
installation relevant RPM(s) which for RH7.2 is php-mysql-4.0.6-7.i386.rpm.

I would advise against mixing RPM and source installs for Apache-PHP. My own
preference is to install AMP (Apache, MySQL, PHP) from source. Search google
for 'lamp php apache' to find the LAMP guide which shows you how to install
all 3 from source. DevShed also has a nice guide called "The Soothingly
Seamless Setup of Apache, SSL, MySQL ,and PHP".


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

/*
As Zeus said to Narcissus, "Watch yourself."
*/

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


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




Re: [PHP] MYSQL maximum query size?

2002-04-05 Thread Jason Wong

On Saturday 06 April 2002 06:01, Phil Schwarzmann wrote:
> Is there a maximum number of characters you can use in a query?
>
> I have a giant query using the UPDATE command (updating about 120
> different columns).

Yes there is.

> I run this query of mine and nothing happens.  No errors.  No updates
> either.

Better check manual. Or ask on the mysql list. 


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

/*
You can do this in a number of ways.  IBM chose to do all of them.
Why do you find that funny?
-- D. Taylor, Computer Science 350
*/

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




Re: [PHP] newbie configuration question

2002-04-05 Thread Jason Wong

On Saturday 06 April 2002 11:12, Eric Kilgore wrote:
> I'm a newbie to Linux and Apache, not so new to php itself. I'm using Red
> Hat 7.2. The RPM installs apache with php, etc. as part of the standard
> install but --without-mysql in the configuration. I've read quit a bit on
> how you are supposed to be able to update the configuration etc.
> ./configure --with-mysql=/usr/bin/mysql etc. The trouble is I have no clue
> as to what directory I'm suppose to be running this in. I'm tempted to
> install a newer version of PHP (Red Hat 7.2 comes with 4.0.6) as the
> documentation on installing from source code seems to be a bit clearer. Can
> I install over the top of the existing module or would I have to uninstall
> that package first?

If all you want is to add mysql support in php then its just a matter of 
installation relevant RPM(s) which for RH7.2 is php-mysql-4.0.6-7.i386.rpm. 

I would advise against mixing RPM and source installs for Apache-PHP. My own 
preference is to install AMP (Apache, MySQL, PHP) from source. Search google 
for 'lamp php apache' to find the LAMP guide which shows you how to install 
all 3 from source. DevShed also has a nice guide called "The Soothingly 
Seamless Setup of Apache, SSL, MySQL ,and PHP".


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

/*
As Zeus said to Narcissus, "Watch yourself."
*/

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




Re: [PHP] getting slash with single quotes in form mail

2002-04-05 Thread Jason Wong

On Saturday 06 April 2002 09:46, Rob Packer wrote:
> Hi,
> I have a contact form and when someone fills it out, all the single
> quotes (apostrophes) end up having a slash in front of them in the e-mail,
> like this:
>
>  I\'m
>
>  Can someone tell me how to stop this? Thanks you.

Check out the setting of "magic_quotes_gpc" in php.ini.


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

/*
"Elves and Dragons!" I says to him.  "Cabbages and potatoes are better
for you and me."
-- J. R. R. Tolkien
*/

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




Re: [PHP] PHP Authorize.net interface

2002-04-05 Thread olinux

http://www.zend.com/codex.php?CID=22

olinux


--- David Johansen <[EMAIL PROTECTED]> wrote:
> I was wondering if someone just point me to a good
> example of a PHP
> interface for Authorize.net to work with ADC Relay
> Response. Thanks,
> Dave
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

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




RE: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Maxim Maletsky


There we go.

Thanks Rodolfo.






Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com




> -Original Message-
> From: Rodolfo Gonzalez [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 06, 2002 2:23 AM
> To: Maxim Maletsky
> Cc: 'James Cox'; 'Andrew Brampton'; [EMAIL PROTECTED]
> Subject: RE: [PHP] nl2br returns ? normality or a bug?
> 
> On Sat, 6 Apr 2002, Maxim Maletsky wrote:
> > But again (I like insisting on such things),
> > Why do I have it now and didn't have it before? Why did it change
> > anyway? I haven't seen it on any other my server and I use it quite
a
> > lot.
> 
> Directly from the manual:
> 
> Note:  Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All
> versions before 4.0.5 will return string with '' inserted before
> newlines instead of ''.
> 
> http://www.php.net/manual/en/function.nl2br.php
> 
> Regards.
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




[PHP] newbie configuration question

2002-04-05 Thread Eric Kilgore

I'm a newbie to Linux and Apache, not so new to php itself. I'm using Red
Hat 7.2. The RPM installs apache with php, etc. as part of the standard
install but --without-mysql in the configuration. I've read quit a bit on
how you are supposed to be able to update the configuration etc.
./configure --with-mysql=/usr/bin/mysql etc. The trouble is I have no clue
as to what directory I'm suppose to be running this in. I'm tempted to
install a newer version of PHP (Red Hat 7.2 comes with 4.0.6) as the
documentation on installing from source code seems to be a bit clearer. Can
I install over the top of the existing module or would I have to uninstall
that package first?

Any help would be greatly appreciated.

Eric


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




Re: [PHP] Getting my host to implement CURL

2002-04-05 Thread Bob

Depends on the OS of your host.. On Linux it took me about 48 seconds to
setup.. Just be sure to compile it sith SSL..

Bob

- Original Message -
From: "Georgie Casey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 05, 2002 6:33 PM
Subject: [PHP] Getting my host to implement CURL


> Would it be hard? Like, is it a lot of work for them and/or a security
risk?
>
> --
> Regards,
> Georgie Casey
> [EMAIL PROTECTED]
>
> ***
> http://www.filmfind.tv
> Online Film Production Directory
> ***
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] Can't get this code to work...

2002-04-05 Thread Analysis & Solutions

Hey Rob:

On Fri, Apr 05, 2002 at 08:31:15PM -0800, Rob Packer wrote:

>  if ("\$checkbox".$cb[$i]=="validate")
>   {echo"can NOT get here";// HINT, HINT

Because you're making a string "$checkboxName"  Of course it doesn't 
equal "validate"

If you want to evaluate the variable $checkboxName, you need to write:

   $var = "checkbox$cb[$i]";
   if ($$var == 'validate')

But, of course, that assumes you actually set the name of your checkbox 
to "checkboxName" and the value of that checkbox to "validate"

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




Re: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Justin French

on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED]) wrote:

> You're deadly wrong, Justin. Years of coding and I have never seen this
> behavior of nl2br(). Perhaps I missed its new behavior's introduction
> (guilty as charged if so) but I only remember it returning me  not
> . I have several regex depending on it.

Well, I've been at this PHP thing for 2 years, and like I said, "for as long
as *I* can remember, it's been ".  Perhaps it was introduced in PHP4,
perhaps earlier.  I was not an in depth user of PHP3.

But I can't be "deadly wrong" :)


> False!
> 
> It DOES NOT work fine in every browser. I'd love to give you a prov, but
> because I am lazy I will just tell you this formula:
> 
> 
> if("I found this issue"=="I noticed screwed pages on my site") {
> All I did: preg_replace("]*>", "", $text); {
> ...and pages became pretty again.
> }
> }
> 
> /// preg 'couse I had no idea what comes up next :-)

Again.  I was only stating MY experience.  "Every browser I can get my hands
on".  I do extensive testing, and have never seen a  or  or 
misbehave.

If you have seen it perform unexpectedly, I'm keen to hear about.


In fact, if this is the case, then I'll be writing my own nl2br function
which returns a , to avoid this problem ever again.


Perhaps in future releases, nl2br() should have an option flag for switching
between XHTML and HTML?  I can't see why the powers that be would have
included XHTML compliance if it wasn't backwards compatible.



> when was it changed? Is there any reference?

I went to php.net/nl2br and this line of text was in there:

"Note: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All versions
before 4.0.5 will return string with '' inserted before newlines instead
of ''."

:)

So it would appear that I've only been using nl2br since I got my hands on
PHP4.05+, which according to the earliest date I can find, was released
sometime around 2001-04-30.



Justin French

Creative Director
http://Indent.com.au



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




[PHP] Getting my host to implement CURL

2002-04-05 Thread Georgie Casey

Would it be hard? Like, is it a lot of work for them and/or a security risk?

--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***
http://www.filmfind.tv
Online Film Production Directory
***



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




[PHP] Can't get this code to work...

2002-04-05 Thread Rob Packer

Sorry for the vague Subject, but I have this code that looks fine to me.
There's some logical error, because I can't get to the second if statement,
although when I echo "\$".$cb[$i] I get $checkboxName. If I hard code
$checkboxName it will work though. Anyone know why? TIA!

$num_fields= 8 ;//the number of fields on the form!
$cb=array("Name", "Address", "State", "Zip", "Phone", "Email", "Comments",
"Fax");
for($i=0; $i<$num_fields; $i++){

if ("\$".$cb[$i] !="")
{
 // CAN GET HERE
 if ("\$checkbox".$cb[$i]=="validate")
  {echo"can NOT get here";// HINT, HINT
  $form_write_msg .=
   'if (!$cb[$i])
   {$error_msg.="Your " . $cb[$i] . " .\n";}
   if ("\$".$cb[$i]){
  $msg.="\$".$cb[$i].": \t" . $cb[$i] . " . \n";}
   '
  ;}elseif("\$checkbox".$cb[$i]=="no")
   {$form_write_msg.=
   'if ("\$".$cb[$i]){
  $msg.=$cb[$i]  .": \t " .$cb[$i]. " . \n";}
   '
  ;}
;}



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




RE: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Rodolfo Gonzalez

On Sat, 6 Apr 2002, Maxim Maletsky wrote:
> But again (I like insisting on such things),
> Why do I have it now and didn't have it before? Why did it change
> anyway? I haven't seen it on any other my server and I use it quite a
> lot.

Directly from the manual:

Note:  Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All 
versions before 4.0.5 will return string with '' inserted before 
newlines instead of ''.

http://www.php.net/manual/en/function.nl2br.php

Regards.


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




RE: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Maxim Maletsky

> nl2br() has returned  for as long as I can remember.

You're deadly wrong, Justin. Years of coding and I have never seen this
behavior of nl2br(). Perhaps I missed its new behavior's introduction
(guilty as charged if so) but I only remember it returning me  not
. I have several regex depending on it.

> As far as my limited knowledge goes, it's to do with the future.  XML
and
> related languages do/will require all single tags (ie not something
like
>  which has an open and close) to have the form .

That's true, I suppose

> This would apply to things like   and many others.
> 
> I have no idea why it places the space in, but I do know that i've
done a
> LOT of testing and  works fine in every browser I've ever got my
hands
> on.

False!

It DOES NOT work fine in every browser. I'd love to give you a prov, but
because I am lazy I will just tell you this formula: 


if("I found this issue"=="I noticed screwed pages on my site") {
All I did: preg_replace("]*>", "", $text); {  
...and pages became pretty again.
}
}

/// preg 'couse I had no idea what comes up next :-)

> Of course, if you don't like it, you can add a str_replace in MANY
ways:
> 
>  $text = nl2br($text);
> $text = str_replace("","",$text);
> ?>

yup

 
> So, to answer your Q, it's a normality.  Sorry I can't provide a full
reason
> why :)
> 


when was it changed? Is there any reference?

 
> Justin French
> 
> Creative Director
> http://Indent.com.au
> 
> 
> 
> 
> 
> on 06/04/02 10:13 AM, Maxim Maletsky ([EMAIL PROTECTED])
wrote:
> 
> >
> > I've never seen that nl2rb would return me  instead of the
> > traditional . But it did.
> >
> > Is that normal or it that a bug?
> >
> >
> > Here's some test code:
> >
> >  >
> > $text = "
> >
> > Hello
> >
> > this is
> > the
> > silliest
> >
> > test
> >
> > I can
> >
> >
> > ever
> >
> > invent
> >
> > ";
> >
> > echo nl2br($text);
> >
> > echo "on machine: $SERVER_SOFTWARE";
> >
> > ?>
> >
> >
> > returns me such HTML:
> >
> > --
> >
> > 
> >
> > 
> > Hello
> > 
> >
> > 
> > this is
> > 
> > the
> > 
> > silliest
> > 
> >
> > 
> > test
> > 
> >
> > 
> > I can
> > 
> >
> > 
> >
> > 
> > ever
> > 
> >
> > 
> > invent
> > 
> >
> > 
> > on machine: [Apache-AdvancedExtranetServer/1.3.22 (Mandrake
> > Linux/1.2mdk) mod_ssl/2.8.5 OpenSSL/0.9.6 PHP/4.0.6]
> > --
> >
> >
> >
> > I've triple-checked for what ANSI characters I had there. They were
> > fine. And as you can read below, there were the same as when nl2br
used
> > to return me .
> >
> > The problem has never occurred to me on any of the previous machines
> > site was hosted on. It does on this one though, with even the same
> > version of PHP and the same data from DB. I've noticed this problem
> > because I had a RegEx after nl2br() that always worked till we
migrated
> > on a new server, then my expression has obviously stopped to work
> > because of that extra space and slash nl2br kindly provided me with.
> > Temporarily fixed with another RegEx. But, I was wondering, is a
known
> > bug or it's because of my machine? Other than that nothing has
> > changed...
> >
> > Enlighten me on this, please. Did I miss a bug report?
> >
> >
> > Sincerely,
> >
> > Maxim Maletsky
> > Founder, Chief Developer
> >
> > PHPBeginner.com (Where PHP Begins)
> > [EMAIL PROTECTED]
> > www.phpbeginner.com
> >



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




Re: [PHP] IE 5.0 Trouble

2002-04-05 Thread Alexandra Aguiar

well.. i dunno y yet.. but  if the (from)email  is [EMAIL PROTECTED]
it worked.. but i tried other email and it doesnt work  (that happens only
for  IE 5.0 ...)
kknow y ??

 - Original Message -
From: "Analysis & Solutions" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Friday, April 05, 2002 9:46 PM
Subject: Re: [PHP] IE 5.0 Trouble


On Fri, Apr 05, 2002 at 09:03:04PM -0300, Alexandra Aguiar wrote:
>
> well.. i got a script that sends an email automatically to the user (he
> informed his email) . everything works fine .. but that the IE 5.0 users
> just don't receive the email!!
>
> any1 know y ??

Because there's a bug in your script and/or or HTML?

Post the code.

--Dan

--
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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



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




RE: [PHP] CRONTAB

2002-04-05 Thread Julian

YES!!  MY SCRIPT RUN AND I'M NOT RECEIVING ANY EMAIL!

Thanks to all!!

Specials thanks to Miguel and Dan!!

Regards! Julian



- Original Message - 
From: Analysis & Solutions 
To: PHP List 
Sent: Friday, April 05, 2002 9:44 PM
Subject: Re: [PHP] CRONTAB


On Fri, Apr 05, 2002 at 09:42:02PM -0300, Julian wrote:
> 0 0 * * * /usr/bin/php /path/to/my/script.php
> 
> But I continue receiving an email each time that the script run that say:
> 
> X-Powered-By: PHP/4.0.6
> Content-type: text/html

Those two lines are PHP's default output.  Crontab, by default, sends 
output of programs to the user by email.  You can change both behaviors 
by doing this:

0 0 * * * /usr/bin/php -q /path/to/my/script.php >> /dev/null 2>&1

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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



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




Re: [PHP] IE 5.0 Trouble

2002-04-05 Thread Analysis & Solutions

On Fri, Apr 05, 2002 at 09:03:04PM -0300, Alexandra Aguiar wrote:
> 
> well.. i got a script that sends an email automatically to the user (he
> informed his email) . everything works fine .. but that the IE 5.0 users
> just don't receive the email!!
> 
> any1 know y ??

Because there's a bug in your script and/or or HTML?

Post the code.

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




Re: [PHP] CRONTAB

2002-04-05 Thread Analysis & Solutions

On Fri, Apr 05, 2002 at 09:42:02PM -0300, Julian wrote:
> 0 0 * * * /usr/bin/php /path/to/my/script.php
> 
> But I continue receiving an email each time that the script run that say:
> 
> X-Powered-By: PHP/4.0.6
> Content-type: text/html

Those two lines are PHP's default output.  Crontab, by default, sends 
output of programs to the user by email.  You can change both behaviors 
by doing this:

0 0 * * * /usr/bin/php -q /path/to/my/script.php >> /dev/null 2>&1

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




RE: [PHP] CRONTAB

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Julian wrote:
> My script run fine with:
> 
> 0 0 * * * /usr/bin/php /path/to/my/script.php
> 
> But I continue receiving an email each time that the script run that say:
> 
> X-Powered-By: PHP/4.0.6
> Content-type: text/html

PHP thinks it's producing output to be sent via a web server, so it 
outputs those headery lines.

Changing "/usr/bin/php" to "/usr/bin/php -q" will probably fix the
problem.

miguel


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




RE: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Maxim Maletsky


OK, James, even worth.

But again (I like insisting on such things),
Why do I have it now and didn't have it before? Why did it change
anyway? I haven't seen it on any other my server and I use it quite a
lot.



Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com




> -Original Message-
> From: James Cox [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 06, 2002 2:34 AM
> To: Maxim Maletsky; 'Andrew Brampton'; [EMAIL PROTECTED]
> Subject: RE: [PHP] nl2br returns ? normality or a bug?
> 
> actually,
> 
>  is not parsed in the same way as  for many browsers. 
is
> XHTML, and is not a fully supported language set yet.
> 
> --
> James Cox :: [EMAIL PROTECTED] :: Landonize It! http://landonize.it/
> Was I helpful?
http://www.amazon.co.uk/exec/obidos/wishlist/23IVGHQ61RJGO/
> 
> -Original Message-
> From: Maxim Maletsky [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 06, 2002 1:31 AM
> To: 'Andrew Brampton'; [EMAIL PROTECTED]
> Subject: RE: [PHP] nl2br returns ? normality or a bug?
> 
> 
> 
> Not same, Andrew, It had made my pages VERY VERY UGLY!
> 
> I know that it can be parsed well, but should not have done such
effect
> on the site. I wouldn't care about this thing if I wouldn't find a few
> pages on my site 1000 pixel wide.
> 
> But, the question is: why only on this machine? I run the same PHP
> version and use same data as before.
> 
> 
> 
> Sincerely,
> 
> Maxim Maletsky
> Founder, Chief Developer
> 
> PHPBeginner.com (Where PHP Begins)
> [EMAIL PROTECTED]
> www.phpbeginner.com
> 
> 
> 
> > -Original Message-
> > From: Andrew Brampton [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, April 06, 2002 2:21 AM
> > To: Maxim Maletsky; [EMAIL PROTECTED]
> > Subject: Re: [PHP] nl2br returns ? normality or a bug?
> >
> >  is that XML style newline or something...
> >
> > Don't worry about it, it parsed the same as 
> >
> > Andrew
> > - Original Message -
> > From: "Maxim Maletsky" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, April 06, 2002 1:13 AM
> > Subject: [PHP] nl2br returns ? normality or a bug?
> >
> >
> > >
> > > I've never seen that nl2rb would return me  instead of the
> > > traditional . But it did.
> > >
> > > Is that normal or it that a bug?
> > >
> > >
> > > Here's some test code:
> > >
> > >  > >
> > > $text = "
> > >
> > > Hello
> > >
> > > this is
> > > the
> > > silliest
> > >
> > > test
> > >
> > > I can
> > >
> > >
> > > ever
> > >
> > > invent
> > >
> > > ";
> > >
> > > echo nl2br($text);
> > >
> > > echo "on machine: $SERVER_SOFTWARE";
> > >
> > > ?>
> > >
> > >
> > > returns me such HTML:
> > >
> > > --
> > >
> > > 
> > >
> > > 
> > > Hello
> > > 
> > >
> > > 
> > > this is
> > > 
> > > the
> > > 
> > > silliest
> > > 
> > >
> > > 
> > > test
> > > 
> > >
> > > 
> > > I can
> > > 
> > >
> > > 
> > >
> > > 
> > > ever
> > > 
> > >
> > > 
> > > invent
> > > 
> > >
> > > 
> > > on machine: [Apache-AdvancedExtranetServer/1.3.22 (Mandrake
> > > Linux/1.2mdk) mod_ssl/2.8.5 OpenSSL/0.9.6 PHP/4.0.6]
> > > --
> > >
> > >
> > >
> > > I've triple-checked for what ANSI characters I had there. They
were
> > > fine. And as you can read below, there were the same as when nl2br
> used
> > > to return me .
> > >
> > > The problem has never occurred to me on any of the previous
machines
> > > site was hosted on. It does on this one though, with even the same
> > > version of PHP and the same data from DB. I've noticed this
problem
> > > because I had a RegEx after nl2br() that always worked till we
> migrated
> > > on a new server, then my expression has obviously stopped to work
> > > because of that extra space and slash nl2br kindly provided me
with.
> > > Temporarily fixed with another RegEx. But, I was wondering, is a
> known
> > > bug or it's because of my machine? Other than that nothing has
> > > changed...
> > >
> > > Enlighten me on this, please. Did I miss a bug report?
> > >
> > >
> > > Sincerely,
> > >
> > > Maxim Maletsky
> > > Founder, Chief Developer
> > >
> > > PHPBeginner.com (Where PHP Begins)
> > > [EMAIL PROTECTED]
> > > www.phpbeginner.com
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




RE: [PHP] CRONTAB

2002-04-05 Thread Julian

Hi Miguel!!

Thank you for your help!

My script run fine with:

0 0 * * * /usr/bin/php /path/to/my/script.php

But I continue receiving an email each time that the script run that say:

X-Powered-By: PHP/4.0.6
Content-type: text/html


I don't understand it, because in my script I didn't put content of this
type

Do you know what is the problem now??

Regards and thank for your time!! Julian



- Original Message -
From: Miguel Cruz
To: Julian
Cc: [EMAIL PROTECTED]
Sent: Friday, April 05, 2002 7:26 PM
Subject: Re: [PHP] CRONTAB


On Fri, 5 Apr 2002, Julian wrote:
> I am attempting execute automatically an script PHP, all the days at a
> certain hour.
>
> I configured the cron to executes it, but when it is executed, instead of
> working, I receive an email in
> my main account where say:
>
> /home/vipteam/public_html/distribuidor/mailf.php: echoNo tinterrumpir:
> command not found

If you are running from cron, you need to tell it to use the php
interpreter.

So either tell it in your crontab entry with something like:

  0 * * * * /usr/local/bin/php /blah/blah/mailf.php

Or channel it through your web server with something like this:

  0 * * * * /usr/bin/lynx http://127.0.0.1/distribuidor/mailf.php

Or put a comment in the first line of your PHP file that tells the shell
to use PHP to run it:

  #!/usr/local/bin/php

All of these paths are samples; you'll need to figure out where these
things are on your system.

miguel




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


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




RE: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread James Cox

actually,

 is not parsed in the same way as  for many browsers.  is
XHTML, and is not a fully supported language set yet.

--
James Cox :: [EMAIL PROTECTED] :: Landonize It! http://landonize.it/
Was I helpful?  http://www.amazon.co.uk/exec/obidos/wishlist/23IVGHQ61RJGO/

-Original Message-
From: Maxim Maletsky [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 06, 2002 1:31 AM
To: 'Andrew Brampton'; [EMAIL PROTECTED]
Subject: RE: [PHP] nl2br returns ? normality or a bug?



Not same, Andrew, It had made my pages VERY VERY UGLY!

I know that it can be parsed well, but should not have done such effect
on the site. I wouldn't care about this thing if I wouldn't find a few
pages on my site 1000 pixel wide.

But, the question is: why only on this machine? I run the same PHP
version and use same data as before.



Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com



> -Original Message-
> From: Andrew Brampton [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 06, 2002 2:21 AM
> To: Maxim Maletsky; [EMAIL PROTECTED]
> Subject: Re: [PHP] nl2br returns ? normality or a bug?
>
>  is that XML style newline or something...
>
> Don't worry about it, it parsed the same as 
>
> Andrew
> - Original Message -
> From: "Maxim Maletsky" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, April 06, 2002 1:13 AM
> Subject: [PHP] nl2br returns ? normality or a bug?
>
>
> >
> > I've never seen that nl2rb would return me  instead of the
> > traditional . But it did.
> >
> > Is that normal or it that a bug?
> >
> >
> > Here's some test code:
> >
> >  >
> > $text = "
> >
> > Hello
> >
> > this is
> > the
> > silliest
> >
> > test
> >
> > I can
> >
> >
> > ever
> >
> > invent
> >
> > ";
> >
> > echo nl2br($text);
> >
> > echo "on machine: $SERVER_SOFTWARE";
> >
> > ?>
> >
> >
> > returns me such HTML:
> >
> > --
> >
> > 
> >
> > 
> > Hello
> > 
> >
> > 
> > this is
> > 
> > the
> > 
> > silliest
> > 
> >
> > 
> > test
> > 
> >
> > 
> > I can
> > 
> >
> > 
> >
> > 
> > ever
> > 
> >
> > 
> > invent
> > 
> >
> > 
> > on machine: [Apache-AdvancedExtranetServer/1.3.22 (Mandrake
> > Linux/1.2mdk) mod_ssl/2.8.5 OpenSSL/0.9.6 PHP/4.0.6]
> > --
> >
> >
> >
> > I've triple-checked for what ANSI characters I had there. They were
> > fine. And as you can read below, there were the same as when nl2br
used
> > to return me .
> >
> > The problem has never occurred to me on any of the previous machines
> > site was hosted on. It does on this one though, with even the same
> > version of PHP and the same data from DB. I've noticed this problem
> > because I had a RegEx after nl2br() that always worked till we
migrated
> > on a new server, then my expression has obviously stopped to work
> > because of that extra space and slash nl2br kindly provided me with.
> > Temporarily fixed with another RegEx. But, I was wondering, is a
known
> > bug or it's because of my machine? Other than that nothing has
> > changed...
> >
> > Enlighten me on this, please. Did I miss a bug report?
> >
> >
> > Sincerely,
> >
> > Maxim Maletsky
> > Founder, Chief Developer
> >
> > PHPBeginner.com (Where PHP Begins)
> > [EMAIL PROTECTED]
> > www.phpbeginner.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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


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




RE: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Maxim Maletsky


Not same, Andrew, It had made my pages VERY VERY UGLY!

I know that it can be parsed well, but should not have done such effect
on the site. I wouldn't care about this thing if I wouldn't find a few
pages on my site 1000 pixel wide.

But, the question is: why only on this machine? I run the same PHP
version and use same data as before.



Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com



> -Original Message-
> From: Andrew Brampton [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 06, 2002 2:21 AM
> To: Maxim Maletsky; [EMAIL PROTECTED]
> Subject: Re: [PHP] nl2br returns ? normality or a bug?
> 
>  is that XML style newline or something...
> 
> Don't worry about it, it parsed the same as 
> 
> Andrew
> - Original Message -
> From: "Maxim Maletsky" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, April 06, 2002 1:13 AM
> Subject: [PHP] nl2br returns ? normality or a bug?
> 
> 
> >
> > I've never seen that nl2rb would return me  instead of the
> > traditional . But it did.
> >
> > Is that normal or it that a bug?
> >
> >
> > Here's some test code:
> >
> >  >
> > $text = "
> >
> > Hello
> >
> > this is
> > the
> > silliest
> >
> > test
> >
> > I can
> >
> >
> > ever
> >
> > invent
> >
> > ";
> >
> > echo nl2br($text);
> >
> > echo "on machine: $SERVER_SOFTWARE";
> >
> > ?>
> >
> >
> > returns me such HTML:
> >
> > --
> >
> > 
> >
> > 
> > Hello
> > 
> >
> > 
> > this is
> > 
> > the
> > 
> > silliest
> > 
> >
> > 
> > test
> > 
> >
> > 
> > I can
> > 
> >
> > 
> >
> > 
> > ever
> > 
> >
> > 
> > invent
> > 
> >
> > 
> > on machine: [Apache-AdvancedExtranetServer/1.3.22 (Mandrake
> > Linux/1.2mdk) mod_ssl/2.8.5 OpenSSL/0.9.6 PHP/4.0.6]
> > --
> >
> >
> >
> > I've triple-checked for what ANSI characters I had there. They were
> > fine. And as you can read below, there were the same as when nl2br
used
> > to return me .
> >
> > The problem has never occurred to me on any of the previous machines
> > site was hosted on. It does on this one though, with even the same
> > version of PHP and the same data from DB. I've noticed this problem
> > because I had a RegEx after nl2br() that always worked till we
migrated
> > on a new server, then my expression has obviously stopped to work
> > because of that extra space and slash nl2br kindly provided me with.
> > Temporarily fixed with another RegEx. But, I was wondering, is a
known
> > bug or it's because of my machine? Other than that nothing has
> > changed...
> >
> > Enlighten me on this, please. Did I miss a bug report?
> >
> >
> > Sincerely,
> >
> > Maxim Maletsky
> > Founder, Chief Developer
> >
> > PHPBeginner.com (Where PHP Begins)
> > [EMAIL PROTECTED]
> > www.phpbeginner.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Miguel Cruz

On Sat, 6 Apr 2002, Maxim Maletsky wrote:
> I've never seen that nl2rb would return me  instead of the
> traditional . But it did. 
> 
> Is that normal or it that a bug?

In Yon Coming Days of HTML ye shall find that such notation is The Way And 
The Law.

Might as well get used to it...

miguel


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




Re: [PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Andrew Brampton

 is that XML style newline or something...

Don't worry about it, it parsed the same as 

Andrew
- Original Message - 
From: "Maxim Maletsky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 1:13 AM
Subject: [PHP] nl2br returns ? normality or a bug?


> 
> I've never seen that nl2rb would return me  instead of the
> traditional . But it did. 
> 
> Is that normal or it that a bug?
> 
> 
> Here's some test code:
> 
>  
> $text = "
> 
> Hello 
> 
> this is
> the 
> silliest
> 
> test
> 
> I can
> 
> 
> ever
> 
> invent
> 
> ";
> 
> echo nl2br($text);
> 
> echo "on machine: $SERVER_SOFTWARE";
> 
> ?>
> 
> 
> returns me such HTML:
> 
> --
> 
> 
> 
> 
> Hello 
> 
> 
> 
> this is
> 
> the 
> 
> silliest
> 
> 
> 
> test
> 
> 
> 
> I can
> 
> 
> 
> 
> 
> ever
> 
> 
> 
> invent
> 
> 
> 
> on machine: [Apache-AdvancedExtranetServer/1.3.22 (Mandrake
> Linux/1.2mdk) mod_ssl/2.8.5 OpenSSL/0.9.6 PHP/4.0.6]
> --
> 
> 
> 
> I've triple-checked for what ANSI characters I had there. They were
> fine. And as you can read below, there were the same as when nl2br used
> to return me .
> 
> The problem has never occurred to me on any of the previous machines
> site was hosted on. It does on this one though, with even the same
> version of PHP and the same data from DB. I've noticed this problem
> because I had a RegEx after nl2br() that always worked till we migrated
> on a new server, then my expression has obviously stopped to work
> because of that extra space and slash nl2br kindly provided me with.
> Temporarily fixed with another RegEx. But, I was wondering, is a known
> bug or it's because of my machine? Other than that nothing has
> changed...
> 
> Enlighten me on this, please. Did I miss a bug report?
> 
> 
> Sincerely,
> 
> Maxim Maletsky
> Founder, Chief Developer
> 
> PHPBeginner.com (Where PHP Begins)
> [EMAIL PROTECTED]
> www.phpbeginner.com
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




[PHP] nl2br returns ? normality or a bug?

2002-04-05 Thread Maxim Maletsky


I've never seen that nl2rb would return me  instead of the
traditional . But it did. 

Is that normal or it that a bug?


Here's some test code:




returns me such HTML:

--




Hello 



this is

the 

silliest



test



I can





ever



invent



on machine: [Apache-AdvancedExtranetServer/1.3.22 (Mandrake
Linux/1.2mdk) mod_ssl/2.8.5 OpenSSL/0.9.6 PHP/4.0.6]
--



I've triple-checked for what ANSI characters I had there. They were
fine. And as you can read below, there were the same as when nl2br used
to return me .

The problem has never occurred to me on any of the previous machines
site was hosted on. It does on this one though, with even the same
version of PHP and the same data from DB. I've noticed this problem
because I had a RegEx after nl2br() that always worked till we migrated
on a new server, then my expression has obviously stopped to work
because of that extra space and slash nl2br kindly provided me with.
Temporarily fixed with another RegEx. But, I was wondering, is a known
bug or it's because of my machine? Other than that nothing has
changed...

Enlighten me on this, please. Did I miss a bug report?


Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com


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




[PHP] IE 5.0 Trouble

2002-04-05 Thread Alexandra Aguiar

hi list!

well.. i got a script that sends an email automatically to the user (he =
informed his email) . everything works fine .. but that the IE 5.0 users =
just don't receive the email!!

any1 know y ??

thnx in advance

Alexandra Aguiar
ps.: in other browsers it works just fine...



[PHP] Re: some kind of "library loader"

2002-04-05 Thread Eric Thelin

I have had a similar idea.  I also tried the custom error handler
aproach and it didn't work here either.  I have set the project aside
that I was thinking about it for but I do have some ideas that would
help and may be able to contribute.  I wasn't even able to get php to
call my custom error handler for function not found errors.  How did you
do that?  Was there anything useful in the context argument?  My guess
is that to get this aproach to work would require hacking the code to
php itself but the hack wouldn't be very major.  However I do have an
alternate plan that has been waiting for me to get around to building it
is a simple parser that will read a php file and get the required
functions and classes and then pre build a library file for just that
page.  The parsing shouldn't be that dificult as all function calls
begin with 'func(' and for classes checking for 'new classname' or
'classname::' would give me a list of all items that need to be checked
for.  Then simply build (from the source) a list of all builtin php
functions and allow those and check for declarations of inline functions
and classes while parsing and remove those.  That would leave a list of
functions and classes that are external.  Then build a database of
classes and functions either as a real database or simple an index of
the files that contain each resource.  I don't think it would be too
hard.  The next step would be to make a publicly available archive of
functions and classes that fit into this index.  Or to build it into
pear.

Please keep in touch with me on this issue.  Feel free to email me off
list if you want.

Eric

On Wed, 3 Apr 2002, Arpad Tamas wrote:

> Hi Everyone!
>
> I have an idea, but I don't know how to realise it, if it can be at
> all.
> We have a relatively big system, with 52k lines of php code without
> much html, and many classes (1138) that depend on each other.
> And I think I don't need to say that php parses the code somewhat
> slow. That's what I'm trying to solve. I know there are code caches,
> but none of them suits all of our customers or our needs (price,
> effectiveness).
> Of course not all classes are needed on every page request, so I'm
> trying to separate them, and require them when they are really
> needed, but that's not easy with 1100 classes.
>
> So I thought I'd write a custom error handler, and when an unloaded
> class is created or it's static method is accessed an error would
> be triggered and I'd require it in the error handler. The "only"
> problem is, that after the error handler finished the main code is
> executed *after* the "statement" that triggered the error, so I can't
> tell php to give one more try for the previously faulty code.
>
> Is there any chance for this to work with some trick, or do you know
> of a better sollution for the problem?
>
> Thanks for your help,
>
>   Arpi
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




RE: [PHP] getting slash with single quotes in form mail

2002-04-05 Thread Rick Emery

stripslashes($text)

-Original Message-
From: Rob Packer [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 7:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP] getting slash with single quotes in form mail


Hi,
I have a contact form and when someone fills it out, all the single
quotes (apostrophes) end up having a slash in front of them in the e-mail,
like this:

 I\'m

 Can someone tell me how to stop this? Thanks you.
Rob



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

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




[PHP] getting slash with single quotes in form mail

2002-04-05 Thread Rob Packer

Hi,
I have a contact form and when someone fills it out, all the single
quotes (apostrophes) end up having a slash in front of them in the e-mail,
like this:

 I\'m

 Can someone tell me how to stop this? Thanks you.
Rob



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




Re: [PHP] CRONTAB

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Julian wrote:
> I am attempting execute automatically an script PHP, all the days at a
> certain hour.
> 
> I configured the cron to executes it, but when it is executed, instead of
> working, I receive an email in
> my main account where say:
> 
> /home/vipteam/public_html/distribuidor/mailf.php: echoNo tinterrumpir:
> command not found

If you are running from cron, you need to tell it to use the php 
interpreter.

So either tell it in your crontab entry with something like:

  0 * * * * /usr/local/bin/php /blah/blah/mailf.php

Or channel it through your web server with something like this:

  0 * * * * /usr/bin/lynx http://127.0.0.1/distribuidor/mailf.php

Or put a comment in the first line of your PHP file that tells the shell 
to use PHP to run it:

  #!/usr/local/bin/php

All of these paths are samples; you'll need to figure out where these 
things are on your system.

miguel




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




RE: [PHP] PHP Clock

2002-04-05 Thread Kevin Stone

If you want a real time clock you're going to have to do it in
Javascript.  If you just want the page to display the current time/date
then look up the date() function on php.net


-Original Message-
From: Chuck "PUP" Payne [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 05, 2002 1:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Clock

Does anyone know where I can get a script to all a clock done in PHP or
will
I have to do it with Java script.

Chuck Payne
Magi Design and Support


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




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




RE: [PHP] PHP books

2002-04-05 Thread Kevin Stone

Ditto on that one Adam.  "PHP And MySQL Web Development" comes highly
recommended.  Big book lots of content.  Real world working examples.
Very well written.  You will break the binding on this book I guarantee
it.  ;)
-Kevin

-Original Message-
From: Adam Alkins [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 05, 2002 2:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP books

A great book I read is PHP and MySQL Web Development, authors Luke
Welling
and Laura Thomson.

Its an excellent book to read if you are new to PHP and MySQL, and even
if
you have a good knowledge. I learnt a lot from it, and still am
learning. :)

Adam

- Original Message -
From: "Mikhail Avrekh" <[EMAIL PROTECTED]>
To: "cyberskydive" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, April 05, 2002 5:21 PM
Subject: Re: [PHP] PHP books


> "Professional PHP Programming" by Castagnetto et al. (from Wrox) is
pretty
> good IMHO. So is "Web application development with PHP", by
> Ratschiller/Gerken. These are the ones I've used for my purposes, as
well
> as for a PHP class that I taught a while back.
>
> On Fri, 5 Apr 2002, cyberskydive wrote:
>
> > I have 2 PHP books
> >
> > the first is called PHP fast & easy web development -from primatech
> >
> > the second is called CORE PHP PROGRAMMING by Leon Atkinson
> >
> > I like them both, and I was glad I read fast & easy first, i like
core
php
> > alot, havent read the whole thing yet, been kinda referencing around
it,
but
> > still reading the whole thing.
> >
> > has anyone else used these books?
> >
> > what are your opinions and what are some other grest books out
there?
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>



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




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




[PHP] CRONTAB

2002-04-05 Thread Julian

Hello to all !!!

I write you because I have the following question:

I am attempting execute automatically an script PHP, all the days at a
certain hour.

I configured the cron to executes it, but when it is executed, instead of
working, I receive an email in
my main account where say:

/home/vipteam/public_html/distribuidor/mailf.php: echoNo tinterrumpir:
command not found
/home/vipteam/public_html/distribuidor/mailf.php: =: command not found
/home/vipteam/public_html/distribuidor/mailf.php: =: command not found
/home/vipteam/public_html/distribuidor/mailf.php: =: command not found
/home/vipteam/public_html/distribuidor/mailf.php: line 10: syntax error near
unexpected token `Rand(1 '
/home/vipteam/public_html/distribuidor/mailf.php: line 10: ` $codigo1 =
rand(1,32767); '


I think that the code is not interpreted. I don't know what happen!

Help, please!

Regards! Julián


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




[PHP] MYSQL maximum query size?

2002-04-05 Thread Phil Schwarzmann

Is there a maximum number of characters you can use in a query?
 
I have a giant query using the UPDATE command (updating about 120
different columns).
 
I run this query of mine and nothing happens.  No errors.  No updates
either.
 
Thanks!!
Phil



Re: [PHP] Speaking of sockets...

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Liam Gibbs wrote:
> I'm trying to connect to the server (same one from
> which the page is at). My code is as follows:
> 
> if($searchsocket = fsockopen("127.0.0.1", 8080,
> &$errornumber, &$errormessage, 30)) {
> 
> Obviously 127.0.0.1 is not the real IP address. But it's at this point
> that it's reporting error number 111 (Connection refused). Is that
> because my line of code is wrong? I'm trying to connect to port 8080.
> Should I just leave the port blank and put :8080 after the IP address?

Nope, you have the port number in the right place. The reason you're 
getting Connection Refused is probably because the connection is being 
refused.

Do you have shell access on the machine where the PHP program is running?
Try using a simple tool like netcat to see whether your connections really 
are being accepted at that port?

miguel


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




[PHP] Speaking of sockets...

2002-04-05 Thread Liam Gibbs

... I gotta problem with them.

I'm trying to connect to the server (same one from
which the page is at). My code is as follows:

if($searchsocket = fsockopen("127.0.0.1", 8080,
&$errornumber, &$errormessage, 30)) {

Obviously 127.0.0.1 is not the real IP address. But
it's at this point that it's reporting error number
111 (Connection refused). Is that because my line of
code is wrong? I'm trying to connect to port 8080.
Should I just leave the port blank and put :8080 after
the IP address? Is this because there could be
something about the server which is breaking the code?
What's going on?

__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

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




Re: [PHP] PHP books

2002-04-05 Thread Adam Alkins

A great book I read is PHP and MySQL Web Development, authors Luke Welling
and Laura Thomson.

Its an excellent book to read if you are new to PHP and MySQL, and even if
you have a good knowledge. I learnt a lot from it, and still am learning. :)

Adam

- Original Message -
From: "Mikhail Avrekh" <[EMAIL PROTECTED]>
To: "cyberskydive" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, April 05, 2002 5:21 PM
Subject: Re: [PHP] PHP books


> "Professional PHP Programming" by Castagnetto et al. (from Wrox) is pretty
> good IMHO. So is "Web application development with PHP", by
> Ratschiller/Gerken. These are the ones I've used for my purposes, as well
> as for a PHP class that I taught a while back.
>
> On Fri, 5 Apr 2002, cyberskydive wrote:
>
> > I have 2 PHP books
> >
> > the first is called PHP fast & easy web development -from primatech
> >
> > the second is called CORE PHP PROGRAMMING by Leon Atkinson
> >
> > I like them both, and I was glad I read fast & easy first, i like core
php
> > alot, havent read the whole thing yet, been kinda referencing around it,
but
> > still reading the whole thing.
> >
> > has anyone else used these books?
> >
> > what are your opinions and what are some other grest books out there?
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>



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




Re: [PHP] PHP books

2002-04-05 Thread Mikhail Avrekh

"Professional PHP Programming" by Castagnetto et al. (from Wrox) is pretty
good IMHO. So is "Web application development with PHP", by
Ratschiller/Gerken. These are the ones I've used for my purposes, as well
as for a PHP class that I taught a while back.

On Fri, 5 Apr 2002, cyberskydive wrote:

> I have 2 PHP books
>
> the first is called PHP fast & easy web development -from primatech
>
> the second is called CORE PHP PROGRAMMING by Leon Atkinson
>
> I like them both, and I was glad I read fast & easy first, i like core php
> alot, havent read the whole thing yet, been kinda referencing around it, but
> still reading the whole thing.
>
> has anyone else used these books?
>
> what are your opinions and what are some other grest books out there?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




[PHP] PHP Clock

2002-04-05 Thread Chuck \"PUP\" Payne

Does anyone know where I can get a script to all a clock done in PHP or will
I have to do it with Java script.

Chuck Payne
Magi Design and Support


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




RE: [PHP] Re: help condensing regular expressions

2002-04-05 Thread Tom Rogers

Hi
For some reason $DOCUMENT_ROOT always points to /usr/local/apache/htocs 
even when the actual document root on the virtual domain is 
/usr/local/apache/domains/domain.com/www/
You can use PATH_TRANSLATED but that doesn't solve the http side when you 
may need to find the images directory from an included file :)
My little relative_root does the trick nicely for both situations, just I 
think the expression I use is very brutal and there is probably a more 
elegant way to arrive at the same result.
Tom

At 06:32 AM 6/04/2002, Collins, Robert wrote:
>why not use somthing like this then
>
>include($DOCUMENT_ROOT."/include/mysql_connect.inc");
>
>
>Robert W. Collins II
>Webmaster
>New Orleans Regional Transit Authority
>Phone : (504) 248-3826
>Email : [EMAIL PROTECTED]
>
>
>
>-Original Message-
>From: Tom Rogers [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 05, 2002 2:33 PM
>To: [EMAIL PROTECTED]
>Subject: Re: [PHP] Re: help condensing regular expressions
>
>
>Hi
>Yes that would be fine for the html examples I gave but the real use is for
>php to find the include directory which I keep out of the server tree, one
>directory back like this
>
>include($relative_root."../include/mysql_connect.inc")
>
>Each domain has its own include directory which I want to keep seperate
>from the default php include directory set in php.ini
>
>The other thing is that this gets rid of the include file inside included
>file problem as long as I set $relative_root at the top level.
>Tom
>
>At 06:26 AM 6/04/2002, Julio Nobrega Trabalhando wrote:
> >   How about:
> >
> >$site_root = '/www/user/htdocs/';
> >
> >
> >
> >   Instead of going relative, go from the root. Or you could put $site_root
> >as your url:
> >
> >$site_root = 'http://www.your_site.com/';
> >
> >--
> >
> >Julio Nobrega.
> >
> >Um dia eu chego lá:
> >http://sourceforge.net/projects/toca
> >
> >Ajudei? Salvei? Que tal um presentinho?
> >http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
> >
> >
> >"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
> >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hi
> > > I am trying to calculate how far into a directory structure I am so that
>I
> > > can include images and include files without having to hard code them.
> > > I need to turn $PHP_SELF which could be /admin/emails/index.php into
> >../../
> > > which I can then use to get to any directory from root.
> > > like IMG src=images/logo.png
> > > Regular expressions leave me cold but I have come up with the following
> > > monster which works
> > >
> > > $relative_root = preg_replace("<\/[[:alnum:]]+>","../",
> > > preg_replace("","",strtok($PHP_SELF,".")));
> > >
> > > Anybody have a better solution?
> > > Thanks for any help.
> > > Tom
> > >
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] Under what circumstances would you use Sockets in PHP?

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Chris wrote:
> Just wondering, under what circumstances would you use sockets under PHP?
> Any examples?

The most obvious answer is to use them for speaking internet protocols not 
directly supported by other functionality in PHP. For instance, there are 
already ways to speak HTTP, but if you need to talk to a whois server, a 
finger server, etc., then it's sockets to the rescue.

miguel


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




[PHP] Re: PHP 4.1.2 - does not work. !

2002-04-05 Thread Septic Flesh

any idea what might be the problem ?
 how did you compile it ??

./configure --with-mysql=/dir --with-apxs=/dir
make
make install


any other modifications ? ? or config options ?
can you put the libphp4.so somewhere to download it ?

cheerss.

--


Sapilas@/dev/pinkeye


"Septic Flesh" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Anyone manage to recompile php4.1.2 and use successfully ?
> I use slack8, apache 1.3.24.
> When I install php 4.1.1 it works fine.
> When I install php4.1.2 Apache doesnt work.
>
> error:
> apache cannot start. . could not load libphp4.so , not defined compress.
>
> The libphp4.so is there . . but only the one from version 4.1.1 works..
>
> any idea ?
> cheers.
>
>
> --
> 
>
> Sapilas@/dev/pinkeye
>
> 
>
>



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




RE: [PHP] Re: help condensing regular expressions

2002-04-05 Thread Collins, Robert

why not use somthing like this then

include($DOCUMENT_ROOT."/include/mysql_connect.inc");


Robert W. Collins II 
Webmaster 
New Orleans Regional Transit Authority 
Phone : (504) 248-3826 
Email : [EMAIL PROTECTED] 



-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 2:33 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: help condensing regular expressions


Hi
Yes that would be fine for the html examples I gave but the real use is for 
php to find the include directory which I keep out of the server tree, one 
directory back like this

include($relative_root."../include/mysql_connect.inc")

Each domain has its own include directory which I want to keep seperate 
from the default php include directory set in php.ini

The other thing is that this gets rid of the include file inside included 
file problem as long as I set $relative_root at the top level.
Tom

At 06:26 AM 6/04/2002, Julio Nobrega Trabalhando wrote:
>   How about:
>
>$site_root = '/www/user/htdocs/';
>
>
>
>   Instead of going relative, go from the root. Or you could put $site_root
>as your url:
>
>$site_root = 'http://www.your_site.com/';
>
>--
>
>Julio Nobrega.
>
>Um dia eu chego lá:
>http://sourceforge.net/projects/toca
>
>Ajudei? Salvei? Que tal um presentinho?
>http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
>
>
>"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi
> > I am trying to calculate how far into a directory structure I am so that
I
> > can include images and include files without having to hard code them.
> > I need to turn $PHP_SELF which could be /admin/emails/index.php into
>../../
> > which I can then use to get to any directory from root.
> > like IMG src=images/logo.png
> > Regular expressions leave me cold but I have come up with the following
> > monster which works
> >
> > $relative_root = preg_replace("<\/[[:alnum:]]+>","../",
> > preg_replace("","",strtok($PHP_SELF,".")));
> >
> > Anybody have a better solution?
> > Thanks for any help.
> > Tom
> >
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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

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




Re: [PHP] Re: help condensing regular expressions

2002-04-05 Thread Tom Rogers

Hi
Yes that would be fine for the html examples I gave but the real use is for 
php to find the include directory which I keep out of the server tree, one 
directory back like this

include($relative_root."../include/mysql_connect.inc")

Each domain has its own include directory which I want to keep seperate 
from the default php include directory set in php.ini

The other thing is that this gets rid of the include file inside included 
file problem as long as I set $relative_root at the top level.
Tom

At 06:26 AM 6/04/2002, Julio Nobrega Trabalhando wrote:
>   How about:
>
>$site_root = '/www/user/htdocs/';
>
>
>
>   Instead of going relative, go from the root. Or you could put $site_root
>as your url:
>
>$site_root = 'http://www.your_site.com/';
>
>--
>
>Julio Nobrega.
>
>Um dia eu chego lá:
>http://sourceforge.net/projects/toca
>
>Ajudei? Salvei? Que tal um presentinho?
>http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
>
>
>"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi
> > I am trying to calculate how far into a directory structure I am so that I
> > can include images and include files without having to hard code them.
> > I need to turn $PHP_SELF which could be /admin/emails/index.php into
>../../
> > which I can then use to get to any directory from root.
> > like IMG src=images/logo.png
> > Regular expressions leave me cold but I have come up with the following
> > monster which works
> >
> > $relative_root = preg_replace("<\/[[:alnum:]]+>","../",
> > preg_replace("","",strtok($PHP_SELF,".")));
> >
> > Anybody have a better solution?
> > Thanks for any help.
> > Tom
> >
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] Having problems deleting an element from an array

2002-04-05 Thread Joshua E Minnie

Can anyone tell me why when stepping through an array and trying to delete a
specific element in the array it deletes not only the one that I want it to
delete, but also the first and last element in the array as well.?

Here is the situation:
I am retrieving information from a text file, dumping it to any array of
arrays.  Then searching for the specific element to delete it.  After the
deletion it should re-write the information back to the text file. Without
the element that I wanted to delete.  But it also deletes the first and last
element.

 $data) {
foreach($stores[$i] = explode(":", $data) as $key => $val) {
  $stores[$i][$key] = trim($val);
}
$i++;
  }
  $fp = @ fopen($storelist, "w") or die("Fatal Error: could not open
$storelist for edit\n");
  foreach($HTTP_POST_VARS as $key => $val) {
unset($stores[$val]);
  }
  for($i=0; $i
--
Joshua E Minnie
CIO
[EMAIL PROTECTED]

"Don't work for recognition, but always do work worthy of recognition."



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




[PHP] Re: help condensing regular expressions

2002-04-05 Thread Julio Nobrega Trabalhando

  How about:

$site_root = '/www/user/htdocs/';



  Instead of going relative, go from the root. Or you could put $site_root
as your url:

$site_root = 'http://www.your_site.com/';

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
> I am trying to calculate how far into a directory structure I am so that I
> can include images and include files without having to hard code them.
> I need to turn $PHP_SELF which could be /admin/emails/index.php into
../../
> which I can then use to get to any directory from root.
> like IMG src=images/logo.png
> Regular expressions leave me cold but I have come up with the following
> monster which works
>
> $relative_root = preg_replace("<\/[[:alnum:]]+>","../",
> preg_replace("","",strtok($PHP_SELF,".")));
>
> Anybody have a better solution?
> Thanks for any help.
> Tom
>



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




[PHP] Under what circumstances would you use Sockets in PHP?

2002-04-05 Thread Chris

Just wondering, under what circumstances would you use sockets under PHP?
Any examples?
How is it different from Java sockets etc?

Thanks for any reply.

Chris



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




Re: [PHP] Arrays within classes

2002-04-05 Thread Brian McLaughlin

Thank you!!

Now I need to figure out how to put all this hair back in my head.

Brian


"Rick Emery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I corrected the syntax errors Erik found and added var_dump() after each
$t
> equation/assignment
>
> The problem is that you refer to $test->words.  You should refer to
> $test->words
> BIG DIFFERENCE
>
> $test->words means find the value of $words and look for that variable in
> $test.  That is, if $words ="abc",
> then $test->$words means $test->abc
>
> Yes, it's in the manual
>




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




[PHP] help condensing regular expressions

2002-04-05 Thread Tom Rogers

Hi
I am trying to calculate how far into a directory structure I am so that I 
can include images and include files without having to hard code them.
I need to turn $PHP_SELF which could be /admin/emails/index.php into ../../ 
which I can then use to get to any directory from root.
like IMG src=images/logo.png
Regular expressions leave me cold but I have come up with the following 
monster which works

$relative_root = preg_replace("<\/[[:alnum:]]+>","../", 
preg_replace("","",strtok($PHP_SELF,".")));

Anybody have a better solution?
Thanks for any help.
Tom


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




Re: [PHP] Arrays within classes

2002-04-05 Thread Brian McLaughlin

Hi Erik

Thanks for the reply.  I'm not sure how I missed the opening { in my
message -- I copy/pasted the code.  But the opening { is definitely there in
the code -- I'd get a nice error message if it weren't.  I believe it's OK
to have a ; after the class def end-brace, but I removed it and I got the
same symptoms.  I also believe it's OK to not have the () in the "new test"
instance assignment as long as my constructor takes no parameters.  I added
the (), and didn't get different results.

I'm not sure what you mean when you say "Don't you want to  perform your
error-testing functions on the instances?"  I'm trying to initialize some
class-arrays in the constructor.  I put some echo"" statements in there to
try and figure out what was going on.  The example is just an example -- the
smallest piece of code I could make (presumably) that would exhibit the
symptoms.  The purpose for the "real" class I'm working with is to
encapsulate several arrays (one of which is an array of arrays) along with a
few other variables into a data class that can be put/retrieved as a single
object into the session.  The reason is so that all the code that builds
these arrays only happens when the user hits the first page.  Then the
arrays are available from the session on subsequent hits.

My problem is that when I assign an empty array to a variable, I get
different results depending on whether that variable is in an object or not.
In the case of assigning $a=array(); outside of an object, each element of
the array is empty (as I expected).  But when assigning
$this->$words=array(); results in $this->$words["Amy"] (or any other element
for that matter) already being assigned an array.  And if I look at the
elements of those arrays, they are also initialized to arrays.  I don't know
how deep it goes.

The way I noticed this at first was like this:  In the constructor, I'm
reading phrases from a file and putting each word into the $words array, and
assigning $words[$word]=array($phrasenum);  (so each word in the $words
array gives back an array containing the id's of the phrases it appears in)
When I come across a word that I've already added for phrase 1 in phrase 2,
I expect it to already exist in the array, because I put it there the first
time I came across the word in phrase 1.  Instead, Every element is
pre-assigned to another array, and so the code gets confused, thinking that
it has entries for any word I care to index the array with.

Sorry for the long drawn-out message.  Maybe it will help?

Thanks

Brian

"Erik Price" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I might be completely mistaken here, but it looks like there are a few
> errors in your code:
>
> - No starting brace for the test() method
> - semi-colon used after class def end-brace
> - no parentheses after "new test" instance assignment
>
> Don't you want to keep your class as general as possible, and perform
> your error-testing functions on the instances?  It's hard for me to tell
> what kind of data you are trying to represent with this class.  My
> advice is that, even if it seems unnecessarily didactic, you use some
> sort of actual object to help you visualize what you are trying to do
> with this class, like Person() or something -- it helps.  I can't figure
> out what this class is even supposed to do.
>
>
> Erik
>

>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>



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




Re: [PHP] using new AUTOGLOBALS

2002-04-05 Thread Philip Olson


As miguel suggests, these are just arrays.  Use them like 
any other array:

  print $arr['key'];
  print "string {$arr['key']} string";
  print 'string ' . $arr['key'] . ' string';
  etc.

Read about arrays and strings:
  http://us2.php.net/manual/en/language.types.array.php
  http://de.php.net/manual/en/language.types.string.php
  http://www.zend.com/zend/tut/using-strings.php

With the only difference being that they are *super* 
global, so no need for: global $_SERVER;  in your 
functions, etc.

Now if you want to be truly cutting edge :) Then consider 
extract() or import_request_variables() like so:

  import_request_variables('g', 'g_');

Which will allow:
  // http://www.example.com/test.php?foo=bar
  print $g_foo;  // the GET variable foo

Which is like:
  print $_GET['foo'];
  print $HTTP_GET_VARS['foo'];

See manual entry for more details and features:
  http://uk.php.net/import_request_variables

The above assumes you want it to be from GET and only GET, 
maybe this is not your desire so modify accordingly.

Or let's say you want to use server predefined variables such 
as $PHP_SELF, $DOCUMENT_ROOT, etc. yet have register_globals 
remain off.  Since register_globals = on creates these, 
consider:

  a) Using $_SERVER or $HTTP_SERVER_VARS in your code i.e.
   print $_SERVER['HTTP_USER_AGENT'];
  b) Or use extract()

For example:

  // If register_globals are off (0) then extract
  if (!ini_get('register_globals')) {
extract($HTTP_SERVER_VARS);
  }

  // We just created these!
  print $PHP_SELF;
  print $REQUEST_URI;

Going through $_SERVER is good in that you're not wasting 
energy creating variables you'll never use, so do as 
you will.

extract() has many many options, read about them:
  http://ca.php.net/extract

All of the above should give ideas, have fun!

Regards,
Philip Olson

p.s. Use a mirror
  http://uk.php.net/mirrors.php



On Fri, 5 Apr 2002, Miguel Cruz wrote:

> On Fri, 5 Apr 2002, cyberskydive wrote:
> > So I wanna learn how to code properly with register_globals off, I reead on
> > PHP.net about the new auto globals and inmy new php4.1.2 windows
> > installation using php.ini-rec edited according to the intall.txt file, and
> > a few changes from books I have (upload tmp dir etc) I'm off to learn how to
> > use the new auto globals. I've tried $_REGISTER and $_POST .  Here is what I
> > tried as a simple test.
> > 
> > 
> > 
> > 
> > 
> > 
> > --somefile.php--
> > 
> >  > 
> > print("$_REGISTER["is_name"]");
> > or
> > print("$_POST["is_name"]");
> > 
> > ?>
> 
> Two problems.
> 
> 1) It's $_REQUEST, not $_REGISTER
> 
> 2) Take the outermost quotes off the argument to your print, like so:
> 
>print $_REQUEST["is_name"];
> 
> miguel
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




RE: [PHP] Arrays within classes

2002-04-05 Thread Rick Emery

Corrected typo:

The problem is that you refer to $test->$words.  You should refer to
$test->words
BIG DIFFERENCE

$test->$words means find the value of $words and look for that variable in
$test.  That is, if $words ="abc",
then $test->$words means $test->abc

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 1:28 PM
To: 'Brian McLaughlin'; [EMAIL PROTECTED]
Subject: RE: [PHP] Arrays within classes


I corrected the syntax errors Erik found and added var_dump() after each $t
equation/assignment

The problem is that you refer to $test->words.  You should refer to
$test->words
BIG DIFFERENCE

$test->words means find the value of $words and look for that variable in
$test.  That is, if $words ="abc",
then $test->$words means $test->abc

Yes, it's in the manual

-Original Message-
From: Brian McLaughlin [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 12:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Arrays within classes


This is driving me crazy!  I've created a class to hold data so I can just
put the object into the session rather than saving off each piece of data
separately.  But I'm getting odd results from the arrays in my class that I
can't explain.  Here's a hunk of code that demonstrates:

$words;
echo "1: words = $t\n";// Shows that $words is empty
$this->$words = array();
$t = $this->$words;
echo "2: words = $t\n";   // Shows that $words is an array
$t = $this->$words["Amy"];
echo "3: words[Amy] = $t\n";  // Shows that $words["Amy"] is also an
array -- WHAT??
  }
};

###  Declare a$ to be an array
echo "1: a = $a\n"; // Shows that $a is empty
$a = array();
$t = $a;
echo "2: a = $t\n"; // Shows that $a is an array
$t = $a["Amy"];
echo "3: a[Amy] = $t\n";   // Shows that $a["Amy"] is also
empty -- GOOD

echo "";

## Instantiate a test object
$test = new test;

?>

When I declare a member variable ($words) within the class and then assign
to it an empty array, it seems all the elements of that array are also
arrays -- they should be empty.  When I do the same thing outside of a class
($a), I get the results I expect.

Can anyone tell me why that is?

Thanks

Brian
[EMAIL PROTECTED]




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

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

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




RE: [PHP] Arrays within classes

2002-04-05 Thread Rick Emery

I corrected the syntax errors Erik found and added var_dump() after each $t
equation/assignment

The problem is that you refer to $test->words.  You should refer to
$test->words
BIG DIFFERENCE

$test->words means find the value of $words and look for that variable in
$test.  That is, if $words ="abc",
then $test->$words means $test->abc

Yes, it's in the manual

-Original Message-
From: Brian McLaughlin [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 12:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Arrays within classes


This is driving me crazy!  I've created a class to hold data so I can just
put the object into the session rather than saving off each piece of data
separately.  But I'm getting odd results from the arrays in my class that I
can't explain.  Here's a hunk of code that demonstrates:

$words;
echo "1: words = $t\n";// Shows that $words is empty
$this->$words = array();
$t = $this->$words;
echo "2: words = $t\n";   // Shows that $words is an array
$t = $this->$words["Amy"];
echo "3: words[Amy] = $t\n";  // Shows that $words["Amy"] is also an
array -- WHAT??
  }
};

###  Declare a$ to be an array
echo "1: a = $a\n"; // Shows that $a is empty
$a = array();
$t = $a;
echo "2: a = $t\n"; // Shows that $a is an array
$t = $a["Amy"];
echo "3: a[Amy] = $t\n";   // Shows that $a["Amy"] is also
empty -- GOOD

echo "";

## Instantiate a test object
$test = new test;

?>

When I declare a member variable ($words) within the class and then assign
to it an empty array, it seems all the elements of that array are also
arrays -- they should be empty.  When I do the same thing outside of a class
($a), I get the results I expect.

Can anyone tell me why that is?

Thanks

Brian
[EMAIL PROTECTED]




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

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




Re: [PHP] Arrays within classes

2002-04-05 Thread Erik Price

I might be completely mistaken here, but it looks like there are a few 
errors in your code:

- No starting brace for the test() method
- semi-colon used after class def end-brace
- no parentheses after "new test" instance assignment

Don't you want to keep your class as general as possible, and perform 
your error-testing functions on the instances?  It's hard for me to tell 
what kind of data you are trying to represent with this class.  My 
advice is that, even if it seems unnecessarily didactic, you use some 
sort of actual object to help you visualize what you are trying to do 
with this class, like Person() or something -- it helps.  I can't figure 
out what this class is even supposed to do.


Erik



On Friday, April 5, 2002, at 01:21  PM, Brian McLaughlin wrote:

> This is driving me crazy!  I've created a class to hold data so I can 
> just
> put the object into the session rather than saving off each piece of 
> data
> separately.  But I'm getting odd results from the arrays in my class 
> that I
> can't explain.  Here's a hunk of code that demonstrates:
>
> 
> class test {
>
>   var $words;
>
>   function test()
>
>
> $t = $this->$words;
> echo "1: words = $t\n";// Shows that $words is empty
> $this->$words = array();
> $t = $this->$words;
> echo "2: words = $t\n";   // Shows that $words is an array
> $t = $this->$words["Amy"];
> echo "3: words[Amy] = $t\n";  // Shows that $words["Amy"] is 
> also an
> array -- WHAT??
>   }
> };
>
> ###  Declare a$ to be an array
> echo "1: a = $a\n"; // Shows that $a is empty
> $a = array();
> $t = $a;
> echo "2: a = $t\n"; // Shows that $a is an array
> $t = $a["Amy"];
> echo "3: a[Amy] = $t\n";   // Shows that $a["Amy"] is also
> empty -- GOOD
>
> echo "";
>
> ## Instantiate a test object
> $test = new test;
>
> ?>
>
> When I declare a member variable ($words) within the class and then 
> assign
> to it an empty array, it seems all the elements of that array are also
> arrays -- they should be empty.  When I do the same thing outside of a 
> class
> ($a), I get the results I expect.
>
> Can anyone tell me why that is?
>
> Thanks
>
> Brian
> [EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] MySQL - UPDATE & INSERT

2002-04-05 Thread Erik Price


On Friday, April 5, 2002, at 01:58  PM, Phil Schwarzmann wrote:

> Is this query legal?
>
> $query = "UPDATE table SET (var1, var2, var3) VALUES ($var1, $var2,
> $var3) WHERE username='$username'";

No.  The SET modifier (or whatever that is) can only be used to create 
column name/value relationship pairs.  To my knowledge, your syntax 
above (which looks similar to INSERT INTO table (..., ..., ...) 
VALUES (..., ..., ...)) cannot be used for UPDATE statements.

> Im wondering cause I have an INSERT query
>
> $query = "INSERT INTO table (var1, var2, var3) VALUES ($var1, $var2,
> $var)";
>
> ...but only there are like 150 different variables and it will take me
> forever to write a query like
>
> $query = "UPDATED table SET var1='$var1', var2='$var2', var3='$var3'
> WHERE username='$username'";

If you have shell access to your database server, you can always CREATE 
TEMPORARY TABLE and test things out on a small scale, then DROP TABLE 
when you're done playing.


Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




RE: [PHP] MySQL - UPDATE & INSERT

2002-04-05 Thread Rick Emery

what happened when you tried your query?

-Original Message-
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 12:58 PM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL - UPDATE & INSERT


Is this query legal?
 
$query = "UPDATE table SET (var1, var2, var3) VALUES ($var1, $var2,
$var3) WHERE username='$username'";
 
 
Im wondering cause I have an INSERT query
 
$query = "INSERT INTO table (var1, var2, var3) VALUES ($var1, $var2,
$var)";
 
...but only there are like 150 different variables and it will take me
forever to write a query like
 
$query = "UPDATED table SET var1='$var1', var2='$var2', var3='$var3'
WHERE username='$username'";
 
THANKS!

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




[PHP] Arrays within classes

2002-04-05 Thread Brian McLaughlin

This is driving me crazy!  I've created a class to hold data so I can just
put the object into the session rather than saving off each piece of data
separately.  But I'm getting odd results from the arrays in my class that I
can't explain.  Here's a hunk of code that demonstrates:

$words;
echo "1: words = $t\n";// Shows that $words is empty
$this->$words = array();
$t = $this->$words;
echo "2: words = $t\n";   // Shows that $words is an array
$t = $this->$words["Amy"];
echo "3: words[Amy] = $t\n";  // Shows that $words["Amy"] is also an
array -- WHAT??
  }
};

###  Declare a$ to be an array
echo "1: a = $a\n"; // Shows that $a is empty
$a = array();
$t = $a;
echo "2: a = $t\n"; // Shows that $a is an array
$t = $a["Amy"];
echo "3: a[Amy] = $t\n";   // Shows that $a["Amy"] is also
empty -- GOOD

echo "";

## Instantiate a test object
$test = new test;

?>

When I declare a member variable ($words) within the class and then assign
to it an empty array, it seems all the elements of that array are also
arrays -- they should be empty.  When I do the same thing outside of a class
($a), I get the results I expect.

Can anyone tell me why that is?

Thanks

Brian
[EMAIL PROTECTED]




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




Re: [PHP] MySQL - UPDATE & INSERT

2002-04-05 Thread Julie Meloni

The UPDATE syntax in the manual:

http://www.mysql.com/doc/U/P/UPDATE.html

UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
SET col_name1=expr1, [col_name2=expr2, ...]
[WHERE where_definition]
[LIMIT #]

Yes, it is different than the INSERT syntax.

PS> ...but only there are like 150 different variables and it will take me
PS> forever to write a query like

Therein lies your problem - quite likely you need to normalize!


- Julie

--> Julie Meloni
--> [EMAIL PROTECTED]
--> www.thickbook.com

Find "Sams Teach Yourself MySQL in 24 Hours" at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20


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




RE: [PHP] Making sure a post request came from your site

2002-04-05 Thread Johnson, Kirk

Good starters. I would add one more starter item: don't blindly grab
everything out of the $_POST[] array. Instead, only grab the variables that
*you* put on the form page. A cracker might send you a name/value pair like
"$admin=1", trying to guess what flag you are using for "admin" users.

Kirk

> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 05, 2002 11:42 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Making sure a post request came from your site
> 
> 
> > Ok, then how do you go about checking to make sure that submitted
> > data is, in fact, benign and acceptable for your use?
> 
> For starters:
> 
> If it's supposed to be a number make sure that it is a number.
> If it's supposed to be a name make sure it only contains 
> letters a-z & A-Z & 
> spaces.

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




[PHP] MySQL - UPDATE & INSERT

2002-04-05 Thread Phil Schwarzmann

Is this query legal?
 
$query = "UPDATE table SET (var1, var2, var3) VALUES ($var1, $var2,
$var3) WHERE username='$username'";
 
 
Im wondering cause I have an INSERT query
 
$query = "INSERT INTO table (var1, var2, var3) VALUES ($var1, $var2,
$var)";
 
...but only there are like 150 different variables and it will take me
forever to write a query like
 
$query = "UPDATED table SET var1='$var1', var2='$var2', var3='$var3'
WHERE username='$username'";
 
THANKS!



[PHP] Re: Making sure a post request came from your site

2002-04-05 Thread Julio Nobrega Trabalhando

  Using sessions, $HTTP_HOST, form keys, $HTTP_REFERER, ip address,
Javascript.

  On a session you can record the user_agent on the first page, the ip, the
host, and check on the form's action page. Form keys are some number you
come up and pass either via url or post, and check on the action page.

  The thing is to find out whetever you can check that should be fixed
between page transitions or things that you can invent.

  Not 100%, but the more, the best.

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


"Chris Boget" <[EMAIL PROTECTED]> wrote in message
000701c1dccb$8b911ee0$[EMAIL PROTECTED]">news:000701c1dccb$8b911ee0$[EMAIL PROTECTED]...
> For security, you can modify your code so that you check
> the $_POST elements instead of using the magic globals.
> That's all well and good.
> However, someone copy and save your HTML to their local
> machine, change some values, change the "Action" page of the
> form to be http://www.yoursite.com/form_page.php instead of
> "form_page.php".  You'll be checking the $_POST elements
> but you won't have any idea that they were changed and posted
> from the user's local machine.
> Is there any way to determine from where the post request came
> from w/o using http_referer?
>
> Chris
>



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




Re: [PHP] Making sure a post request came from your site

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Chris Boget wrote:
>> You can never assume that submitted data is benign or untampered. 
> 
> Ok, then how do you go about checking to make sure that submitted
> data is, in fact, benign and acceptable for your use?

I use two general principles:

1) Rather than trying to rule out bad stuff, instead rule in good stuff.  
For instance, people often sanitize data with regular expressions that
filter out some selected boogeyman characters (quotes, backslashes,
semicolons, whatever, depending on context). I prefer to always approach
it the other way, thinking of the minimum range of characters that are
actually useful in the context, and allow ONLY those.

   $str = ereg_replace ('[^a-zA-Z]', '', $str);

That way it's much less likely that some unanticipated attack will catch 
me by surprise.

Another way of saying this would be to never assume anything about your 
inputs, and to explicitly mold each input to your program's needs.

2) If you already have a piece of data, try not to get it from the 
browser. Instead, just get the browser to send you a relative pointer to 
the appropriate item within your set.

If someone is selecting an item from a list you already have in your
database, make sure that the 'select' form element sends in the numerical
ID of that item rather than its name - you already know the names. The ID
can immediately be validated or discarded as bogus, and being a number, 
it's much safer to work with.

In an example that came up today, someone needed to select a file stored
on the server, and specify a path. There's no need to specify a full path 
in a case like that; it should always be relative to the top of the area 
in which web visitors are able to view files. In this case, you already 
know the first part of the path and there's no need to have the browser 
tell you. All you need to know is which subpath the user's selected.

Probably all common sense but you never know...

miguel


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




[PHP] Headers not working

2002-04-05 Thread Sheridan Saint-Michel

I was trying to write a some code that would disallow specific users access
to certain pages.  I had thought this would be as simple as looking at
$PHP_AUTH_USER and sending a 401 header if it was a user that shouldn't have
access to that page.

The problem is the HTTP header was not going out.  I tried 404 and 401, and
then I thought perhaps the HTTP authentication was preventing me from
sending the header, so I tried several different headers (all copied and
pasted from the PHP manual) in an unprotected directory.  I also tried both
IE6 and Mozilla to make sure there wasn't a borwser issue.

The header line seems to be completely overlooked as things echoed below the
header were appearing in the original script.

The test scripts in the unprotected directory are all very simple, for
example:



I have saved three test scripts as both .php and .phps so you can view them.
In addition, I put up an info.php so you can see my entire PHP config in
case that is the problem. (links below).  Also header(Location:) seems to
work without any problems.

So what am I overlooking?

http://www.foxjet.com/info.php
http://www.foxjet.com/test1.php
http://www.foxjet.com/test1.phps
http://www.foxjet.com/test2.php
http://www.foxjet.com/test2.phps
http://www.foxjet.com/test3.php
http://www.foxjet.com/test3.phps

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


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




Re: [PHP] Making sure a post request came from your site

2002-04-05 Thread Jason Wong

On Saturday 06 April 2002 02:26, Chris Boget wrote:
> > You can never assume that submitted data is benign or untampered.
>
> Ok, then how do you go about checking to make sure that submitted
> data is, in fact, benign and acceptable for your use?

For starters:

If it's supposed to be a number make sure that it is a number.
If it's supposed to be a name make sure it only contains letters a-z & A-Z & 
spaces.


etc, etc.


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

/*
senility, n.:
The state of mind of elderly persons with whom one happens to disagree.
*/

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




Re: [PHP] New Server, Bad Attitude

2002-04-05 Thread Liam Gibbs

Thanks to Tyler Longren, Hiroshi Ayukawa, and Matt
Schroebel for your help. I've made big changes; the
encryption thing is still throwing me for a loop, but
the other two are fixed up (mostly).


__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

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




RE: [PHP] mysql_fetch_array()

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Phil Ewington wrote:
> This is for an events calendar, I want all the dates form the db but when I
> am generating the individual days for the calendar I need to know whether
> there is an event for that day, hence pulling out all the dates from the db.
> As I am looping through all the days in a month to dynamically create the
> calendar, I do not want to loop through the entire recordset to look for a
> date for that day in each iteration.

That sounds like a lot of work (both for you and for the server). Assuming
you want to draw a monthly calendar where each day appears whether or not
it holds any events (it's even easier if you don't need that)...

Just make sure the database returns your results in date order.

   SELECT eventtitle, eventdate FROM event WHERE eventdate>='2002-03-01' 
  AND eventdate<'2002-04-01' ORDER BY eventdate

Then loop through the days and draw any events that happen to occur on 
each day as you get to it:

  $row = mysql_fetch_assoc($sql);
  for ($day = 1; $day <= $num_days_in_month; $day++)
  {
 print "$day";
 while ($row && (date('j', strtotime($row['eventdate'])) == $day))
 {
print "{$row['eventtitle']}";
$row = mysql_fetch_assoc($sql);
 }
  }

miguel


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




Re: [PHP] Making sure a post request came from your site

2002-04-05 Thread Erik Price


On Friday, April 5, 2002, at 01:15  PM, Miguel Cruz wrote:

>> For security, you can modify your code so that you check
>> the $_POST elements instead of using the magic globals.
>> That's all well and good.
>> However, someone copy and save your HTML to their local
>> machine, change some values, change the "Action" page of the
>> form to be http://www.yoursite.com/form_page.php instead of
>> "form_page.php".  You'll be checking the $_POST elements
>> but you won't have any idea that they were changed and posted
>> from the user's local machine.
>> Is there any way to determine from where the post request came
>> from w/o using http_referer?
>
> No, nor with it. Someone who wants to mess with you can supply any HTTP
> referer they want to (using something like 'curl -e' or just creating 
> the
> request by hand in a text editor).
>
> You can never assume that submitted data is benign or untampered.

Exactly.  I was kind of blown away when I realized how it all works for 
the first time -- for a few weeks I was assuming that using listboxes or 
radio buttons was safer than using text inputs, since it limits what 
kind of data the user can send you.  But this was completely false 
security on my part, because in reality, the user can send you whatever 
they want -- the browser is only one way to provide this ability to 
users.

Anyone can use telnet to try to send you any POST data they wish, and 
even the stupidest of crackers can figure out how to send GET data in 
the browser's "Address" bar (as you point out in your original post) or 
modify the value in their cookies.

How to make sure that input or other elements of your HTML pages are 
safe?  Religious error checking.  Write some decent error checking 
functions, and then run them on any user-input data you get before you 
allow that data to have any effect on your code.  DevShed recently had 
an article on the subject of writing a class for form validation:  
http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page1.html

And remember, unless your server is unplugged in a locked room, it's 
never really safe from intrusion.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




[PHP] Re: conditionaly including classes/functions

2002-04-05 Thread CC Zona

In article ,
 [EMAIL PROTECTED] (Andrew Warner) wrote:

> Is it okay practice to condtionally include php files that contain 
> only classes or functions (as opposed to just straight code)?   The 
> result is a class or function inserted right in the middle of an if{} 
> block:
> 
> 
> } elseif ($var=='a')
> {
>  include('temp.php');
> 
>  $obj = new foo;
>  echo $obj->hello();
> 
> }

It's fine, but since redeclaring functions is an error, better to use 
include_once() or require_once().

-- 
CC

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




Re: [PHP] Making sure a post request came from your site

2002-04-05 Thread Chris Boget

> > Is there any way to determine from where the post request came
> > from w/o using http_referer?
> No, nor with it. 

I know that http_referer is unviable, that's why I asked if you can find
out that data w/o using it.

> Someone who wants to mess with you can supply any HTTP
> referer they want to (using something like 'curl -e' or just creating the 
> request by hand in a text editor).

Understood.

> You can never assume that submitted data is benign or untampered. 

Ok, then how do you go about checking to make sure that submitted
data is, in fact, benign and acceptable for your use?

Chris


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




[PHP] Re: regexp for ' replacement

2002-04-05 Thread CC Zona

In article 
<[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Thalis A. Kalfigopoulos) wrote:

> If I have as part of a text:
> ...and then 'the quick brown fox jumped over the lazy dog's piano'...
> 
> How can I substitute the single quote in "dog's" with say \'
> I want to aply a substitution for only the single quote that is between two 
> single quotes and leave the rest of the text in between the same.

Does this work for you?

$str="...and then 'the quick brown fox jumped over the lazy dog's 
piano'...";
echo $str=preg_replace("/'(.*)'(.*)'/U","'$1\'$2'",$str);

-- 
CC

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




RE: [PHP] refresh

2002-04-05 Thread Rick Emery

yes, put the name of the PHP file

-Original Message-
From: Kris Vose [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 12:23 PM
To: Rick Emery
Subject: RE: [PHP] refresh


When I delete a record from a table in php it loops back to the table.
However, It does not show that the record has been deleted.  I have to click
on the refresh button to see the change.  I am not sure how this header
function works.  Do you put the name of the php file as the location?  

Kris 

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 05, 2002 12:09 PM
To: Kris Vose; [EMAIL PROTECTED]
Subject: RE: [PHP] refresh

after database submission, header("location: ...") re-directed to the script
you wish to go to


-Original Message-
From: Kris Vose [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:31 AM
To: [EMAIL PROTECTED]
Subject: [PHP] refresh


I want to be able to refresh my browser window after a submission to a
database.  Is there a reliable function out there that can accomplish this?
 
Kris

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




RE: [PHP] regexp for ' replacement

2002-04-05 Thread Rick Emery

regexp is not what you need then

You will require a character-by-character search/replace

or try:

which produces:

$q= 'here's to you'
$a= \'here\'s to you\'
$z= 'here\'s to you'

-Original Message-
From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 11:35 AM
To: Rick Emery
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] regexp for ' replacement


Nop. I don't want to affect the first and last ' of every line.


On Fri, 5 Apr 2002, Rick Emery wrote:

> addslashes($textline)
> 
> -Original Message-
> From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 05, 2002 10:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] regexp for ' replacement
> 
> 
> Yet another regexpr question.
> If I have as part of a text:
> ...and then 'the quick brown fox jumped over the lazy dog's piano'...
> 
> How can I substitute the single quote in "dog's" with say \'
> I want to aply a substitution for only the single quote that is between
two
> single quotes and leave the rest of the text in between the same.
> 
> Make sense for regexpr usage?
> 
> TIA,
> thalis
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




Re: [PHP] PHP and mySQL...

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Anthony Ritter wrote:
> Any idea what the cost is for the ISP to install mySQL on their end so that
> I can utilize my database that I've set up on localhost?

MySQL is free for that sort of usage, so it only costs their time. If 
they've done it before, it takes about 5 minutes from beginning the 
download to standing up and clapping yourself on the back for a job well 
done - in a unix environment, anyway. Not sure what's involved on the 
Windows side but I expect it's slightly more complicated.

miguel


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




Re: [PHP] how to process URL parameers

2002-04-05 Thread Lee Doolan

> "Erik" == Erik Price <[EMAIL PROTECTED]> writes:
   [. . .]

Erik> There is another way, it's a bit more involved.  You open a
Erik> socket with the server and directly send the data as POST
Erik> data.  This allows you to avoid having to bother with a
Erik> form.  Rasmus Lerdorf wrote a function to do this (takes
Erik> most of the work out of it) but it helps to understand how
Erik> sockets work if you're going to take this route.  Let me
Erik> know if you want this function, I have a copy of it.

you can use curl also.

-- 
Share your feedback at Affero:
http://svcs.affero.net/rm.php?r=leed_25

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




Re: [PHP] Making sure a post request came from your site

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Chris Boget wrote:
> For security, you can modify your code so that you check
> the $_POST elements instead of using the magic globals.  
> That's all well and good.
> However, someone copy and save your HTML to their local
> machine, change some values, change the "Action" page of the 
> form to be http://www.yoursite.com/form_page.php instead of 
> "form_page.php".  You'll be checking the $_POST elements
> but you won't have any idea that they were changed and posted
> from the user's local machine.
> Is there any way to determine from where the post request came
> from w/o using http_referer?

No, nor with it. Someone who wants to mess with you can supply any HTTP
referer they want to (using something like 'curl -e' or just creating the 
request by hand in a text editor).

You can never assume that submitted data is benign or untampered. 

miguel


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




[PHP] PHP Authorize.net interface

2002-04-05 Thread David Johansen

I was wondering if someone just point me to a good example of a PHP
interface for Authorize.net to work with ADC Relay Response. Thanks,
Dave



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




Re: [PHP] Directory to array to select box...

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Jas wrote:
> So adding a hidden field would definately pass the contents of the select
> box to the other script so I am not doing anything wrong with this portion,
> but what if I wanted to append the path of the file name? Any tips?

This isn't an answer to your question, but I just wanted to warn you: If 
you place something like a path in a hidden field, or as part of a 
select option, you have no guarantee that a user won't change it before 
submitting the form. Most browsers won't let them, but there are plenty of 
other ways they can (for instance, debugging web proxies that allow 
editing of raw form submissions, and so on).

So it's VERY IMPORTANT that you don't rely on this path without doing
further checks to make sure it's really valid. Otherwise people could try
to read or write any file on your system. They probably won't get away
with writing directly, but if they manage to read your password file or
something, they soon will be writing.

miguel


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




Re: [PHP] using new AUTOGLOBALS

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, cyberskydive wrote:
> So I wanna learn how to code properly with register_globals off, I reead on
> PHP.net about the new auto globals and inmy new php4.1.2 windows
> installation using php.ini-rec edited according to the intall.txt file, and
> a few changes from books I have (upload tmp dir etc) I'm off to learn how to
> use the new auto globals. I've tried $_REGISTER and $_POST .  Here is what I
> tried as a simple test.
> 
> 
> 
> 
> 
> 
> --somefile.php--
> 
>  
> print("$_REGISTER["is_name"]");
> or
> print("$_POST["is_name"]");
> 
> ?>

Two problems.

1) It's $_REQUEST, not $_REGISTER

2) Take the outermost quotes off the argument to your print, like so:

   print $_REQUEST["is_name"];

miguel


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




[PHP] Making sure a post request came from your site

2002-04-05 Thread Chris Boget

For security, you can modify your code so that you check
the $_POST elements instead of using the magic globals.  
That's all well and good.
However, someone copy and save your HTML to their local
machine, change some values, change the "Action" page of the 
form to be http://www.yoursite.com/form_page.php instead of 
"form_page.php".  You'll be checking the $_POST elements
but you won't have any idea that they were changed and posted
from the user's local machine.
Is there any way to determine from where the post request came
from w/o using http_referer?

Chris


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




Re: [PHP] Miguel...

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Anthony Ritter wrote:
> Now I have a .txt file of my sql statement.
> 
>> As others have suggested, you can use phpmyadmin to import this file, or 
>> you can just pipe it into the mysql command-line tool on the server once 
>> you've created your database. Look inside the file created by mysqldump 
>> and all will be much clearer.
> 
> I take that to mean (the ISP's remote server where my website resides).  
> Right?
> 
> How can I get the compete mysql statement onto the ISP's server?

If you have shell access on your ISP's server, the quickest way to get
that data into the database there is to copy the file across (using FTP or
scp or whatever you use) and then pipe it straight in. Assuming that the
mysqldump file is called 'data.txt', your database name is 'my_database'
and your database username is 'me', you could use a command like this:

   mysql -p -u me my_database < data.txt

It'll ask for your password and then the data will be in.

If you don't have command-line access, you could use a tool like
phpmyadmin, which your ISP may provide. It has an option to import data 
from a mysqldump file.

Worst comes to worst, you can write a quick PHP script that reads each 
line of the .txt file and sends it to mysql_query. Just skip blank lines 
and comments (lines starting with #).

miguel


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




Re: [PHP] conditionally including classes/functions

2002-04-05 Thread Hugh Bothwell

> -Original Message-
> From: Andrew Warner [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 04, 2002 11:29 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] conditionaly including classes/functions
>
> Is it okay practice to condtionally include php files that contain
> only classes or functions (as opposed to just straight code)?   The
> result is a class or function inserted right in the middle of an if{}
> block:


I would find it much more useful to do something like
a transparent include-on-first-use; for a function this
shouldn't be too hard, but I have no idea how to make it
work for a class short of wrapping every method
independantly.

function MyLazy($a) {
if (!function_exists("contentsMyLazy"))
include("contentsmylazy.php");// define the function

return contentsMyLazy($a);
}



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




RE: [PHP] regexp for ' replacement

2002-04-05 Thread Thalis A. Kalfigopoulos

Nop. I don't want to affect the first and last ' of every line.


On Fri, 5 Apr 2002, Rick Emery wrote:

> addslashes($textline)
> 
> -Original Message-
> From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 05, 2002 10:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] regexp for ' replacement
> 
> 
> Yet another regexpr question.
> If I have as part of a text:
> ...and then 'the quick brown fox jumped over the lazy dog's piano'...
> 
> How can I substitute the single quote in "dog's" with say \'
> I want to aply a substitution for only the single quote that is between two
> single quotes and leave the rest of the text in between the same.
> 
> Make sense for regexpr usage?
> 
> TIA,
> thalis
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] php+myslq+IDE

2002-04-05 Thread eric.coleman

http://dev.zaireweb.com/phpcoder.exe

That should be the file
- Original Message - 
From: "Charles Little" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 04, 2002 4:59 AM
Subject: RE: [PHP] php+myslq+IDE


> > Try PHP Coder (not Maguma's Version, becuase PHP Coder kicks it's ass)
> > 
> > I can email you the installed, as there site seems to be down now..
> > 
> Could you e-mail it to me, also?
> 
> 
> 


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




RE: [PHP] Writing to Files

2002-04-05 Thread Rick Emery

try creating a script with fopen(), fwrite(), etc.

When you run into problems, ask here.

$filex = fopen("myfile","w");
fwrite( $filex, "write this here");
fclose($filex);

-Original Message-
From: Sebastian A. [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:29 AM
To: PHP General List (PHP.NET)
Subject: [PHP] Writing to Files


Hey All,
I have recently been trying to create some logs for the install
script I
have been making (to make it easier for me to diagnose problems) but I am
wondering how to create and write to text files. I know about the fopen()
and fwrite() functions, which theoretically should enable me to do this
however I am not exactly sure how I should go about this. Also, I realize
that there is limited formatting I can have with text, however I would like
to know if its possible to control the line spacing between the entries, and
whether or not its possible to indent lines. Lastly, are text files a good
idea for logs? Do any of you use anything else I should be aware of?

Thanks for all your help!


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

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




RE: [PHP] regexp for ' replacement

2002-04-05 Thread Rick Emery

addslashes($textline)

-Original Message-
From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regexp for ' replacement


Yet another regexpr question.
If I have as part of a text:
...and then 'the quick brown fox jumped over the lazy dog's piano'...

How can I substitute the single quote in "dog's" with say \'
I want to aply a substitution for only the single quote that is between two
single quotes and leave the rest of the text in between the same.

Make sense for regexpr usage?

TIA,
thalis


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

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




RE: [PHP] refresh

2002-04-05 Thread Rick Emery

after database submission, header("location: ...") re-directed to the script
you wish to go to


-Original Message-
From: Kris Vose [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:31 AM
To: [EMAIL PROTECTED]
Subject: [PHP] refresh


I want to be able to refresh my browser window after a submission to a
database.  Is there a reliable function out there that can accomplish this?
 
Kris

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




[PHP] Re: What's wrong with the Array? I"m baffled!

2002-04-05 Thread Michael Virnstein

> $number = $sumItUp[$name];
> $number++;
> $sumItUp[$name] = $number;

this could be done easier:

$sumItUp[$name]++;

:)


"Scott Fletcher" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi!
>
> I'm a little baffled on why the array is not working the way I expect
it
> to.  It showed there is something about the array I do not know about.
> Well, it's never too late to learn something new.  So, here's the code and
> see if you can help me out.
>
> -- clip --
>
>   $name = "TU4R";
>
>   if ($sumItUp[$name] == "") {
>  $sumItUp[$name] = 0;
>   } else {
> //debug
> echo "**";
>  $number = $sumItUp[$name];
>  $number++;
>  $sumItUp[$name] = $number;
>   }
>   echo $sumItUp[$name]."";
>
> -- clip --
>
> In this case, the if statement never went into else statement when
> there's a number like 0, 1, 2, etc.  So, what's the heck is happening
here?
> When the array, "sumItUp[]" was empty then the number "0" was assigned and
> it work like a charm.  So,  when this code is repeated again, the if
> statement check the array, "sumItUp[]" and found a number, "0" and it is
not
> equal to "" as shown in the if statement.  So, therefore the else
statement
> should be executed.  But in this case, it never did.  I tested it myself
to
> make sure I wasn't missing something by putting in the php codes, "echo
> '**';" and the data, "**" was never spitted out on the webpage.  So, it
tell
> me that the else statment was never executed.  So, the problem had to do
> with the data in the array itself.  So, can anyone help me out?  Thanks a
> million!!
>
> Scott
>
>



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




Re: [PHP] PHP books

2002-04-05 Thread Erik Price


On Friday, April 5, 2002, at 12:12  PM, cyberskydive wrote:

> what are your opinions and what are some other grest books out there?

grest -- is that like "great" and "best" ?  ;)

I think that Visual QuickPro PHP Advanced, which just came out a month 
or two ago, is pretty good.  I learned a lot of techniques like using 
templates and PHP's object oriented features, and some non-introductory 
coverage of things like databases and security.  However, the book is 
more like a rough guide than an in-depth tutorial, so you really need to 
already know PHP to use it (which is why I liked it -- short and 
sweet).  I'd recommend it to someone who knows PHP basics but might want 
to know how shopping carts are written, or how to use OO or some 
security and database advice.  There's a chapter on XML too, but the XML 
stuff in PHP changes at times so I wouldn't rely on it.

Rasmus Lerdorf wrote a book on PHP for O'Reilly, it apparently just came 
out a few days ago although I haven't read it.  I believe it covers many 
advanced topics as well (not just a tutorial).


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] Any ideas on combining arrays????

2002-04-05 Thread Michael Virnstein

perhaps:

$FFR = array("TU4R" => array("data" => array(array("count" => "TU4R is 0"),
 array("count" => "TU4R is 1"),
 array("count" => "TU4R is
2"))),
  "PH01" => array("data" => array(array("count" => "PH01 is
0";
print_r($FFR);


"Rick Emery" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> ok...so what problem are you having?  what's the error?
> your code worked for me, i.e., it compiled and executed
>
> -Original Message-
> From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 03, 2002 11:15 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Any ideas on combining arrays
>
>
> Hi!
>
> Need some ideas on combining some arrays into one!  I have array for
> data and other array for counter.  How do I make an array that would show
> different data for each counter number?
>
> -- clip --
>$FFR = array (
>   "TU4R"  => array( "data" => "", "count" => "" ),
>   "PH01"  => array( "data" => "", "count" => "" ),
>);
> -- clip --
>
> The response should look something like this when I pick the correct
> data and correct count;
>
>$FFR["TU4R"]["data"]["0"]["count"]  = "TU4R is 0";
>$FFR["TU4R"]["data"]["1"]["count"] = "TU4R is 1";
>$FFR["TU4R"]["data"]["2"]["count"]  = "TU4R is 2";
>
> I tried to do something like this but it doesn't work.  I have been
> working for 2 days trying to figure it out.  I appreciate any help you can
> provide for me.
>
> Thanks,
>   Scott
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] Re: using new AUTOGLOBALS

2002-04-05 Thread Erik Price


On Friday, April 5, 2002, at 12:09  PM, cyberskydive wrote:

> the thing is, using the methods I described in my first post, the
> superglobals or autoglobals arent working. I cant figure out why, and , 
> like
> the other guy said, most books dont include this feature in a topic for
> discussion.
>
> Can anyone offer advice?

Post your exact code, I'll look at it.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




  1   2   >