[PHP] Re: Function Call Line Number

2001-11-14 Thread dav

Well, I don't know either but I was thinking about that...
Usually this $lineno = __LINE__ would be avaluated when the function is
called, this mean it gives the __LINE__ of the function call itself.
Why don't you try a more simple include/require instead of calling a
funcion ?(see example)
but maybe it will return the value LINE 1 in the included file... I don't
know...

that is:

...code...
include(line.php);
...code...

line.php

echo(__LINE__);
Jason G. [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello,

 Does anyone know of a way, that from within a function, you can determine
 what line number and file the function was called on?

 I did try:
 function myfunc($lineno = __LINE__)
 {
 echo $lineno;
 }
 but this just outputted the very line that __LINE__ resides on.

 This would be very helpful in displaying sensible error messages, like the
 native php functions do.

 Thanks,

 -Jason Garber
 IonZoft.com




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Function Call Line Number

2001-11-14 Thread dav

Another thing...
if the $lineno variable isn't defined yet, maybe the parser first try a cast
into __LINE__ type, so even if the assign procedure is called at the
function call, the line is evaluated at the funcion definition step...

but maybe it's a bullship :-)
J
Dav [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Well, I don't know either but I was thinking about that...
 Usually this $lineno = __LINE__ would be avaluated when the function is
 called, this mean it gives the __LINE__ of the function call itself.
 Why don't you try a more simple include/require instead of calling a
 funcion ?(see example)
 but maybe it will return the value LINE 1 in the included file... I
don't
 know...

 that is:

 ...code...
 include(line.php);
 ...code...

 line.php
 
 echo(__LINE__);
 Jason G. [EMAIL PROTECTED] ha scritto nel messaggio
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hello,
 
  Does anyone know of a way, that from within a function, you can
determine
  what line number and file the function was called on?
 
  I did try:
  function myfunc($lineno = __LINE__)
  {
  echo $lineno;
  }
  but this just outputted the very line that __LINE__ resides on.
 
  This would be very helpful in displaying sensible error messages, like
the
  native php functions do.
 
  Thanks,
 
  -Jason Garber
  IonZoft.com
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: using sessions and include

2001-11-14 Thread dav

session name in the display_image appears to be different from the name
specified in the index

Jtjohnston [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Martin, are ya out there? Does anyone know anything about sessions? (An
 post  reply would be handy :)

 I am using session_register. I have:

 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html

http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html.phps

 Which submits to:

 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.php

 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.phps

 postcard.php  is supposed to pass data to display_image.php


http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.ph
p


http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.ph
ps

 The problem is that display_image.php loses my data coming from
 index.html

 }else{
 include display_image.php;
 }

 But when I try to debug and remove the \\ on lines 3  4

 //include(display_image.php);
 //exit;

 display_image.php will display my data correctly from index.html

 Can anyone help? What am I doing wrong?

 John





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Multiple .ini-files for PHP

2001-11-14 Thread Stefan

Is there a way to have different .ini-files for each VirtualHost?
Apache is used as webserver

Thank you for helping
Stefan Rusterholz, [EMAIL PROTECTED]
--
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
--
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
--



[PHP] array_unique() workaround?

2001-11-14 Thread Spunk S. Spunk III

I'm working on a script that needs array_unique() but my host is using 4.0.4
and it's broken in that build. Does anyone have a good workaround for this?
I can wait for my host to upgrade but if I release this code, it would be
better to have the workaround...

I just need a good way to check for dups in an array and remove them. I
can't get my brain around it...

TIA
Spunk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Multiple .ini-files for PHP

2001-11-14 Thread dav

You can pass different ini stuff in the htaccess file for each virtual host
Stefan [EMAIL PROTECTED] ha scritto nel messaggio
002a01c16ce4$bf6bc960$3c01a8c0@quasimodo">news:002a01c16ce4$bf6bc960$3c01a8c0@quasimodo...
Is there a way to have different .ini-files for each VirtualHost?
Apache is used as webserver

Thank you for helping
Stefan Rusterholz, [EMAIL PROTECTED]
--
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
--
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
--




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Multiple .ini-files for PHP

2001-11-14 Thread dav

From www.php.net searching htaccess in the online documentation:
When using PHP as an Apache module, it is possible to override PHP ini
setting per Virtual Host in httpd.conf or per directory with .htaccess.
Refer to the Configuration section and Apache Manual for details.

Stefan [EMAIL PROTECTED] ha scritto nel messaggio
002a01c16ce4$bf6bc960$3c01a8c0@quasimodo">news:002a01c16ce4$bf6bc960$3c01a8c0@quasimodo...
Is there a way to have different .ini-files for each VirtualHost?
Apache is used as webserver

Thank you for helping
Stefan Rusterholz, [EMAIL PROTECTED]
--
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
--
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
--




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: array_unique() workaround?

2001-11-14 Thread dav

You can:
1) make a while cycle
2) pop the value
3) use the in_array to check if the value is in the array
(pop means extract not only get)
4) if in_array function returns true push the value in a new array

J
Spunk S. Spunk III [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm working on a script that needs array_unique() but my host is using
4.0.4
 and it's broken in that build. Does anyone have a good workaround for
this?
 I can wait for my host to upgrade but if I release this code, it would be
 better to have the workaround...

 I just need a good way to check for dups in an array and remove them. I
 can't get my brain around it...

 TIA
 Spunk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] %20

2001-11-14 Thread Oosten, Sjoerd van

Hello

I just discovered a netscape 4.7 bug when sending a string. The variable
cannot contain a space.  So a string like this does not work in netscape 4.7

objectdetail.php?Bouw=variableObject_type=normalStreet_type=normal
street.

The variable Street_type doesn't get through netscape 4.7, but IE and
Netscape 6 do let the variable through.


Is there a way to automatically let a spacer fill with %20 so it works at
all browsers and i don't have to reprogram my system?


Thanks!



Sjoerd van Oosten 
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V. 
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730 
4817 ZH BREDA Telefax: (076) 5 877 757 
___


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Newbie question pleeze help

2001-11-14 Thread RVB Pixels

Hi,

I'm new to the list and I have a problem with PHPNUKE 5.2 and W98.

After installing some categories and links in the Web Links section, and
then clicking on one of the links created I keep getting the following
message error in W98SE.

PHP caused an invalid page fault in module PHP4TS.DLL...


Does anyone know why and how can I solve this problem ?





Stephen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] %20

2001-11-14 Thread Pavel Jartsev

Oosten, Sjoerd van wrote:

 Hello
 
 I just discovered a netscape 4.7 bug when sending a string. The variable
 cannot contain a space.  So a string like this does not work in netscape 4.7
 
 objectdetail.php?Bouw=variableObject_type=normalStreet_type=normal
 street.
 
 The variable Street_type doesn't get through netscape 4.7, but IE and
 Netscape 6 do let the variable through.
 
 
 Is there a way to automatically let a spacer fill with %20 so it works at
 all browsers and i don't have to reprogram my system?
 

You need this:

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

-- 
Pavel a.k.a. Papi


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] File Upload Form

2001-11-14 Thread Sharat Hegde

Hello,

I found the solution to my problem here it is.

Adding the following line in the HTML seems to make the PHP code work well
with the Upload Form.

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN

Don't know why but, I guess this makes the document HTML compliant.

Regards,
Sharat

-Original Message-
From: Sharat Hegde [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 3:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] File Upload Form


Hello,

The PHP manual provides a method for File Upload. The sample code is as
follows:
FORM ENCTYPE=multipart/form-data ACTION=_URL_ METHOD=POST
INPUT TYPE=hidden name=MAX_FILE_SIZE value=1000
Send this file: INPUT NAME=userfile TYPE=file
INPUT TYPE=submit VALUE=Send File
/FORM 

While this works when this is part of an HTML page, it strangely does not
work when it is part of a PHP3 file. I found this to be problem with my PHP
page after some struggle.

Any reasons why this does not work in a PHP3 file?

Regards,
Sharat
*
Disclaimer: The information in this e-mail and any attachments is
confidential / privileged. It is intended solely for the addressee or
addressees. If you are not the addressee indicated in this message, you may
not copy or deliver this message to anyone. In such case, you should destroy
this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind.
*

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
*
Disclaimer: The information in this e-mail and any attachments is
confidential / privileged. It is intended solely for the addressee or
addressees. If you are not the addressee indicated in this message, you may
not copy or deliver this message to anyone. In such case, you should destroy
this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind.
*

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array_unique() workaround?

2001-11-14 Thread Stig Venaas

On Wed, Nov 14, 2001 at 09:17:03AM +0100, Spunk S. Spunk III wrote:
 I'm working on a script that needs array_unique() but my host is using 4.0.4
 and it's broken in that build. Does anyone have a good workaround for this?
 I can wait for my host to upgrade but if I release this code, it would be
 better to have the workaround...
 
 I just need a good way to check for dups in an array and remove them. I
 can't get my brain around it...

If you can sort the array, it is quite easy, simply sort it and look for
consecutive values that are equal.

Depending on your values, you might also try array_flip() twice. The
values becomes keys and keys values, and then back again. You will
then have unique values.

Yet another way could be to use array_count_values() perhaps.

Stig

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] VALUABLE LESSON: using sessions and include

2001-11-14 Thread jtjohnston

Thanks Dav,

You caught me while I was debugging. But I learned a valuable  lesson! I indeed
did not name my session_name correctly. IN FACT ... I did not name it AT ALL in
display_image.php. There lay the problem. I needed to declare both:

session_name(ESLpostcard);
session_start();

at the beginning of display_image.php AND postcard.php for the data to
re-transmit itself.

I was running both php files without session_name and session_start. The docs
just don't make that clear enough that you need to re-include session_name.

Duh, uh, ...  the session ID stayed the same, so I figured the data was
getting through even if I didn't see it. Indeed, postcard.php was receiving the
data - we can see that in the form - but was not transmitting the data as well,
only if I included display_image.php


 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html.phps
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.php
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.phps
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.php
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.phps



Re: [PHP] problem with function array_* that preserved the key

2001-11-14 Thread Stig Venaas

On Sat, Nov 03, 2001 at 03:54:23PM -0500, Reuben D Budiardja wrote:
 since the key are preserved, arrC is no longer indexed from 0. Well, in most 
 cases I don't care about the key if it's just indexed array. But since the 
 key I preserved, I can no longer do
 
 for($i=0; $icount($arrC);$i++)
   echo $arrC[$i];
 
 if it happens that the returned indedex in array C 19, 20,25, for example. 
 Any workaround?

There are many other ways you could traverse the array, but I think
array_values() does what you want.

Stig

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: VALUABLE LESSON: using sessions and include

2001-11-14 Thread dav

What you can do is not to name session at all :-) It's easyer :-)
J
Jtjohnston [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Thanks Dav,

 You caught me while I was debugging. But I learned a valuable  lesson! I
indeed
 did not name my session_name correctly. IN FACT ... I did not name it AT
ALL in
 display_image.php. There lay the problem. I needed to declare both:

 session_name(ESLpostcard);
 session_start();

 at the beginning of display_image.php AND postcard.php for the data to
 re-transmit itself.

 I was running both php files without session_name and session_start. The
docs
 just don't make that clear enough that you need to re-include
session_name.

 Duh, uh, ...  the session ID stayed the same, so I figured the data
was
 getting through even if I didn't see it. Indeed, postcard.php was
receiving the
 data - we can see that in the form - but was not transmitting the data as
well,
 only if I included display_image.php


  http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html
 
http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html.phps
  http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.php
 
http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.phps
 
http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.ph
p
 
http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.ph
ps




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] %20

2001-11-14 Thread John Steele

Hi Oosten,

  I don't think that's a bug in NS 4.7, but part of the spec for URLs.  See the PHP 
manual for the urlencode() encode function.

John

Hello

I just discovered a netscape 4.7 bug when sending a string. The variable
cannot contain a space.  So a string like this does not work in netscape 4.7

objectdetail.php?Bouw=variableObject_type=normalStreet_type=normal
street.

The variable Street_type doesn't get through netscape 4.7, but IE and
Netscape 6 do let the variable through.


Is there a way to automatically let a spacer fill with %20 so it works at
all browsers and i don't have to reprogram my system?


Thanks!



Sjoerd van Oosten 
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V. 
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730 
4817 ZH BREDA Telefax: (076) 5 877 757 
___

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Array problrem!

2001-11-14 Thread De Necker Henri

Hi there.
I have an array like this : 1.2 , 0.3 , 0.5 , 1.6 , 0.3 
I output like this:

 while($data_array[$j]){
  echo br$data[$j] ;
  $j++ ;
 }

My output is like this : 1 , 0 , 0 , 1 , 0 
The values in the db are floats and are read correctly !

Why is the values not there.Is there a specific way to store values in a
array?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Array problrem!

2001-11-14 Thread dav

It seems you data are down-taken to Integers (int) instead of the correct
variable type.
Try to define the array as an array of correct types, otherwise the array
will be int type and will contain integers (1.2 taken to 1, 0,5 taken to
0, and so on)
J
De Necker Henri [EMAIL PROTECTED] ha scritto nel messaggio
3A8ED7A62794D311AA7700508B6164EC08DCA38A@SCPTS01">news:3A8ED7A62794D311AA7700508B6164EC08DCA38A@SCPTS01...
 Hi there.
 I have an array like this : 1.2 , 0.3 , 0.5 , 1.6 , 0.3
 I output like this:

  while($data_array[$j]){
   echo br$data[$j] ;
   $j++ ;
  }

 My output is like this : 1 , 0 , 0 , 1 , 0
 The values in the db are floats and are read correctly !

 Why is the values not there.Is there a specific way to store values in a
 array?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array_unique() workaround? SOLUTION!

2001-11-14 Thread Spunk S. Spunk III

Thanks everyone for the ideas,
Here's what I came up with...
I forgot to mention that I needed to preserve the original array's keys.
Here is a replacement I wrote that seems to work. Let me know if you see
errors in it or have improvements.

