Re: [PHP] Text Fields - How Big Can They Be?

2002-12-14 Thread Jason Wong
On Saturday 14 December 2002 15:46, Monty wrote:
> Hi John, I'm using POST for the form. But it's the HTML form field itself
> that won't allow me to paste in a large amount of text. If I can get the
> field to accept the text, there's no problem sending it via POST to the PHP
> script.

I think that is browser-dependent. For example, for NN (4.x) I think it was 
64K.

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

/*
If you don't strike oil in twenty minutes, stop boring.
-- Andrew Carnegie, on public speaking
*/


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




Re: [PHP] Problems with text files from a Mac

2002-12-14 Thread Justin French
1. they can export the CSV as DOS/Windows from Excel on the Mac with ease

2. they can pipe the CSV thru any text editor that lets them choose between
mac/win/unix line endings (BBEdit/Lite for example)

3. $filecontents = str_replace('\r', '\n', $filecontents); //should work


on 13/12/02 1:22 PM, Sterling Anderson ([EMAIL PROTECTED]) wrote:

> I am working on an application for a school district and am having some
> problems with the files they are supplying for import.
> They are supplying data files and I am writing routines to populate the
> database using these files. Its a simple file upload then I just need to
> parse through the tab separated value file. I am using the most recent
> PHP build on Windows with IIS ISAPI and a MSSQL database. They are
> sending text files from a Macintosh application.
> I noticed on the documentation for fgetcsv() that it cannot read the end
> of line character on Mac files. I have not been able to find a good work
> around for this issue. When I grab the entire contents of the file then
> try doing a string replacement on the "\r" or even "\t" for that matter
> it does not work.
> Has anyone found a good solution for dealing with Mac files?
> 

Justin French

http://Indent.com.au
Web Development & 
Graphic Design



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




Re: [PHP] Is there any alternative to FuseBox?

2002-12-14 Thread Jason Wong
On Saturday 14 December 2002 12:25, Javier wrote:
> I was reading FuseBox's beginners' guide but I didn't completely understood
> the way that framework works.
>
> How do you process the data obtained from forms? Is it the same script that
> displays the form?

Doesn't fusebox have it's own mailing list where you can ask questions? If so 
wouldn't that be a better place to do so?

In answer to the question in your subject:

  http://marc.theaimsgroup.com/?l=php-general&m=103964196113392&w=2

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

/*
The big cities of America are becoming Third World countries.
-- Nora Ephron
*/


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




Re: [PHP] Mail Error

2002-12-14 Thread Jason Wong
On Saturday 14 December 2002 11:34, Manuel Ochoa wrote:
> I have a Windows server running Apache 2 and PHP 4.3
>
> I got the following error while using the mail() function:
> Warning: mail() [function.mail]: SMTP server response: 550 User not local.
> We don't relay in C:\Apache2\htdocs\mymail.php on line 22 Any ideas?

The smtp server specified in php.ini does not allow you to send mail.

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

/*
Good salesmen and good repairmen will never go hungry.
-- R.E. Schenk
*/


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




Re[2]: [PHP] File Upload

2002-12-14 Thread Tom Rogers
Hi,

Saturday, December 14, 2002, 5:55:12 PM, you wrote:
JW> On Saturday 14 December 2002 11:35, Tom Rogers wrote:

>> You are missing this bit:
>>
>> 

JW> I am curious as to why so many people say this in response to file upload 
JW> problems? 

JW> In practice, none of my upload forms have that "missing bit" but they work 
JW> perfectly well using a diverse range of browsers (NN, IE, Mozilla, Opera, 
JW> Konqueror).

JW> Could you provide me with an example where your upload would not work without 
JW> that "missing bit"?

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

JW> /*
JW> He's like a function -- he returns a value, in the form of his opinion.
JW> It's up to you to cast it into a void or not.
JW> -- Phil Lapsley
JW> */


Just clutching at straws as there was no mention of which browser was being used
and it may have been needed as this is a browser directive. I have never had
trouble uploading files with or without that setting.

-- 
regards,
Tom


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




Re: Re[2]: [PHP] File Upload

2002-12-14 Thread Jason Wong
On Saturday 14 December 2002 16:40, Tom Rogers wrote:

> Just clutching at straws as there was no mention of which browser was being
> used and it may have been needed as this is a browser directive. I have
> never had trouble uploading files with or without that setting.

Ah, so in your case you're quoting an urban legend ;-)

I would really like to hear of a case where an upload fails *just because of* 
not putting in that hidden element. I've asked on the list before but never 
got any definite responses.

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

/*
You can't hold a man down without staying down with him.
-- Booker T. Washington
*/


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




[PHP] session_start

2002-12-14 Thread John Taylor-Johnston
I used to think I knew how to do this ... take pity :)

I start my session:

session_name("TestALS");
session_start();

I register a variable:

session_register("studentid");
if (isset($_SESSION["studentid"]))
{
$id = $_SESSION["studentid"];
echo "\$studentid= $studentid";
}

Pretend $studentid contains something from a previous form.

Here is my form with nothing else other than a submit button. But the variable does 
not get passed unless I add a field. Where did I go wrong? Geez, I know I don't have 
to repeat a whole bunch of . That is what a session 
is for.





Should I pass the session id? How? Why does my variable "studentid" NOT get passed 
after I click submit. Where did I f*** up?

Like I said, take pity. I have been reading the FAQ: 
http://www.php.net/manual/en/ref.session.php

And like I also said, I thought I knew how to do this :)

John


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




[PHP] I did: Re: session_start

2002-12-14 Thread John Taylor-Johnston
I did call session_start() before anything is output to the browser.
http://www.php.net/manual/en/function.session-start.php

I only have one php file so I know I'm recyling my code each time:

session_name("TestALS");
session_start();

session_register("studentid");
if (isset($_SESSION["studentid"]))
{
$id = $_SESSION["studentid"];
echo "\$studentid= $studentid";
}


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




Re: Re[2]: [PHP] File Upload

2002-12-14 Thread Paul Roberts
the legend starts here 
http://www.php.net/manual/sk/features.file-upload.php

"The _URL_ should point to a PHP file. The MAX_FILE_SIZE hidden field must precede the 
file input field and its value is the maximum filesize accepted. The value is in 
bytes." 

it also notes

"The MAX_FILE_SIZE is advisory to the browser. It is easy to circumvent this maximum. 
So don't count on it that the browser obeys your wish! The PHP-settings for 
maximum-size, however, cannot be fooled. "


Paul Roberts
[EMAIL PROTECTED]

- Original Message - 
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 14, 2002 8:53 AM
Subject: Re: Re[2]: [PHP] File Upload


On Saturday 14 December 2002 16:40, Tom Rogers wrote:

> Just clutching at straws as there was no mention of which browser was being
> used and it may have been needed as this is a browser directive. I have
> never had trouble uploading files with or without that setting.

Ah, so in your case you're quoting an urban legend ;-)

I would really like to hear of a case where an upload fails *just because of* 
not putting in that hidden element. I've asked on the list before but never 
got any definite responses.

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

/*
You can't hold a man down without staying down with him.
-- Booker T. Washington
*/


-- 
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] File Upload

2002-12-14 Thread Paul Roberts
what version of php are you using?

- Original Message - 
From: "Miro Kralovic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 14, 2002 3:52 AM
Subject: RE: [PHP] File Upload


Thanks Tom, but still no luck.. it seems like it doesn't recognize $testfile
variable at all in PHP script, even thought the globals are ON...



You are missing this bit:



--
regards,
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




Re: [PHP] Re: File Upload

2002-12-14 Thread Bogdan Stancescu
Ok, have you tried
");
  print_r($_FILES);
  echo("");
?>

at the beginning of the 2nd script? What does it say?

Bogdan

Miro Kralovic wrote:

Hi Bodgan..

yes, I have globals On, Uploads On and SafeMode=off.. no luck... 

I did it exactly by the book, damn it..:-(


-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 13, 2002 22:09
To: [EMAIL PROTECTED]
Subject: [PHP] Re: File Upload


Globals on? File uploads allowed? Safe mode off?




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




Re: Re[2]: [PHP] File Upload

2002-12-14 Thread Jason Wong
On Saturday 14 December 2002 18:26, Paul Roberts wrote:
> the legend starts here
> http://www.php.net/manual/sk/features.file-upload.php
>
> "The _URL_ should point to a PHP file. The MAX_FILE_SIZE hidden field must
> precede the file input field and its value is the maximum filesize
> accepted. The value is in bytes."

I know, I've rftm :)

> it also notes
>
> "The MAX_FILE_SIZE is advisory to the browser. It is easy to circumvent
> this maximum. So don't count on it that the browser obeys your wish! The
> PHP-settings for maximum-size, however, cannot be fooled. "

Exactly. What that says to me is that it is optional. If you include it then 
the browser may or may not use it. But if you don't include it then your 
browser would allow you to upload any size of file.

However, the point is that a number of people seem to be implying that uploads 
only worked for them *after* they've added that MAX_FILE_SIZE thing. But 
there isn't any concrete evidence to show that the lack of the MAX_FILE_SIZE 
thing does have any effect on whether or not one can upload.

If you have spare time on your hands go through the archives for problems 
related to file uploads, invariably someone would suggest adding 
MAX_FILE_SIZE. To me, I think it's a load of cobblers, unless someone can 
show me otherwise :)

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

/*
Preudhomme's Law of Window Cleaning:
It's on the other side.
*/


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




Re: [PHP] I did: Re: session_start

2002-12-14 Thread Jason Wong
On Saturday 14 December 2002 17:19, John Taylor-Johnston wrote:
> I did call session_start() before anything is output to the browser.
> http://www.php.net/manual/en/function.session-start.php
>
> I only have one php file so I know I'm recyling my code each time:
>
> session_name("TestALS");
> session_start();
>
> session_register("studentid");
> if (isset($_SESSION["studentid"]))
> {
> $id = $_SESSION["studentid"];
> echo "\$studentid= $studentid";
> }

RTFM again. Sessions depends on a number of factors including your version of 
PHP and the setting of register_globals.

Basically if you're going to be using $_SESSION then you don't use 
session_register(). You just assign the value directly to $_SESSION.

";
  }
   
?> 



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




[PHP] php --with-GD

2002-12-14 Thread info
Hello List,

I want to know all about copiling, installing and configuring php with gd-support.

Anybody knows.
Oliver Etzel



[PHP] migrating from register_globals on to off

2002-12-14 Thread Willem
Hello,

Lately we discovered that, by mistake, we've run PHP with register_globals
on for a few months for all our customers.

Since we want to turn it off, we need to figure out which customers use the
'register_globals' functionality so we can ask them to modify their scripts.

However, checking all php code by hand is a non-trivial task, because there
are 20,000+ php scripts. Is there a way to:

a) parse all .php scripts once and detect whether they depend on register
globals on?

or probably easier:

b) add something to our current setup so that when a scripts is executed and
uses the register globals functionality, we get a notification
automatically?

Any suggestions?
Thanks!




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




RE: [PHP] migrating from register_globals on to off

2002-12-14 Thread John W. Holmes
> Lately we discovered that, by mistake, we've run PHP with
register_globals
> on for a few months for all our customers.
> 
> Since we want to turn it off, we need to figure out which customers
use
> the
> 'register_globals' functionality so we can ask them to modify their
> scripts.

Why do you want to turn it off? Turning register_globals off doesn't
instantly make your scripts more secure, by any means. All it does is
invite people that depend on it to write a quick work around that
emulates register_globals as best as they can and they drive on with the
same issues the _might_ of had before. The problem is not with
register_globals, it's with poor logic in scripts that do not initialize
their own variables. 

> However, checking all php code by hand is a non-trivial task, because
> there
> are 20,000+ php scripts. Is there a way to:
> 
> a) parse all .php scripts once and detect whether they depend on
register
> globals on?
> 
> or probably easier:
> 
> b) add something to our current setup so that when a scripts is
executed
> and
> uses the register globals functionality, we get a notification
> automatically?

No, there's no way to do that very easily. I guess you could parse one
of their HTML forms and parse the ACTION page of the form and check for
_POST, _GET, or maybe even HTTP_GET_POST or HTTP_GET_VARS, but that's no
definitive answer that every script they have uses globals or not. 