function my_array_unique($somearray)
{
asort($somearray);
reset($somearray);
$currentarrayvar = current($somearray);
foreach ($somearray as $key=$var)
{
if (next($somearray) != $currentarrayvar)
{
$uniquearray[$key] = $currentarrayvar;
$currentarrayvar = current($somearray);
} 
} 
reset($uniquearray);
return $uniquearray;
}


 
 I'm working on a script that needs array_unique() but my host is using 4.0.4
 and it's broken in that build. Does anyone have a good workaround for this?
 I can wait for my host to upgrade but if I release this code, it would be
 better to have the workaround...
 
 I just need a good way to check for dups in an array and remove them. I
 can't get my brain around it...
 
 TIA
 Spunk
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Array problrem!

2001-11-14 Thread Andrey Hristov

Try with
foreach ($data as $v)
echo 'br'.$v;
The values in the array _may_not_have consequetn indexes.

Regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: De Necker Henri [EMAIL PROTECTED]
To: PHP-General (E-mail) [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 11:35 AM
Subject: [PHP] Array problrem!


 Hi there.
 I have an array like this : 1.2 , 0.3 , 0.5 , 1.6 , 0.3 
 I output like this:
 
  while($data_array[$j]){
   echo br$data[$j] ;
   $j++ ;
  }
 
 My output is like this : 1 , 0 , 0 , 1 , 0 
 The values in the db are floats and are read correctly !
 
 Why is the values not there.Is there a specific way to store values in a
 array?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] %20

2001-11-14 Thread TD - Sales International Holland B.V.

Spaces are not allowed in URL's, that the newer browsers do accept them 
probably means nothing more than that they don't show you that they encode it 
to %20

On Wednesday 14 November 2001 01:54, John Steele stuffed this into my mailbox:
 Hi Oosten,

   I don't think that's a bug in NS 4.7, but part of the spec for URLs.  See
 the PHP manual for the urlencode() encode function.

 John

 Hello
 
 I just discovered a netscape 4.7 bug when sending a string. The variable
 cannot contain a space.  So a string like this does not work in netscape
  4.7
 
 objectdetail.php?Bouw=variableObject_type=normalStreet_type=normal
 street.
 
 The variable Street_type doesn't get through netscape 4.7, but IE and
 Netscape 6 do let the variable through.
 
 
 Is there a way to automatically let a spacer fill with %20 so it works at
 all browsers and i don't have to reprogram my system?
 
 
 Thanks!
 
 
 
 Sjoerd van Oosten
 Digitaal vormgever [EMAIL PROTECTED]
 Datamex E-sites B.V.
 http://www.esites.nl
 Minervum 7368 Telefoon: (076) 5 730 730
 4817 ZH BREDA Telefax: (076) 5 877 757
 ___

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] High-Volume Newsletter Techniques?

2001-11-14 Thread Sondra Russell

Yes, I saw the discussion a few days earlier on this topic, but I'm 
wondering if there is still some unmined wisdom out there about 
building a script that sends a newsletter out to 25,000+ people 
The very impressive class I found (phpmailer-1.41) looked great, but 
it didn't *directly* address the high-volume issue in the readme so 
I'm still a little nervous.

And, unfortunately, it's not one of those types of technical 
challenges you can keep testing over and over without seriously 
annoying the first 100 or so people on your list who *do* get the 
email before the script times out.

I think the amount of trash email I get each day proves that vast 
mailings aren't TOO difficult, but I think I could use a little 
wisdom before I give it a shot.

Anyone?  I'll buy you a coke!

Thank you in advance,
Sondra Russell

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Anyone knows how to prevent nonACSII chars convertion with MSSQL?

2001-11-14 Thread Tomaz Kovacic

Hi!
Anyone knows how to prevent anoying convertion of nonACSII  characters when
MSSQL Server stores data in database?
I know, that when I use ODBC there is no problem with conversion, but I'd
like to avoid using ODBC connection if possible.

Tomaz



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] keeping my code!

2001-11-14 Thread Ye Tun

Hi all,

I am not sure if this is the right list to ask.  But I am wondering if I 
can keep my php code from Server Administrator of the web server I am 
putting my code on?   Is there anyway I can encrypt or do something so that 
the server admin can't look at my code.

REgards,

Ye



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Problem with

2001-11-14 Thread Paul - Zenith Tech Inc

Hi,

I have a text file, which is acting as a template for apache config.
I open the file, and read it in using this bit of code:

   $filename = DIR_TEMPLATES./apache/subdom.txt;
   $fd = fopen ($filename, r);
   $template = fread ($fd, filesize ($filename));
   fclose ($fd);

However, the first line is missed off, along with any line beginning with


For example, this line is missed out:

VirtualHost xxx.xxx.xxx.xxx

Does anybody know the way round this??
Or does anybody know why this is happening?

Thanks,
Paul



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] matches problem (preg_match)

2001-11-14 Thread Bruno Grab

Thank you for your answer.
However our real problem is to solve it with preg_match.
we want to rather analyse more complicated structures than the one
in our example. Well, let me reformulate it:
How can we (with preg_match) s a v e  each subpattern  into an array
element, that is, also e a c h  m a t c h  o f  a  r e p e a t e d  s u b p
a t t e r n  (e.g (...)* and (...)+) ??
Thanks a lot (again)
Bruno
Valentin V. Petruchek [EMAIL PROTECTED] schrieb im Newsbeitrag
028f01c16c5b$c87b1da0$[EMAIL PROTECTED]">news:028f01c16c5b$c87b1da0$[EMAIL PROTECTED]...
 Try this code:

 $str=eins zwei drei vier fünf sechs;
 $Wort = explode (' ',$str);

 $n=count($Wort);
 for($i=0;$i$n;$i++){echo $i: $Wort[$i]br;}

 It should works

 Zliy Pes [EMAIL PROTECTED]







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: keeping my code!

2001-11-14 Thread Julio Nobrega Trabalhando

  Here are a few links that might help you:

'Zend Encoder':
http://www.zend.com/zend/products.php
'PBC':
http://pbc.sourceforge.net/
'AfterBurner Cache':
http://bwcache.bware.it/

  Pear's cache classes may also protect a little bit your code... I don't
know how easy it is to break the file generated by Pear but at least you
have a target..

--

Julio Nobrega

No matter where you go, this.

Ye Tun [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,

 I am not sure if this is the right list to ask.  But I am wondering if I
 can keep my php code from Server Administrator of the web server I am
 putting my code on?   Is there anyway I can encrypt or do something so
that
 the server admin can't look at my code.

 REgards,

 Ye





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] keeping my code!

2001-11-14 Thread Richard Black

Theres the Zend Encoder, but this is a bit pricey if you don't have a 
company to pay for it. Don't know if theres any free alternatives or not

-Original Message-
From:   Ye Tun [SMTP:[EMAIL PROTECTED]]
Sent:   14 November 2001 11:39
To: [EMAIL PROTECTED]
Subject:[PHP] keeping my code!

Hi all,

I am not sure if this is the right list to ask.  But I am wondering if I
can keep my php code from Server Administrator of the web server I am
putting my code on?   Is there anyway I can encrypt or do something so that 
the server admin can't look at my code.

REgards,

Ye



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array_unique() workaround? SOLUTION!

2001-11-14 Thread Jason G.

it seems that...

$newarray = array()
foreach($oldarray as $key = $value)
 if(! isset($newarray[$key]))
 $newarray[$key] = $value;

-JAson Garber
IonZOft.com

At 10:42 AM 11/14/2001 +0100, Spunk S. Spunk III wrote:
Thanks everyone for the ideas,
Here's what I came up with...
I forgot to mention that I needed to preserve the original array's keys.
Here is a replacement I wrote that seems to work. Let me know if you see
errors in it or have improvements.

function my_array_unique($somearray)
{
 asort($somearray);
 reset($somearray);
 $currentarrayvar = current($somearray);
 foreach ($somearray as $key=$var)
 {
 if (next($somearray) != $currentarrayvar)
 {
 $uniquearray[$key] = $currentarrayvar;
 $currentarrayvar = current($somearray);
 }
 }
 reset($uniquearray);
 return $uniquearray;
}


 
  I'm working on a script that needs array_unique() but my host is using 
 4.0.4
  and it's broken in that build. Does anyone have a good workaround for this?
  I can wait for my host to upgrade but if I release this code, it would be
  better to have the workaround...
 
  I just need a good way to check for dups in an array and remove them. I
  can't get my brain around it...
 
  TIA
  Spunk
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Time out for file()?

2001-11-14 Thread Jean-Arthur Silve

Hi !

I use the file function for accessing to pages on another server.

It works perfectly.

But if the server does not respond or is too long to send datas, the file 
function wait too long..

Is there a way to tune the time out ?? I would like that id the server does 
not respond, the function return in few seconds only.

I thought to a solution using :

set_time_limit(2);
register_shutdown_function(func);
file(myurl);
set_time_limit(30);
func();

In this example if the file function takes more than 2 seconds, then func() 
would be called. If the file function does not time out, then then func is 
called too...

But may be there is a cleanest way to do this (I checked the manual, 
somethink like socket_set_timeout), in the way that if the time function 
timed out then the script continues normally, returning an error:

tuning the time out(2);
$f=file(myurl);
if ($f==false)
 // Timed out
else
 // ok


Thank you !

jean-arthur

---

EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Can If Else statements be split into code blocks??

2001-11-14 Thread Jason G.

try this..

?
if(true)
{
 ?
 Raw html code here for
 as long as
 you want
 ?
}
else
{
 ?
 More
 Raw
 Html
 Code
 Here
 ?
}


I believe that this feature is way underutilized by php developers.  Tying 
all your html up in echo or print statements is a mess to say the least.

-Jason Garber
IonZoft.com


At 05:13 PM 11/13/2001 -0800, Brad Melendy wrote:
Ok, I figured out that just using echo seems to be the best way to do this
under PHP.  In ASP, you can end your code block and start in with HTML, but
I couldn't get that to work with PHP.  However, I was able to just use the
echo statement to get the conditional HTML I wanted to show up when the
proper condition was met in the If Else statement.

Brad

Brad Melendy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hello,
  I'm trying to execute some HTML in an IF ELSE statement.  I'm trying
  something like:
 
  ?php
  if (strstr($DomResults,$Match))
  print Congratulations!  $domain.$suffix is available!;
  ?
  form method=POST action=step2.asp name=form2
pinput type=submit value=Register name=B1/p
  /form
 
  ?php
 else
  print Sorry, $domain.$suffix is already taken.;
  ?
 
  Basically, it works great without the form I'm trying to insert, but with
  the form after the IF statement, it fails.  Is what I want to do against
the
  rules?  I'm converting an ASP script I have to PHP and I have it all
working
  under ASP.  That means it should be eaiser with PHP right?  ;-)  Thanks in
  advance.
 
  ...Brad
 
 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Time out for file()?

2001-11-14 Thread _lallous

from the manual
?php
$fp = fsockopen(www.php.net, 80);
if(!$fp) {
echo Unable to open\n;
} else {
fputs($fp,GET / HTTP/1.0\n\n);
$start = time();
socket_set_timeout($fp, 2);
$res = fread($fp, 2000);
//var_dump(socket_get_status($fp));
fclose($fp);
print $res;
}
?
this will grab a file too using the socket functions, the
socket_set_timeout()'s first param is expected to be a socket handle.

Jean-Arthur Silve [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi !

I use the file function for accessing to pages on another server.

It works perfectly.

But if the server does not respond or is too long to send datas, the file
function wait too long..

Is there a way to tune the time out ?? I would like that id the server does
not respond, the function return in few seconds only.

I thought to a solution using :

set_time_limit(2);
register_shutdown_function(func);
file(myurl);
set_time_limit(30);
func();

In this example if the file function takes more than 2 seconds, then func()
would be called. If the file function does not time out, then then func is
called too...

But may be there is a cleanest way to do this (I checked the manual,
somethink like socket_set_timeout), in the way that if the time function
timed out then the script continues normally, returning an error:

tuning the time out(2);
$f=file(myurl);
if ($f==false)
 // Timed out
else
 // ok


Thank you !

jean-arthur

---

EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] keeping my code!

2001-11-14 Thread Michael A. Peters

On Wed, 14 Nov 2001 18:38:48 +0700
Ye Tun [EMAIL PROTECTED] wrote:

 Hi all,
 
 I am not sure if this is the right list to ask.  But I am wondering if I 
 can keep my php code from Server Administrator of the web server I am 
 putting my code on?   Is there anyway I can encrypt or do something so that 
 the server admin can't look at my code.
 
 REgards,
 
 Ye
 

ZendEncoder works really really well.
It's not free- but hey, those guys have given us a lot already.

The server _must_ be running the ZendOptimizer or it won't work.