Bottom line, the best thing you can do is to educate your customers on
how to write PHP scripts correctly and advise them to turn register
globals off on their own site (with .htaccess if you're using apache). 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




Re: [PHP] Is there any alternative to FuseBox?

2002-12-14 Thread Javier
[EMAIL PROTECTED] (Jason Wong) wrote in
[EMAIL PROTECTED]:">news:[EMAIL PROTECTED]: 

Hi, sorry that I didn't make it clear.
I'm looking for an alternative to php-fusebox.

So I was asking how do you process the data from forms and so. 


> On Saturday 14 December 2002 12:25, Javier wrote:
>> I was reading FuseBox's beginners' guide but I didn't completely
>> understood the way that framework works.
>>
>> How do you process the data obtained from forms? Is it the same
>> script that displays the form?
> 
> Doesn't fusebox have it's own mailing list where you can ask
> questions? If so wouldn't that be a better place to do so?
> 
> In answer to the question in your subject:
> 
>   http://marc.theaimsgroup.com/?l=php-general&m=103964196113392&w=2
> 



-- 
*** s2r - public key: (http://leeloo.mine.nu/s2r-gmx.sig)

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




[PHP] php --with-gd support

2002-12-14 Thread info
Hello List,

I want to know all about copiling, installing and configuring php with gd-support.

Anybody knows a good site or book to read about?
Oliver Etzel



[PHP] Compiling PHP and RH Linux

2002-12-14 Thread Todd Cary




I am new to Linux, so the syntax is still quite foreign for setting up compiles.
 Here is what I need to do:

Compile PHP with MySQL, Interbase, and the GD library and then compile Apache
so that it has the newly compiled PHP integrated.  Can someone refer me to
some literature on the correct syntax and order for doing this?

Todd

-- 
 

  
 
 
 




Re: [PHP] Compiling PHP and RH Linux

2002-12-14 Thread Chris Hewitt
Todd Cary wrote:


I am new to Linux, so the syntax is still quite foreign for setting up 
compiles.  Here is what I need to do:

Compile PHP with MySQL, Interbase, and the GD library and then compile 
Apache so that it has the newly compiled PHP integrated.  Can someone 
refer me to some 

The INSTALL file that comes with the PHP source is quite good, have you 
looked at that? Or maybe you do not feel it is enough for your needs?

What Linux are you using? Do you need a particular version of PHP or 
Apache? Most linux distributions come with both. If you did an "install 
everything" then you probably already have it.  I don't know Interbase, 
you may need to install some Interbase files to support that. If you 
feel you need to recompile, then you need the sources not just the 
binaries installed on your computer.

If you have Apache already compiled with mod_so (most seem to) and you 
are happy to have PHP as a DSO (OK for many situations), then you would 
not need to recompile Apache.

HTH
Chris


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



Re: [PHP] Is there any alternative to FuseBox?

2002-12-14 Thread Jason Wong
On Saturday 14 December 2002 23:57, Javier wrote:
> [EMAIL PROTECTED] (Jason Wong) wrote in
> [EMAIL PROTECTED]:">news:[EMAIL PROTECTED]:
>
> Hi, sorry that I didn't make it clear.
> I'm looking for an alternative to php-fusebox.

For processing of forms, there are a number of classes on www.phpclasses.org 
which do the job just fine.

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

/*
Be cheerful while you are alive.
-- Phathotep, 24th Century B.C.
*/


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




php-general Digest 14 Dec 2002 19:55:50 -0000 Issue 1763

2002-12-14 Thread php-general-digest-help

php-general Digest 14 Dec 2002 19:55:50 - Issue 1763

Topics (messages 128272 through 128292):

Re: Text Fields - How Big Can They Be?
128272 by: Jason Wong

Re: Problems with text files from a Mac
128273 by: Justin French

Re: Is there any alternative to FuseBox?
128274 by: Jason Wong
128288 by: Javier
128292 by: Jason Wong

Re: Mail Error
128275 by: Jason Wong

Re: File Upload
128276 by: Tom Rogers
128277 by: Jason Wong
128280 by: Paul Roberts
128281 by: Paul Roberts
128282 by: Bogdan Stancescu
128283 by: Jason Wong

session_start
128278 by: John Taylor-Johnston

I did: Re: session_start
128279 by: John Taylor-Johnston
128284 by: Jason Wong

php --with-GD
128285 by: info.t-host.com

migrating from register_globals on to off
128286 by: Willem
128287 by: John W. Holmes

php --with-gd support
128289 by: info.t-host.com

Compiling PHP and RH Linux
128290 by: Todd Cary
128291 by: Chris Hewitt

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--

--- Begin Message ---
On Saturday 14 December 2002 15:46, Monty wrote:
> Hi John, I'm using POST for the form. But it's the HTML form field itself
> that won't allow me to paste in a large amount of text. If I can get the
> field to accept the text, there's no problem sending it via POST to the PHP
> script.

I think that is browser-dependent. For example, for NN (4.x) I think it was 
64K.

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

/*
If you don't strike oil in twenty minutes, stop boring.
-- Andrew Carnegie, on public speaking
*/


--- End Message ---
--- Begin Message ---
1. they can export the CSV as DOS/Windows from Excel on the Mac with ease

2. they can pipe the CSV thru any text editor that lets them choose between
mac/win/unix line endings (BBEdit/Lite for example)

3. $filecontents = str_replace('\r', '\n', $filecontents); //should work


on 13/12/02 1:22 PM, Sterling Anderson ([EMAIL PROTECTED]) wrote:

> I am working on an application for a school district and am having some
> problems with the files they are supplying for import.
> They are supplying data files and I am writing routines to populate the
> database using these files. Its a simple file upload then I just need to
> parse through the tab separated value file. I am using the most recent
> PHP build on Windows with IIS ISAPI and a MSSQL database. They are
> sending text files from a Macintosh application.
> I noticed on the documentation for fgetcsv() that it cannot read the end
> of line character on Mac files. I have not been able to find a good work
> around for this issue. When I grab the entire contents of the file then
> try doing a string replacement on the "\r" or even "\t" for that matter
> it does not work.
> Has anyone found a good solution for dealing with Mac files?
> 

Justin French

http://Indent.com.au
Web Development & 
Graphic Design



--- End Message ---
--- Begin Message ---
On Saturday 14 December 2002 12:25, Javier wrote:
> I was reading FuseBox's beginners' guide but I didn't completely understood
> the way that framework works.
>
> How do you process the data obtained from forms? Is it the same script that
> displays the form?

Doesn't fusebox have it's own mailing list where you can ask questions? If so 
wouldn't that be a better place to do so?

In answer to the question in your subject:

  http://marc.theaimsgroup.com/?l=php-general&m=103964196113392&w=2

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

/*
The big cities of America are becoming Third World countries.
-- Nora Ephron
*/


--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] (Jason Wong) wrote in
[EMAIL PROTECTED]:">news:[EMAIL PROTECTED]: 

Hi, sorry that I didn't make it clear.
I'm looking for an alternative to php-fusebox.

So I was asking how do you process the data from forms and so. 


> On Saturday 14 December 2002 12:25, Javier wrote:
>> I was reading FuseBox's beginners' guide but I didn't completely
>> understood the way that framework works.
>>
>> How do you process the data obtained from forms? Is it the same
>> script that displays the form?
> 
> Doesn't fusebox have it's own mailing list where you can ask
> questions? If so wouldn't that be a better place to do so?
> 
> In answer to the question in your subject:
> 
>   http://marc.theaimsgroup.com/?l=php-general&m=10396419611339

[PHP] Fw: Formatting dates (from MySQL)

2002-12-14 Thread freaky
Hey there,

I was just looking at the date/time functions
(http://www.php.net/manual/en/function.time.php) and I can't seem to find a
function that can format a date that is supplied in the format of a DATETIME
column.

So, I was wondering, is there a function that can format it properly or
should I let the database handle the formatting (I'm really new to SQL, I
didn't come across anything to mod in the select statement yet). I could
ofcourse split it on space for a time and a date var and then split the date
on -'s for years, months and days but efficient is something else I think
:-) In the archives I saw some examples doing exactly that, but nothing with
a single function (unless home defined ofcourse).

Kind regards and TIA




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




Re: [PHP] Fw: Formatting dates (from MySQL)

2002-12-14 Thread Marco Tabini
You should be able to use strtotime() to transform the datetime string
into a UNIX timestamp, which you can then format back using date().
However, this is a very circuitous way--either use SQL to format it or,
if your DBMS supports it, have it returned already as a UNIX timestamp.
The actual SQL commands depend on which DBMS you actually use.


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
Hey there,

I was just looking at the date/time functions
(http://www.php.net/manual/en/function.time.php) and I can't seem to find a
function that can format a date that is supplied in the format of a DATETIME
column.

So, I was wondering, is there a function that can format it properly or
should I let the database handle the formatting (I'm really new to SQL, I
didn't come across anything to mod in the select statement yet). I could
ofcourse split it on space for a time and a date var and then split the date
on -'s for years, months and days but efficient is something else I think
:-) In the archives I saw some examples doing exactly that, but nothing with
a single function (unless home defined ofcourse).

Kind regards and TIA




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



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


RE: [PHP] Fw: Formatting dates (from MySQL)

2002-12-14 Thread John W. Holmes
> I was just looking at the date/time functions
> (http://www.php.net/manual/en/function.time.php) and I can't seem to
find
> a
> function that can format a date that is supplied in the format of a
> DATETIME
> column.
> 
> So, I was wondering, is there a function that can format it properly
or
> should I let the database handle the formatting (I'm really new to
SQL, I
> didn't come across anything to mod in the select statement yet). I
could
> ofcourse split it on space for a time and a date var and then split
the
> date
> on -'s for years, months and days but efficient is something else I
think
> :-) In the archives I saw some examples doing exactly that, but
nothing
> with
> a single function (unless home defined ofcourse).

You can use the DATE_FORMAT() function in your SELECT query to format
the date however you want it. Or, you can use UNIX_TIMESTAMP() to pull
it out in the unix format and then use the PHP function date() to format
it. 

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
#Date_and_time_functions

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP] Undefined Variable

2002-12-14 Thread Anthony Ritter
Using MS Win 98 / Apache Server:

I'm trying to test a form box using the php mail() function.

All is well when I fill in the text boxes and hit submit.

I receive the e-mail.

The form action in the html page is:

http://localhost/getform.php";  METHOD="POST">

_Now_

when I copy both of those files which are:

1. The html file for the form box

- I have now changed the form action to read:

http://www.narrowsburg.org/getform.php";  METHOD="POST">

and

2. the .php file for the script

and publish them to my site which is hosted on my ISP's MS Server, and then
input data in the form boxes and hit submit:

I now get the following:
..
NOTICE: Undefined Variable: name in
d:\inetpub\www.narrowsburg.org\getform.php  in line 7


Then, when I check my e-mail I get a message with no input data from the
variables like the name, e-mail, address, etc.

Thanking all in advance who might help me out.
Tony Ritter








--





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




Re: [PHP] Undefined Variable

2002-12-14 Thread Marco Tabini
Best guess, your local server has register_globals on and your ISP
doesn't. However, without seeing your code it's going to be difficult to
tell for sure! :-)


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
Using MS Win 98 / Apache Server:

I'm trying to test a form box using the php mail() function.

All is well when I fill in the text boxes and hit submit.

I receive the e-mail.

The form action in the html page is:

http://localhost/getform.php";  METHOD="POST">

_Now_

when I copy both of those files which are:

1. The html file for the form box

- I have now changed the form action to read:

http://www.narrowsburg.org/getform.php";  METHOD="POST">

and

2. the .php file for the script

and publish them to my site which is hosted on my ISP's MS Server, and then
input data in the form boxes and hit submit:

I now get the following:
..
NOTICE: Undefined Variable: name in
d:\inetpub\www.narrowsburg.org\getform.php  in line 7


Then, when I check my e-mail I get a message with no input data from the
variables like the name, e-mail, address, etc.

Thanking all in advance who might help me out.
Tony Ritter








--





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



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


Re: [PHP] Undefined Variable

2002-12-14 Thread Anthony Ritter
>"Marco Tabini <[EMAIL PROTECTED]> wrote in message:
> Best guess, your local server has register_globals on and your ISP
> doesn't. However, without seeing your code it's going to be difficult to
> tell for sure! :-)
>
>
> Marco


Thanks for the reply Marco.

The following is the code.  Any advice would be greatly appreciated.
Happy holidays...
Tony


//this is the the html page


http://www.narrowsburg.org/getform.php"; METHOD="POST">

Your Name:
Business Name:
Contact Person:
Telephone Number:
e-mail address:
Mailing Address:
Town:State:  Zip Code:
Category:
Description of your business: 






//this is the .php file called "getform.php"

http://localhost/n_proserv_x.html";);
 exit;
}
$msg = "This e-mail was sent from:\n";
$msg .= "Sender's Name:$thename\n";
$msg .= $thename ."'s business name is:$bizname\n";
$msg .= "The contact person is:$contactname\n";
$msg .= $thename. "'s phone number is:$phone\n";
$msg .= $thename. "'s e-mail address is: $email\n";
$msg .= $thename. "'s mailing address is: $mailing\n";
$msg .= "Town: $town\n";
$msg .= "State: $state\n";
$msg .= "Zip Code: $zip\n";
$msg .= $thename."'s category is: $cat\n";
$msg .= "and the message is:  $description\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "Narrowsburg Chamber of Commerce";
$mailheaders = "From: $thename\n";
$mailheaders .= "Reply to:$email\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
.



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