I recommend getting the ZendEncoder (assuming it has been ported to your
devel platform- last time I checked, it hadn't yet been ported to OS X or
PPC Linux- but it has been ported to the major x86 distro's)

ZendEncoder solves a lot of problem.
When you code, that's your value :)

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-
Michael A. Peters
http://24.5.29.77:10080/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Sending mail without using mai() ?

2001-11-14 Thread Jaime Iniesta Aleman

Hi, is it possible to send SMTP mail if the server where are my pages
hosted forbids the use of the mail() function ? I mean, by opening a
sockets connection to an external SMTP server and writing the commands
there directly...

Jaime


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array_unique() workaround? SOLUTION!

2001-11-14 Thread dav

Well infact you are checking equity, like my suggestion about in_array :-)
Spunk S. Spunk III [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Thanks everyone for the ideas,
 Here's what I came up with...
 I forgot to mention that I needed to preserve the original array's keys.
 Here is a replacement I wrote that seems to work. Let me know if you see
 errors in it or have improvements.

 function my_array_unique($somearray)
 {
 asort($somearray);
 reset($somearray);
 $currentarrayvar = current($somearray);
 foreach ($somearray as $key=$var)
 {
 if (next($somearray) != $currentarrayvar)
 {
 $uniquearray[$key] = $currentarrayvar;
 $currentarrayvar = current($somearray);
 }
 }
 reset($uniquearray);
 return $uniquearray;
 }


 
  I'm working on a script that needs array_unique() but my host is using
4.0.4
  and it's broken in that build. Does anyone have a good workaround for
this?
  I can wait for my host to upgrade but if I release this code, it would
be
  better to have the workaround...
 
  I just need a good way to check for dups in an array and remove them. I
  can't get my brain around it...
 
  TIA
  Spunk
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sending mail without using mai() ?

2001-11-14 Thread Andrey Hristov

I think that are some code which does what you want? Look at www.hotscripts.com,
phpclasses.upperdesign.net 

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: Jaime Iniesta Aleman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 2:53 PM
Subject: [PHP] Sending mail without using mai() ?


 Hi, is it possible to send SMTP mail if the server where are my pages
 hosted forbids the use of the mail() function ? I mean, by opening a
 sockets connection to an external SMTP server and writing the commands
 there directly...
 
 Jaime
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array_unique() workaround? SOLUTION!

2001-11-14 Thread Andrey Hristov

reset() is not needed when using foreach but is requirement when using : 
each(),next(),prev(), etc.

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: dav [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 3:08 PM
Subject: Re: [PHP] array_unique() workaround? SOLUTION!


 Well infact you are checking equity, like my suggestion about in_array :-)
 Spunk S. Spunk III [EMAIL PROTECTED] ha scritto nel messaggio
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Thanks everyone for the ideas,
  Here's what I came up with...
  I forgot to mention that I needed to preserve the original array's keys.
  Here is a replacement I wrote that seems to work. Let me know if you see
  errors in it or have improvements.
 
  function my_array_unique($somearray)
  {
  asort($somearray);
  reset($somearray);
  $currentarrayvar = current($somearray);
  foreach ($somearray as $key=$var)
  {
  if (next($somearray) != $currentarrayvar)
  {
  $uniquearray[$key] = $currentarrayvar;
  $currentarrayvar = current($somearray);
  }
  }
  reset($uniquearray);
  return $uniquearray;
  }
 
 
  
   I'm working on a script that needs array_unique() but my host is using
 4.0.4
   and it's broken in that build. Does anyone have a good workaround for
 this?
   I can wait for my host to upgrade but if I release this code, it would
 be
   better to have the workaround...
  
   I just need a good way to check for dups in an array and remove them. I
   can't get my brain around it...
  
   TIA
   Spunk
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: keeping my code!

2001-11-14 Thread nobody

Has anyone been successful in compiling afterBURNER Cache on Win32?  I
tried, but couldn't do it

Julio Nobrega Trabalhando [EMAIL PROTECTED] wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Here are a few links that might help you:

 'Zend Encoder':
 http://www.zend.com/zend/products.php
 'PBC':
 http://pbc.sourceforge.net/
 'AfterBurner Cache':
 http://bwcache.bware.it/

   Pear's cache classes may also protect a little bit your code... I don't
 know how easy it is to break the file generated by Pear but at least you
 have a target..

 --

 Julio Nobrega

 No matter where you go, this.

 Ye Tun [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi all,
 
  I am not sure if this is the right list to ask.  But I am wondering if I
  can keep my php code from Server Administrator of the web server I am
  putting my code on?   Is there anyway I can encrypt or do something so
 that
  the server admin can't look at my code.
 
  REgards,
 
  Ye
 
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Login/Security Problem

2001-11-14 Thread Joe Van Meer

Hi there. I'm new to php and would like some insight on securing a website.
Upon successful login to my site (checks against database for username and
password) I assign a session variable called '$islogged' to 'yes'. On all
other pages throughout my site I use the following code to determine if this
variable is set, and if not redirect them to the login page.

if($islogged = = no){

header(Location:index.php);
}
elseif(EMPTY($islogged))
{
header(Location:index.php);
}


This seems to work, however, if I close out my browser and say type in
main.php (this page has the above code) in the address bar I can still
access the page. How can I fix this? Is there something else I could be
doing to improve the functionality?
Any insights would greatly be appreciated.

Cheers Joe:)



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Can If Else statements be split into code blocks??

2001-11-14 Thread Dan McCullough

If someone has already replied to this I apploigize for a double post.
You need to put in brackets after the if statement and end bracket before the else and 
then
another open after the else, lastly you need to close with a bracket.

Example:
  ?php
  if (strstr($DomResults,$Match)) {
  print Congratulations!  $domain.$suffix is available!;
  ?
  form method=POST action=step2.asp name=form2
pinput type=submit value=Register name=B1/p
  /form
 
  ?php
 } else {
  print Sorry, $domain.$suffix is already taken.;
  }?

I hope this help.  PHP is pretty easy, its just some differences that you need to get 
used to. 
Good luck.
--- Brad Melendy [EMAIL PROTECTED] wrote:
 Ok, I figured out that just using echo seems to be the best way to do this
 under PHP.  In ASP, you can end your code block and start in with HTML, but
 I couldn't get that to work with PHP.  However, I was able to just use the
 echo statement to get the conditional HTML I wanted to show up when the
 proper condition was met in the If Else statement.
 
 Brad
 
 Brad Melendy [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hello,
  I'm trying to execute some HTML in an IF ELSE statement.  I'm trying
  something like:
 
  ?php
  if (strstr($DomResults,$Match))
  print Congratulations!  $domain.$suffix is available!;
  ?
  form method=POST action=step2.asp name=form2
pinput type=submit value=Register name=B1/p
  /form
 
  ?php
 else
  print Sorry, $domain.$suffix is already taken.;
  ?
 
  Basically, it works great without the form I'm trying to insert, but with
  the form after the IF statement, it fails.  Is what I want to do against
 the
  rules?  I'm converting an ASP script I have to PHP and I have it all
 working
  under ASP.  That means it should be eaiser with PHP right?  ;-)  Thanks in
  advance.
 
  ...Brad
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


=
Dan McCullough
---
Theres no such thing as a problem unless the servers are on fire!
h: 603.444.9808
w: McCullough Family
w: At Work

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Login/Security Problem

2001-11-14 Thread Daniel Masur

set a cookie, and delete it with a logout button or when the user leaves
your domain


Joe Van Meer [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there. I'm new to php and would like some insight on securing a
website.
 Upon successful login to my site (checks against database for username and
 password) I assign a session variable called '$islogged' to 'yes'. On all
 other pages throughout my site I use the following code to determine if
this
 variable is set, and if not redirect them to the login page.

 if($islogged = = no){

 header(Location:index.php);
 }
 elseif(EMPTY($islogged))
 {
 header(Location:index.php);
 }


 This seems to work, however, if I close out my browser and say type in
 main.php (this page has the above code) in the address bar I can still
 access the page. How can I fix this? Is there something else I could be
 doing to improve the functionality?
 Any insights would greatly be appreciated.

 Cheers Joe:)





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Login/Security Problem

2001-11-14 Thread Joe Van Meer

Thx for replying, so I can do away with the session variable that I was
setting and just set a cookie on their machine and delete it when they
logout? I don't have to check on each page?

Cheer Joe:)


Daniel Masur [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 set a cookie, and delete it with a logout button or when the user leaves
 your domain


 Joe Van Meer [EMAIL PROTECTED] schrieb im Newsbeitrag
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi there. I'm new to php and would like some insight on securing a
 website.
  Upon successful login to my site (checks against database for username
and
  password) I assign a session variable called '$islogged' to 'yes'. On
all
  other pages throughout my site I use the following code to determine if
 this
  variable is set, and if not redirect them to the login page.
 
  if($islogged = = no){
 
  header(Location:index.php);
  }
  elseif(EMPTY($islogged))
  {
  header(Location:index.php);
  }
 
 
  This seems to work, however, if I close out my browser and say type in
  main.php (this page has the above code) in the address bar I can still
  access the page. How can I fix this? Is there something else I could be
  doing to improve the functionality?
  Any insights would greatly be appreciated.
 
  Cheers Joe:)
 
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] javascript to php ????

2001-11-14 Thread Grimes, Dean

One way I do this is with the following:

?php
if ($submit) {
// Create a php array.
$t_array = explode(,,$x_array);
print_r($t_array);
exit;
}
?

html
head
script language=javascript
var x = new Array();
x[0] = zero;
x[1] = one;
x[2] = two;
/script
/head

body
form name=f method=post
input type=submit name=submit
input type=hidden name=x_array
/form

!--
Use an onSubmit clause in the form tag to execute a function that
sets any hidden form values you need. This little test just falls
through but it doesn't have to.
--

script language=javascript
// set the hidden input to a comma delimited string
document.f.x_array.value = x.toString();

// alert(document.f.x_array.value);
/script
/body
/html


Hope this helps.

Dean


-Original Message-
From: fitiux [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 4:54 PM
To: PHP General
Subject: [PHP] javascript to php 


Hi  =)

is it possible to pass a javascript array to php ???


thanks.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Problem with

2001-11-14 Thread Rasmus Lerdorf

The lines are not missed, they are simply not visible when you echo the 
stuff to the browser because your browser thinks these are HTML tags.  Try 
doing a View Source in your browser and I bet you will discover that 
they are actually there.

-Rasmus

On Wed, 14 Nov 2001, Paul - Zenith Tech Inc wrote:

 Hi,
 
 I have a text file, which is acting as a template for apache config.
 I open the file, and read it in using this bit of code:
 
$filename = DIR_TEMPLATES./apache/subdom.txt;
$fd = fopen ($filename, r);
$template = fread ($fd, filesize ($filename));
fclose ($fd);
 
 However, the first line is missed off, along with any line beginning with
 
 
 For example, this line is missed out:
 
 VirtualHost xxx.xxx.xxx.xxx
 
 Does anybody know the way round this??
 Or does anybody know why this is happening?
 
 Thanks,
 Paul
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Login/Security Problem

2001-11-14 Thread Daniel Masur

so set an md5() of each user name as yes.
islogged=Ehyfoa74a23gfd
or whatever is good i think. but sessions are the most secure way, so think
about both (sessions and cookies) and decide what you really need.

you have linux?
you could make an .htaccess, and make real users with no bash, and let them
login with real usernames and passwords.

windows?
on win2k you could do this too. but be shure to not grant access to local
hd's. major security risk...

Stefan Rusterholz [EMAIL PROTECTED] schrieb im Newsbeitrag
009f01c16d13$bfd6b4d0$3c01a8c0@quasimodo">news:009f01c16d13$bfd6b4d0$3c01a8c0@quasimodo...
 I don't think this is a secure method.
 If I do only a little effort an find out, that it's this variable
$islogged
 which has to set to yes (or whatever) I can gain access by simply typing
 into the browsers addressbar
 www.yourdomain.com/theFileIWantToGo.php?islogged=yes and I will gain
 access.

 I'm sorry, but I can't tell you a better way to do it.

 Stefan Rusterholz, [EMAIL PROTECTED]
 --
 interaktion gmbh
 Stefan Rusterholz
 Zürichbergstrasse 17
 8032 Zürich
 --
 T. +41 1 253 19 55
 F. +41 1 253 19 56
 W3 www.interaktion.ch
 --

 - Original Message -
 From: Daniel Masur [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, November 14, 2001 2:33 PM
 Subject: [PHP] Re: Login/Security Problem


  set a cookie, and delete it with a logout button or when the user leaves
  your domain
 
 
  Joe Van Meer [EMAIL PROTECTED] schrieb im Newsbeitrag
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi there. I'm new to php and would like some insight on securing a
  website.
   Upon successful login to my site (checks against database for username
 and
   password) I assign a session variable called '$islogged' to 'yes'. On
 all
   other pages throughout my site I use the following code to determine
if
  this
   variable is set, and if not redirect them to the login page.
  
   if($islogged = = no){
  
   header(Location:index.php);
   }
   elseif(EMPTY($islogged))
   {
   header(Location:index.php);
   }
  
  
   This seems to work, however, if I close out my browser and say type in
   main.php (this page has the above code) in the address bar I can still
   access the page. How can I fix this? Is there something else I could
be
   doing to improve the functionality?
   Any insights would greatly be appreciated.
  
   Cheers Joe:)
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Anyone knows how to prevent nonACSII chars convertion with MSSQL?

2001-11-14 Thread Andrew Hill

Tomaz,

In spite of your ODBC adversion it may be your best bet :)
One related option - OpenLink has a FreeTDS based driver available that you
may wish to try.

Please let me know if you require assistance.

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

 -Original Message-
 From: Tomaz Kovacic [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 14, 2001 6:32 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Anyone knows how to prevent nonACSII chars convertion
 with MSSQL?


 Hi!
 Anyone knows how to prevent anoying convertion of nonACSII
 characters when
 MSSQL Server stores data in database?
 I know, that when I use ODBC there is no problem with conversion, but I'd
 like to avoid using ODBC connection if possible.

 Tomaz



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] newbie question about odbc_connect

2001-11-14 Thread Andrew Hill

Johannnes,

To enable ODBC support in PHP on Linux, configure --with-iodbc per the HOWTO
at www.iodbc.org.
This will link PHP against an ODBC Driver Manager, but you will still
require an ODBC Driver.

If you cannot obtain an ODBC driver for FMPro for Linux, you can use the
OpenLink Multi-Tier ODBC Driver and piggyback it on the FMPro DSN on the
server. eg:

1. create a DSN on the FMPro server (I assume either Windows or Mac OS X?)
that we'll call foo for this example.
2. install the OpenLink Multi-Tier driver with Linux as your client, and
FMPro box as server.  Ensure that you install the ODBC agent on your server
platform (this is a non-database specific database agent).
3. create a DSN on your Linux box, specifying ServerType = ODBC, Hostname =
[FMPro server IP address], Database = foo
All other parameters should be self-explanatory.

Note - you may also use the above method to piggyback a Linux ODBC DSN onto
a local or remote JDBC Driver instead of an ODBC driver; let me know if you
require assistance.

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

 -Original Message-
 From: Johannes Ambrose [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, November 13, 2001 7:22 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] newbie question about odbc_connect


 Hi,
 I've been happily using mysql_connect() for various scripts on a linux
 box. Now I'd like to connect to a filemaker pro database using
 odbc_connect(). However, the response I get is Call to undefined
 function.

 Do I need to compile odbc support? (I thought it was built in.)

 Is there an include file somewhere that I need to specifiy?

 regards


 --
 Johannes Ambrose
 Computer Systems Manager
 School of Life Sciences
 University of Queensland, Brisbane Australia
 ph: 07 3365 4826 fax:3365 1655 mob: 0401 714 835



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] keeping my code! Why?

2001-11-14 Thread George Whiffen

Zend encoder is probably your best option.

But why do you want to hide your php code from your Server Admin?

1. If you can't trust your Server Administrator you've got big
problems.  Change your hosting!

2. Are you sure your code is so valuable?  Developers always 
seem to greatly overestimate the value of their code to anyone
else.  There's loads of really great php freely available out 
there to handle almost any general task.  A lot of effort goes 
into publicising it yet it's still hard to get anyone interested 
in looking at it, let alone using it.

3. Is the php code really what you need to protect?  My
experience is that most of the difficult parts of an application
are embedded in the data structures, the functionality and
the presentation, not the php code.  Any idiot can develop php
code if they know exactly what it has to do (and that it can
be done...)

4. If you're worried about your customer simply keeping the code
and not paying you, my advice is to give up.  If someone wants to
rip you off they probably will.  You'll do yourself just as much
good by taking the simple step of asserting your copyright and
being ready to go to court if they don't pay and still use the
software.  You'll be lucky to win, but at least it'll be clear
who is ripping off who.

5. I hope your real interest is not just to lock your users/
customers into using you for all maintenance work.  If so
my advice is to stop using Open Source products such as php
and switch to proprietary products.  The proprietary world
has been living for years off customer lock-in and has all
the techniques to help you get your share of the rip-off as
long as you're on their side.  If you stick with Open source, you
get none of that business support/price umbrella and your 
customers are much more likely to come up with embarrassing 
questions like: Why are you fleecing us?

In general, if you think your old code is an asset and you're just 
protecting it, think again.  All code is obsolete before it's
finished.  It's only your skills/experience that really matter 
and the best way to protect them is to share your work and learn 
from others.

Good Luck,


George

Michael A. Peters wrote:
 
 On Wed, 14 Nov 2001 18:38:48 +0700
 Ye Tun [EMAIL PROTECTED] wrote:
 
  Hi all,
 
  I am not sure if this is the right list to ask.  But I am wondering if I
  can keep my php code from Server Administrator of the web server I am
  putting my code on?   Is there anyway I can encrypt or do something so that
  the server admin can't look at my code.
 
  REgards,
 
  Ye
 
 
 ZendEncoder works really really well.
 It's not free- but hey, those guys have given us a lot already.
 
 The server _must_ be running the ZendOptimizer or it won't work.
 
 I recommend getting the ZendEncoder (assuming it has been ported to your
 devel platform- last time I checked, it hadn't yet been ported to OS X or
 PPC Linux- but it has been ported to the major x86 distro's)
 
 ZendEncoder solves a lot of problem.
 When you code, that's your value :)
 
 --
 -=-=-=-=-=-=-=-=-=-=-=-=-
 Michael A. Peters
 http://24.5.29.77:10080/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Login/Security Problem

2001-11-14 Thread Tamas Arpad

On Wednesday 14 November 2001 14:58, you wrote:
I think mixing of the web application's and the host's operating 
system's authantication is not the best thing (if you don't exactly 
need that)

The $isLogged variable that is stored in the session is perfect as 
long as you check that it is came from the session 
($HTTP_SESSION_VARS) and you know that no one can access and write 
into your session files (open_basedir, and safe_mode in php.ini).

Arpi

 so set an md5() of each user name as yes.
 islogged=Ehyfoa74a23gfd
 or whatever is good i think. but sessions are the most secure way,
 so think about both (sessions and cookies) and decide what you
 really need.

 you have linux?
 you could make an .htaccess, and make real users with no bash, and
 let them login with real usernames and passwords.

 windows?
 on win2k you could do this too. but be shure to not grant access to
 local hd's. major security risk...

 Stefan Rusterholz [EMAIL PROTECTED] schrieb im
 Newsbeitrag 009f01c16d13$bfd6b4d0$3c01a8c0@quasimodo">news:009f01c16d13$bfd6b4d0$3c01a8c0@quasimodo...

  I don't think this is a secure method.
  If I do only a little effort an find out, that it's this variable

 $islogged


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP debugging/tracing extensrion release

2001-11-14 Thread George Schlossnagle

This is just a quick announcement of the release of APD, a completely free and open 
(QPL) profiling/tracing/debugging extension for PHP.  APD provides for strace/truss 
type output switched on and off inside scriipts as well as the ability to dump 
complete backtraces, similair to Perl's croak().  APD has been tested on 
php-4.0.3pl1-4.1.0RC2.  It's available at http://apd.communityconnect.com/.

George

--
George Schlossnagle
1024D/1100A5A0  1370 F70A 9365 96C9 2F5E  56C2 B2B9 262F 1100 A5A0




Re: [PHP] keeping my code! Why?

2001-11-14 Thread mweb


 In general, if you think your old code is an asset and you're just
 protecting it, think again.  All code is obsolete before it's
 finished.  It's only your skills/experience that really matter
 and the best way to protect them is to share your work and learn
 from others.


PERFECT ANSWER, George. Both this last paragraph and all the rest before
it. I was going to make the same comments, but it's not needed now.

An all your message should be tattoed on the faces of the idiots that,
instead of posting job offers for webmasters able to set up highly
dynamic sites with the lowest expenses in HW and SW tools specify
that they will only accept candidates with knowledge of this or that
proprietary, expensive and generally screwed tool/IDE.

mweb


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Redeclare a Function

2001-11-14 Thread Yasuo Ohgaki

Joffrey Van Wageningen wrote:

 its possible to create lambda-style functions with create_function() and
 redeclare the variable functions
 
 ---
 $funct = create_function('$x', 'return ++$x;');
 echo $funct(10);
 
 $funct = create_function('$x', 'return --$x;');
 echo $funct(10);
 ---
 
 its fun to create array's of functions :) try it :P
 
 with kind regards,
 Joffrey van Wageningen


APD can rename/redeclare functions also.

http://apd.communityconnect.com/

--
Yasuo Ohgaki


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Time out for file()? - Use fsockopen

2001-11-14 Thread George Whiffen

Jean-Arthur,

Your set_time_limit/shutdown function solution looks like a clever
trick.  If you can come up with that you might just as well do the
proper job with an fsockopen and socket_set_timeout.

The manual pages on fsockopen, socket_set_timeout plus the user comments
have plenty of useful examples:

http://www.php.net/manual/en/function.fsockopen.php
http://www.php.net/manual/en/function.socket-set-timeout.php

You might also want to look at socket_set_blocking as an alternative.
(Switch to non-blocking so that your gets always returns immediately
and then you can put in your own wait/action before trying another gets).
Check out: 

http://www.php.net/manual/en/function.socket-set-blocking.php

Either way, to write your own jasfile() to emulate file() shouldn't be more than 
10-20 lines.

An extra advantage of using fsockopen is that you can send a HEAD request
before your GET/POST to check the server/page are there.  If that
works you can then give the target server longer to serve the GET in
case the problem is just slow communications rather than a missing/slow
server.


Good Luck

George


Jean-Arthur Silve wrote:
 
 Hi !
 
 I use the file function for accessing to pages on another server.
 
 It works perfectly.
 
 But if the server does not respond or is too long to send datas, the file
 function wait too long..
 
 Is there a way to tune the time out ?? I would like that id the server does
 not respond, the function return in few seconds only.
 
 I thought to a solution using :
 
 set_time_limit(2);
 register_shutdown_function(func);
 file(myurl);
 set_time_limit(30);
 func();
 
 In this example if the file function takes more than 2 seconds, then func()
 would be called. If the file function does not time out, then then func is
 called too...
 
 But may be there is a cleanest way to do this (I checked the manual,
 somethink like socket_set_timeout), in the way that if the time function
 timed out then the script continues normally, returning an error:
 
 tuning the time out(2);
 $f=file(myurl);
 if ($f==false)
  // Timed out
 else
  // ok
 
 
 Thank you !
 
 jean-arthur
 
 ---
 
 EuroVox
 4, place Félix Eboue
 75583 Paris Cedex 12
 Tel : 01 44 67 05 05
 Fax : 01 44 67 05 19
 Web : http://www.eurovox.fr
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Redeclare a Function

2001-11-14 Thread Joffrey van Wageningen


i recon this is a way too, the website does not support to much
information about how to use a tool like APD.

create_function is a php native function so support, stability and
usability is much greater than a 3rd party Zend Extention in early beta :)

with kind regards,

Joffrey van Wageningen

On Thu, 15 Nov 2001, Yasuo Ohgaki wrote:

 Joffrey Van Wageningen wrote:

  its possible to create lambda-style functions with create_function() and
  redeclare the variable functions
 
  ---
  $funct = create_function('$x', 'return ++$x;');
  echo $funct(10);
 
  $funct = create_function('$x', 'return --$x;');
  echo $funct(10);
  ---
 
  its fun to create array's of functions :) try it :P
 
  with kind regards,
  Joffrey van Wageningen


 APD can rename/redeclare functions also.

 http://apd.communityconnect.com/

 --
 Yasuo Ohgaki





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] High-Volume Newsletter Techniques?

2001-11-14 Thread Michael Sims

At 12:14 PM 11/14/2001 +0100, Sondra Russell wrote:
Yes, I saw the discussion a few days earlier on this topic, but I'm 
wondering if there is still some unmined wisdom out there about building a 
script that sends a newsletter out to 25,000+ people The very 
impressive class I found (phpmailer-1.41) looked great, but it didn't 
*directly* address the high-volume issue in the readme so I'm still a 
little nervous.
[snip]

Why not off load the responsibility of sending the email to some other 
program besides PHP?  In other words, set up a mailing list on your MTA and 
have the PHP script send the message to one address, the mailing list, and 
have your MTA (Sendmail, for example) have the responsibility of forwarding 
the message to all it's intended recipients...


-
Michael Sims
mhsims at midsouth dot rr dot com

The manual said the program requires
Windows 95 or better, so I installed Linux ...
- 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Help! How do i mail a value from a mysql databse?

2001-11-14 Thread George Whiffen

There's also a potential problem with:
 Her har du ditt passord: $myrow[id] \n God appetitt! Hilsen Subway

You are using double quotes for the array index,(id) within a double
quoted string.  I'm amazed php accepts this, you might expect it to
parse that as Her har du ditt passord: $myrow[  and then id and then
] \n God appetitt! Hilsen Subway which should generate a syntax error
at id.

Until recently it certainly didn't substitute array variables in double 
quoted strings at all.  There's a whole bunch of stuff in the manual now
about ensuring correct parsing of variables inside double quotes with
the use of braces etc. See: http://www.php.net/manual/en/language.types.string.php
(N.B. I think the English version is more comprehensive than the German)

However the simple safe thing to do is just to break the string i.e. 

Her har du ditt passord:  . $myrow[id] .  \n God appetitt! Hilsen Subway

Or even better IMHO:

'Her har du ditt passord: ' . $myrow['id'] . ' \n God appetitt! Hilsen Subway'

Personally I don't think the automatic substitution of variables in double
quotes really helps.  

I prefer to use single quotes since they don't
get in the way of double quotes in HTML e.g.  print 'TD COLSPAN=3';
My simple rules are :
 single quotes for php strings
 double quotes in HTML/Javascript
 explicit concatenation of any php variables 
   e.g.  print 'TD COLSPAN='.$myrow['colspan'].'';
   NOT   print TD COLSPAN=\{$myrow[colspan]}\; 

Of course ,the important thing is to be consistent.  Once you start inserting php 
array variables
into
Javascript strings inside HTML attributes of HTML embedded into php strings, you want
to be sure you can work out what on earth is going on!

Regards,

George 



David Robley wrote:
 
 On Wed, 14 Nov 2001 04:26, Raymond wrote:
  Hi!
 
  I'm trying to send a mail with password to the new user of my website,
  but . Does anyone know how to put the variable inside my mail?
 
  I have tried this:
 
  --
  else {
 
  // sende kundeopplysninger til databasen
 
$db = mysql_connect(localhost, root);
 
mysql_select_db(subway,$db);
 
$sql = INSERT INTO nettkunder
  (fornavn,etternavn,firma,adresse,postnr,sted,telefon,epost) VALUES
  ('$fornavn','$etternavn','$firma','$adresse','$postnr','$sted','$telefo
 n','$ epost');
 
$result = mysql_query($sql);
 
echo Velkommen som kunde hos Subway.\n;
 
  }
 
$db = mysql_connect(localhost, root);
 
mysql_select_db(subway,$db);
 
 
  $id = mysql_query(GET id FROM nettkunder WHERE epost = '$epost',$db);
 
  mail($epost, Velkommen som kunde hos Subway, Her har du ditt
  passord: $myrow[id] \n God appetitt! Hilsen Subway);
 
 The value you are passing in $myrow[id] doesn't exist in your code. You
 need to do
 
 $myrow = mysql_fetch_row($id);
 
 after your mysql_query to populate the row data. And your query should
 probably read SELECT id FROM...
 
 --
 David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
 CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA
 
Washed the cat - took HOURS to get the hair off my tongue!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] very weird PHP behaviour...

2001-11-14 Thread Christian Dechery

I don't know what it is... but PHP is acting very weird today... or I am 
becoming crazy... can anyone tell me which one?

I have this function:
function Upload($source_file,$source_filename,$dest_dir,$allowed_types=array())
{
global $upload_errmsg;

if( count($allowed_types) )
{
   $file_ext=ArquivoExt($source_filename);
   $ext_found=in_array($file_ext,$allowed_types);
   //die(source=$source_filename);
   //var_dump($ext_found);
   //die;
   if( !$ext_found )
   {
 $upload_errmsg=O arquivo \$source_filename\ não está entre os tipos 
autorizados;
 //die(errmsg=$upload_errmsg);
 return false;
   }
}
... some more code here ..
return true;
}

the first crazy behaviour is... I use a test file called something.jpg, 
ArquivoExt() returns me the extension of a given filename, in this case 
jpg. $allowed_types contains gif,jpg and png so that in_array() 
should return true... and it does... but get this... if I uncomment that 
var_dump() guess what it outputs?

bool(true) bool(false)

very weird... how can one var_dump() call gives me two outputs?
This double output doesn't occur if I uncomment the die after the 
var_dump(). It only outputs bool(true) in that case.