Re: [PHP] Undefined Variable

2002-12-14 Thread Marco Tabini
Hey Anthony--

It's definitely a register_globals problem. Your ISP has turned it off
because it's generally considered a significant security risk.

The best way to solve it is to use the superglobal $_POST to access your
post data. In your PHP script, change all the variables that you take
from the form into their $_POST[''] equivalent (see below for a rough
example--I put the assignments at the beginning because I wanted to
touch your code as little as possible). Also, keep in mind that you're
not performing any checks on the data--I'm sure you want to do it once
you've sorted the current problem out, but the way it is now you're
leaving yourself exposed to a number of possible attacks.

$thename = $_POST['thename'];
$email = $_POST['email'];
$description = $_POST['description'];
$bizname = $_POST['bizname'];
$contactname = $_POST['contactname'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$mailing = $_POST['mailing'];
$town = $_POST['town'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$cat = $_POST['cat'];

if (($thename == "") && ($email == "") && ($description == "")) {
 header("Location: http://localhost/n_proserv_x.html";);
 exit;
}
$msg = "This e-mail was sent from:\n";
$msg .= "Sender's Name:$thename\n";
$msg .= $thename ."'s business name is:$bizname\n";
$msg .= "The contact person is:$contactname\n";
$msg .= $thename. "'s phone number is:$phone\n";
$msg .= $thename. "'s e-mail address is: $email\n";
$msg .= $thename. "'s mailing address is: $mailing\n";
$msg .= "Town: $town\n";
$msg .= "State: $state\n";
$msg .= "Zip Code: $zip\n";
$msg .= $thename."'s category is: $cat\n";
$msg .= "and the message is:  $description\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "Narrowsburg Chamber of Commerce";
$mailheaders = "From: $thename\n";
$mailheaders .= "Reply to:$email\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
>"Marco Tabini <[EMAIL PROTECTED]> wrote in message:
> Best guess, your local server has register_globals on and your ISP
> doesn't. However, without seeing your code it's going to be difficult to
> tell for sure! :-)
>
>
> Marco


Thanks for the reply Marco.

The following is the code.  Any advice would be greatly appreciated.
Happy holidays...
Tony


//this is the the html page


http://www.narrowsburg.org/getform.php"; METHOD="POST">

Your Name:
Business Name:
Contact Person:
Telephone Number:
e-mail address:
Mailing Address:
Town:State:  Zip Code:
Category:
Description of your business: 






//this is the .php file called "getform.php"

http://localhost/n_proserv_x.html";);
 exit;
}
$msg = "This e-mail was sent from:\n";
$msg .= "Sender's Name:$thename\n";
$msg .= $thename ."'s business name is:$bizname\n";
$msg .= "The contact person is:$contactname\n";
$msg .= $thename. "'s phone number is:$phone\n";
$msg .= $thename. "'s e-mail address is: $email\n";
$msg .= $thename. "'s mailing address is: $mailing\n";
$msg .= "Town: $town\n";
$msg .= "State: $state\n";
$msg .= "Zip Code: $zip\n";
$msg .= $thename."'s category is: $cat\n";
$msg .= "and the message is:  $description\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "Narrowsburg Chamber of Commerce";
$mailheaders = "From: $thename\n";
$mailheaders .= "Reply to:$email\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
.



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



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


Re: [PHP] Undefined Variable

2002-12-14 Thread Anthony Ritter
Marco Tabini <[EMAIL PROTECTED]> wrote in message:
> Hey Anthony--
>
> It's definitely a register_globals problem. Your ISP has turned it off
> because it's generally considered a significant security risk.
>
> The best way to solve it is to use the superglobal $_POST to access your
> post data. In your PHP script, change all the variables that you take
> from the form into their $_POST[''] equivalent (see below for a rough
> example--I put the assignments at the beginning because I wanted to
> touch your code as little as possible). Also, keep in mind that you're
> not performing any checks on the data--I'm sure you want to do it once
> you've sorted the current problem out, but the way it is now you're
> leaving yourself exposed to a number of possible attacks.
>
> $thename = $_POST['thename'];
(snipped)
.

Yep.

That did it.  Thanks again Marco.

Two more questions:

1. Can you give me some examples about:

"leaving yourself exposed to a number of possible attacks."

and

2. Where can I pick up the PHP magazine in your post sig.

best...
TR






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




[PHP] Hey, If anyone can help me with this at all, I would reallyappreciate it...

2002-12-14 Thread Ryan Smaglik
I got a generic ³text to png on the fly² script which works fine but I want
to change it so that the image only the size of the text. (so the text has
no border, or padding around it) For and example of what I want to do check
out: http://www.spoono.com/font/?string=This is what i want to do&.png
I have the script:


The text for the image is called from a url like
www.xelerix.com/font/font.php?text=Hi

Thanks!





[PHP] Parse Errors

2002-12-14 Thread Andy Turegano
I am a PHP beginner so this error may be a stupid one. Anyway, I'm
trying to write a simple addition script. The client enters two numbers,
then my script (adder.php) adds them. However, when the script is run, I
get "Parse Error On Line 3" I have no idea exactly what I have done wrong.
Here is the script.



Any help would be greatly appreciated. Thank you.



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




Re: [PHP] Parse Errors

2002-12-14 Thread DL Neil
Andy,

> I am a PHP beginner so this error may be a stupid one. Anyway, I'm
> trying to write a simple addition script. The client enters two numbers,
> then my script (adder.php) adds them. However, when the script is run, I
> get "Parse Error On Line 3" I have no idea exactly what I have done wrong.
> Here is the script.
>
>  print ("Your first number is:$firstnumber\n")
> print ("Your second number is:$secondnumber\n")
> $answer=$firstnumber+$second number
> echo ("The answer is: $answer\n")
> ?>
>
> Any help would be greatly appreciated. Thank you.


PHP code lines must end with a semi-colon (;).
Also, HTML newlines are  (not \n)
Some PHPs won't like the short tags, recommend: http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Querying two tables

2002-12-14 Thread Cesar Aracena
Hi all,

I have several tables from which I have to fetch certain products &
categories based on customer selection. The tables are as follows:

Table 1 - Categories
catid (autonum)
catname

Table 2 - Sub categories
subcatid (autonum)
subcatname

Table 3 - Products
prodid (autonum)
prodname

Table 4 - Relationships
Catid
Subcatid
Prodid

Now, the question is how to fetch all the sub-categories let's say that
are related to category 0001. I know it's as simple as relating two
tables in one query, but I don't remember how. Any help appreciated.


Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




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




[PHP] Session: I RTFM

2002-12-14 Thread John Taylor-Johnston
>Jason wrote:
>RTFM again.

Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.

>Sessions depends on a number of factors
>including your version of PHP and the setting of register_globals.

The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
cleaner way?


";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname";
}




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




Re: [PHP] Session: I RTFM

2002-12-14 Thread Marco Tabini
I haven't followed the rest of the thread, but how about using a
function?

function getvar ($varname)
{
if (isset ($_POST[$varname])
{
$_SESSION[$varname] = $_POST[$varname];
return $_POST[$varname];
}
elseif (isset ($_SESSION[$varname]))
return $_SESSION[$varname];
}

session_start();

// You don't need session_register anymore

$familyname = getvar('familyname');


and so on--just one line per variable.

Hope this helps.

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
>Jason wrote:
>RTFM again.

Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.

>Sessions depends on a number of factors
>including your version of PHP and the setting of register_globals.

The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
cleaner way?


";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname";
}




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



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


[PHP] question

2002-12-14 Thread r.vellinga
Hello,

still trying to get PHP 4 support on Apache 2. (Windows ME)
Mysql is working Fine, Apache also.

but when i insert the 2 or 3 lines " Load module etc."  the server will shut down 

can somebody help me please ?

ricardo