Now for the second weird behaviour... since no matter what, $ext_found will 
always be false (due to the previous weirdness) it will always enter the 
IF... but the weird thing is when the caller of Upload() prints 
$upload_errmsg it only outputs:

O arquivo  não está entre os tipos autorizados

where is the filename? I've checked it tons of times... If I uncomment the 
second die, right after the $upload_errmsg assignment, it outputs ok, with 
the filename.

Now, can someone explain me this VERY WEIRD behaviour??



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Error with Netscape 6.2

2001-11-14 Thread Anthony

I get a CGI error whenever I view my php app under Netscape 6.  The 
error is:
CGI Error
The specified CGI application misbehaved by not returning a complete set 
of HTTP headers. The headers it did return are:

My question is, what are the headers that I need to send, where can I 
find more info on this?  The app works perfectly under IE, but not Netscape.

- Anthony


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] very weird PHP behaviour...

2001-11-14 Thread Steve Cayford

Sure sounds like you're hitting this function twice by accident. Are you 
sure you're only calling it once? That would explain why you only get 
one output with the die(), but two without it.

-Steve

On Wednesday, November 14, 2001, at 10:34  AM, Christian Dechery wrote:

 I don't know what it is... but PHP is acting very weird today... or I 
 am becoming crazy... can anyone tell me which one?

 I have this function:
 function 
 Upload($source_file,$source_filename,$dest_dir,$allowed_types=array())
 {
 global $upload_errmsg;

 if( count($allowed_types) )
 {
   $file_ext=ArquivoExt($source_filename);
   $ext_found=in_array($file_ext,$allowed_types);
   //die(source=$source_filename);
   //var_dump($ext_found);
   //die;
   if( !$ext_found )
   {
 $upload_errmsg=O arquivo \$source_filename\ não está entre os 
 tipos autorizados;
 //die(errmsg=$upload_errmsg);
 return false;
   }
 }
 ... some more code here ..
 return true;
 }

 the first crazy behaviour is... I use a test file called something.jpg, 
 ArquivoExt() returns me the extension of a given filename, in this case 
 jpg. $allowed_types contains gif,jpg and png so that in_array() 
 should return true... and it does... but get this... if I uncomment 
 that var_dump() guess what it outputs?

 bool(true) bool(false)

 very weird... how can one var_dump() call gives me two outputs?
 This double output doesn't occur if I uncomment the die after the 
 var_dump(). It only outputs bool(true) in that case.

 Now for the second weird behaviour... since no matter what, $ext_found 
 will always be false (due to the previous weirdness) it will always 
 enter the IF... but the weird thing is when the caller of Upload() 
 prints $upload_errmsg it only outputs:

 O arquivo  não está entre os tipos autorizados

 where is the filename? I've checked it tons of times... If I uncomment 
 the second die, right after the $upload_errmsg assignment, it outputs 
 ok, with the filename.

 Now, can someone explain me this VERY WEIRD behaviour??



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Error with Netscape 6.2

2001-11-14 Thread Michael Stearne

That is not an error you get from a browser, that is an error generated 
by the server.  Netscape or IE are just reporting that.  Are you sure 
the app works in IE (try Shift+Refresh on IE and Shift+Reload on NS). 
 It sounds like there is a problem in your code.

Michael



Anthony wrote:

 I get a CGI error whenever I view my php app under Netscape 6.  The 
 error is:
 CGI Error
 The specified CGI application misbehaved by not returning a complete 
 set of HTTP headers. The headers it did return are:

 My question is, what are the headers that I need to send, where can I 
 find more info on this?  The app works perfectly under IE, but not 
 Netscape.

 - Anthony






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: silly question

2001-11-14 Thread George Whiffen

Rodrigo,

I don't quite understand your problem,  it might help to see some of the
php or form html. It might also help if I explain how I usually handle updates.

I have a single php page with the form on it which is also the target
of the form.

Typically users get to the form via a link which includes the id on the
url (i.e. passed as a GET variable).  The php picks up this id and uses
it to query the database to get the current data.  Then the form is 
presented with the form values set to the current values and the id
included as a hidden field.  The user makes a change and presses a submit 
button with the name update (INPUT TYPE=SUBMIT NAME=update)

The php checks to see if update is set (isset($update)).  If it is
it uses the form values to update the database before it goes to search
for the current values. Then it just continues as normal retrieving the
database (new) values and printing out the form.  i.e. the logic is :

if (isset($update))
{
update database for id record
e.g. update mytable set myfield = '.$myfield.' where id = '.$id.'
}

select data for id record into myrow
e.g. select * from mytable where id = '.$id.'

print form including data
e.g.
print '
   HTMLHEAD/HEADBODY 
   FORM ACTION='.$SCRIPT_NAME.' METHOD=POST
   MY FIELD : INPUT TYPE=TEXT NAME=myfield VALUE='.$myrow['myfield'].'
   INPUT TYPE=SUBMIT NAME=update
   /FORM
   /BODY/HTML

For the user this means they always have visual confirmation that their
changes have gone to the database after pressing SUBMIT.  If they're
happy they have a link to go wherever they want to next.  If they're
not happy they can correct the data and submit again.

Could you be getting problems because there is confusion between your
hidden id and the id on the url?  The ACTION='.$SCRIPT_NAME.' 
should sort that out since it will remove anything passed on the url
when the form is submitted.

Or perhaps you have set the values in the form to php variables with
the same name as the form variables e.g.

print 'INPUT TYPE=TEXT NAME=myfield VALUE='.$myfield.'

If this is the case, then the form will always come back with the last
entered details and not blank details since $myfield is continually
being set to the value of the HTML input variable myfield.

Sorry I can't help more without getting a better idea of what you
are trying to achieve!

George 

Rodrigo Peres wrote:
 
 Hi list,
 
 I have PHP code to insert the result of a form into mysql. When I nedd to
 made an update, I pass an id in the url and use it to make the update
 query. The problem is after I click in the update button (input submit) my
 page refresh and came back in the same state, to see the changes I need to
 type in the url again with the parameter?? why?? There's a way to avoid this
 and get a new blank form page after the update?
 
 ps: I've stored the id in a input type hidden, so I could click the button
 and still have the id
 
 Thank's in advance
 
 Rodrigo Peres
 --

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: High-Volume Newsletter Techniques?

2001-11-14 Thread Manuel Lemos

Hello,

Sondra Russell wrote:
 
 Yes, I saw the discussion a few days earlier on this topic, but I'm
 wondering if there is still some unmined wisdom out there about
 building a script that sends a newsletter out to 25,000+ people
 The very impressive class I found (phpmailer-1.41) looked great, but
 it didn't *directly* address the high-volume issue in the readme so
 I'm still a little nervous.
 
 And, unfortunately, it's not one of those types of technical
 challenges you can keep testing over and over without seriously
 annoying the first 100 or so people on your list who *do* get the
 email before the script times out.

You should be using a dedicated mailing list management system for that
like something with ezmlm/qmail.

You may want to try this class that lets you manage the creation and
properties of ezmlm mailing lists.

http://phpclasses.UpperDesign.com/browse.html/package/177

Regards,
Manuel Lemos

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] very weird PHP behaviour...

2001-11-14 Thread Christian Dechery

that's exactly the problem... damn, how couldn't I think of this..

I didn't realise that when a file is NOT uploaded its value is set to 
'none'... and I was using empty() to check it...

thanks a lot.

At 10:54 14/11/01 -0600, Steve Cayford wrote:
Sure sounds like you're hitting this function twice by accident. Are you 
sure you're only calling it once? That would explain why you only get one 
output with the die(), but two without it.

-Steve

On Wednesday, November 14, 2001, at 10:34  AM, Christian Dechery wrote:

I don't know what it is... but PHP is acting very weird today... or I am 
becoming crazy... can anyone tell me which one?

I have this function:
function 
Upload($source_file,$source_filename,$dest_dir,$allowed_types=array())
{
global $upload_errmsg;

if( count($allowed_types) )
{
   $file_ext=ArquivoExt($source_filename);
   $ext_found=in_array($file_ext,$allowed_types);
   //die(source=$source_filename);
   //var_dump($ext_found);
   //die;
   if( !$ext_found )
   {
 $upload_errmsg=O arquivo \$source_filename\ não está entre os 
 tipos autorizados;
 //die(errmsg=$upload_errmsg);
 return false;
   }
}
... some more code here ..
return true;
}

the first crazy behaviour is... I use a test file called something.jpg, 
ArquivoExt() returns me the extension of a given filename, in this case 
jpg. $allowed_types contains gif,jpg and png so that in_array() 
should return true... and it does... but get this... if I uncomment that 
var_dump() guess what it outputs?

bool(true) bool(false)

very weird... how can one var_dump() call gives me two outputs?
This double output doesn't occur if I uncomment the die after the 
var_dump(). It only outputs bool(true) in that case.

Now for the second weird behaviour... since no matter what, $ext_found 
will always be false (due to the previous weirdness) it will always enter 
the IF... but the weird thing is when the caller of Upload() prints 
$upload_errmsg it only outputs:

O arquivo  não está entre os tipos autorizados

where is the filename? I've checked it tons of times... If I uncomment 
the second die, right after the $upload_errmsg assignment, it outputs ok, 
with the filename.

Now, can someone explain me this VERY WEIRD behaviour??



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] High-Volume Newsletter Techniques?

2001-11-14 Thread Larry Jeannette II


This is something I am curious about also. We are currently building a
system to allow people to maintain/send out newsletters (40,000+). We have
done some initial testing of the process (which uses the mail() function)
and have found that it takes about 30 - 40 minutes to process 4000 emails.

Right now we are doing this through a web page so we can watch the process,
I myself, was perplexed when the script didn't timeout after 2.5 minutes
(the timeout period set in php.ini) and actually finished the process. My
question is: will this still be true when sending out 40,000 emails and the
process takes 5 - 6 hours? Like Sondra, I don't really want to anger
thousands of people testing this thing out.

Larry Jeannette



Sondra Russell writes:

 Yes, I saw the discussion a few days earlier on this topic, but I'm 
 wondering if there is still some unmined wisdom out there about 
 building a script that sends a newsletter out to 25,000+ people 
 The very impressive class I found (phpmailer-1.41) looked great, but 
 it didn't *directly* address the high-volume issue in the readme so 
 I'm still a little nervous.
 
 And, unfortunately, it's not one of those types of technical 
 challenges you can keep testing over and over without seriously 
 annoying the first 100 or so people on your list who *do* get the 
 email before the script times out.
 
 I think the amount of trash email I get each day proves that vast 
 mailings aren't TOO difficult, but I think I could use a little 
 wisdom before I give it a shot.
 
 Anyone?  I'll buy you a coke!
 
 Thank you in advance,
 Sondra Russell
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Error with Netscape 6.2

2001-11-14 Thread Phil Driscoll

On Wednesday 14 November 2001 5:10 pm, Michael Stearne wrote:
 That is not an error you get from a browser, that is an error generated
 by the server.  Netscape or IE are just reporting that.  Are you sure
 the app works in IE (try Shift+Refresh on IE and Shift+Reload on NS).
  It sounds like there is a problem in your code.
...or, if your platform is windows, php is not installed correctly or your 
web server is not configured correctly - in which case the install.txt file 
which comes with the windows distribution will help you out.

Cheers
-- 
Phil Driscoll


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Including declare statements that contain variables

2001-11-14 Thread Fred

I would like to offer my recent experience in the hope that it will help
others avoid the wasted effort and frustration I managed to burden myself
with yesterday.  I will start by stating that the conclusions I have drawn
may seem obvious at first blush, however in a troubleshooting environment it
is sometimes difficult to see the forest for the trees.  This is
particularly true when several principles of PHP syntax are working in
concert to produce a problem.

My problems started when I found myself in the rare position of needing to
write a function that accessed global variables rather than passed values or
references.  This need arose because I was writing a data access abstraction
function and would have no way of knowing in advance what variables would
need to be accessed or in what order.  The total number of possible
variables was large when compared with the total number of lines of code in
the function.  If I had chosen to write the function to accept an
associative array that could be extracted within the function to produce the
needed variables the total number of lines of code needed outside of the
function to produce the array would have been greater than the total number
of lines of code within the function.

Because the purpose of choosing to use a function rather than writing the
code several times was to reduce the number of lines of code and provide
clarity to the script I decided that passing an array to the function was
not an option.

I decided to simply write the function so that it had access to all
variables in the GLOBALS array to overcome this problem.  The function was
as follows:

// Function to send query and retrieve result pointer
function GetData($Query)
{
extract  ($GLOBALS);
$Result = mysql_query($Query, $db_conn)
   or die (mysql_error());
Return $Result;
}

The function accepts an SQL statement as an argument and returns a pointer
to a result set.  The SQL statement that is passed to the function is one of
many defined constants, many of which contain variables.  For example:

define (ClassesByTeacher,SELECT Classes.SectionNo, Period, CourseNo,
Title, Teacher FROM Classes, Attendance WHERE Classes.SectionNo =
Attendance.SectionNo AND Teacher LIKE \$Teach\ AND Attendance.Date =
\$SQLDate\ GROUP BY Classes.SectionNo);

This particular statement needs to have access to the $Teach and $SQLDate
variables.  When these variables were passed as GET values in the URL the
function worked as expected.  However, if I assigned the variables within
the code of the script outside the function I invariably received empty
result sets.  I spent quite a bit of time under the impression that the
global variables where not being accessed by the function unless they where
GET variables.  This did not turn out to be the case.  Upon adding debug
code to the script I was able to determine that the function was correctly
accessing the global variables, but the mysql_query function was not.  As it
turned out, and this is the part that may seem obvious, the problem resulted
from the fact that the define statement was evaluating the variables to 
before they were actually set in code.

The result was an SQL statemente like this:

SELECT Classes.SectionNo, Period, CourseNo, Title, Teacher FROM Classes,
Attendance WHERE Classes.SectionNo = Attendance.SectionNo AND Teacher LIKE
 AND Attendance.Date =  GROUP BY Classes.SectionNo

which explains the empty data sets and lack of an error message.

The define statements are in a seperate file that is included into the
script.  It is my general practice to include all files that contain
functions as the beginning of a script and this is what I had done here.  As
soon as the file containing the defines was included the variables were
evaluated to empty strings within the defined constant before the variables
were set to usable values within the code.  Moving the include statement
below the variable assignments in the script provided the solution.

The lesson I learned is this:

When including files that contain declare statements which in turn contain
variables, always include the file after the variables have actually been
set to their desired values.

Fred




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] javascript to php ????

2001-11-14 Thread Mike Eheler

No.

You have to realise that JavaScript is client side, and PHP is server 
side, so -- apart from inserting those javascript values into a form and 
submitting it using code -- PHP and JavaScript cannot interact.

Mike

fitiux wrote:

Hi  =)

is it possible to pass a javascript array to php ???


thanks.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] silly question

2001-11-14 Thread Mike Eheler

I assume that you have input type=text name=field1 value=?= 
$field1 ? / or some variation thereof. In that case, just set $field1 
=  after you save the record, or remove the value= statement altogether.

Mike

Rodrigo Peres wrote:

Hi list,

I have PHP code to insert the result of a form into mysql. When I nedd to
made an update, I pass an id in the url and use it to make the update
query. The problem is after I click in the update button (input submit) my
page refresh and came back in the same state, to see the changes I need to
type in the url again with the parameter?? why?? There's a way to avoid this
and get a new blank form page after the update?

ps: I've stored the id in a input type hidden, so I could click the button
and still have the id

Thank's in advance

Rodrigo Peres




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Including declare statements that contain variables

2001-11-14 Thread Jim Lucas

Here are a few pointers to make it run just a little faster also.

don't extract the entire $GLOBALS array.  just use the $var that you need.
function GetData($Query)
{
return(mysql_query($Query, $GLOBALS[db_conn]));
}

another thing would be to build a wrapper function for mysql_query() and
have it display your error code/problems.

why are you using a define to set an SQL query string?

Jim

- Original Message -
From: Fred [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 9:45 AM
Subject: [PHP] Including declare statements that contain variables


 I would like to offer my recent experience in the hope that it will help
 others avoid the wasted effort and frustration I managed to burden myself
 with yesterday.  I will start by stating that the conclusions I have drawn
 may seem obvious at first blush, however in a troubleshooting environment
it
 is sometimes difficult to see the forest for the trees.  This is
 particularly true when several principles of PHP syntax are working in
 concert to produce a problem.

 My problems started when I found myself in the rare position of needing to
 write a function that accessed global variables rather than passed values
or
 references.  This need arose because I was writing a data access
abstraction
 function and would have no way of knowing in advance what variables would
 need to be accessed or in what order.  The total number of possible
 variables was large when compared with the total number of lines of code
in
 the function.  If I had chosen to write the function to accept an
 associative array that could be extracted within the function to produce
the
 needed variables the total number of lines of code needed outside of the
 function to produce the array would have been greater than the total
number
 of lines of code within the function.

 Because the purpose of choosing to use a function rather than writing the
 code several times was to reduce the number of lines of code and provide
 clarity to the script I decided that passing an array to the function was
 not an option.

 I decided to simply write the function so that it had access to all
 variables in the GLOBALS array to overcome this problem.  The function was
 as follows:

 // Function to send query and retrieve result pointer
 function GetData($Query)
 {
 extract  ($GLOBALS);
 $Result = mysql_query($Query, $db_conn)
or die (mysql_error());
 Return $Result;
 }

 The function accepts an SQL statement as an argument and returns a pointer
 to a result set.  The SQL statement that is passed to the function is one
of
 many defined constants, many of which contain variables.  For example:

 define (ClassesByTeacher,SELECT Classes.SectionNo, Period, CourseNo,
 Title, Teacher FROM Classes, Attendance WHERE Classes.SectionNo =
 Attendance.SectionNo AND Teacher LIKE \$Teach\ AND Attendance.Date =
 \$SQLDate\ GROUP BY Classes.SectionNo);

 This particular statement needs to have access to the $Teach and $SQLDate
 variables.  When these variables were passed as GET values in the URL the
 function worked as expected.  However, if I assigned the variables within
 the code of the script outside the function I invariably received empty
 result sets.  I spent quite a bit of time under the impression that the
 global variables where not being accessed by the function unless they
where
 GET variables.  This did not turn out to be the case.  Upon adding debug
 code to the script I was able to determine that the function was correctly
 accessing the global variables, but the mysql_query function was not.  As
it
 turned out, and this is the part that may seem obvious, the problem
resulted
 from the fact that the define statement was evaluating the variables to 
 before they were actually set in code.

 The result was an SQL statemente like this:

 SELECT Classes.SectionNo, Period, CourseNo, Title, Teacher FROM Classes,
 Attendance WHERE Classes.SectionNo = Attendance.SectionNo AND Teacher LIKE
  AND Attendance.Date =  GROUP BY Classes.SectionNo

 which explains the empty data sets and lack of an error message.

 The define statements are in a seperate file that is included into the
 script.  It is my general practice to include all files that contain
 functions as the beginning of a script and this is what I had done here.
As
 soon as the file containing the defines was included the variables were
 evaluated to empty strings within the defined constant before the
variables
 were set to usable values within the code.  Moving the include statement
 below the variable assignments in the script provided the solution.

 The lesson I learned is this:

 When including files that contain declare statements which in turn contain
 variables, always include the file after the variables have actually been
 set to their desired values.

 Fred




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL 

Re: [PHP] very weird PHP behaviour...

2001-11-14 Thread Jim Lucas

try this:

function
Upload($source_file,$source_filename,$dest_dir,$allowed_types=array(),
$upload_errmsg=)
{
if( count($allowed_types) )
{
   if(!in_array(ArquivoExt($source_filename),$allowed_types))
   {
 ?O arquivo ?=$source_filename? não está entre os tipos
autorizados?
 return false;
   }
}
... some more code here ..
return true;
}

Jim

- Original Message -
From: Christian Dechery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 8:34 AM
Subject: [PHP] very weird PHP behaviour...


I don't know what it is... but PHP is acting very weird today... or I am
becoming crazy... can anyone tell me which one?

I have this function:
function
Upload($source_file,$source_filename,$dest_dir,$allowed_types=array())
{
global $upload_errmsg;

if( count($allowed_types) )
{
   $file_ext=ArquivoExt($source_filename);
   $ext_found=in_array($file_ext,$allowed_types);
   //die(source=$source_filename);
   //var_dump($ext_found);
   //die;
   if( !$ext_found )
   {
 $upload_errmsg=O arquivo \$source_filename\ não está entre os tipos
autorizados;
 //die(errmsg=$upload_errmsg);
 return false;
   }
}
... some more code here ..
return true;
}

the first crazy behaviour is... I use a test file called something.jpg,
ArquivoExt() returns me the extension of a given filename, in this case
jpg. $allowed_types contains gif,jpg and png so that in_array()
should return true... and it does... but get this... if I uncomment that
var_dump() guess what it outputs?

bool(true) bool(false)

very weird... how can one var_dump() call gives me two outputs?
This double output doesn't occur if I uncomment the die after the
var_dump(). It only outputs bool(true) in that case.

Now for the second weird behaviour... since no matter what, $ext_found will
always be false (due to the previous weirdness) it will always enter the
IF... but the weird thing is when the caller of Upload() prints
$upload_errmsg it only outputs:

O arquivo  não está entre os tipos autorizados

where is the filename? I've checked it tons of times... If I uncomment the
second die, right after the $upload_errmsg assignment, it outputs ok, with
the filename.

Now, can someone explain me this VERY WEIRD behaviour??



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Including declare statements that contain variables

2001-11-14 Thread Fred


Jim Lucas [EMAIL PROTECTED] wrote in message
012301c16d3a$6def13c0$96def5cc@bendcom">news:012301c16d3a$6def13c0$96def5cc@bendcom...
 Here are a few pointers to make it run just a little faster also.

 don't extract the entire $GLOBALS array.  just use the $var that you need.
 function GetData($Query)
 {
 return(mysql_query($Query, $GLOBALS[db_conn]));
 }

The problem with this approach is that I do not know ahead of time which
GLOBALS
I will need (other than $db_conn).  For instance, once query may depend of
the $ClassID
and $Attendance variables while another depends on the $StudentID and $Grade
variables


 why are you using a define to set an SQL query string?

I am using define to set SQL query strings because there are a limited
number (30 or so)
of queries used by the application, but they are used in different contexts.
So, for example,
I may have:

 SELECT FirstName, LastName, Grade, Attendance FROM Students, Classes
WHERE Students.StudentID = Classes.StudentID AND ClassID = $Class

defined as StudentsByClass.  I can then pass the function the constant and
use it in
different situations.  For example:

PrintMenu(Students,GetData(StudentsByClass));

will print a menu of student names whereas:

PrintAttendance(GetData(StudentsByClass));

would print an attendance report

Fred




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] High-Volume Newsletter Techniques?

2001-11-14 Thread The Big Roach

Just a reminder of sorts when dealing with this kind of issue.
Where I work, we never had a need to mail 20,000+ newsletters but we do
distribute 300 or so each week.
On our initial tests, we discovered our external smtp server (our isp
account), limited our mailings to chunks of 20 emails at a time, which meant
we had to reconnect after every 20 newsletters had been sent.
We still deal with this issue, and are looking for a more efficient/friendly
isp to handle our needs.
Alternatively (plan B) we could set up our own server in-house.
We don't know yet but there could be also limits on our DSL connection
imposed by the ISP.

Still studying the problem.

Ciao, Fans!

Larry Jeannette II [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 This is something I am curious about also. We are currently building a
 system to allow people to maintain/send out newsletters (40,000+). We have
 done some initial testing of the process (which uses the mail() function)
 and have found that it takes about 30 - 40 minutes to process 4000 emails.

 Right now we are doing this through a web page so we can watch the
process,
 I myself, was perplexed when the script didn't timeout after 2.5 minutes
 (the timeout period set in php.ini) and actually finished the process. My
 question is: will this still be true when sending out 40,000 emails and
the
 process takes 5 - 6 hours? Like Sondra, I don't really want to anger
 thousands of people testing this thing out.

 Larry Jeannette



 Sondra Russell writes:

  Yes, I saw the discussion a few days earlier on this topic, but I'm
  wondering if there is still some unmined wisdom out there about
  building a script that sends a newsletter out to 25,000+ people
  The very impressive class I found (phpmailer-1.41) looked great, but
  it didn't *directly* address the high-volume issue in the readme so
  I'm still a little nervous.
 
  And, unfortunately, it's not one of those types of technical
  challenges you can keep testing over and over without seriously
  annoying the first 100 or so people on your list who *do* get the
  email before the script times out.
 
  I think the amount of trash email I get each day proves that vast
  mailings aren't TOO difficult, but I think I could use a little
  wisdom before I give it a shot.
 
  Anyone?  I'll buy you a coke!
 
  Thank you in advance,
  Sondra Russell
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] gd-lib and libjpeg issues

2001-11-14 Thread Bill Brennick

Hi all...   Having an issue with PHP recognizing the libgd and libjpeg libraries...
I specifically downloaded the newest version(s) of those,
and compiled the PHP 4.0.6 with:

./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.22 --with-xml 
--with-zlib --with-gd=/usr/lib --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib


However,  I still keep getting the following message everytime I use
an app that uses GD (For example, jpgraph)

Your PHP (and GD-lib) installation does not appear to support any known graphic 
formats.You need to first make sure GD is compiled as a module to PHP. If you also 
want to use JPEG images you must get the JPEG library. Please see the PHP docs for 
details.

Have looked into everything:   php.ini's, apache config's, etc...  

At a loss...

Thanks...
- Bill





[PHP] About Berkeley DB2 Databases

2001-11-14 Thread Ricardo Núñez

Hello,

I read a paper about Berkeley DB2 databases and I have a few doubts about PHP db2 
support

I compiled my php with --with-db2 option...

1) How can I create a Berkeley db2 database with the Berkeley DB Concurrent Access 
Method I want. Let's say... a B+Tree ... or hash method. USING php.

2) How can I use structured data (like objects) as register values of a Berkeley 
database USING php (I read 
http://www.dst.usb.ve/manuales/php-eng/function.dba-insert.html function, but it 
assumes only a string).

Thank you very much,

Ricardo Núñez
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Setting variables from a text file

2001-11-14 Thread Rudi Ahlers

Hi

Say I have a text file, separated by | ( a pipe). Now, I want to extract
that info, in the form of variables. I can extract and display the info in
the text files, but that's not what I want. I want to be able to tell it
that the first entry should be variable1, the second entry should be
variable2, etc. I add the info into the file with a script, that always adds
variable1 into field one, variable2 into field2, etc. These variables are
taken from a form. Now, I need to pass those variables onto another script,
but I need to be able to extract them. Can anyone help me with this please?
Thank you

Rudi Ahlers



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] javascript to php ???????

2001-11-14 Thread Mark

On Wed, 14 Nov 2001 10:30:03 +1100, Martin Towell wrote:
That's why I put quotes around the words - obviously a function
would be
need to be written to do the serialising and a corresponding php
function
to retrieve the values and place them into an array again.

oops, I guess I misread that. You're right, that's crazy enough to
work. a serialize function in javascript that serializes things the
same way as php would be very useful, probably an unserialize
function would be too.


-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:28 AM
To: [EMAIL PROTECTED]; PHP General
Subject: RE: [PHP] javascript to php ???


On Wed, 14 Nov 2001 10:16:42 +1100, Martin Towell wrote:
serialise the array and make the value of a hidden field this
value.
Then in PHP unserialise it.

that would work great if it were a php array, but I believe we're
talking about javascript arrays here. :)

-Original Message-
From: fitiux [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:18 AM
To: PHP General
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] javascript to php ???


Hi  =)
is it possible to pass a javascript array to php ???

by the time javascript comes into play, php has already done it's
job
and left the building. If you mean can javascript pass variables
to
a
new request for php to handle, then sure.


Thanks for your reply.  =)

I have a little problem..
well.. with php I build an html page with javascript to validate a
form,
the action of this form is call again to the php page.
I mean...
  test.php - (make an html page)--- question.html ---
(submit
form) test.php

I populated an array but now I need to pass this array to the same
starting
php page again.

can I do this?


--Patricio