[PHP] PHP/ldap - atomic attribute modification

2002-12-14 Thread Carl J Meyer
Hi all,

Anyone out there have significant experience using the PHP/ldap
interface?  It appears to me that it's missing some important
functionality, but I might just not be seeing how to do it.

I have a user-management application which needs to manage an openLDAP
user base of several thousand users.  For adding users, we need a way to
get the next available UID number without creating a race condition
where two users could simultaneously grab the same UID number.

The question of how to best do this (on the LDAP side) has been hashed
over quite a bit on the openldap-software mailing list.  Without
repeating all that discussion, the conclusion is that we need to grab a
"highestAssignedUid" attribute of the "ou=users,dc=example,dc=com" entry
and increment it using an attribute modify operation like this:

dn: ou=users,dc=example,dc=com
changetype: modify
delete: highestAssignedUid
highestAssignedUid: 500
-
add: highestAssignedUid
highestAssignedUid: 501

This solves the problem, because LDAP modify operations are atomic, and
this modify operation will fail if the 'highestAssignedUid' attribute no
longer has the value that we grabbed (eg 500).  So if we grab the
highestAssignedUid, and then our increment fails, we just back off and
try the whole thing over again.  If the increment succeeds, we know
we've got a unique UIDnumber.

But here's the problem: The PHP/ldap interface doesn't seem to have any
way of supporting this type of modify, where one value is deleted and
another added in a single atomic modify operation.  ldap_mod_replace()
and ldap_modify() replace /all/ the values of an attribute, irrespective
of previous values.  ldap_mod_del() will delete a specific value of an
attribute, and ldap_mod_add() will add a value to an attribute without
replacing existing ones, but if I have to make two function calls I've
lost the crucial feature, which is atomicity, and reintroduced the race
condition.

Is there any good solution here?

TIA for any advice,
Carl


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




[PHP] Re: Session: I RTFM

2002-12-14 Thread TomH

When faced with this problem I tried the following (works)

The top section of PHP code just reads the POST return array
and plops it into a series of successive _SESSION vars

Included is a FORM to use that shows the simple code at work

HTH
TomHenry

  Tested  =

session_start();

//echo "List the _POST key/val pairs";

// Try to cycle though the _POST vars
// and use them as input to creating _SESSION vars

while(list($k,$v)=each($_POST)){
$_SESSION[$k]=$v;
//echo "_name_ ".stripslashes($k)." _value_ 
".stripslashes($v)."";
}

// easy way to peek at the contents of what we just did

echo "print_r of the \$_SESSION array";
print_r($_SESSION);
echo "";
?>




	Nextpage




Is our _SESSION here?


KeyValue

while(list($k,$v)=each($_SESSION)){
echo 
"".stripslashes($k)."".stripslashes($v)."";
}
?>


 method=POST>
key  -- value 

Name:  
-- Address: 








John Taylor-Johnston wrote:
Jason wrote:
RTFM again.



Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.



Sessions depends on a number of factors
including your version of PHP and the setting of register_globals.



The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, cleaner way?


";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname";
}






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




Re: [PHP] A little regex help

2002-12-14 Thread Justin French
Not sure if it will be quicker or not, but I don't think you NEED a regex:

- get rid of 'for more information'
- split on 'See' into $pre and $code
- trim the bits down
- wrap $code in a URL
- glue it all back together

UNTESTED CODE:
http://support.microsoft.com/default.aspx?scid=kb;en-us;";;
$suffix = 'for more information';
$splitter = 'See';

// do it
list($pre,$code) = explode($splitter,$str = str_replace($suffix,'',$str));
$pre = trim($pre); $code = trim($code);
$str = "{$pre} See {$code} {$suffix}";

echo $str;
?>

If this gets heavy traffic, u may want to test which is faster -- or you may
not care!!


Justin


on 14/12/02 5:21 AM, Gareth Hastings ([EMAIL PROTECTED]) wrote:

> Hi,
> 
> I'm trying to work out the regex needed to split either one of the
> following lines
> 
> Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information
> Windows XP Hotfix (SP2) See Q327696 for more information
> 
> Into one of these
> 
> Windows 2000 Hotfix (Pre-SP4) See  href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'>Q
> 322842 for more information
> Windows XP Hotfix (SP2) See  href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696>Q3
> 27696 for more information
> 
> I can work out half of the expression but not the other half lol, I've
> used a combination of ereg and split but I'm sure this can be done with
> 1 ereg statement. Here is my code
> 
> $ms = "http://support.microsoft.com/default.aspx?scid=kb;en-us;";;
> 
> 
> if (ereg("(\[See )([Q|q][0-9]+)( for more information\])", $name))
> {
> $sp = split("\[See ", $name);
> ereg("([Q|q][0-9]+)( for more information\])", $sp[1], $qb);
> 
> $url = $sp[0] . "See  target='_blank'>" . $qb[1] . " for more information";
> 
> }
> 
> Any ideas?
> 
> Gareth
> 
> 

Justin French

http://Indent.com.au
Web Development & 
Graphic Design



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




Re: [PHP] migrating from register_globals on to off

2002-12-14 Thread Justin French
Why not:

1. place a .htaccess file in each existing client/developer directory
switching the value to ON -- being careful to ensure you don't wipe over an
existing .htaccess file!!

2. switch the value to OFF in php.ini


This means all current clients will have continued support for ON, and all
new ones will default to OFF.  If existing clients which to go with OFF,
they just delete the .htaccess file.


OR the vice-versa can be done... advise clients that you are moving to OFF
in a month, explain the benefits, and make a .htaccess file available to
those who don't want to migrate... so that their stuff doesn't break.

Most developers will know which way they're writing code.


You ultimately need to:

- change the default to OFF
- allow existing clients to "patch" to ON



Justin


on 15/12/02 12:43 AM, Willem ([EMAIL PROTECTED]) wrote:

> Hello,
> 
> Lately we discovered that, by mistake, we've run PHP with register_globals
> on for a few months for all our customers.
> 
> Since we want to turn it off, we need to figure out which customers use the
> 'register_globals' functionality so we can ask them to modify their scripts.
> 
> However, checking all php code by hand is a non-trivial task, because there
> are 20,000+ php scripts. Is there a way to:
> 
> a) parse all .php scripts once and detect whether they depend on register
> globals on?
> 
> or probably easier:
> 
> b) add something to our current setup so that when a scripts is executed and
> uses the register globals functionality, we get a notification
> automatically?
> 
> Any suggestions?
> Thanks!
> 
> 
> 

Justin French

http://Indent.com.au
Web Development & 
Graphic Design



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




[PHP] Re: Session: I RTFM

2002-12-14 Thread John Taylor-Johnston
Thanks.

John