(I apology because my english is not good enough.. I hope that you
can
understand me.. )








--
Mark, [EMAIL PROTECTED] on 11/14/2001



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Setting variables from a text file

2001-11-14 Thread Jeff Lewis

Someone may have a better way but you can read each line (assuming the file
uses \n for a new record) and use:

arrayname = explode(|,$variable_holding_line_from_file);

Then you can do assign the variables as such:

$name = $arrayname[0]; etc

Could be a better way from the list :)

Jeff
- Original Message -
From: Rudi Ahlers [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 3:08 PM
Subject: [PHP] Setting variables from a text file


 Hi

 Say I have a text file, separated by | ( a pipe). Now, I want to extract
 that info, in the form of variables. I can extract and display the info in
 the text files, but that's not what I want. I want to be able to tell it
 that the first entry should be variable1, the second entry should be
 variable2, etc. I add the info into the file with a script, that always
adds
 variable1 into field one, variable2 into field2, etc. These variables are
 taken from a form. Now, I need to pass those variables onto another
script,
 but I need to be able to extract them. Can anyone help me with this
please?
 Thank you

 Rudi Ahlers



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Setting variables from a text file

2001-11-14 Thread Matthew Luchak

How about

pseudocode...

$variable=variablename;

$array = explode(|,$text);

foreach ($array as $key = $value) {
$variable$key=$value;
}
 

 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 3:12 PM
To: Rudi Ahlers; PHP General
Subject: Re: [PHP] Setting variables from a text file


Someone may have a better way but you can read each line (assuming the
file
uses \n for a new record) and use:

arrayname = explode(|,$variable_holding_line_from_file);

Then you can do assign the variables as such:

$name = $arrayname[0]; etc

Could be a better way from the list :)

Jeff
- Original Message -
From: Rudi Ahlers [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 3:08 PM
Subject: [PHP] Setting variables from a text file


 Hi

 Say I have a text file, separated by | ( a pipe). Now, I want to
extract
 that info, in the form of variables. I can extract and display the
info in
 the text files, but that's not what I want. I want to be able to tell
it
 that the first entry should be variable1, the second entry should be
 variable2, etc. I add the info into the file with a script, that
always
adds
 variable1 into field one, variable2 into field2, etc. These variables
are
 taken from a form. Now, I need to pass those variables onto another
script,
 but I need to be able to extract them. Can anyone help me with this
please?
 Thank you

 Rudi Ahlers



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
[EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] About Berkeley DB2 Db Nr. 2

2001-11-14 Thread Ricardo Núñez

Hello again,



Nr. 2



I compiled my php with --with-db2 option...



1) Does PHP support Berkeley DB2 concurrency control? How?



2) Does PHP support Berkeley DB2 transaction control? How?



Thank you very much,



Ricardo Núñez

[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: VALUABLE LESSON: using sessions and include

2001-11-14 Thread jtjohnston

Yeah, I tried to NOT name the session, but it didn't carry over the data. This
this simple lesson.

Dav wrote:

 What you can do is not to name session at all :-) It's easyer :-)
 J
 Jtjohnston [EMAIL PROTECTED] ha scritto nel messaggio
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Thanks Dav,
 
  You caught me while I was debugging. But I learned a valuable  lesson! I
 indeed
  did not name my session_name correctly. IN FACT ... I did not name it AT
 ALL in
  display_image.php. There lay the problem. I needed to declare both:
 
  session_name(ESLpostcard);
  session_start();
 
  at the beginning of display_image.php AND postcard.php for the data to
  re-transmit itself.
 
  I was running both php files without session_name and session_start. The
 docs
  just don't make that clear enough that you need to re-include
 session_name.
 
  Duh, uh, ...  the session ID stayed the same, so I figured the data
 was
  getting through even if I didn't see it. Indeed, postcard.php was
 receiving the
  data - we can see that in the form - but was not transmitting the data as
 well,
  only if I included display_image.php
 
 
   http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html
  
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html.phps
   http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.php
  
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.phps
  
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.ph
 p
  
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.ph
 ps
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] VALUABLE LESSON: using sessions and include

2001-11-14 Thread jtjohnston

Only if you are allowed anywhere near your admin's account :)

Papp Gyozo wrote:

 or name it in PHP.ini:

 session.name

  What you can do is not to name session at all :-) It's easyer :-)
  J
  Jtjohnston [EMAIL PROTECTED] ha scritto nel messaggio
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Thanks Dav,
 
  You caught me while I was debugging. But I learned a valuable  lesson! I
 indeed
  did not name my session_name correctly. IN FACT ... I did not name it AT
 ALL in
  display_image.php. There lay the problem. I needed to declare both:
 
  session_name(ESLpostcard);
  session_start();
 
  at the beginning of display_image.php AND postcard.php for the data to
  re-transmit itself.
 
  I was running both php files without session_name and session_start. The
 docs
  just don't make that clear enough that you need to re-include
 session_name.
 
  Duh, uh, ...  the session ID stayed the same, so I figured the data
 was
  getting through even if I didn't see it. Indeed, postcard.php was
 receiving the
  data - we can see that in the form - but was not transmitting the data as
 well,
  only if I included display_image.php
 
 
   http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html
  
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/index.html.phps
   http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.php
  
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/postcard.phps
  
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.ph
 p
  
 http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/display_image.ph
 ps
 

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] FTP Clients

2001-11-14 Thread Rudi Ahlers

Sorry for the totally OT question, but can anyone recommend a good, FREE,
FTP client for windows? I now have to pay for AceFTP aswell, which used to
be free.
Thank you


Rudi Ahlers


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Setting variables from a text file

2001-11-14 Thread Rudi Ahlers

I couldn't get this to work. Here is my complete script:



?
function WriteToFile ($URL, $Description) {
 $file = bonzai.txt;
 $open = fopen ($file, a);
 if ($open) {
  fwrite ($open, $URL\t$Description\n);
  fclose ($open);
  $Worked = TRUE ;
 } else {
  $Worked = FALSE;
 }
 return $Worked;
}

function ReadFromFile() {
 $file = bonzai.txt;
 $open = fopen ($file, r);
  if ($open) {
  print (URLs currently listed in the data file:P\n);
 $data = file ($file);
 for ($n = 0; $n  count($data); $n++) {
  $GetLine = explode(|, $data[$n]);
 print ($GetLine[0]p\n);
 }
 fclose ($open);
 print (hrP\n);
 } else {
 print (Unable to read from bonzai.txt!BR\n);
 }
}


ReadFromFile();


?

It gives me some error. I'm still pretty new to php, so I still need to
learn all of this.
Regards
Rudi Ahlers
- Original Message -
From: Jeff Lewis [EMAIL PROTECTED]
To: Rudi Ahlers [EMAIL PROTECTED]; PHP General
[EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 10:11 PM
Subject: Re: [PHP] Setting variables from a text file


 Someone may have a better way but you can read each line (assuming the
file
 uses \n for a new record) and use:

 arrayname = explode(|,$variable_holding_line_from_file);

 Then you can do assign the variables as such:

 $name = $arrayname[0]; etc

 Could be a better way from the list :)

 Jeff
 - Original Message -
 From: Rudi Ahlers [EMAIL PROTECTED]
 To: PHP General [EMAIL PROTECTED]
 Sent: Wednesday, November 14, 2001 3:08 PM
 Subject: [PHP] Setting variables from a text file


  Hi
 
  Say I have a text file, separated by | ( a pipe). Now, I want to
extract
  that info, in the form of variables. I can extract and display the info
in
  the text files, but that's not what I want. I want to be able to tell it
  that the first entry should be variable1, the second entry should be
  variable2, etc. I add the info into the file with a script, that always
 adds
  variable1 into field one, variable2 into field2, etc. These variables
are
  taken from a form. Now, I need to pass those variables onto another
 script,
  but I need to be able to extract them. Can anyone help me with this
 please?
  Thank you
 
  Rudi Ahlers
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] FTP Clients

2001-11-14 Thread Kurt Lieber

Look -- if you're going to post OT messages, at least put [OT] in the subject 
line so those of us who get pissy about OT messages (such as myself) can 
filter them out.

As for a good, free windows FTP utility, you have one:

Open up a command prompt and type ftp.

--kurt

On Wednesday 14 November 2001 01:28 pm, Rudi Ahlers wrote:
 Sorry for the totally OT question, but can anyone recommend a good, FREE,
 FTP client for windows? I now have to pay for AceFTP aswell, which used to
 be free.
 Thank you

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Need a little help with IMAP (OT?)

2001-11-14 Thread Magnus

Hello all!

I have finally got php and apache to work with IMAP, pdf and gd, not
problems compiling them.

But...
When I try to connect to my local account called homer with IMAP in a
php-page I get an error:
Warning: Couldn't open stream {localhost:143}INBOX

When I get more info about the error from IMAP I get Unable to connect,
connectiosn refused.

When I connect to the server via ftp I get the same error Connection
refused.

Is there anyone who knwos what's wrong and how to get thins running? :-)

I'm running RedHat 7.1 with the latest stable version of PHP and IMAP and
Apache.

Thanks.
/Magnus Hammar
--


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] matches problem: refinement of the question

2001-11-14 Thread Bruno Grab


Von: Bruno Grab [EMAIL PROTECTED]
An: [EMAIL PROTECTED]
Betreff: Re: [PHP] matches problem (preg_match)
Datum: Mittwoch, 14. November 2001 12:41

Thank you for your answer.
However our real problem is to solve it with preg_match.
we want to rather analyse more complicated structures than the one
in our example. Well, let me reformulate it:
How can we (with preg_match) s a v e  each subpattern  into an array
element, that is, also e a c h  m a t c h  o f  a  r e p e a t e d  s u b -
p a t t e r n  (e.g (...)* and (...)+) ??
Thanks a lot (again)
Bruno
Valentin V. Petruchek [EMAIL PROTECTED] schrieb im Newsbeitrag
028f01c16c5b$c87b1da0$[EMAIL PROTECTED]">news:028f01c16c5b$c87b1da0$[EMAIL PROTECTED]...
 Try this code:

 $str=eins zwei drei vier fünf sechs;
 $Wort = explode (' ',$str);

 $n=count($Wort);
 for($i=0;$i$n;$i++){echo $i: $Wort[$i]br;}

 It should works

 Zliy Pes [EMAIL PROTECTED]









-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] NO CARGA PAGINA PHP

2001-11-14 Thread Daniel Geldres Castro

Tengo un pequeño problema con mi servidor SuSe 7.0
Tengo instalado el apache y corriendo los demonios, tengo instlado los rpm
del mod_php, postgres y mysql pero cuando desde mi navegador deseo
visualizar alguna pagina con la extension php esta se descarga sola, no me
visualiza nada.

Que error debo de haber cometido si aparentemnte todo estaba bien.

===
Saludos,
Daniel Geldres Castro
mail: [EMAIL PROTECTED]
Telf Trab.: 511-447-7600
Telf Casa.: 511-251-3584
ICQ 72211218
MSN [EMAIL PROTECTED]
Yahoo ID danielgeldres
===


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Check if ip is with a network block

2001-11-14 Thread Paul Wolstenholme

Greetings,

I'd like to check to see if an ip is within an ip cidr style network
block (192.75.242.157 with 192.75.242.0/23). Initially, I started off
with some code derived from some perl code that I found (code below).
However, the bitmask calcution did not work ( $bitmask = 0x 
(32 - $nbits);) and the hexdec did not appear to support values as bit
as  0x. 

So I did a bit more research and found a relevant posting on the php
mailing list. If the function 'within' works properly it should return
true if the ip is within the network block but I cannot seem to get it
to work properly. Are there any CIDR/bitwise operator wiz's out there
that could help me get this straightened out. Thanks.

/Paul

Input:
remote_ip = 192.75.242.88
cidr = 192.75.242.0/24 

Output:
ip = -1068764584 
start = -1068764672 
mask = -16777216 


function within ($remote_ip, $cidr) {
## within function checks whether an ip is within a network
block
## example with(192.75.242.157, 192.75.242.0/24) 
## returns true if ip is within range

$ip=ip2long($remote_ip); 
list ($quad, $nbits) = split (/, $cidr, 2);
$shift_mask = (integer) $nbits; 
$start=ip2long($quad);

$mask = -1$shift_mask;

return $ip  $start == $mask;
}




PERL derived code:
$cidr = $valid_client; /* db value 192.55.192.0/24 */
list ($quad, $nbits) = split (/, $cidr, 2);
$byte = explode (., $quad);
$address_required = ($byte[0]  24) | ($byte[1]  16) | ($byte[2] 
8) | $byte[3];

/* remote host info */
$byte = explode(., $ip); /* ip from $HTTP_SERVER_VARS['REMOTE_ADDR']
*/
$address_client = ($byte[0]  24) | ($byte[1]  16) | ($byte[2]  8)
| $byte[3];

$bitmask = 0x  (32 - $nbits); 
if (($address_client  $bitmask) == ($address_required  $bitmask)) {
echo Ip is within block;
} else {
echo Ip is NOT within block;
}
-- 

Paul Wolstenholme
SMA Webware
http://www.zzube.com/
What do you know?
http://make.zzube.com/
Vancouver, BC Canada


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP] Re: Can If Else statements be split into code blocks??

2001-11-14 Thread Papp Gyozo

Nonetheless sometimes it is more efficient to use a template engine.
(IMHO)

Papp Gyozo
- [EMAIL PROTECTED]

- Original Message - 
From: Jason G. [EMAIL PROTECTED]
To: Brad Melendy [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 1:33 PM
Subject: Re: [PHP] Re: Can If Else statements be split into code blocks??


 try this..
 
 ?
 if(true)
 {
  ?
  Raw html code here for
  as long as
  you want
  ?
 }
 else
 {
  ?
  More
  Raw
  Html
  Code
  Here
  ?
 }
 
 
 I believe that this feature is way underutilized by php developers.  Tying 
 all your html up in echo or print statements is a mess to say the least.
 
 -Jason Garber
 IonZoft.com
 
 
 At 05:13 PM 11/13/2001 -0800, Brad Melendy wrote:
 Ok, I figured out that just using echo seems to be the best way to do this
 under PHP.  In ASP, you can end your code block and start in with HTML, but
 I couldn't get that to work with PHP.  However, I was able to just use the
 echo statement to get the conditional HTML I wanted to show up when the
 proper condition was met in the If Else statement.
 
 Brad
 
 Brad Melendy [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hello,
   I'm trying to execute some HTML in an IF ELSE statement.  I'm trying
   something like:
  
   ?php
   if (strstr($DomResults,$Match))
   print Congratulations!  $domain.$suffix is available!;
   ?
   form method=POST action=step2.asp name=form2
 pinput type=submit value=Register name=B1/p
   /form
  
   ?php
  else
   print Sorry, $domain.$suffix is already taken.;
   ?
  
   Basically, it works great without the form I'm trying to insert, but with
   the form after the IF statement, it fails.  Is what I want to do against
 the
   rules?  I'm converting an ASP script I have to PHP and I have it all
 working
   under ASP.  That means it should be eaiser with PHP right?  ;-)  Thanks in
   advance.
  
   ...Brad
  
  
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



[PHP] Ramadan@egyptpresents

2001-11-14 Thread Egypt Presents Marketing

   Egypt Presents Logo
http://www.egyptpresents.com/EgyPres.ASP?MRKID=210800  

Ramadan @ EgyptPresents
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=0CatName=occasionsSubCatID=4SubCatName=ramadanMRK
ID=131101 
First Online Gift Shop in Egypt   
http://www.EgyptPresents.com
http://www.EgyptPresents.com/EgyPres.ASP?MRKID=210800  
Happy Ramadan
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=0CatName=occasionsSubCatID=4SubCatName=ramadanMRK
ID=131101 

? 
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=0CatName=occasionsSubCatID=4SubCatName=ramadanMRK
ID=131101 

NEW Collection of Best   
ChocoFlowers
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=504CatName=+FlowersSubCatID=2SubCatName=New+Flower
+CollectionMRKID=210800
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=520CatName=ChocolateSubCatID=1SubCatName=Chocoflow
ersMRKID=131101  

Best Watches Collection
 
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=512CatName=++WatchesSubCatID=1SubCatName=menMRKID=
131101 

Can't Spend Ramadan With Your Loved Ones???

No problem.
Now you can share your loved ones their 
Very special occasions and traditions

Now you can buy Ramadan Gifts including  Ramadan Lanterns Fawanis,
Oriental Pastry, and Islamic Decorations that will impress your loved
ones during the Holly Month and give you the chance to participate in
their very special traditions.

All gifts are delivered to the doorstep of your loved ones and you get
all this in the best prices in the Town.

 

Large Selection of Best Brands at best prices
Perfumes
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=500CatName=+PerfumesSubCatID=0SubCatName=ESCADAMR
KID=210800
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=500CatName=+PerfumesSubCatID=0SubCatName=ESCADAMR
KID=131101 

Large Selection of Best  
Silver Plated Gifts
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=506CatName=++SilverSubCatID=0SubCatName=Silver+Pla
tedMRKID=210800
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=506CatName=++SilverSubCatID=0SubCatName=Silver+Pla
tedMRKID=131101  

Loveliest Selection of 
Teddy Bears 
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=500CatName=+PerfumesSubCatID=0SubCatName=ESCADA
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=3CatName=GiftsSubCatID=7SubCatName=Teddy+BearsMRK
ID=131101  

 
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=500CatName=+PerfumesSubCatID=0SubCatName=ESCADAMR
KID=131101
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=510CatName=TiesSubCatID=0SubCatName=TiesMRKID=131
101
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=514CatName=DessertsSubCatID=0SubCatName=Oriental+P
astryMRKID=131101 

 
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=514CatName=DessertsSubCatID=1SubCatName=CakesMRKI
D=131101 

 
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=520CatName=ChocolateSubCatID=1SubCatName=Chocoflow
ersMRKID=131101 

 
http://www.egyptpresents.com/EgyPres.ASP?WCI=FrameSetMainURL=EgyPres.A
SP?WCI=ItemsCatID=0CatName=occasionsSubCatID=4SubCatName=ramadanMRK
ID=131101  

with compliments of

Egypt Presents

 

 

 




[PHP] IP Address Variable

2001-11-14 Thread Ben Clumeck

I currently log ip address that reach my site.   However, I want to be able
to log both the ip address and remote name.  Can anyone help?

Thanks,

Ben


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] IP Address Variable

2001-11-14 Thread Jim Lucas

check this out
http://www.php.net/manual/en/function.gethostbyaddr.php

jim
- Original Message -
From: Ben Clumeck [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 2:48 PM
Subject: [PHP] IP Address Variable


 I currently log ip address that reach my site.   However, I want to be
able
 to log both the ip address and remote name.  Can anyone help?

 Thanks,

 Ben


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] IP Address Variable

2001-11-14 Thread Ben Clumeck

Jim,

Thanks for your quick response.  I looked over the URL and tried it but it
doesn't seem to work.

I tried:
?php

$name = gethostbyaddr($ip);
print ($ip is $name\n);
?

Any advice would be appreciated.

Ben

-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 2:57 PM
To: Ben Clumeck; [EMAIL PROTECTED]
Subject: Re: [PHP] IP Address Variable


check this out
http://www.php.net/manual/en/function.gethostbyaddr.php

jim
- Original Message -
From: Ben Clumeck [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 2:48 PM
Subject: [PHP] IP Address Variable


 I currently log ip address that reach my site.   However, I want to be
able
 to log both the ip address and remote name.  Can anyone help?

 Thanks,

 Ben


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Session help

2001-11-14 Thread John Taylor-Johnston

Start at index.html. It goes to postcard.php. When I click on submit in
postcard.php, if I change any of the values in the form, the session
values received in send_mail.php do not change. Anyone have an idea what
I have done wrong now?

http://www.CollegeSherbrooke.qc.ca/~languesmodernes/postcard/index.html.phps

http://www.CollegeSherbrooke.qc.ca/~languesmodernes/postcard/postcard.phps

http://www.CollegeSherbrooke.qc.ca/~languesmodernes/postcard/display_image.phps

http://www.CollegeSherbrooke.qc.ca/~languesmodernes/postcard/send_mail.phps

John


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] take date and convert to day of year fixed!

2001-11-14 Thread sundogcurt

OK GOT IT!!

$utine = strtotime(26-Nov-2001);
$bday=(int)$utine;

$utoday = strtotime();
$btoday = (int)$utoday;

if((($bday-$btoday) = 1209600  ($bday-$btoday)0)){
print you have  . round(($bday-$btoday)/86400). Days till 
'blanks' bdaybr;
print you are within the two week range.;
}else{
print you are NOT within the date range.;
}

It's messy but it works, thanks everybody that helped me out on this.

(C:

[EMAIL PROTECTED] wrote:

date(z); // the today's ordinal number 

z - day of the year; i.e. 0 to 365 

if you want the ordinal number of other days different than the current one
you can play with mktime or strftime or strtotime to make an appropiate 
timestamp as you did in your earlier codes.

 
- Original Message - 
From: Martin Towell [EMAIL PROTECTED]
To: GENERAL PHP LIST [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 3:19 AM
Subject: RE: [PHP] take date and convert to day of year


I'm running on WinNT4 w/ PHP 4.0.6 and the code I supplied came back with
333
and for today I get 317
dunno why you're getting 364
anyone, any eye-dears ??

-Original Message-
From: sundogcurt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 12:14 PM
To: GENERAL PHP LIST
Subject: Re: [PHP] take date and convert to day of year


I have tried to implement your code Martin, and I do thank you VERY MUCH 
for the help, but your code seems to have the same trouble as mine, it 
doesn't matter what date I start with, I end up with 364 as the day of 
the year, I am on win32 though I don't know if that matters.

Here is what I tried:


//FORMAT HAS TO BE date(d-M-Y);
//GET DAY OF YEAR FOR DOB utime = UNIX time
$utine = strtotime(30-Nov-1971);
$dob = getdate($utime);
$dobnum = $dob['yday'];
print dob is  . $dobnum . br;

//GET DAY OF YEAR FOR TODAY
//$today = date(d-M-Y);
$utoday = strtotime(date(d-M-Y));
$today = getdate($utoday);
$todaynum = $today['yday'];
print today is  . $todaynum . br;

There should be a different of about 17 days here right? Not if this is 
returning 364 for $dobnum, then it's 48!


[EMAIL PROTECTED] wrote:

looking at the manual, getdate() is meant to be passed a unix time stamp,
so, you'll need to use strtotime() first thus:

$utime = strtotime(30-Nov-1971);
$dob = getdate($utime);
$dobnum = $dob['yday'];
print $dobnum;

Notice I changed the format of the date, when I tried using the original
format, strtotime() complained, saying it couldn't convert it.

Martin T

-Original Message-
From: sundogcurt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 7:57 AM
To: GENERAL PHP LIST
Subject: [PHP] take date and convert to day of year


Hi guys, I know that you can take todays date and display it as the 
numeric day of the year, 1 - 365 / 0 - 364 etc.
But can you take a date such as (November-30-1971) and convert that to 
the numeric day of the year?

I have been trying to do this but have had no joy, I don't think my code 
is even close.

$dob = getdate(Nov-30-1971);
$dobnum = $dob['yday'];
print $dobnum;

$dob 'should' be an array and 'yday' should be the numeric value for the 
day of the year, right?!?

This is what I am trying, and how I understand it, using 'yday' should 
give you basically the same output as date (z);

What I would like is the ability to convert any date to the days numeric 
value. Any help would be GREATLY appreciated.

(C:




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Re: [PHP] IP Address Variable

2001-11-14 Thread John Taylor-Johnston

It may not work, if you are running Windows PHP on your localhost at home.
I'll bet you are trying to log getenv('REMOTE_HOST').
Been there done that. I use http://www.indigostar.com/microweb.htm to create a
localhost to develop and debug and then upload to the server. (I pay for modem
time.) I remember this not working if I used it at home.

Are you sure you are not looking for getenv('REMOTE_HOST') in addition to
getenv('REMOTE_ADDR'} You may want this instead. Here's some of my code:

?php
$machine = getenv('REMOTE_HOST');
if(!strpos($machine, collegesherbrooke.qc.ca))
{
include exterior.html;
}else{

echo FRAMESET cols=\200,*\
  FRAME src=\index_tree.html\ name=\treeframe\ 
  FRAME SRC=\college.html\ name=\basefrm\
/FRAMESET;
}
?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mail() function

2001-11-14 Thread Brandon Orther

Hello,
 
I have been mssing with the mail function for a day now.  When I send a
e-mail it always adds the server name to the end of whatever I put the
e-mail from in the header.
 
Example:
 
$mailheaders = From: \Do Not Reply\\r\nReply-To: Do Not Reply@Do Not
Reply\n;
 
If I use the above headers it says from Do Not [EMAIL PROTECTED]
 
Does anyone know how to make it just say Do Not Reply?
 
Thanks
Brandon



RE: [PHP] mail() function

2001-11-14 Thread Martin Towell

It's probably thinking that Do Not Reply is a user name, so try:
Do Not Reply [EMAIL PROTECTED]
and see how that goes

-Original Message-
From: Brandon Orther [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 15, 2001 10:50 AM
To: PHP User Group
Subject: [PHP] mail() function


Hello,
 
I have been mssing with the mail function for a day now.  When I send a
e-mail it always adds the server name to the end of whatever I put the
e-mail from in the header.
 
Example:
 
$mailheaders = From: \Do Not Reply\\r\nReply-To: Do Not Reply@Do Not
Reply\n;
 
If I use the above headers it says from Do Not [EMAIL PROTECTED]
 
Does anyone know how to make it just say Do Not Reply?
 
Thanks
Brandon



[PHP] Re: Function registration failed and Module compiled with debug=0 errors

2001-11-14 Thread Richard Lynch

D'oh!!!

That's what I get for trying copying and pasting with Mandrake's screwy 
./configure line!  An oddly altered php.ini file was indeed the problem.

Seems obvious in retrospect -- php.ini was trying to load Mandrake's old 
dynamic modules that are already static in my new PHP Module, so all sorts 
of duplicate functions and incompatible modules show up.

THANKS!!!

 It may be wrong, but it seems you have modules loaded in php.ini.
 Are there extension=php_pgsql.so, etc, in your php.ini?
 
 --
 Yasuo Ohgaki
 
 Richard Lynch wrote:
 
 Trying to compile 4.0.6 from source on Mandrake 8.0 using:
 
 ./configure \
 --with-apxs=/usr/local/apache/bin/apxs \
 --disable-debug \
 --disable-debugger \
 --enable-pic \
 --enable-inline-optimization \
 --prefix=/usr \
 --with-zlib \
 --with-config-file-path=/etc \
 --enable-magic-quotes \
 --enable-track-vars \
 --with-versioning \
 --enable-sysvsem \
 --enable-sysvshm \
 --enable-ftp \
 --with-xml \
 --with-gettext \
 --with-jpeg-dir=/usr/src/jpeg-6b \
 --with-png-dir=/usr/src/libpng-1.2.0 \
 --with-gd \
 --with-freetype-dir=/usr/src/freetype
 
 Can anybody translate these into English or suggest a course of
 action...? -- /usr/local/apache/logs/error_log
 ---
 PHP Warning:  Function registration failed - duplicate name - imagearc in
 Unknown on line 0 [similarly for every single imageXXX function]
 PHP Warning:  Function registration failed - duplicate name -
 mysql_tablename in Unknown on line 0 [similarly for every single
 mysql_XXX function]
 PHP Warning:  mysql:  Unable to register functions, unable to load in
 Unknown on line 0
 PHP Warning:  pgsql: Unable to initialize module
 [The following is repeated 5 times]
 Module compiled with debug=0, thread-safety=0 module API=20001214
 PHP compiled with debug=0, thread-safety=0 module API=20001222
 These options need to match
  in Unknown on line 0
 -
 
 I don't even *WANT* MySQL or PostgreSQL in the darn thing, okay?  I
 understand MySQL snuck in with the built-in stuff, but how did pgsql get
 into the picture?!
 
 I need the GD stuff though, pretty badly.
 
 Searched the -install and -general archives with no luck...
 
 
 
 
 

-- 
Like music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




  1   2   >