> When faced with this problem I tried the following (works)
>
> The top section of PHP code just reads the POST return array
> and plops it into a series of successive _SESSION vars
>
> Included is a FORM to use that shows the simple code at work
>
> HTH
> TomHenry
>
>   Tested  =
>  session_start();
>
> //echo "List the _POST key/val pairs";
>
> // Try to cycle though the _POST vars
> // and use them as input to creating _SESSION vars
>
> while(list($k,$v)=each($_POST)){
> $_SESSION[$k]=$v;
> //echo "_name_ ".stripslashes($k)." _value_
> ".stripslashes($v)."";
> }
>
> // easy way to peek at the contents of what we just did
>
> echo "print_r of the \$_SESSION array";
> print_r($_SESSION);
> echo "";
> ?>
> 
>
> 
> 
> Nextpage
> 
>
> 
> 
> Is our _SESSION here?
> 
> 
> KeyValue
>  while(list($k,$v)=each($_SESSION)){
> echo
> "".stripslashes($k)."".stripslashes($v)."";
> }
> ?>
> 
> 
>  method=POST>
> key  maxlength="25"> -- value  value='ValueOne' size="30" maxlength="80">
> 
> Name: 
> -- Address: 
> 
> 
> 
> 
> 
>
> John Taylor-Johnston wrote:
> >>Jason wrote:
> >>RTFM again.
> >
> >
> > Jason, again, I RTFM, but did not get it working.
> > Otherwise I wouldn't have dared ask a question.
> >
> >
> >>Sessions depends on a number of factors
> >>including your version of PHP and the setting of register_globals.
> >
> >
> > The FM manual says:
> >
> > "$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"
> >
> > So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)
> >
> > Ok. I quit using $HTTP_POST_VARS["familyname"].
> >
> > With a little rethinking, I have this working, I hope.
> >
> > Now ... is there a cleaner way to assign my variable "familyname"?
> >
> > Pseudo code:
> >
> > if _post["familyname"] exists set session variable
> >  (no sense in setting it until I post it)
> > if _session["familyname"] exists, $familyname = $_SESSION["familyname"];
> >
> > I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
>cleaner way?
> >
> >
> >  > #session_name("TestALS");
> > session_start();
> >
> > if (isset($_POST["familyname"]))
> > {
> > session_register("familyname");
> > $familyname = $_POST["familyname"];
> > echo "Yay: \$familyname= $familyname";
> > }
> >
> > if (isset($_SESSION["familyname"]))
> > {
> > $familyname = $_SESSION["familyname"];
> > echo "yay session works, \$familyname= $familyname";
> > }
> >
> >
> >

--
John Taylor-Johnston
-
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] Session: I RTFM

2002-12-14 Thread John Taylor-Johnston
Marco (or anyone)

What is the difference between:
$familyname = getvar("familyname");
and
$familyname = getvar('familyname');

What do single quotes do, as a general rule, that double cannot (he asks remembering 
something, but not sure what)?




Marco Tabini wrote:

> I haven't followed the rest of the thread, but how about using a
> function?
>
> function getvar ($varname)
> {
> if (isset ($_POST[$varname])
> {
> $_SESSION[$varname] = $_POST[$varname];
> return $_POST[$varname];
> }
> elseif (isset ($_SESSION[$varname]))
> return $_SESSION[$varname];
> }
>
> session_start();
>
> // You don't need session_register anymore
>
> $familyname = getvar('familyname');
>
> and so on--just one line per variable.
>
> Hope this helps.
>
> Cheers,
>
> Marco
> --
> 
> php|architect - The Magazine for PHP Professionals
> The monthly magazine dedicated to the world of PHP programming
>
> Check us out on the web at http://www.phparch.com!
>
>   
>---
>
> Subject: [PHP] Session: I RTFM
> Date: Sat, 14 Dec 2002 18:41:40 -0500
> From: John Taylor-Johnston <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Organization: FLSH, U-de-S
> To: [EMAIL PROTECTED]
>
> >Jason wrote:
> >RTFM again.
>
> Jason, again, I RTFM, but did not get it working.
> Otherwise I wouldn't have dared ask a question.
>
> >Sessions depends on a number of factors
> >including your version of PHP and the setting of register_globals.
>
> The FM manual says:
>
> "$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"
>
> So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)
>
> Ok. I quit using $HTTP_POST_VARS["familyname"].
>
> With a little rethinking, I have this working, I hope.
>
> Now ... is there a cleaner way to assign my variable "familyname"?
>
> Pseudo code:
>
> if _post["familyname"] exists set session variable
>  (no sense in setting it until I post it)
> if _session["familyname"] exists, $familyname = $_SESSION["familyname"];
>
> I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
>cleaner way?
>
>  #session_name("TestALS");
> session_start();
>
> if (isset($_POST["familyname"]))
> {
> session_register("familyname");
> $familyname = $_POST["familyname"];
> echo "Yay: \$familyname= $familyname";
> }
>
> if (isset($_SESSION["familyname"]))
> {
> $familyname = $_SESSION["familyname"];
> echo "yay session works, \$familyname= $familyname";
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
John Taylor-Johnston
-
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] question

2002-12-14 Thread Justin French
I assume you know that running PHP on Apache 2 is NOT RECOMMENDED YET, or at
the very least, listed as "experimental"??

Justin


on 15/12/02 11:13 AM, r.vellinga ([EMAIL PROTECTED]) wrote:

> Hello,
> 
> still trying to get PHP 4 support on Apache 2. (Windows ME)
> Mysql is working Fine, Apache also.
> 
> but when i insert the 2 or 3 lines " Load module etc."  the server will shut
> down 
> 
> can somebody help me please ?
> 
> ricardo
> 
> 
> 

Justin French

http://Indent.com.au
Web Development & 
Graphic Design



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




Re: [PHP] Session: I RTFM

2002-12-14 Thread Justin French
John,

PHP looks for "$vars or {$vars} to parse in the string" when double quotes
are used... whereas when single quotes are used, it won't parse/substitute
the vars.



So, when you're not using $vars, using single quotes will be marginally
faster... perhaps not important on small sites, but very important on big
ones, and a decent habbit to get into :)


Justin


on 15/12/02 12:30 PM, John Taylor-Johnston
([EMAIL PROTECTED]) wrote:

> Marco (or anyone)
> 
> What is the difference between:
> $familyname = getvar("familyname");
> and
> $familyname = getvar('familyname');
> 
> What do single quotes do, as a general rule, that double cannot (he asks
> remembering something, but not sure what)?
> 
> 
> 
> 
> Marco Tabini wrote:
> 
>> I haven't followed the rest of the thread, but how about using a
>> function?
>> 
>> function getvar ($varname)
>> {
>> if (isset ($_POST[$varname])
>> {
>> $_SESSION[$varname] = $_POST[$varname];
>> return $_POST[$varname];
>> }
>> elseif (isset ($_SESSION[$varname]))
>> return $_SESSION[$varname];
>> }
>> 
>> session_start();
>> 
>> // You don't need session_register anymore
>> 
>> $familyname = getvar('familyname');
>> 
>> and so on--just one line per variable.
>> 
>> Hope this helps.
>> 
>> Cheers,
>> 
>> Marco
>> --
>> 
>> php|architect - The Magazine for PHP Professionals
>> The monthly magazine dedicated to the world of PHP programming
>> 
>> Check us out on the web at http://www.phparch.com!
>> 
>> -
>> -
>> -
>> -
>> -
>> -
>> -
>> -
>> -
>> -
>> -
>> 
>> 
>> Subject: [PHP] Session: I RTFM
>> Date: Sat, 14 Dec 2002 18:41:40 -0500
>> From: John Taylor-Johnston <[EMAIL PROTECTED]>
>> Reply-To: [EMAIL PROTECTED]
>> Organization: FLSH, U-de-S
>> To: [EMAIL PROTECTED]
>> 
>>> Jason wrote:
>>> RTFM again.
>> 
>> Jason, again, I RTFM, but did not get it working.
>> Otherwise I wouldn't have dared ask a question.
>> 
>>> Sessions depends on a number of factors
>>> including your version of PHP and the setting of register_globals.
>> 
>> The FM manual says:
>> 
>> "$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"
>> 
>> So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test
>> offline)
>> 
>> Ok. I quit using $HTTP_POST_VARS["familyname"].
>> 
>> With a little rethinking, I have this working, I hope.
>> 
>> Now ... is there a cleaner way to assign my variable "familyname"?
>> 
>> Pseudo code:
>> 
>> if _post["familyname"] exists set session variable
>> (no sense in setting it until I post it)
>> if _session["familyname"] exists, $familyname = $_SESSION["familyname"];
>> 
>> I'll have about 30 variables. Going to be alot of lines. There must be an
>> easier, cleaner way?
>> 
>> > #session_name("TestALS");
>> session_start();
>> 
>> if (isset($_POST["familyname"]))
>> {
>> session_register("familyname");
>> $familyname = $_POST["familyname"];
>> echo "Yay: \$familyname= $familyname";
>> }
>> 
>> if (isset($_SESSION["familyname"]))
>> {
>> $familyname = $_SESSION["familyname"];
>> echo "yay session works, \$familyname= $familyname";
>> }
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> --
> John Taylor-Johnston
> -
> "If it's not open-source, it's Murphy's Law."
> 
> ' ' '   Collège de Sherbrooke:
> ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
> - Université de Sherbrooke:
> http://compcanlit.ca/
> 819-569-2064
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

Justin French

http://Indent.com.au
Web Development & 
Graphic Design



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




[PHP] Installing PEAR on windows

2002-12-14 Thread Davy Obdam
Hi people,

I have a question, i would like to use PEAR in some of my applications, 
how can i download and iinstall PEAR on windows. I have Apache 2.0.43 
with PHP 4.3.0 RC3 installed on a windows XP machine. I read on 
http://pear.php.net/manual/en/faq.windows.php .

To make PEAR work on Windows, you simple need to add the PEAR 
installation dir (e.g. c:\php\pear) to the include_path directive in 
your php.ini.

Well i thats easy, but i dont have a pear directory? Making a new 
directory is easy also;-), but.. How and where do i download and 
instal the PEAR packages on my machine... Thanks...

Best regards,..

Davy Obdam
mailto:[EMAIL PROTECTED]




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



[PHP] Strange problem with PHP,SSI

2002-12-14 Thread sport4ever
PHP version: 4.2.1
OS: RedHat Linux 8
Apache version: 2.0

My problem is that I can't execute more than one (SSI include) on my website JUST for 
PHP file.. so there is NO problems at all if I include HTML or SHTML files.

Anyway, if I include 2 PHP files into any page, the first INCLUDE statement would 
execute correctly and print out the file output, but the second INCLUDE statement 
would NOT execute, and instead, the statement printed in the page source as it is:



notice that this problem was not exist in my server before I upgrade PHP from 4.1.2 to 
4.2.1 and Apache from 1.3 to 2.0 and Linux from 7.3 to 8.0 !!

any idea?




Re: [PHP] question

2002-12-14 Thread Andy Turegano
Yes, that is indeed true.

On Sun, 15 Dec 2002, Justin French wrote:

> I assume you know that running PHP on Apache 2 is NOT RECOMMENDED YET, or at
> the very least, listed as "experimental"??
>
> Justin
>
>
> on 15/12/02 11:13 AM, r.vellinga ([EMAIL PROTECTED]) wrote:
>
> > Hello,
> >
> > still trying to get PHP 4 support on Apache 2. (Windows ME)
> > Mysql is working Fine, Apache also.
> >
> > but when i insert the 2 or 3 lines " Load module etc."  the server will shut
> > down
> >
> > can somebody help me please ?
> >
> > ricardo
> >
> >
> >
>
> Justin French
> 
> http://Indent.com.au
> Web Development &
> Graphic Design
> 
>
>
> --
> 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] Re: Session: I RTFM

2002-12-14 Thread michael kimsal
Instead of

while(list($k,$v)=each($_POST)){
$_SESSION[$k]=$v;
//echo "_name_ ".stripslashes($k)." _value_ 
".stripslashes($v)."";
}

why not just

$_SESSION = array_merge($_SESSION,$_POST);

???


Michael Kimsal
http://www.phpappserver.com
734-480-9961


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




[PHP] Re: Strange problem with PHP,SSI

2002-12-14 Thread conbud
Sport4ever wrote:

PHP version: 4.2.1
OS: RedHat Linux 8
Apache version: 2.0

My problem is that I can't execute more than one (SSI include) on my website JUST for PHP file.. so there is NO problems at all if I include HTML or SHTML files.

Anyway, if I include 2 PHP files into any page, the first INCLUDE statement would execute correctly and print out the file output, but the second INCLUDE statement would NOT execute, and instead, the statement printed in the page source as it is:



notice that this problem was not exist in my server before I upgrade PHP from 4.1.2 to 4.2.1 and Apache from 1.3 to 2.0 and Linux from 7.3 to 8.0 !!

any idea?




Hey, you could try using the PHP include



or




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




[PHP] Re: Session: I RTFM

2002-12-14 Thread conbud
John Taylor-Johnston wrote:

Jason wrote:
RTFM again.



Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.



Sessions depends on a number of factors
including your version of PHP and the setting of register_globals.



The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, cleaner way?


";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname";
}





Hey, I dont know how much easier it will be but it is faster, you could 
use a switch statement.

switch ($_SESSION['familyname'])
{
case 'name1':
do something;
break;

case 'name2':
do something;
break;

default:
do this if the variable doesnt match a case;
break;
}


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