[PHP] fsockopen() to remote URL: what if remote URL times out?

2003-01-10 Thread Phil Powell
I have a question about the usage of fsockopen() to open and scrape the contents of 
a remote URL: if the contents take a very long time to load on the remote URL either 
due to server or coding issues, is there a way for the socket on the PHP end to time 
out, that is, quit trying to scrape contents from the remote site and post a default 
message instead?

Just wondering
Thanx
Phil



Re: [PHP] calculate the traffic size with php(like the apacheaccess_log)

2003-01-10 Thread Torsten Rosenberger
Hello again 

thank's for the fast anwser.

So I trie it now with the access_log file but
this file become very big (20 - 40 MB)

and then i get  Allowed memory size of 10485760 bytes exhausted
(i can set the size in php.ini to a higher value but ..)

is there a possibility to read a part of the file and not the hole
contend a time (like RPC or a database select)

BR/Torsten Rosenberger







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




Re: [PHP] calculate the traffic size with php(like the apache

2003-01-10 Thread Jean-Christian Imbeault
I'm not sure what you are trying to do exactly (i haven't been following 
this thread) but if you want to analyze apache web logs try analog. It 
can do everything and is *blazzingly* fast. I use on log file that are 
10 Gb or greater ...

http://www.analog.cx

Jc


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



[PHP] Re: how to passing two dimension array

2003-01-10 Thread Noel Wade
You're missing string concatenation operators.  I use echo instead of
print - but here's how it should look with either:

echo SELECT NAME=\.$vari[$i][$j].\;

Explanation:  The \ makes the double-quote appear in the final HTML, then
you have to use a plain  to end the text string.  Then you use the .
concatenation operator, followed by your variable.  To add further text, use
another . operator, then  to open up the text string, then \ for the HTML
close-quote, then the  to close the HTML tag, then  to close out the echo
or print statement.  End with a ;

Let me know if that helps!

Take care,

--Noel


Rizki Salamun [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 hi there..

 I have a problem when I want to passing two dimension varible. I made this
 variable from html form.

 like this:


 FORM method=post action=page2.php
 ?
 print SELECT name=\vari[$i][$j]\;
 ?
OPTION value=Aa
OPTION value=Bb
...
...
 /SELECT
 /FORM

 but when again I want to print the $vari[$i][$j, in the page2.php it
 seems doesnt recognize this variable.


 thanks

 -rizki-





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




[PHP] checking status of a HTML checkbox

2003-01-10 Thread Shams
Hi,

If I pass a FORM (using POST) from one php script to another, which
contains the following HTML checkbox:

INPUT type=checkbox name=insurance value=yes

I know that the input will only be passed if the checkbox is ticked... but
how do I check if the checkbox was ticked and the value has actually been
passed ?

At the moment I am doing this:

if ( $_POST[insurance] == yes )
{
}

But is there a more accurate way of checking the exsistence of insurance
?

Many Thanks,
Shams



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




Re: [PHP] checking status of a HTML checkbox

2003-01-10 Thread - Edwin
Shams [EMAIL PROTECTED] wrote: 

[snip]
 At the moment I am doing this:
 
 if ( $_POST[insurance] == yes )
 {
 }
 
 But is there a more accurate way of checking the exsistence of
 insurance?
[/snip]

I think you're looking for isset():

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

- E

__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


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




RE: [PHP] building web album - design questions

2003-01-10 Thread Daevid Vincent
Why re-invent the wheel. There are plenty of these out there...

Two I suggest are

[1] mine... http://daevid.com/photo_album.phtml

And

[2] http://www.andymack.com/freescripts/


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




Re: [PHP] Re: how to passing two dimension array

2003-01-10 Thread - Edwin
Or,

Noel Wade [EMAIL PROTECTED] wrote: 
 You're missing string concatenation operators.  I use echo instead of
 print - but here's how it should look with either:
 
 echo SELECT NAME=\.$vari[$i][$j].\;

Try this instead:

Just add curly brackets before and after the variable and don't forget the $ sign. 
So, this

  print SELECT name=\vari[$i][$j]\;

would be like this:

  print SELECT name=\{$vari[$i][$j]}\;

or this:

  echo select name=\{$vari[$i][$j]}\;

- E

...[snip]...

__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


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




[PHP] Column size, user input and htmlspecialchars

2003-01-10 Thread Jim
Hi,

No problems with my code but instead I'd like some views on the best way of
doing the following:

When I read in a text field from a users HTML form, I will allow them a
maximum of say 50 characters. So, I define the corresponding field in MySQL
to be VARCHAR(50). The problem is that after I run it through
htmlspecialchars() the size could have increased considerably, if there were
for example 5 characters that got escaped, this would mean possibly an extra
25 characters to the original meaning it would be truncated considerably.
One option is to store the input without using htmlspecialchars, and then
when I display the information wrap the output in htmlspecialchars. I don't
like this though as I've got several text fields which will be hit very
often, it seems too much of a performance penalty. The other option is to
str_replace($text, '', '') so this gets round people embedding Javascript
and other HTML but means non-malicious less-than characters would be lost,
however I would only need to use htmlspecialchars when outputting to an
input box, not just as plain text, so not so much a performance penalty as
the first option.

How do you guys go about resolving this situation?

Thanks for any input,

Jim.


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




Re: [PHP] checking status of a HTML checkbox

2003-01-10 Thread Shams
thanks a lot, thats what I was looking for

:o)

Shams

- Edwin [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Shams [EMAIL PROTECTED] wrote:

 [snip]
  At the moment I am doing this:
 
  if ( $_POST[insurance] == yes )
  {
  }
 
  But is there a more accurate way of checking the exsistence of
  insurance?
 [/snip]

 I think you're looking for isset():

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

 - E

 __
 Do You Yahoo!?
 Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/




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




[PHP] Re: undefined variable notice - how to furn of

2003-01-10 Thread Philippe Saladin
Everything works fine, just now I'm getting Notice messages for every
undefined variable or undefined index in arrays..
So now I have to use issset() everytime to avoid this messages...

you would initialize your variables in the beginning of your scripts. With
that, you don't need isset().

..is there any way to turn this messages off, because if prior versions I
never got them..??

ok, the other guys have answered with error_reporting(E_ALL ~E_NOTICE) or
error_reporting(E_NONE).
But don't you think it would be a best practice to set error reporting to
E_ALL and initialize your variables ? your script would work, regardless of
the configuration of php.ini, and would be more portable.
error_reporting(E_ALL) and register_globals = off are IMHO a good way to
have better code.
In fact, I use error_reporting(E_ALL) on my test server, and
error_reporting(E_NONE) (or a file log) on the production one.
Best regards,
Philippe



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




[PHP] how can I use an external 'template' file and still use PHP variables?

2003-01-10 Thread Daevid Vincent
I've posted this a few weeks ago with no response. I want to use an
external
email template as it were, so that the sales guys can edit it as they
like and simply shuffle the variables around that they need
$username and $password (either with or without the ?php ? tags).

I don't want them mucking around in my code and potentially screwing it
up. Not to mention having a huge 'email' text in between those
HTMLMESSAGE markers is ugly as hell and ends up making the color-coding
in HomeSite all kinds of whack at the end of it.

I tried to use:

$message = HTMLMESSAGE
  include(/pathto/customer_email.php);
HTMLMESSAGE;

But $message has the literal string
''include(/pathto/customer_email.php);'' instead of including the
file. Grr.. (wouldn't it make sense that an include() should be parsed
FIRST with the contents put in place basically? This seems like a 'bug'
not a feature.

I also tried:

$filename = /pathto/customer_email.php;
$fd = fopen ($filename, r);
$message = fread ($fd, filesize ($filename));
fclose ($fd);

But all the $username, etc. are treated as literals and if I use
?=$username? in the customer_email.php the field is blank (like it's
being parsed but doesn't have a value for it or something), instead of
being converted to their actual PHP values. I also tried to put the
global keyword in the customer_email.php file at the top.

Ideally I would like to set things up so we have varoius form letter
emails and I can switch them around based upon say a special order
code, where the $user/$pw is always the same (depending on the database
user of course), but the email content is different formats.

Is there no way to accomplish this? Am I not being clear on what it is
I'm trying to accomplish?

My final thought is to use some regex to search for ?=$username? in
$message after it's all been read in, and replace it with the variable
$username or make up my own tag codes like [!username!] or something
like that. This seems like such a hack, when PHP should be able to do
this natively somehow.

Surely somebody out there has had to do this type of thing?




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




Re: [PHP] Column size, user input and htmlspecialchars

2003-01-10 Thread - Edwin
Hello,

Jim [EMAIL PROTECTED] wrote: 

...[snip]...

 How do you guys go about resolving this situation?

Well, first, increase the size of your field, say VARCHAR(100) then in your form, use 
maxlength like this:

  input type=text name=mytext size=50 maxlength=50 /

That would prevent them from entering more that 50 characters. (At least, that's how 
it should work.) But, just to make sure, count the characters entered using strlen() 
or something before you use htmlspecialchars()...

- E

__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


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




Re: [PHP] how can I use an external 'template' file and still use PHP variables?

2003-01-10 Thread Benjamin Niemann
I think this should make it:

ob_start();
include(/pathto/customer_email.php);
$message = ob_get_contents();
ob_end_clean();

- Original Message -
From: Daevid Vincent [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 10, 2003 10:48 AM
Subject: [PHP] how can I use an external 'template' file and still use PHP
variables?


 I've posted this a few weeks ago with no response. I want to use an
 external
 email template as it were, so that the sales guys can edit it as they
 like and simply shuffle the variables around that they need
 $username and $password (either with or without the ?php ? tags).

 I don't want them mucking around in my code and potentially screwing it
 up. Not to mention having a huge 'email' text in between those
 HTMLMESSAGE markers is ugly as hell and ends up making the color-coding
 in HomeSite all kinds of whack at the end of it.

 I tried to use:

 $message = HTMLMESSAGE
   include(/pathto/customer_email.php);
 HTMLMESSAGE;

 But $message has the literal string
 ''include(/pathto/customer_email.php);'' instead of including the
 file. Grr.. (wouldn't it make sense that an include() should be parsed
 FIRST with the contents put in place basically? This seems like a 'bug'
 not a feature.

 I also tried:

 $filename = /pathto/customer_email.php;
 $fd = fopen ($filename, r);
 $message = fread ($fd, filesize ($filename));
 fclose ($fd);

 But all the $username, etc. are treated as literals and if I use
 ?=$username? in the customer_email.php the field is blank (like it's
 being parsed but doesn't have a value for it or something), instead of
 being converted to their actual PHP values. I also tried to put the
 global keyword in the customer_email.php file at the top.

 Ideally I would like to set things up so we have varoius form letter
 emails and I can switch them around based upon say a special order
 code, where the $user/$pw is always the same (depending on the database
 user of course), but the email content is different formats.

 Is there no way to accomplish this? Am I not being clear on what it is
 I'm trying to accomplish?

 My final thought is to use some regex to search for ?=$username? in
 $message after it's all been read in, and replace it with the variable
 $username or make up my own tag codes like [!username!] or something
 like that. This seems like such a hack, when PHP should be able to do
 this natively somehow.

 Surely somebody out there has had to do this type of thing?




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




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




[PHP] version switch problem

2003-01-10 Thread Christian Stalberg
redhat linux 7.3
apache 1.3.27
mysql 3.23.49
php 4.0.4pl1 (static install)
mod_ssl-2.8.12

the box had php 4.2.3 installed on it originally.
we had a mysql application that would only run
with php version 4.0.4pl1 so we installed that
version of php and everything worked.

later we ran autorpm with the 'interactive' setting
(just downloading and not auto installing) and the 
php-dependent application broke. when we run 
debug_phpinfo it says version 4.2.3. we have 
reinstalled php version 4.0.4pl1 and 
debug_phpinfo still says version 4.2.3 and the app. 
remains broken. yes we copied the php.ini file 
after the reinstall of the old version

we checked the new php binary and its definitely
version 4.0.4pl1. we're pulling our hair out.
what are we doing wrong/do we have yet to do?

thanks!

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




Re: [PHP] how can I use an external 'template' file and still use PHP variables?

2003-01-10 Thread - Edwin
Daevid Vincent [EMAIL PROTECTED] wrote: 
 I've posted this a few weeks ago with no response. I want to use an
 external
 email template as it were, so that the sales guys can edit it as they
 like and simply shuffle the variables around that they need
 $username and $password (either with or without the ?php ? tags).
 
 I don't want them mucking around in my code and potentially screwing it
 up. Not to mention having a huge 'email' text in between those
 HTMLMESSAGE markers is ugly as hell and ends up making the color-coding
 in HomeSite all kinds of whack at the end of it.
 
 I tried to use:
 
 $message = HTMLMESSAGE
   include(/pathto/customer_email.php);
 HTMLMESSAGE;
 
 But $message has the literal string
 ''include(/pathto/customer_email.php);'' instead of including the
 file. Grr.. (wouldn't it make sense that an include() should be parsed
 FIRST with the contents put in place basically? This seems like a 'bug'
 not a feature.

Well, include() will parse the file--maybe you're just doing it the wrong way... ;)

I'm not sure how your customer_email.php looks like but consider this:

  ?php

$name = General PHP;

include inc.php;

echo $message;

  ?

Then in inc.php you have:

  ?php

$message = $name, how are you doing?;

  ?

Running the first script should echo:

  General PHP, how are you doing?

So, as you can see the $name was replaced.

Just a simple example...

- E

...[snip]...

__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


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




[PHP] Re: version switch problem

2003-01-10 Thread Jean-Christian Imbeault
You high jacked someone else's thread, probably because you hit the 
reply-to button and just changed the subject line instead of posting a 
new message.

Try posting again, creating a new message this time. You'll start your 
own thread and will definitely get more answers ...

Jc

Christian Stalberg wrote:
redhat linux 7.3
apache 1.3.27
mysql 3.23.49
php 4.0.4pl1 (static install)
mod_ssl-2.8.12

the box had php 4.2.3 installed on it originally.
we had a mysql application that would only run
with php version 4.0.4pl1 so we installed that
version of php and everything worked.

later we ran autorpm with the 'interactive' setting
(just downloading and not auto installing) and the 
php-dependent application broke. when we run 
debug_phpinfo it says version 4.2.3. we have 
reinstalled php version 4.0.4pl1 and 
debug_phpinfo still says version 4.2.3 and the app. 
remains broken. yes we copied the php.ini file 
after the reinstall of the old version

we checked the new php binary and its definitely
version 4.0.4pl1. we're pulling our hair out.
what are we doing wrong/do we have yet to do?

thanks!


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




[PHP] Too many open files

2003-01-10 Thread Macrosoft
Can anybody explain me what does mean error:

Warning: main(footer.inc.php) [function.main.html]: failed to
create stream:
Too many open files in /www/sql/main.php on line 96

(phpPgAdmin 2.4.2 scripts, PHP 4.3.0 + Apache)

Does PHP exceed any limit of opened files? How can I change the limit?

Krzysztof Czuma
[EMAIL PROTECTED]



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




Re: [PHP] Too many open files

2003-01-10 Thread Rus Foster
On Wed, 8 Jan 2003, Macrosoft wrote:

 Can anybody explain me what does mean error:

 Warning: main(footer.inc.php) [function.main.html]: failed to
 create stream:
 Too many open files in /www/sql/main.php on line 96

 (phpPgAdmin 2.4.2 scripts, PHP 4.3.0 + Apache)

 Does PHP exceed any limit of opened files? How can I change the limit?

 Krzysztof Czuma
 [EMAIL PROTECTED]



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

That looks more like a operating system limit. Can you check the SYSLOG on
the host at all?

Rgds

Rus
--
http://www.fsck.me.uk - My blog
http://www.65535.net - $120 for a lifetime UNIX shell account


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




RE: [PHP] how to make server response to emails

2003-01-10 Thread See kok Boon
Thanks Michael!!

This process is something really new to me and sounds like there is much to
learn abt. Thanks for the guide.

Can I also request that you send the perl equivalent script that you have
written to me to [EMAIL PROTECTED] please? Thank you very, very
much =)


kokboon

-Original Message-
From: Michael Sims [mailto:[EMAIL PROTECTED]] 
Sent: 09 January 2003 11:49
To: [EMAIL PROTECTED]
Cc: See kok Boon
Subject: Re: [PHP] how to make server response to emails

On Thu, 9 Jan 2003 17:33:02 +0800, you wrote:

I believe
that there is a way to make the mail server, or which ever it is, to
response specifically to text within the mail.
[...]
However, I have no idea how this is accomplished and what this system is
called, so I need some precious help here. Anyone please?

99% of the time scripts such as this operate in the following manner.
Lets say the script responds to emails sent to [EMAIL PROTECTED]  The
server which handles mail for example.com has an alias for the address
foo which actually points to an external script.  Most MTA's will
allow you to do this (yes, even some for Windows, believe it or not).
For example, in sendmail you could place a line in /etc/aliases or
/etc/mail/aliases (depending on your installation) like the following:

foo:  |/usr/local/bin/myscript.php -s

This would cause sendmail to send the text of any email sent to foo
to myscript.php's stdin via a pipe.  (Be aware that some sites with
sendmail use the sendmail restricted shell, so there are some extra
steps involved in getting an alias like the above to work, which I
won't go into here).

myscript.php would need to be a PHP CLI script, meaning that it's
chmod'ed executable and has:

#!/usr/local/bin/php

at the top or something similar.  Then this script would have to read
from stdin and parse the text it receives via regexes or some other
method to determine how to handle it.  The script would receive the
full message, including all headers.

In PHP you can read from stdin by opening a filehandle to it:

$stdin = fopen('php://stdin', 'r');

Although in PHP 4.3.0 there are CLI specific constants defined which
obseletes the above.  For more info:

http://www.php.net/manual/en/features.commandline.php

I've implementing a script like this before, but unfortunately it's
written in Perl.  Many of the concepts are similar, though, so if you
know any Perl at all and think it may help you I can send it to you
off-list.

HTH...



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




[PHP] Re: how can I use an external 'template' file and still use PHP variables?

2003-01-10 Thread Noel Wade
I agree with Edwin on this one.

What's the  for??

Could it be you want to be doing this:

$templatestring = include(/pathto/email_template.php);

$message = HTMLMESSAGE.$templatestring.HTMLMESSAGE;

??

When you include() a file with PHP, it DOES parse the included file
(although in the included file, anything not between ?php and ? tags
will be considered plain text.  Put another way: Even though the include
statement in the main document is ALREADY between PHP tags, the parser looks
for an opening PHP tag in the included file to find where to begin parsing -
anything before that opening tag is echo'ed out as plain text).

Hope this helps!

Take care,

--Noel


---
Daevid Vincent [EMAIL PROTECTED] wrote in message
006801c2b88d$69748a60$0801a8c0@telecom">news:006801c2b88d$69748a60$0801a8c0@telecom...
 I've posted this a few weeks ago with no response. I want to use an
 external

 $message = HTMLMESSAGE
   include(/pathto/customer_email.php);
 HTMLMESSAGE;





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




[PHP] gd library

2003-01-10 Thread Jorge Miguel Fonseca Martins
Title: Mensagem



I have just 
installed php 4.3.0what do I have to do now to get the gd library to 
work?

thanks






  
  


  


  
Jorge Martins
J[EMAIL PROTECTED]Engenheiro 
de InformáticaEngineering Department Tel: +351 22 3744827 
  WeMake - Tecnologias de Informação, 
Ldahttp://www.WeMake.pt/Rua 
Pinto de Aguiar, 223 2º ESQ 4400-252 V.N. GAIA - PortugalFax: +351 22 
3744831
  
Este E-mail contém informação 
  dirigida e para uso exclusivo das pessoas acima enunciadas. O seu conteúdo 
  é confidencial e é expressamente proibida qualquer utilização não 
  autorizada. Se recebeu este mail por engano, por favor notifique o seu 
  remetente imediatamente. Muito obrigado.The information contained 
  in this E-mail is intended for the exclusive use of the individual named 
  above. The contents may be confidential and any unauthorized use of 
  whatever kind is strictly prohibited. If you have received this 
  comunication in error, please notify de sender immediately. Thank you. 
  



RE: [PHP] Re: fletcher's checksum

2003-01-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Dave Gervais [mailto:[EMAIL PROTECTED]]
 Sent: 09 January 2003 21:36
 
 Here is the C code. There is a decode function, but I don't 
 need it in 
 PHP because I have a C program listening to serial port on 
 the other end 
 that will validate the checksum.
 
 
 /*
 * operator fletcher_encode
 */
 fletcher_encode( buffer, count )
 unsigned char* buffer;
 long count;
 {
   int i;
   unsigned char c0 = 0;
   unsigned char c1 = 0;
   * ( buffer + count - 1 ) = 0;
   * ( buffer + count - 2 ) = 0;
   for( i = 0; i  count; i++)
   {
  c0 = c0 + * ( buffer + i );
  c1 =c1 +c0;
   }
   * ( buffer + count - 2 ) = c0 - c1;
   * ( buffer + count - 1 ) = c1 - 2*c0;
 }
 
 
 My problem with PHP was with the unsigned char.

Well, as I guess that would effectively be an integer in the range 0-255, I'd just 
treat it as an integer and reduce it modulo 256 in places where it might overflow that 
value.

Exactly how this translates into your PHP code depends on how you're translating the 
rest of the routine, and especially what you turn buffer into, but the loop might go 
something like:

   for ($i=0; $i$count; $i++):
  $c0 = ($c0+$buffer[i])%256;
  $c1 = ($c1+$c0)%256;
   endfor;

You could also do the modulo 256 reduction by doing a bitwise and with 0xff (or 0377, 
or 255), of course -- this is likely to be more efficient, and may, depending on your 
point of view, be more obvious as to what's going on.  Then your loop might look like 
this:

   for ($i=0; $i$count; $i++):
  $c0 = ($c0+$buffer[i])0xff;
  $c1 = ($c1+$c0)0xff;
   endfor;

Hope this is helpful and sets you off on the right track.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




Re: [PHP] fsockopen() to remote URL: what if remote URL times out?

2003-01-10 Thread Maxim Maletsky

Phil Powell [EMAIL PROTECTED] wrote... :

 I have a question about the usage of fsockopen() to open and scrape the contents 
of a remote URL: if the contents take a very long time to load on the remote URL 
either due to server or coding issues, is there a way for the socket on the PHP end 
to time out, that is, quit trying to scrape contents from the remote site and post 
a default message instead?


Yes, it is the last parameter of the fsockopen() function. Normally, it
will be set to something like 30 seconds, you might adjust it to
whatever you like. After that time you will get error 110 which means
Connection timed out. Additionally, if you set anything over 30
seconds, you might also consider altering the execution time limit for
the php script itself.



--
Maxim Maletsky
[EMAIL PROTECTED]



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




Re: [PHP] Is this possible with php?

2003-01-10 Thread Maxim Maletsky

[EMAIL PROTECTED] wrote... :

 I would like to know if the follwing function can be implemneted
 in php with help of other tools:

in PHP distribution? PHP is the programming language, not a
client/server tool. This is definitely something to be an integrated
part of something else.

 using MS Word in windows, 

MS Word for editing PHP files? That is very, very bad ... You will never
find a job if ever mention it to an employer. Search the archives of
this list for PHP Editors. I recommend Edit Plus for plain-text
programming. If you want a whole IDE then Zend Studio is probably the
best for you.

 when a file is saved, can it be AUTOMATICALLY
 uploaded (via http POST or other mechanism) to a server?

 Currently I need to first save it on my desktop, then upload that copy
 to a php-supported server.

Oh well, there are four ways to accomplish this.


1. Professional way:

Using CVS. CVS (cvshome.org) is a system that allows you to version your
files. This, in two words, works this way: in CVS, you `checkout'
(update) a file, edit it, and save it (if somebody else edited that file
while you edited yours both changes will merge). CVS is the most
professional solution for this thing.


2. Simplest way:

Use a mapped networking like Samba. This will mean that you will see
your server just as it was a hard disk on your windows. You dragdrop
files there and the same will occur remotely. Not a very secure way,
though.


3. FTP integrated tool:

Get a good editor that has some FTP integration. It will means that when
you `save' a file in your editor, it will automatically FTP that file on
the server. A very tool-dependent way but can work. Very cruel when
something goes wrong, though. Again, Zend IDE and Edit Plus can do that.


4. The Geeky way:

Edit all your files in a simple VIM or other fancy directly on the
server by logging there with telnet or SSH.


Have fun.


--
Maxim Maletsky
[EMAIL PROTECTED]


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




Re: [PHP] Converting Excel Spreadsheet to MySQL table ...

2003-01-10 Thread Maxim Maletsky

Excel on its own is a compiled document. However, I think there was some
way to do that. I remember I had to do it for MS Aceess files (Access -
mySQL) and i used a tool made by a brasilian guy, (someone remind me the
name). I have the feeling that this is accomplisheable. Not sure if
directly on Linux box...


--
Maxim Maletsky
[EMAIL PROTECTED]



Adam Ferguson [EMAIL PROTECTED] wrote... :

 Hello ...
 
 I was wondering if anyone had a good resource or code sample for opening ( or 
accessing ) an excel spreadsheet using php.  I need to be able to convert a 
spreadsheet of products and info to a table of products in a mysql database.  Also 
... I need to be able to perform this on a Linux machine.  Any help would be great.
 
 Thanks guys!
 Adam Ferguson


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




Re: [PHP] searching for string inside document

2003-01-10 Thread Maxim Maletsky

Martin Hudec [EMAIL PROTECTED] wrote... :

 Hello,
 
 i have document in html and i want to get out string between title
 tags to put it into another variable..
 
 i am wondering if i could use eregi() herebut how? I cant figure
 out any possible way... same with strchr() and strstr()

all these functions can work. Though, you will need to get the
document's contents into a variable of your script so you can perform a
preg_match()/ereg()/strstr() on that string variable. I believe this is
what you missed out.

--
Maxim Maletsky
[EMAIL PROTECTED]



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




Re: [PHP] Auto Include a Function

2003-01-10 Thread Justin French
Hi,

I haven't seen anything like that implemented yet.  I have my functions
logically grouped/organised into files... I only include the file when
needed.  Some files (like my string functions and DB functions) are
auto-prepend (a php.ini directive) auto-included into every script, which
does save me some time.

However, it occurs to me that there COULD be a way to implement what you
want... whether it's worth the grief or not is a different discussion
altogether :)


For starters, you can check whether a function has been defined using
function_exists().  If it doesn't exist, you could then include() it,
assuming that you have one function per file, and each file named the same
as the function, or with decent naming conventions.

There are two functions which can call your user defined function

call_user_func_array() (use an array to pass multiple arguments) or
call_user_func() aparently for single arguments.

I haven't used either of these.


In psuedo code, here's what i'm thinking:

?
function theWrapper($targetFunction,$args)
{
if(!function_exists($targetFunction))
{
$file = functions_lib/{$targetFunction}.func;
if(file_exists($file))
{ include($file); }
}

$result = call_user_func_array($targetFunction,$args);
return $result;
}
?

so, let's say I have a function called foo, saved as a file foo.func in the
/functions_lib/ directory

?
function foo($animal,$name,$color)
{
return I have a {$animal} named {$name}, and it is {$color};
}
?

I could the call foo() thru theWrapper()

?
$args = array('cat','muffins','black');
echo theWrapper('foo',$args);
?


*Totally* untested code, but in theory this should echo

I have a cat named muffins, and it is black


Now, this still needs a LOT of work.  theWrapper() needs lots of error
handling code... i haven't allowed for missing functions/files, missing
arguments, or anything else... I guess this was more of a proof of
concept...  perhaps something to get you started?  Or perhaps something to
make you say nah, too difficult :)


Justin



on 10/01/03 9:15 AM, Brian T. Allen ([EMAIL PROTECTED]) wrote:

 Hi,
 
 This may exist, but I haven't been able to find it, and I think it would
 be REALLY helpful and convenient.
 
 The idea is this:
 
 When you write a script and call a function:
 
 ?php
 
 $whatever = previously_uncalled_function(one,two);
 
 ?
 
 PHP would automatically look for a file named
 previously_uncalled_function in your /include/functions/ directory.
 
 This would eliminate a LOT of include() and require() calls (or at least
 make them automatic) in a script.  The function would only get read in
 if it was used.
 
 This would be very convenient.  When you create a new function you drop
 it in that directory (with a very specific, unique name, of course), and
 it can immediately be called anywhere in the site.  And, you only incur
 the disk IO to read it when its used for the first time in a script.
 
 The 3 things I want to avoid are:
 
 1)  Explicitly including every function, every time it's needed.
 2)  Disk IO of including a function when it's not needed.
 3)  Taking the easy route and including a file with a bunch of functions
 when most won't get called.
 
 Does this already exist, or is this a good idea (if not, any reasons
 why)?  I personally would love to see it implemented if it isn't
 already.
 
 Thanks,
 Brian Allen
 [EMAIL PROTECTED]
 


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




Re: [PHP] something annoying about includes/relative paths.

2003-01-10 Thread Maxim Maletsky

Sean Malloy [EMAIL PROTECTED] wrote... :

 Moving to PHP from an ASP backgroun, I always found one thing really
 annoying about PHP.
 
 With ASP, you could have a file structure such as:
 
 SYSTEM
 |--HTML
 |  |--header.asp
 |
 |--LOGIC
 |  |--engine.asp
 |
 |--core.asp
 
 in default.asp, you would
 !--#include file=system/core.asp--
 in core.asp, engine.asp would be included as such
 !--#include file=LOGIC/engine.asp--
 in engine.asp, header.asp would be included as such
 !--#include file=../HTML/header.asp--
 
 
 Its a bad example. However, it demonstrates that the relative path for each
 include changed depending on what file was being included.
 
 PHP doesn't do that. Which is kind of annoying, but you get used to it.. But
 I've come up with a work around.

Wrong. PHP doesn't care that much about these paths themselves, both ASP
and PHP need the path to give it to the filesystem and to retrieve the
file pointer. Which means, on the same system both PHP and ASP would
behave the same way to get the same files from the same locations.

Difference stays in the fact that you can also configure it in the
php.ini file. For instance, if you add '.' in php.ini then every file
request will be relative to your current location (check it, it might
not be set for you - include_path directive). 

 htdocs/index.php
 include('./system/core.php');

dot `.' is the current directory *relative* to the current directory -
makes not much sense in many cases.

 htdocs/system/core.php
 define('CORE_PATH', str_replace('core.php', '', __FILE__));

a cute way to accomplish the above is:
define('CORE_PATH', dirname(__FILE__) . '/');

 include(CORE_PATH.'logic/engine.php');
 
 htdocs/system/logic/engine.php
 include(CORE_PATH.'html/header.php');
 
 and so on and so forth. searching for __FILE__, and removing the filename
 from the output, gives you a sort of relative path hack.
 
 Hope someone finds that useful


--
Maxim Maletsky
[EMAIL PROTECTED]

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




Re: [PHP] Converting Excel Spreadsheet to MySQL table ...

2003-01-10 Thread rblack

If this is a one off excercise, ie you only have to do it once and
afterwards things will be dealt with ENTIRELY through the MySQL database,
you could save the spreadsheet as a CSV file and work with that.

HTH,

Richy

==
Richard Black
Senior Developer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 951 3481
Email: [EMAIL PROTECTED]


   

Maxim Maletsky 

[EMAIL PROTECTED]   To: Adam Ferguson 
[EMAIL PROTECTED]   
cc: [EMAIL PROTECTED]   

 Subject: Re: [PHP] Converting Excel 
Spreadsheet to MySQL table ...
10/01/2003 

11:40  

Please respond 

to maxim   

   

   






Excel on its own is a compiled document. However, I think there was some
way to do that. I remember I had to do it for MS Aceess files (Access -
mySQL) and i used a tool made by a brasilian guy, (someone remind me the
name). I have the feeling that this is accomplisheable. Not sure if
directly on Linux box...


--
Maxim Maletsky
[EMAIL PROTECTED]



Adam Ferguson [EMAIL PROTECTED] wrote... :

 Hello ...

 I was wondering if anyone had a good resource or code sample for opening
( or accessing ) an excel spreadsheet using php.  I need to be able to
convert a spreadsheet of products and info to a table of products in a
mysql database.  Also ... I need to be able to perform this on a Linux
machine.  Any help would be great.

 Thanks guys!
 Adam Ferguson


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



This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com






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




Re: [PHP] Databases vs. File Access

2003-01-10 Thread Justin French
Totally depends on the data in question.

I tend to organise my data in a mySQL database, for easy queries, sorting,
categorisation, etc etc.  However sometimes I associate a file to a record
(eg a photo of a member or employee)... so the employee with the id 45 will
have a photo stored in the filesystem called 45.jpg.

I tend to keep raw-text-based data in a database, and binary or heavily
formatted data (mp3s, giffs, JPEGs, PNGs, .doc's, .xls's) in the file
system, attached to the database records.

I've read that you get faster queries by separating bulky data from the
simple stuff... this separation can be done with files, or with relational
db tables...

I guess it depends a lot on what sort of data, how you will use it, and
which your prefer (file/db).

One other bit of advice i've read: if you do have LOTS of files in a
filesystem (1000's, not 100's), it's best to break them up somehow... by
alphabet (a/, b/, c/, etc), year (2002/, 2003/, 2004/, etc), category
(entrés/, mains/, soups/, deserts/, etc), etc.


on 09/01/03 4:04 PM, Erich Kolb ([EMAIL PROTECTED]) wrote:

 I am going to be dealing with a ton of data shortly and my goal is to make
 it accessible via the web.  I am curious about the performance differences
 between using a database or leaving the data in the individual files they
 originated in.  Can anyone offer any recommendations?


Justin French


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




[PHP] Mysql/php database performance question

2003-01-10 Thread Simon Dedeyne

Hi,

I got a question about using Mysql databases.
I load textdata in VARCHAR colums up to size 50. I have about 5 of those
columns. 
The last columns often contain empty cells. (data are wordmeanings, many
words have only a 1 or 2meanings)

What would be faster/better:
- putting everything in a big varchar column (size 5x50) and PHP parsing
them by comma after
  fetching 

 or 

- keeping those 5 columns with a lot of empty cells in the last columns?

Thanks,
Simon


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




Re: [PHP] Informing a User of an Illegal Character in a post

2003-01-10 Thread Justin French
Basically, you want to do a regular expression to see what characters are in
the username, and make none of them are illegal...

I currently have the rules of

5-30 characters
lowercase, numbers 0-9 and underscore (_) only

I achieve this with:

?
if((!preg_match(/^[a-z0-9_]*$/, $username)) OR (strlen($username)  5) OR
(strlen($username)  30) ) {
echo username invalid -- must contain only blah blah blah;
}

You could extend preg_match(/^[a-z0-9_]*$/, $username) to match more or
less characters to suit your needs, but I'm no expert.

[a-zA-Z0-9_-] would also include a dash (-) and uppercase chars


Best advice I can give you is rather than worrying about which chars might
do damage, think the other way, and only allow characters you trust.


Justin


on 10/01/03 1:46 AM, Vernon ([EMAIL PROTECTED]) wrote:

 I'm having trouble when a user post a message to a MySQL database where if a
 user create a user name like 'useruser' as the  symbol is used in URLs.
 Does anyone have any idea how I can inform user that they have entered and
 illegal character and are there are illegal characters that I should let
 them use other than '' and '?'



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




Re: [PHP] Is this possible with php?

2003-01-10 Thread Justin French
on 10/01/03 6:14 PM, Tom Rogers ([EMAIL PROTECTED]) wrote:

 I use webdrive which allows me to map an ftp site to a windows drive letter so
 it gets treated as a local drive . very usefull.
 You can read about it here http://www.webdrive.com/

Does anyone know of a mac (OS8/9 NOT OSX) application that does a simular
thing?

Justin


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




RE: [PHP] HEEELP...please

2003-01-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 10 January 2003 01:00
 
 All of a sudden, I get the message:
 Warning: Failed opening '/../lib/somefile.conf' for inclusion 
 (include_path='.:/usr/local/lib/php') in 
 /usr/local/www/html/index.php on 
 line 6
 
 I can find nothing in the httpd.conf files that could account 
 for this; 
 there is no configuration in them for include_path.

Have you also checked in php.ini? -- that would seem to be a more likely
place!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




[PHP] Re: About php4-imap package

2003-01-10 Thread Guille -bisho-
Hello!

I don't know if there is a bug on php4-imap debian package, but I could
not connect to to my IMAP server. (With mutt it works).

PHP says:
Couldn't open stream {localhost:143/notls}INBOX

I have tried everything. Add/remove the /notls to the port, imap2, imap3,
imaps, dpkg-reconfigure libc-client2002 and allow/disallow encryted
connections, etc...

I suspect that is a problem with TLS, that is not supported by PHP, but
I don't know how to solve it.

The imap server is the uw-imapd:
ii  uw-imapd  2002a.dev.snap.021205 remote mail folder...
ii  uw-imapd-ssl  2002a.dev.snap.021205 Dummy upgrade package...

PHP version is 4.2.3-9, and I have tried both remotely and localy, from
apache php server and using php4-cgi as shell to test only the
imap_open sentence.

Thanks in advance

-- 
.,,, Guillermo Pérez-=] 10/01/2003 [=-
  _' .- bisho@ ( onirica.com | eurielec.etsit.upm.es )
 ·)/ ,''
  ( \/::   Por Galicia: ¡Nunca máis!  ::
bisho! ``\\


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




Re: [PHP] Is this possible with php?

2003-01-10 Thread Danny Shepherd
Hi,

Where did he say he wanted to use Word to edit PHP files? AFAICT the idea
was to automatically upload Word files, presumably to make them available on
an Intranet for download etc.

As for uploading a file automatically - PHP isn't going to do it. An app
which can map a virtual drive in Windows would probably be the best bet - I
think Windows has built in support for mapping WebDAV and FTP servers as
shares so this may be a good starting point.

HTH

Danny.

- Original Message -
From: Maxim Maletsky [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, January 10, 2003 11:38 AM
Subject: Re: [PHP] Is this possible with php?



 [EMAIL PROTECTED] wrote... :

  I would like to know if the follwing function can be implemneted
  in php with help of other tools:

 in PHP distribution? PHP is the programming language, not a
 client/server tool. This is definitely something to be an integrated
 part of something else.

  using MS Word in windows,

 MS Word for editing PHP files? That is very, very bad ... You will never
 find a job if ever mention it to an employer. Search the archives of
 this list for PHP Editors. I recommend Edit Plus for plain-text
 programming. If you want a whole IDE then Zend Studio is probably the
 best for you.

  when a file is saved, can it be AUTOMATICALLY
  uploaded (via http POST or other mechanism) to a server?
 
  Currently I need to first save it on my desktop, then upload that copy
  to a php-supported server.

 Oh well, there are four ways to accomplish this.


 1. Professional way:

 Using CVS. CVS (cvshome.org) is a system that allows you to version your
 files. This, in two words, works this way: in CVS, you `checkout'
 (update) a file, edit it, and save it (if somebody else edited that file
 while you edited yours both changes will merge). CVS is the most
 professional solution for this thing.


 2. Simplest way:

 Use a mapped networking like Samba. This will mean that you will see
 your server just as it was a hard disk on your windows. You dragdrop
 files there and the same will occur remotely. Not a very secure way,
 though.


 3. FTP integrated tool:

 Get a good editor that has some FTP integration. It will means that when
 you `save' a file in your editor, it will automatically FTP that file on
 the server. A very tool-dependent way but can work. Very cruel when
 something goes wrong, though. Again, Zend IDE and Edit Plus can do that.


 4. The Geeky way:

 Edit all your files in a simple VIM or other fancy directly on the
 server by logging there with telnet or SSH.


 Have fun.


 --
 Maxim Maletsky
 [EMAIL PROTECTED]


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



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




RE: [PHP] Re: How can I redirect to another php page

2003-01-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Jason Sheets [mailto:[EMAIL PROTECTED]]
 Sent: 10 January 2003 02:25
 
 You should always use the exit after a redirect, the browser is not
 required to go to the new location.
 
 If you do not exit your script after you redirect and the browser does
 not go to the new location you risk the unintended continued execution
 of your script.

That's good advice, but the explanation is not quite accurate.  If you do not exit 
your script after a redirect, the remainder *will* be executed and any output it 
generates sent to the browser.  However, if the browser obeys the redirect, it will 
simply ignore the output you sent, and never display it -- so you've just wasted 
bandwidth transmitting it!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




Re: [PHP] Posting data using fsockopen() causes session problem

2003-01-10 Thread Marek Kilimajer
You can make a special case - if a special cookie is present, session is 
not required. Then your client script would send the cookie.

Max Davy wrote:

Hi,

I finally figured out how to use fsockopen() to post data
when my server responded with a Document Moved error.

I knew the document was where I said it was ... After
many hours I realised that the location the document had
allegedly been moved to was the login screen that the
user would be redirected to if they did not have a valid
session id.

I removed the session handling and ... success!

This is not an acceptable solution because I need the
session to be valid.

Any help would be most appreciated.

Thanks,

Max

--

Oz Impact Multimedia
Innovate, Immerse, Inspire

www.ozimpact.com



 



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




Re: [PHP] Medium to Large PHP Application Design

2003-01-10 Thread Maxim Maletsky

Nick,

 As PHP becomes more accepted in the corporate world, it is only logical 
 that larger and more complex applications are going to be developed using 
 it.  

To start I will state this: I am one of the consultants of a project
run by 70 developers for the period of 2 years at the Ministry of the
Economy and Finance of Italy.

This is supposed to be the world's first or the second biggest project
in the (depending on whatever size Yahoo is like, Rasmus is there :) The
project is mostly in PHP/Apache/Linux and uses Oracle and PL/SQL plus a
lot of other things like Java, Ruby, C/C++, C# and even old-friend COBOL
and NatStar.  Most of the whole thing is PHP/Oracle though. There are
approximately 104 servers in all the regions of Italy and are some
5-8.000 authenticated users.

Best part of PHP was not really the price (there were money) but the
compatibility for all the technologies we needed to communicate within
the framework.  There are also parts written in other languages and PHP
handles them just well.

Normally, one chooses Java for such things as Java is supposed to be the
most dymanic and flexible language. But, personally, I don't see it that
way - I prefer PHP because of the faster development times what makes
the application's quality much higher and things much quicker to
implement.


 While there is an abundance of information out there about making 
 specific things work, there seems to be a shortage regarding the big picture.

Because of this, PHP is also cheaper - you need less time for debugging
and researching online. Bigger you go - more you appreciate things like
this mailing list and the tons and tons of online resources.

Need a check for the email format? 

in PHP   - a) Google / SourceForge / app you know has it.
in 3-5 minutes you got it.
 
in Java  - a) What Sun's CD was that? b) What class was that? c) Is it
copyrighted? d) Can it be used for free??? 

So, you end up making it on your own, even if Java makes all these
`reusable components' you still need to tripple-check the things and so
on 


 As such, my question is this: What methods and techniques can be used to 
 help design and build complex, medium to large PHP applications that are 
 not only scalable, but maintainable and extensible? 

 Obviously separating application and business logic from interface code is 
 a given, but what about other things? Are the object orientated facilities 
 of PHP currently worth really trying to take advantage of? If so, what are 
 you doing to take advantage of them? Are design concepts such as design 
 patterns relevant at this level?  What frameworks, if any, currently exist 
 to assist in rapid, structured development, and what specific benefits do 
 they bring to the table?

Everyone says OOP. But, in reality I'd say: OOP only for the things you
reuse more that once. The rest of application should be written in plain
concept of 

1. Auto-prepend
2. Prepare XML output
3. Auto-append for the layout

Which is something like, let's load a few classes every file needs. Then
simply make the file's functionality based on params received and output
some XML. The XML will then be used or laying out the page and the rest
of the process.

Everyone this way gets much a simpler framework to develop with.

The important parts of a large PHP project, in my opinion, are:

1. High and solid standardization of the framework and coding. Meaning
that everyone works in the same way and not `as he thinks is the best'.
This will give the possibility for the team to work better together and
move between the sub-projects easier. It's same in every language, so
one should really care.

2. Have at least a one or two people who maintain the commonly shared
libraries. This is, when someone says Hey, I want this code to my page
too the team answers: which code? and then takes that code, creates a
library component, document it and organizes it within the libraries.

3. All of the output for the application is better to be an intermediate
mark-up like XML. This way you can have the designers who get XML and
apply whatever templates to it. Programmers should never care how
something looks - their output is plain XML and that is it. Other
technics are good too - for instance Smarty if a good idea. But, I'd
still prefer XML and then XSLT and then caching mechanism to avoid
overload.

4. 30% (AT LEAST!!!) of thee development times should be spent for
planning.  That is - no coding just sitting with the pen and paper in
the meeting room and designing the framework till everyone agrees. After
that point everyone knows exactly what is where and things becomes very
fast.


5. team should have tools already ready AND STANDARIZED for them to do
the development. Thus, CVS is a must. No one should care what OS one
uses for development workstation, but the way it is organized on the
server should be once agreed and never changed. It is too expensive to
change even a simple .htaccess file - take one hour from 70 

Re: [PHP] Converting Excel Spreadsheet to MySQL table ...

2003-01-10 Thread David T-G
Adam, et al --

...and then Adam Ferguson said...
% 
% Hello ...

Hi!


% 
% I was wondering if anyone had a good resource or code sample for opening ( or 
accessing ) an excel spreadsheet using php.  I need to be able to convert a 
spreadsheet of products and info to a table of products in a mysql database.  Also ... 
I need to be able to perform this on a Linux machine.  Any help would be great.

I haven't used either, but xlHtml and xls2csv have been mentioned on
the mutt-users list a few times for when one receives those annoying
attachments.


% 
% Thanks guys!
% Adam Ferguson


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg92419/pgp0.pgp
Description: PGP signature


Re: [PHP] something annoying about includes/relative paths.

2003-01-10 Thread David T-G
Sean, et al --

...and then Sean Malloy said...
% 
...
% 
% Its a bad example. However, it demonstrates that the relative path for each
% include changed depending on what file was being included.
% 
% PHP doesn't do that. Which is kind of annoying, but you get used to it.. But

Not only does one get used to it, but one might have preferred it that
way in the first place :-)


% I've come up with a work around.
% 
% htdocs/index.php
% include('./system/core.php');
% 
% htdocs/system/core.php
% define('CORE_PATH', str_replace('core.php', '', __FILE__));
% include(CORE_PATH.'logic/engine.php');
% 
% htdocs/system/logic/engine.php
% include(CORE_PATH.'html/header.php');

I've come up with the following trick for files being tested in a
development environment.

In general, we have

  $ cat index.php
  ?php include(/home/sites/.php/devel/index.inc;)?

  $ cat other.php
  ?php include(/home/sites/.php/devel/other.inc;)?

where /devel might be missing (for production code) or /test (for a test
version) or anything else for some devel offshoot.  There are various
files included within index.inc, and we of course want to get the right
copies.

So in index.inc and other.inc and any other files, I have a short

  # this will let us figure out where we are and then always source the right include 
stuff!
  # it does not work with symlinks (__FILE__ reports the *target*)
  # you must have a full env tree in your devel tree; we now look exclusively in 
$DEVELDIR if set
  if ( ereg(/home/sites/\.php/,__FILE__) )# are we *somewhere* in our 
usual master tree?
{ $DEVELDIR = preg_replace(|/.*/home/sites/\.php(.*)/[^/]*$|,\\1,__FILE__) ; } 
 # get the working dir

followed by

  include(/home/sites/.php$DEVELDIR/includestuff.inc);# include our various 
files

where includestuff.inc looks like

  # config settings and functions and the like
  foreach ( array ( config.php , functions.inc ) as $incfile )
  {
foreach
( array # (this could be quite long)
  (
/home/sites/.php$DEVELDIR,# host-wide dir
$_SERVER[DOCUMENT_ROOT],  # web-site-wide dir
getcwd()# this job
  )
  as $dir   # what do we call it?
)
{
  if ( file_exists ($dir/$incfile) )  # is there a script file?
{ include ($dir/$incfile) ; } # well, include it!
}
  }

and, as you can see, gets the master config.php and functions.inc from
the proper devel tree (as well as then from the doc root and the script
dir), and any other includes down in the script point the same way like

  include (/home/sites/.php$DEVELDIR/index.table.inc);# magic auto-table code

or so.  It's hard-coded to our central directory (/home/sites/.php) but
you have to write these things down somewhere :-)


% 
...
% Hope someone finds that useful

Same here :-)


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg92420/pgp0.pgp
Description: PGP signature


[PHP] Structured types

2003-01-10 Thread ntuser
Hi,

I´m a newbie in PHP.
How can I declare a structured type in PHP like the struct statement in C ?

Thanks

amjr


Re: [PHP] Too many open files

2003-01-10 Thread Michael Sims
On Fri, 10 Jan 2003 10:38:31 + (GMT), you wrote:

On Wed, 8 Jan 2003, Macrosoft wrote:

 Can anybody explain me what does mean error:

 Warning: main(footer.inc.php) [function.main.html]: failed to
 create stream:
 Too many open files in /www/sql/main.php on line 96

 (phpPgAdmin 2.4.2 scripts, PHP 4.3.0 + Apache)

 Does PHP exceed any limit of opened files? How can I change the limit?

As someone else said, this is an OS issue, but if you're running on
Linux do a Google search for:

/proc/sys/fs/file-max

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




Re: [PHP] Structured types

2003-01-10 Thread Marek Kilimajer
use array, but remember, there is no type declaration in php.
example

$structure = array ( 'id' = 1,
   'subs' = array( 'sub1', sub2'));

ntuser wrote:


Hi,

I´m a newbie in PHP.
How can I declare a structured type in PHP like the struct statement in C ?

Thanks

amjr
 



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




Re: [PHP] Mysql/php database performance question

2003-01-10 Thread Khalid El-Kary
the thing that may make difference in performance (as i think) is whether 
you make it a fixed -CHAR- or a variable -VARCHAR- it's preferable that you 
make separate char columns, so that PHP will not have to explode every 
record!

Regards,
Khalid Al-Kary,



Hi,

I got a question about using Mysql databases.
I load textdata in VARCHAR colums up to size 50. I have about 5 of those
columns.
The last columns often contain empty cells. (data are wordmeanings, many
words have only a 1 or 2meanings)

What would be faster/better:
- putting everything in a big varchar column (size 5x50) and PHP parsing
them by comma after
  fetching

 or

- keeping those 5 columns with a lot of empty cells in the last columns?

Thanks,
Simon


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



_
The new MSN 8 is here: Try it free* for 2 months 
http://join.msn.com/?page=dept/dialup


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



[PHP] NEW MSGproblem switching versions

2003-01-10 Thread Christian Stalberg
redhat linux 7.3
apache 1.3.27
mysql 3.23.49
php 4.0.4pl1 (static install)
mod_ssl-2.8.12

the box had php 4.2.3 installed on it originally.
we had a mysql application that would only run
with php version 4.0.4pl1 so we installed the
old version of php and everything worked.

then we ran autorpm with the 'interactive' setting
(just downloading and not auto installing) and the 
application broke. when I run debug_phpinfo it
says version 4.2.3. we have reinstalled php 
version 4.0.4pl1 and debug_phpinfo still says 
version 4.2.3 and the app. remains broken. yes 
we copied the php.ini file after the install.

we checked the new php binary and its definitely
version 4.0.4pl1. we're pulling our hair out.
what are we doing wrong/do we have yet to do?

thanks!


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




RE: [PHP] Mysql/php database performance question

2003-01-10 Thread Simon Dedeyne

I see what you mean Khalid, but I only retrieve 1 entry at the time, so
exploding wouldn't be the biggest problem I suppose. 
Furthermore, if I use char columns, and some of those columns have lots
of empty cells, isn't it a waste of space/lookup-time?

So I think I have to reformulate the question: which is better 5 varchar
columns of size 50 or 1 varchar column of size 250
(regardless of parsing).

Thanks,
Simon

---
the thing that may make difference in performance (as i think) is
whether 
you make it a fixed -CHAR- or a variable -VARCHAR- it's preferable that
you 
make separate char columns, so that PHP will not have to explode every 
record!

Regards,
Khalid Al-Kary,


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




RE: [PHP] how to make server response to emails

2003-01-10 Thread See kok Boon
Thanks! But your .txt are not carriage-returned, it just runs continuosly,
very hard to read. Is that you odd programming style or can you send me
another that has enter and newline?

Sorry for the trouble... sorry..

-Original Message-
From: Michael Sims [mailto:[EMAIL PROTECTED]] 
Sent: 10 January 2003 09:30
To: See kok Boon
Subject: Re: [PHP] how to make server response to emails

On Fri, 10 Jan 2003 18:51:07 +0800, you wrote:

Thanks Michael!!

Not a problem...

Can I also request that you send the perl equivalent script that you have
written to me to [EMAIL PROTECTED] please? 

I've attached the scripts.  The main one is vagent-admin.pl, and it
includes code from common.pl.  There's tons of stuff in there that
probably won't be of any interest, but take a look at the subroutine
parsemail that inside vagent-admin.pl.  Also, my coding standards
were fairly odd when I wrote this (lots of tabs) so apologizes if it's
hard to read.  If anything doesn't make sense let me know.


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




RE: [PHP] how to make server response to emails

2003-01-10 Thread See kok Boon

-Original Message-
From: Michael Sims [mailto:[EMAIL PROTECTED]] 
Sent: 10 January 2003 09:30
To: See kok Boon
Subject: Re: [PHP] how to make server response to emails

On Fri, 10 Jan 2003 18:51:07 +0800, you wrote:

Thanks Michael!!

Not a problem...

Can I also request that you send the perl equivalent script that you have
written to me to [EMAIL PROTECTED] please? 

I've attached the scripts.  The main one is vagent-admin.pl, and it
includes code from common.pl.  There's tons of stuff in there that
probably won't be of any interest, but take a look at the subroutine
parsemail that inside vagent-admin.pl.  Also, my coding standards
were fairly odd when I wrote this (lots of tabs) so apologizes if it's
hard to read.  If anything doesn't make sense let me know.


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




RE: [PHP] how can I use an external 'template' file and still use PHP variables? [solved]

2003-01-10 Thread Daevid Vincent
Benjamin, you are my father! Dude! That worked perfectly...

In case you all didn't understand what I was trying to do, attached are
some examples... This worked thanks to Benjamin Vincent ;-)

 snip 'customer_email.php' --
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

html
head
titleUntitled/title
/head

body
CENTER
TABLE
TRTDBUsername/B/TDTDB?=$User?/B/TD/TR
TRTDBPassword/B/TDTDB?=$Password1?/B/TD/TR
TRTDBCompany
Code/B/TDTDB?=$Company?/B/TD/TR
/TABLE
/CENTER
/body
/html
 snip 'customer_email.php' --

 snip 'emailtest.php' --
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

html
head
titleEMAIL include test/title
/head

body
?php

$User = test user;
$Password1 = mypass;
$Company = mycomp;

// email us to let us know there is a new user.
$email= [EMAIL PROTECTED];
$subject  = email test;
$myname   = emailtest;
$myemail  = [EMAIL PROTECTED];
$myreplyemail = $myemail;

ob_start();
include(/www/secure.interactnetworks.com/customer_email.php);
$message = ob_get_contents();
ob_end_clean();

 $headers  = MIME-Version: 1.0\r\n;
 $headers .= Content-type: text/html; charset=iso-8859-1\r\n;
 $headers .= From: .$myname. .$myemail.\r\n;
 $headers .= To: .$email.\r\n;
 $headers .= Reply-To: .$myname. .$myreplyemail.\r\n;
 $headers .= X-Mailer: Linux Server;
 mail($email, $subject, $message, $headers);

echo $message;
?
check your email to see if this worked.
/body
/html
 snip 'emailtest.php' --

 -Original Message-
 From: Benjamin Niemann [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 10, 2003 2:02 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] how can I use an external 'template' file 
 and still use PHP variables?
 
 
 I think this should make it:
 
 ob_start();
 include(/pathto/customer_email.php);
 $message = ob_get_contents();
 ob_end_clean();
 
 - Original Message -
 From: Daevid Vincent [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, January 10, 2003 10:48 AM
 Subject: [PHP] how can I use an external 'template' file and 
 still use PHP
 variables?
 
 
  I've posted this a few weeks ago with no response. I want to use an
  external
  email template as it were, so that the sales guys can 
 edit it as they
  like and simply shuffle the variables around that they need
  $username and $password (either with or without the ?php ? tags).
 
  I don't want them mucking around in my code and potentially 
 screwing it
  up. Not to mention having a huge 'email' text in between those
  HTMLMESSAGE markers is ugly as hell and ends up making the 
 color-coding
  in HomeSite all kinds of whack at the end of it.
 
  I tried to use:
 
  $message = HTMLMESSAGE
include(/pathto/customer_email.php);
  HTMLMESSAGE;
 
  But $message has the literal string
  ''include(/pathto/customer_email.php);'' instead of including the
  file. Grr.. (wouldn't it make sense that an include() 
 should be parsed
  FIRST with the contents put in place basically? This seems 
 like a 'bug'
  not a feature.
 
  I also tried:
 
  $filename = /pathto/customer_email.php;
  $fd = fopen ($filename, r);
  $message = fread ($fd, filesize ($filename));
  fclose ($fd);
 
  But all the $username, etc. are treated as literals and if I use
  ?=$username? in the customer_email.php the field is blank 
 (like it's
  being parsed but doesn't have a value for it or something), 
 instead of
  being converted to their actual PHP values. I also tried to put the
  global keyword in the customer_email.php file at the top.
 
  Ideally I would like to set things up so we have varoius form letter
  emails and I can switch them around based upon say a special order
  code, where the $user/$pw is always the same (depending on 
 the database
  user of course), but the email content is different formats.
 
  Is there no way to accomplish this? Am I not being clear on 
 what it is
  I'm trying to accomplish?
 
  My final thought is to use some regex to search for 
 ?=$username? in
  $message after it's all been read in, and replace it with 
 the variable
  $username or make up my own tag codes like [!username!] or something
  like that. This seems like such a hack, when PHP should be 
 able to do
  this natively somehow.
 
  Surely somebody out there has had to do this type of thing?
 


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




Re: [PHP] PHP/Oracle Command line Segmentation Fault

2003-01-10 Thread Christopher Ditty
Anyone?

CDitty

 Christopher Ditty [EMAIL PROTECTED] 01/09/03 04:04PM 
I have successfully installed oracle 8.1.7 w/ php and have it
configured
to run from the command line.  When I run a simple script that
connects,
and selects records from the database, the last line is a segmentation
fault error.  This does not seem to happen when the same script is run
through the browser.  

Can anyone offer any help or advice?  The code is listed below.

CDitty

#!/usr/bin/php
?
function oci8Connect(){
 $db_conn = ocilogon(usrname,pwd, dbase);
 if (!$db_conn){
echo Helpbr;
exit ();
 }
 echo Connectedbr;
 return ($db_conn);
}

$conn = oci8Connect();

$stmt = ociparse($conn,select * from US_MSTR);
  ociexecute($stmt);

$i=0;
$row = array();

  while(OCIFetchInto($stmt, $row, OCI_ASSOC)){
# do stuff with $row...
echo $row['US_ID'] .  $ibr;
$i++;
}

ocifreestatement($stmt);
ocilogoff($conn);
?


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




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




[PHP] PHP not executing files in subdirectories

2003-01-10 Thread Jacob
Hey All.
 
The subject line pretty much says it all.
 
I have php-nuke installed in the / directory and it works
fine.
However, when I try to run the gallery or netjuke software
(also php)
They just return the source code of the file. (not exactly
what you want)
 
I am using Apache 2.0 and php 4.3 (compiled from sources) on
a redhat 8.0 box.
 
 
If needed I will include the configs, but I don't want to waste
bandwidth.



Re: [PHP] Sessions and Frames...

2003-01-10 Thread Brent Baisley
I highly doubt it. The server, and PHP, have absolutely no idea about 
frames and don't care about them, it's just handling page requests. 
Frames are a display feature in the browser and it's the browser that 
requests the various pages it needs for display. PHP is just getting a 
few page requests in quick succession and as far as I know, PHP is 
thread safe where it uses threads. Meaning it won't trip over itself.

What may be slowing things down is the number of files the browser needs 
to download, which is a minimum of 9 with 8 frames. And that doesn't 
include any image files. Most browsers limit themselves to certain 
number of connections. IE for Mac defaults to 4 max connections and can 
be set as high as 8. So with 9 files to download the browser won't even 
request the 9th file until at least one of the first 8 is completely 
downloaded. And then you have the overhead in the browser parsing all 
those files for display.

I don't know what your web page looks like, but perhaps Javascript, CSS 
and/or DHTML could reduce the number of frames being used.

On Thursday, January 9, 2003, at 01:45 PM, Dale Schell wrote:

All of the pages in these frames activate the
session, and some of them modify session variables.
Can this cause the pages to load slowly? Can a page have the session
file write locked and make other pages wait?

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


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




RE: [PHP] Mysql/php database performance question

2003-01-10 Thread Matt Schroebel
 -Original Message-
 From: Simon Dedeyne [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 10, 2003 9:03 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Mysql/php database performance question

 So I think I have to reformulate the question: which is 
 better 5 varchar columns of size 50 or 1 varchar column of size 250
 (regardless of parsing).

You ought to read the mysql manual on that.  
http://www.mysql.com/doc/en/MyISAM_table_formats.html

Where's the pain?  The trade off between char and varchar is speed vs
table size.  Are just trying to be as fast as possible?  If the db is
small, I wouldn't worry about it and do what ever way you want (i.e.
what's a microsecond or two?)  You could try both ways and profile it
several thousand times to see if it really matters.

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




Re: [PHP] Too many open files

2003-01-10 Thread Gerald Timothy Quimpo
On Friday 10 January 2003 09:27 pm, Michael Sims wrote:
  Warning: main(footer.inc.php) [function.main.html]: failed
  to create stream:
  Too many open files in /www/sql/main.php on line 96

 As someone else said, this is an OS issue, but if you're running on
 Linux do a Google search for:

 /proc/sys/fs/file-max

something else to point out.  if you are hitting this limit, it's possible
that you're doing something wrong.  what does main.php do?  how
many files does it include?  what are you trying to do in there that
could lead to opening lots of files?  e.g., do you have a loop that
opens files, does something with them, then continues the loop
(opening more files without closing the previously opened files
that you don't need anymore)?

tiger

-- 
Gerald Timothy Quimpo  tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph
Public Key: gpg --keyserver pgp.mit.edu --recv-keys 672F4C78
   Veritas liberabit vos.
   Doveryai no proveryai.

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




[PHP] PHP and DB2

2003-01-10 Thread Jack Schroeder
Can PHP connect to IMB DB2 dbms running on an AIX Unix server?

Jack


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




Re: [PHP] Re: fletcher's checksum

2003-01-10 Thread Scott Fletcher
For a moment, I thought you were referring to me when you said Fletcher
since it's my name also.  :-)

FletchSOD
Mike Ford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  -Original Message-
  From: Dave Gervais [mailto:[EMAIL PROTECTED]]
  Sent: 09 January 2003 21:36
 
  Here is the C code. There is a decode function, but I don't
  need it in
  PHP because I have a C program listening to serial port on
  the other end
  that will validate the checksum.
 
 
  /*
  * operator fletcher_encode
  */
  fletcher_encode( buffer, count )
  unsigned char* buffer;
  long count;
  {
int i;
unsigned char c0 = 0;
unsigned char c1 = 0;
* ( buffer + count - 1 ) = 0;
* ( buffer + count - 2 ) = 0;
for( i = 0; i  count; i++)
{
   c0 = c0 + * ( buffer + i );
   c1 =c1 +c0;
}
* ( buffer + count - 2 ) = c0 - c1;
* ( buffer + count - 1 ) = c1 - 2*c0;
  }
 
 
  My problem with PHP was with the unsigned char.

 Well, as I guess that would effectively be an integer in the range 0-255,
I'd just treat it as an integer and reduce it modulo 256 in places where it
might overflow that value.

 Exactly how this translates into your PHP code depends on how you're
translating the rest of the routine, and especially what you turn buffer
into, but the loop might go something like:

for ($i=0; $i$count; $i++):
   $c0 = ($c0+$buffer[i])%256;
   $c1 = ($c1+$c0)%256;
endfor;

 You could also do the modulo 256 reduction by doing a bitwise and with
0xff (or 0377, or 255), of course -- this is likely to be more efficient,
and may, depending on your point of view, be more obvious as to what's going
on.  Then your loop might look like this:

for ($i=0; $i$count; $i++):
   $c0 = ($c0+$buffer[i])0xff;
   $c1 = ($c1+$c0)0xff;
endfor;

 Hope this is helpful and sets you off on the right track.

 Cheers!

 Mike

 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211



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




[PHP] Encrypt in Javascript and Decrypt in PHP????

2003-01-10 Thread Scott Fletcher
Here's the challenging project I'm doing.  I'm trying to encrypt the user_id
and password in javascript and submit it.  Then have PHP to decrypt the
user_id and password.  The only problem I have is I don't know what
javascript function or javascript algorithm that can also work the same way
as the php function or php algorithm.  Anybody know?

Thanks,
 FletchSOD



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




[PHP] Re: PHP and DB2

2003-01-10 Thread Scott Fletcher
Yes, it can.  Use the odbc_connect.   Here's what I use that work...

--clip--
   $database = TEST_DB;
   $user = db2inst1;
   $pass = ibmdb2;

   $cid = @odbc_connect($database,$user,$pass) or die(Unable to Connect to
Database !!!) ;
   if ($cid == 0){
exit(brbrfont color='red'bUnable to Connect to Database
!!!/b/fontbrbr);
   }
--clip--

Jack Schroeder [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Can PHP connect to IMB DB2 dbms running on an AIX Unix server?

 Jack




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




Re: [PHP] PHP/Oracle Command line Segmentation Fault

2003-01-10 Thread Maxim Maletsky

Are you saying that OCILogoff gives you the segfault?
It's very strange because OCILogoff is actually an empty function -
all the contents of that function is commented and is there only for the
backwards compatibility reasons. Zend API ends OCI sessions
automatically as script's execution ends.

Do what, try removing the last function from your script and run again.
If the segfault happens again submit a bug report at http://bugs.php.net
with all the possible details (server log, script, system etc) and I
will take over the bug myself (I maintain the OCI8 extension)


--
Maxim Maletsky
[EMAIL PROTECTED]



Christopher Ditty [EMAIL PROTECTED] wrote... :

 Anyone?
 
 CDitty
 
  Christopher Ditty [EMAIL PROTECTED] 01/09/03 04:04PM 
 I have successfully installed oracle 8.1.7 w/ php and have it
 configured
 to run from the command line.  When I run a simple script that
 connects,
 and selects records from the database, the last line is a segmentation
 fault error.  This does not seem to happen when the same script is run
 through the browser.  
 
 Can anyone offer any help or advice?  The code is listed below.
 
 CDitty
 
 #!/usr/bin/php
 ?
 function oci8Connect(){
  $db_conn = ocilogon(usrname,pwd, dbase);
  if (!$db_conn){
   echo Helpbr;
 exit ();
  }
  echo Connectedbr;
  return ($db_conn);
 }
 
 $conn = oci8Connect();
 
 $stmt = ociparse($conn,select * from US_MSTR);
   ociexecute($stmt);
 
   $i=0;
   $row = array();
 
   while(OCIFetchInto($stmt, $row, OCI_ASSOC)){
   # do stuff with $row...
   echo $row['US_ID'] .  $ibr;
   $i++;
   }
 
   ocifreestatement($stmt);
   ocilogoff($conn);
 ?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




Re: [PHP] Mysql/php database performance question

2003-01-10 Thread Maxim Maletsky

keeping those 5 columns with a lot of empty cells in the last columns
is better as it is means exactly for that. Just don't make it a not null
field.

--
Maxim Maletsky
[EMAIL PROTECTED]



Khalid El-Kary [EMAIL PROTECTED] wrote... :

 the thing that may make difference in performance (as i think) is whether 
 you make it a fixed -CHAR- or a variable -VARCHAR- it's preferable that you 
 make separate char columns, so that PHP will not have to explode every 
 record!
 
 Regards,
 Khalid Al-Kary,
 
 
 
 Hi,
 
 I got a question about using Mysql databases.
 I load textdata in VARCHAR colums up to size 50. I have about 5 of those
 columns.
 The last columns often contain empty cells. (data are wordmeanings, many
 words have only a 1 or 2meanings)
 
 What would be faster/better:
 - putting everything in a big varchar column (size 5x50) and PHP parsing
 them by comma after
fetching
 
   or
 
 - keeping those 5 columns with a lot of empty cells in the last columns?
 
 Thanks,
 Simon
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 _
 The new MSN 8 is here: Try it free* for 2 months 
 http://join.msn.com/?page=dept/dialup
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




[PHP] Re: PHP and DB2

2003-01-10 Thread Scott Fletcher
Be care of the PHP bug on one of hte php function, odbc_fetch_row().  This
function does not very well start at 0 when the odbc_fetch_row() start
automatically, so you'll have to at the counter inside the function.  Why is
that, I do not know.  Here's the example of the workaround I did.
--clip--

$cid = odbc_connect('blah blah blah');

$ask7 = SELECT * FROM INQUIRIES WHERE USER_ID = '38SCK3';

$R7 = odbc_exec($cid,$ask7);

$result = odbc_result($R7,1);

echo Result or No Result??? -- .odbc_fetch_row($R7);

$bug_workaround=0;

while (odbc_fetch_row($R7,++$bug_workaround))

{

odbc_fetch_into($R7,$inquiry,$inq_c);

echo $inquiry[0], $inquiry[1];

}

--clip--

Jack Schroeder [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Can PHP connect to IMB DB2 dbms running on an AIX Unix server?

 Jack




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




[PHP] Re: PHP and DB2

2003-01-10 Thread Scott Fletcher
G...  I meant to say Be careful of the PHP bug.

Scott Fletcher [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Be care of the PHP bug on one of hte php function, odbc_fetch_row().  This
 function does not very well start at 0 when the odbc_fetch_row() start
 automatically, so you'll have to at the counter inside the function.  Why
is
 that, I do not know.  Here's the example of the workaround I did.
 --clip--

 $cid = odbc_connect('blah blah blah');

 $ask7 = SELECT * FROM INQUIRIES WHERE USER_ID = '38SCK3';

 $R7 = odbc_exec($cid,$ask7);

 $result = odbc_result($R7,1);

 echo Result or No Result??? -- .odbc_fetch_row($R7);

 $bug_workaround=0;

 while (odbc_fetch_row($R7,++$bug_workaround))

 {

 odbc_fetch_into($R7,$inquiry,$inq_c);

 echo $inquiry[0], $inquiry[1];

 }

 --clip--

 Jack Schroeder [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Can PHP connect to IMB DB2 dbms running on an AIX Unix server?
 
  Jack
 





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




Re: [PHP] PHP not executing files in subdirectories

2003-01-10 Thread Maxim Maletsky

Jacob [EMAIL PROTECTED] wrote... :

 Hey All.
  
 The subject line pretty much says it all.
  
 I have php-nuke installed in the / directory and it works
 fine.
 However, when I try to run the gallery or netjuke software
 (also php)
 They just return the source code of the file. (not exactly
 what you want)
  
 I am using Apache 2.0 and php 4.3 (compiled from sources) on
 a redhat 8.0 box.
  
  
 If needed I will include the configs, but I don't want to waste
 bandwidth.

what are the extensions of these files? You might need to add them to
your httpd.conf or .htaccess files. 

--
Maxim Maletsky
[EMAIL PROTECTED]



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




Re: [PHP] session_destroy problem

2003-01-10 Thread Scott Fletcher
Session Destroy will work if you provide the user a way to log out of the
website.  But if the user closed the browser then that's it.  Session
Destory can't be used because the browser is a client side and Session
Destroy is a server side.  So, once the browser close, it doesn't contact
the server before closing.

You're only option is to clean up the session data from the webserver as I
usually have done.  I also use the database to find out about the session id
and the timestamp it was updated.  That way, I will know which session not
to delete if it is active.

Ken Nagorski [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 So it is the browsers problem. I tested what you said and Mozilla acts as
 you stated and IE does as well. I guess my question is. Is there no way to
 close clear out the session when the user logs out?

 The way I set things up the class that I wrote just gets the current
 sessionid and does a select from the database to see if it has been
logged.
 The problem this creates is that someone could sit down and reopen a
 browser and have access to the site as if they where logged because the
 session is not gone.

 Hmm - Like a said I have never used sessions before so I am learning about
 them. Thank you for your input...

 Ken


  What browser are you running?  I find that IE drops the session when
  you close the browser window actively working the site.  On Mozilla I
  have to close every instance of Mozilla regardless of the site before
  it drops the session.  Pretty aggravating so I'm going to have to start
  working on a method based on responses to your post.
 
  Larry S. Brown
  Dimension Networks, Inc.
  (727) 723-8388
 
  -Original Message-
  From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, January 09, 2003 1:35 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] session_destroy problem
 
  Hi there,
 
  I have written a class that manages sessions. I have never used
  sessions before so all this is new to me. Everything works fine as far
  as starting the session and logging in however when I call sessoin
  destroy it doesn't seem to work the function returns 1 as it should if
  all goes well however if I go to another page and do some other
  browsing even if I close the browser the session still hangs around. Is
  there something I don't know about sessions? I have read the
  documentation on the session_destroy function, I don't think that I am
  missing anything...
 
  Anyone have any suggestions? I am totally confused.
 
  Thanks
  Ken
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php






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




[PHP] Re: session problem

2003-01-10 Thread Scott Fletcher
I don't normally have problem with using session functions on the Win2000
Server using IIS 5.  It work pretty well.  You may will want to narrow down
the problem and find out if it is a session problem only or if it is
something else.  I don't use some of the IIS patches like the IIS Lockdown
as an example because some of those patches prevent hte PHP function from
working.  IIS is so filled with holes that I had to use hte firewall.

Supra [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I got serious problem I need to solve a.s.a.p.
 Well, I've developed a database application with PHP and MySql, I used
 sessions.
 While developing I used my own computer as a web server - Windows 2000
Pro,
 IIS 5, PHP 4.2.3 via ISAPI. And all my code was tested successfully while
my
 computer is the server and the client. Now after moving the sources to the
 server (Windows 2000 Advanced Server) and exporting the MySql database to
 the server, the application fail. While debugging I got to a firm
conclusion
 that the sessions doesn't work well. I copied the php.ini to the system
root
 on the server and it still doesn't work.

 Please advice me what to do in order to make the application work on the
 server.

 Thanks I advance,

 Supra





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




[PHP] Parsing a directory for specific files

2003-01-10 Thread Dirk van Lyrop
Hi,

does anybody know how to solve the following task?

I'd like to generate a dynamic page, which contents come from txt-files.
The files will be in a directory called content (from the page: 
../content) and they are labeled with date and (within one day) 
increasing numbers,
e.g. 20030108-1.txt, 20030108-2.txt, 20030108-3.txt, 20030109-1.txt, 
20030110-1.txt, 20030110-2.txt
The script should parse the file names and get the most recent five ones!

The text inside should be included in the page - but this is not the 
problem, the task mentioned above is the problem!

Thx in advance for these who can deliever solutions or ideas!

Dirk



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



Re: [PHP] Encrypt in Javascript and Decrypt in PHP????

2003-01-10 Thread Marek Kilimajer
The way you want it can be securely done only using asymetric 
encryption, which is not available to JS.
Do you really need to encrypt user_id? You could use md5 to hash 
password with some random string,
store the hash in a hidden field and erase password. On server side if 
the hidden field is set compare it
whith a hash you create with password and the random string (keep the 
string as a session variable, don't
pass it as a form hidden field). If the hidden hash field is not set, 
use normal procedure.

code:

server:
$_SESSION[random]=create_random_string();

client:
function onsubmit(form)  {
   form.hiddenfield.value= md5( md5(form.password.value) + 
form.randomstring.value);
   form.password.value='';
   return true;
}

server:
if($_POST[hiddenfield]) {
 $res=mysql_query(SELECT * FROM users WHERE user='$_POST[user]'
   AND 
'$_POST[hiddenfield]'=MD5(CONCAT(password,$_SESSION[random]))); 

} else {
   $res=mysql_query(SELECT * FROM users WHERE user='$_POST[user]'
   AND password=MD5($_POST[password]); 
}

this example assumes passwords are stored as md5 hashes in the database

Scott Fletcher wrote:

Here's the challenging project I'm doing.  I'm trying to encrypt the user_id
and password in javascript and submit it.  Then have PHP to decrypt the
user_id and password.  The only problem I have is I don't know what
javascript function or javascript algorithm that can also work the same way
as the php function or php algorithm.  Anybody know?

Thanks,
FletchSOD



 



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




Re: [PHP] Mysql/php database performance question

2003-01-10 Thread Marek Kilimajer

char of greater size than 3 is converted to varchar anyways


Where's the pain?  The trade off between char and varchar is speed vs
table size.  Are just trying to be as fast as possible?  If the db is
small, I wouldn't worry about it and do what ever way you want (i.e.
what's a microsecond or two?)  You could try both ways and profile it
several thousand times to see if it really matters.

 



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




Re: [PHP] Encrypt in Javascript and Decrypt in PHP????

2003-01-10 Thread Scott Fletcher
I'll look into this and try it out.  The only thing that is important to me
is that the password get encrypted before transmitting across the internet.
I'm not worry if the JS is disabled because if it is then the login will
never be authenticated.  I'll keep on exploring for way to increase
security.   Thanks for the response.


Marek Kilimajer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 The way you want it can be securely done only using asymetric
 encryption, which is not available to JS.
 Do you really need to encrypt user_id? You could use md5 to hash
 password with some random string,
 store the hash in a hidden field and erase password. On server side if
 the hidden field is set compare it
 whith a hash you create with password and the random string (keep the
 string as a session variable, don't
 pass it as a form hidden field). If the hidden hash field is not set,
 use normal procedure.

 code:

 server:
 $_SESSION[random]=create_random_string();

 client:
 function onsubmit(form)  {
 form.hiddenfield.value= md5( md5(form.password.value) +
 form.randomstring.value);
 form.password.value='';
 return true;
 }

 server:
 if($_POST[hiddenfield]) {
   $res=mysql_query(SELECT * FROM users WHERE user='$_POST[user]'
 AND
 '$_POST[hiddenfield]'=MD5(CONCAT(password,$_SESSION[random])));

 } else {
 $res=mysql_query(SELECT * FROM users WHERE user='$_POST[user]'
 AND password=MD5($_POST[password]);
 }

 this example assumes passwords are stored as md5 hashes in the database

 Scott Fletcher wrote:

 Here's the challenging project I'm doing.  I'm trying to encrypt the
user_id
 and password in javascript and submit it.  Then have PHP to decrypt the
 user_id and password.  The only problem I have is I don't know what
 javascript function or javascript algorithm that can also work the same
way
 as the php function or php algorithm.  Anybody know?
 
 Thanks,
  FletchSOD
 
 
 
 
 




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




[PHP] Header information ...

2003-01-10 Thread Anders Mellström
Hello. I can't get this code to work. The error message I get is that the header could 
be added, cause it has allready been sent. What shalll I do to get it to work?

//Anders

html
head
title/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1

script language=JavaScript
if ((navigator.appName == Netscape)  (parseInt(navigator.appVersion)  5))
{
window.alert(Upgrade version of NS.);
}
else
{
document.write(?php $i = 1 ?);
}
/script

link rel='stylesheet' href='stil.css' type='text/css'
/head
body

br

?php
if ($i == 1)
{

Header(location:main.php);
}
else
{
print(Byt webblauml;sare!);
}
?
/body
/html



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




[PHP] need some javascript code

2003-01-10 Thread Denis L. Menezes
Hello friends,

Can someone please redirect me to some source with javascript for following?

1. Checking if a text box is populated before going to the next page.
2. To check if any item is selected in a listbox before posting data to the next page.
3. to check if a radio button is selected before posting data to the next page.

Many thanks
denis


RE: [PHP] session_destroy problem

2003-01-10 Thread Larry Brown
Javascript has a function for performing actions on window close.  You could
have a submit action on the page that is sent when the window closes.  I've
not used it yet but it should work I would think.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 10:58 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] session_destroy problem

Session Destroy will work if you provide the user a way to log out of the
website.  But if the user closed the browser then that's it.  Session
Destory can't be used because the browser is a client side and Session
Destroy is a server side.  So, once the browser close, it doesn't contact
the server before closing.

You're only option is to clean up the session data from the webserver as I
usually have done.  I also use the database to find out about the session id
and the timestamp it was updated.  That way, I will know which session not
to delete if it is active.

Ken Nagorski [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 So it is the browsers problem. I tested what you said and Mozilla acts as
 you stated and IE does as well. I guess my question is. Is there no way to
 close clear out the session when the user logs out?

 The way I set things up the class that I wrote just gets the current
 sessionid and does a select from the database to see if it has been
logged.
 The problem this creates is that someone could sit down and reopen a
 browser and have access to the site as if they where logged because the
 session is not gone.

 Hmm - Like a said I have never used sessions before so I am learning about
 them. Thank you for your input...

 Ken


  What browser are you running?  I find that IE drops the session when
  you close the browser window actively working the site.  On Mozilla I
  have to close every instance of Mozilla regardless of the site before
  it drops the session.  Pretty aggravating so I'm going to have to start
  working on a method based on responses to your post.
 
  Larry S. Brown
  Dimension Networks, Inc.
  (727) 723-8388
 
  -Original Message-
  From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, January 09, 2003 1:35 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] session_destroy problem
 
  Hi there,
 
  I have written a class that manages sessions. I have never used
  sessions before so all this is new to me. Everything works fine as far
  as starting the session and logging in however when I call sessoin
  destroy it doesn't seem to work the function returns 1 as it should if
  all goes well however if I go to another page and do some other
  browsing even if I close the browser the session still hangs around. Is
  there something I don't know about sessions? I have read the
  documentation on the session_destroy function, I don't think that I am
  missing anything...
 
  Anyone have any suggestions? I am totally confused.
 
  Thanks
  Ken
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php






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



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




RE: [PHP] Header information ...

2003-01-10 Thread Daniel Kushner
Hi Anders,

You can't send a header to the browser once output has been sent. The
header() function should be before any other output on your script. Further
more, because the script isn't terminated after the header() function, and
you usually do not want to continue running it, an exit() should directly
follow.
e.g.:
Header(Location: main.php);
exit();


Regards,
Daniel Kushner
_
Need hosting? http://thehostingcompany.us



 -Original Message-
 From: Anders Mellstrom [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 10, 2003 11:18 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Header information ...


 Hello. I can't get this code to work. The error message I get is
 that the header could be added, cause it has allready been sent.
 What shalll I do to get it to work?

 //Anders

 html
 head
 title/title
 meta http-equiv=Content-Type content=text/html; charset=iso-8859-1

 script language=JavaScript
 if ((navigator.appName == Netscape) 
 (parseInt(navigator.appVersion)  5))
 {
 window.alert(Upgrade version of NS.);
 }
 else
 {
 document.write(?php $i = 1 ?);
 }
 /script

 link rel='stylesheet' href='stil.css' type='text/css'
 /head
 body

 br

 ?php
   if ($i == 1)
   {

   Header(location:main.php);
   }
   else
   {
   print(Byt webblauml;sare!);
   }
 ?
 /body
 /html



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


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




Re: [PHP] Sessions and Frames...

2003-01-10 Thread Marek Kilimajer
Dale Schell wrote:


List,
   I have a website that uses (too) many frames. At its most ugly, it will
load 8 frames at once. All of the pages in these frames activate the
session, and some of them modify session variables.
   Can this cause the pages to load slowly? Can a page have the session
file write locked and make other pages wait?


I don't know the php internals, but my guess is yes, each 
session_start() locks the session file and the lock is released when you 
session_write_close or your script ends, otherwise some session 
variables could be lost. Other scripts with session_start will wait. You 
should after calling session start do what is neccessery and call 
session_write_close()


Thanks for your help,
Dale
[EMAIL PROTECTED]



 



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




[PHP] Re: Header information ...

2003-01-10 Thread Philippe Saladin
Anders mellström [EMAIL PROTECTED] a écrit dans le message
news: [EMAIL PROTECTED]
Hello. I can't get this code to work. The error message I get is that the
header could be added, cause it has allready been sent. What shalll I do to
get it to work?
Please have a look at http://www.php.net/manual/en/function.header.php.
From online help : Remember that header() must be called before any actual
output is sent, either by normal HTML tags, blank lines in a file, or from
PHP
So you would test your variable $i BEFORE the html tag.
Regards,
Philippe




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




RE: [PHP] Mysql/php database performance question

2003-01-10 Thread Matt Schroebel

 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 10, 2003 11:04 AM
 To: Matt Schroebel
 Cc: Simon Dedeyne; [EMAIL PROTECTED]
 Subject: Re: [PHP] Mysql/php database performance question
 

 
 char of greater size than 3 is converted to varchar anyways

Are you sure?  I've been reading up on this stuff over the last few
days, and my understanding is that char is stored fixed width with
trailing spaces padding the string to the length specified in the
schema, whereas varchar is stored is strlen(rtrim(column))+1.  So a
column char(45) will always take 45 bytes of space, while varchar(45)
will vary from 1 to 46 bytes of space.

The first way makes locating a row in the db fast (as long as all
columns are fixed width [No blob, text, or varchar columns]) since it's
simple math, whereas the latter way saves space but makes MYSQLs finding
a row a little harder (since the offset varies) and thus a bit slower.
I have always been using varchar and have been considering changing to
char.

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

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




Re: [PHP] session_destroy problem

2003-01-10 Thread Scott Fletcher
That would work only if the webserver IP address is '127.0.0.1' (local
machine), but not any other IP address.  Because of the ACK synchrious
communication that get interrupted as result of the browser closing.

Larry Brown [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Javascript has a function for performing actions on window close.  You
could
 have a submit action on the page that is sent when the window closes.
I've
 not used it yet but it should work I would think.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 10, 2003 10:58 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] session_destroy problem

 Session Destroy will work if you provide the user a way to log out of the
 website.  But if the user closed the browser then that's it.  Session
 Destory can't be used because the browser is a client side and Session
 Destroy is a server side.  So, once the browser close, it doesn't contact
 the server before closing.

 You're only option is to clean up the session data from the webserver as I
 usually have done.  I also use the database to find out about the session
id
 and the timestamp it was updated.  That way, I will know which session not
 to delete if it is active.

 Ken Nagorski [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi there,
 
  So it is the browsers problem. I tested what you said and Mozilla acts
as
  you stated and IE does as well. I guess my question is. Is there no way
to
  close clear out the session when the user logs out?
 
  The way I set things up the class that I wrote just gets the current
  sessionid and does a select from the database to see if it has been
 logged.
  The problem this creates is that someone could sit down and reopen a
  browser and have access to the site as if they where logged because the
  session is not gone.
 
  Hmm - Like a said I have never used sessions before so I am learning
about
  them. Thank you for your input...
 
  Ken
 
 
   What browser are you running?  I find that IE drops the session when
   you close the browser window actively working the site.  On Mozilla I
   have to close every instance of Mozilla regardless of the site before
   it drops the session.  Pretty aggravating so I'm going to have to
start
   working on a method based on responses to your post.
  
   Larry S. Brown
   Dimension Networks, Inc.
   (727) 723-8388
  
   -Original Message-
   From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, January 09, 2003 1:35 AM
   To: [EMAIL PROTECTED]
   Subject: [PHP] session_destroy problem
  
   Hi there,
  
   I have written a class that manages sessions. I have never used
   sessions before so all this is new to me. Everything works fine as far
   as starting the session and logging in however when I call sessoin
   destroy it doesn't seem to work the function returns 1 as it should if
   all goes well however if I go to another page and do some other
   browsing even if I close the browser the session still hangs around.
Is
   there something I don't know about sessions? I have read the
   documentation on the session_destroy function, I don't think that I am
   missing anything...
  
   Anyone have any suggestions? I am totally confused.
  
   Thanks
   Ken
  
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 



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





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




RE: [PHP] checking status of a HTML checkbox

2003-01-10 Thread Larry Brown
Also look at empty().  I don't know if the $_POST array will send the key if
it as no variable.  I know on a regular post it does send the variable, but
it has no value.  I have used isset with just receiving post data and got
strange results.  On one I had an isset statement that ran a result that
bypassed some code.  When is submitted the form I got results as if the
isset was being executed and the code was skipped.  Just to make sure this
was the case, I added echo hello; on the first line of the isset bypass
coding and after running the script I got the results without the bypass.  I
took the hello back out and it bypassed!  So adding the hello statement
affected whether isset gave a positive or negative response.  The variable
isset was checking in this case was not being sent with a value.  I changed
to empty() and got the result I was looking for.  If $_POST sends the key
but not a value when you submit the form without a value assigned to the
variable then isset may not always work.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Shams [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 4:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] checking status of a HTML checkbox

thanks a lot, thats what I was looking for

:o)

Shams

- Edwin [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Shams [EMAIL PROTECTED] wrote:

 [snip]
  At the moment I am doing this:
 
  if ( $_POST[insurance] == yes )
  {
  }
 
  But is there a more accurate way of checking the exsistence of
  insurance?
 [/snip]

 I think you're looking for isset():

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

 - E

 __
 Do You Yahoo!?
 Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/




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



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




Re: [PHP] Header information ...

2003-01-10 Thread Marek Kilimajer
Should look like this:

Anders Mellström wrote:


Hello. I can't get this code to work. The error message I get is that the header could be added, cause it has allready been sent. What shalll I do to get it to work?

//Anders

?php
	if ($i == 1)
	{
		
		Header(location:main.php);


   exit;


	}
	else
	{
		//print(Byt webblauml;sare!);  -- displayed later
	}
?html
head
title/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1

script language=JavaScript
if ((navigator.appName == Netscape)  (parseInt(navigator.appVersion)  5))
{
window.alert(Upgrade version of NS.);
}
else
{
document.write(?php $i = 1 ?);
}
/script

link rel='stylesheet' href='stil.css' type='text/css'
/head
body

br
Byt webblauml;sare!

/body
/html



 



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




Re: [PHP] Mysql/php database performance question

2003-01-10 Thread Marek Kilimajer
Sure, just tried it (32-bit platform, might be 7 for 64-bits).
I have a feeling it is somewhere in the manual.

Matt Schroebel wrote:


-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 10, 2003 11:04 AM
To: Matt Schroebel
Cc: Simon Dedeyne; [EMAIL PROTECTED]
Subject: Re: [PHP] Mysql/php database performance question

   


 

char of greater size than 3 is converted to varchar anyways
   


Are you sure?  I've been reading up on this stuff over the last few
days, and my understanding is that char is stored fixed width with
trailing spaces padding the string to the length specified in the
schema, whereas varchar is stored is strlen(rtrim(column))+1.  So a
column char(45) will always take 45 bytes of space, while varchar(45)
will vary from 1 to 46 bytes of space.

The first way makes locating a row in the db fast (as long as all
columns are fixed width [No blob, text, or varchar columns]) since it's
simple math, whereas the latter way saves space but makes MYSQLs finding
a row a little harder (since the offset varies) and thus a bit slower.
I have always been using varchar and have been considering changing to
char.

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

 



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




Re: [PHP] session_destroy problem

2003-01-10 Thread Tamas Arpad
On Friday 10 January 2003 17:39, Scott Fletcher wrote:
  Javascript has a function for performing actions on window close
 That would work only if the webserver IP address is '127.0.0.1' (local
 machine), but not any other IP address.  Because of the ACK synchrious
 communication that get interrupted as result of the browser closing.
I think the javascrit code runs before the browser is closed, other way what 
would run it?

Arpi

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




Re: [PHP] session_destroy problem

2003-01-10 Thread Scott Fletcher
Yes, the JavaScript code can run before the browser is closed but it would
not be finish running because the browser closing had been executed.
Someone had tried it before and struggled with it.   But that is a good
advice, thanks for jumping in.

Tamas Arpad [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Friday 10 January 2003 17:39, Scott Fletcher wrote:
  Javascript has a function for performing actions on window close
 That would work only if the webserver IP address is '127.0.0.1' (local
 machine), but not any other IP address.  Because of the ACK synchrious
 communication that get interrupted as result of the browser closing.
I think the javascrit code runs before the browser is closed, other way what
would run it?

Arpi



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




RE: [PHP] Mysql/php database performance question

2003-01-10 Thread Matt Schroebel
 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 10, 2003 11:45 AM
 To: Matt Schroebel
 Cc: Simon Dedeyne; [EMAIL PROTECTED]
 Subject: Re: [PHP] Mysql/php database performance question
 
 
 Sure, just tried it (32-bit platform, might be 7 for 64-bits).
 I have a feeling it is somewhere in the manual.

How'd you try it?  

I created a 1 column 42 char record in phpMyAdmin.  Everytime I add a
row, regardless of size the dataspace increases by 42.

With a second table, with 1 column varchar(42), each 4-5 char insert
resulted in 20 bytes of space (must be some minimum overhead), and a
full 42 resulted in 44 bytes of dataspace used.

I'm curious here, as it seems the trade off is speed of access with char
[and the overhead of removing trailing spaces on each retrieval] vs
storage size in varchar [and it's improved strip right spaces on storage
only happening once].  That's what the man page I pointed to last time
said.  There are some examples of truncating data to 4 bytes on that
page but no mention of storing char as varchar.  


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




[PHP] PhP 4.3.0 Relative includes and Apache Alias problems.

2003-01-10 Thread quak
Greetings,

Why is that, that when we try to issue a include statement, which has any kind of 
Relative path in it, it will fail if the php script is mapped into apache web tree 
by Alias Statement ?

An example: We have:

/a/b/one.php
/a/c/two.php
/a/three.php

Apache Alias stament is:

Alias   /test   /a/

If we run: include('../c/two.php'); from one.php, it will result in error: failed to 
create stream: No such file or directory.

If we run: include('c/two.php'); from three.php it will result in suiccess.

If we run: include('./c/two.php'); from three.php it will fail as in first example.

If we just copy the whole /a into the web server document root, all examples will work.

Is that some kind of security feature or a bug ?

Regards

Kirill

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




RE: [PHP] session_destroy problem

2003-01-10 Thread Larry Brown
Question...Do you know if Mozilla runs a browser instance that might handle
the process after one of the browser windows is closed?  Right now the
situation is that IE closes the session when the window that opened it
closes.  I have a site that is authenticated and then runs sessions on the
authenticated user.  If you close the browser window and open another one,
you are prompted for the login and password and have your new
identity/session.  On Mozilla if I close the window actively on the site and
have other windows up on other sites I can open another Mozilla instance and
return to the site and it still has my session open and identity.  I have to
close every Mozilla instance for the session to close.  If Mozilla is run by
one central process I would think maybe it could do this onwindowclose
behaviour?  Maybe a good question for the Javascript list but since it
sounds like you guys have seen this tried before maybe you already know.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 12:02 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] session_destroy problem

Yes, the JavaScript code can run before the browser is closed but it would
not be finish running because the browser closing had been executed.
Someone had tried it before and struggled with it.   But that is a good
advice, thanks for jumping in.

Tamas Arpad [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Friday 10 January 2003 17:39, Scott Fletcher wrote:
  Javascript has a function for performing actions on window close
 That would work only if the webserver IP address is '127.0.0.1' (local
 machine), but not any other IP address.  Because of the ACK synchrious
 communication that get interrupted as result of the browser closing.
I think the javascrit code runs before the browser is closed, other way what
would run it?

Arpi



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



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




Re: [PHP] Mysql/php database performance question

2003-01-10 Thread Marek Kilimajer
seems to be a little bit more complicated:

CREATE TABLE `aa` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`aaa` CHAR( 50 ) NOT NULL ,
`bbb` CHAR( 50 ) NOT NULL
);

both aaa and bbb are char now


CREATE TABLE `aaa` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`aaa` CHAR( 50 ) NOT NULL ,
`bbb` VARCHAR( 255 ) NOT NULL
);

aaa will be varchar anyway

CREATE TABLE `aaa` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`aaa` CHAR( 50 ) NOT NULL , 
);

aaa is char

ALTER TABLE `aaa` ADD `bbb` VARCHAR( 250 ) NOT NULL ;

aaa in now VARCHAR

Seems like one cannot mix char and varchar columns in one table

Matt Schroebel wrote:

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 10, 2003 11:45 AM
To: Matt Schroebel
Cc: Simon Dedeyne; [EMAIL PROTECTED]
Subject: Re: [PHP] Mysql/php database performance question


Sure, just tried it (32-bit platform, might be 7 for 64-bits).
I have a feeling it is somewhere in the manual.
   


How'd you try it?  

I created a 1 column 42 char record in phpMyAdmin.  Everytime I add a
row, regardless of size the dataspace increases by 42.

With a second table, with 1 column varchar(42), each 4-5 char insert
resulted in 20 bytes of space (must be some minimum overhead), and a
full 42 resulted in 44 bytes of dataspace used.

I'm curious here, as it seems the trade off is speed of access with char
[and the overhead of removing trailing spaces on each retrieval] vs
storage size in varchar [and it's improved strip right spaces on storage
only happening once].  That's what the man page I pointed to last time
said.  There are some examples of truncating data to 4 bytes on that
page but no mention of storing char as varchar.  


 



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




Re: [PHP] Mysql/php database performance question

2003-01-10 Thread Khalid El-Kary
Oh, sorry, i should have remarked that all of the columns should be fixed 
width (CHAR) for this optimization to take effect, since if even one of the 
columns is variable width (VARCHAR) the whole row will be variable width, 
and it will be no use to change to CHAR.

Regards,
Khalid


seems to be a little bit more complicated:

CREATE TABLE `aa` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`aaa` CHAR( 50 ) NOT NULL ,
`bbb` CHAR( 50 ) NOT NULL
);

both aaa and bbb are char now


CREATE TABLE `aaa` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`aaa` CHAR( 50 ) NOT NULL ,
`bbb` VARCHAR( 255 ) NOT NULL
);

aaa will be varchar anyway

CREATE TABLE `aaa` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`aaa` CHAR( 50 ) NOT NULL , );

aaa is char

ALTER TABLE `aaa` ADD `bbb` VARCHAR( 250 ) NOT NULL ;

aaa in now VARCHAR

Seems like one cannot mix char and varchar columns in one table

Matt Schroebel wrote:


-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] Sent: Friday, 
January 10, 2003 11:45 AM
To: Matt Schroebel
Cc: Simon Dedeyne; [EMAIL PROTECTED]
Subject: Re: [PHP] Mysql/php database performance question


Sure, just tried it (32-bit platform, might be 7 for 64-bits).
I have a feeling it is somewhere in the manual.



How'd you try it?

I created a 1 column 42 char record in phpMyAdmin.  Everytime I add a
row, regardless of size the dataspace increases by 42.

With a second table, with 1 column varchar(42), each 4-5 char insert
resulted in 20 bytes of space (must be some minimum overhead), and a
full 42 resulted in 44 bytes of dataspace used.

I'm curious here, as it seems the trade off is speed of access with char
[and the overhead of removing trailing spaces on each retrieval] vs
storage size in varchar [and it's improved strip right spaces on storage
only happening once].  That's what the man page I pointed to last time
said.  There are some examples of truncating data to 4 bytes on that
page but no mention of storing char as varchar.







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



_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus


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



Re: [PHP] Sessions and Frames...

2003-01-10 Thread Dale Schell
Thanks, that helped out a lot. One of those RTFM times.

Dale

On 1/10/03 10:24, Marek Kilimajer [EMAIL PROTECTED] wrote:

 Dale Schell wrote:
 
 List,
I have a website that uses (too) many frames. At its most ugly, it will
 load 8 frames at once. All of the pages in these frames activate the
 session, and some of them modify session variables.
Can this cause the pages to load slowly? Can a page have the session
 file write locked and make other pages wait?
 
 I don't know the php internals, but my guess is yes, each
 session_start() locks the session file and the lock is released when you
 session_write_close or your script ends, otherwise some session
 variables could be lost. Other scripts with session_start will wait. You
 should after calling session start do what is neccessery and call
 session_write_close()
 
 
 Thanks for your help,
 Dale
 [EMAIL PROTECTED]
 
 
 
  
 
 



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




[PHP] E-mail redirection....?

2003-01-10 Thread Michal Stankoviansky
Hi

I'm totally confused. What I need is the following:

User registers and I need to create an e-mail alias for him, 
something like [EMAIL PROTECTED] If someone sends an 
e-mail to the above address, I need to redirect it to the 
user's real e-mail address. I'm totally lost...can this be 
done in PHP?

Thanx for help, please save me :)

Michal


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



Re: [PHP] session_destroy problem

2003-01-10 Thread Scott Fletcher
You meant the tab browers.  Like 2 tabs...  I haven't tried it but now that
you mentioned it, I'm going to have to look at it soon.  I do noticed one
thing, the status bar, if it have comments, it will show up on other tabs
even though it is a completely a different website.  I get the impression
that it doesn't seem to be as independent of each other, know what I meant?

What I did with the php script is to expire the session first, at the
beginning of hte webpage before the login page showed up and before
attempting to create a session.  Maybe this will help a little bit.

Larry Brown [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Question...Do you know if Mozilla runs a browser instance that might
handle
 the process after one of the browser windows is closed?  Right now the
 situation is that IE closes the session when the window that opened it
 closes.  I have a site that is authenticated and then runs sessions on the
 authenticated user.  If you close the browser window and open another one,
 you are prompted for the login and password and have your new
 identity/session.  On Mozilla if I close the window actively on the site
and
 have other windows up on other sites I can open another Mozilla instance
and
 return to the site and it still has my session open and identity.  I have
to
 close every Mozilla instance for the session to close.  If Mozilla is run
by
 one central process I would think maybe it could do this onwindowclose
 behaviour?  Maybe a good question for the Javascript list but since it
 sounds like you guys have seen this tried before maybe you already know.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 10, 2003 12:02 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] session_destroy problem

 Yes, the JavaScript code can run before the browser is closed but it would
 not be finish running because the browser closing had been executed.
 Someone had tried it before and struggled with it.   But that is a good
 advice, thanks for jumping in.

 Tamas Arpad [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Friday 10 January 2003 17:39, Scott Fletcher wrote:
   Javascript has a function for performing actions on window close
  That would work only if the webserver IP address is '127.0.0.1' (local
  machine), but not any other IP address.  Because of the ACK synchrious
  communication that get interrupted as result of the browser closing.
 I think the javascrit code runs before the browser is closed, other way
what
 would run it?

 Arpi



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





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




Re: [PHP] Re: HEEELP...please

2003-01-10 Thread pippo
I want to thank all those who made suggestions. All were helpful.
Question:
As my server is on LAN only, I could turn on the register_globals for 
debugging purposes etc. But, is the only way to turn register_globals on to 
uninstall and then reinstall mod_php4 with a modified php.ini file?
Or is there another temporary solution until I can modify all my php files?

PJ

At 08:39 PM 1/9/2003 -0500, you wrote:
$DOCUMENT_ROOT is now $_SERVER['DOCUMENT_ROOT'] unless register_globals is
on.

You need

include $_SERVER['DOCUMENT_ROOT'].'/../lib/somefile.conf';

take care,
Greg
--
phpDocumentor
http://www.phpdoc.org

[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I absolutely cannot understand the include_path directive.
 Can somebody, please, explain this?
 I have a situation that I find absolutely incomprehensible: I moved my
 experimental web-site from FreeBSD 4.5 running php4 v. 4.0 (or something),
 apache 1.13 where thesite worked just fine to another box with FreeBSD 4.7
 running php4 v. 4.2.3, apache 1.13.27_1.
 All of a sudden, I get the message:
 Warning: Failed opening '/../lib/somefile.conf' for inclusion
 (include_path='.:/usr/local/lib/php') in /usr/local/www/html/index.php on
 line 6

 I can find nothing in the httpd.conf files that could account for this;
 there is no configuration in them for include_path.

 Obviously, the php file is being parsed correctly, but there is a problem
 with the line :
 include $DOCUMENT_ROOT/../lib/somefile.conf.

 It works on one machine, but not on the latest version of php4 an apache.

 I see there are others on the net who have had this problem, but I have
not
 yet found an explanation or a cure.

 HELP please,

 PJ








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




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




RE: [PHP] session_destroy problem

2003-01-10 Thread Larry Brown
It helps for me being able to re-login as a different user.  It's a good
idea but it still leaves a bit to be desired for security.  I'm going to
also post this to the js list and see if they've worked with it before.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 12:35 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] session_destroy problem

You meant the tab browers.  Like 2 tabs...  I haven't tried it but now that
you mentioned it, I'm going to have to look at it soon.  I do noticed one
thing, the status bar, if it have comments, it will show up on other tabs
even though it is a completely a different website.  I get the impression
that it doesn't seem to be as independent of each other, know what I meant?

What I did with the php script is to expire the session first, at the
beginning of hte webpage before the login page showed up and before
attempting to create a session.  Maybe this will help a little bit.

Larry Brown [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Question...Do you know if Mozilla runs a browser instance that might
handle
 the process after one of the browser windows is closed?  Right now the
 situation is that IE closes the session when the window that opened it
 closes.  I have a site that is authenticated and then runs sessions on the
 authenticated user.  If you close the browser window and open another one,
 you are prompted for the login and password and have your new
 identity/session.  On Mozilla if I close the window actively on the site
and
 have other windows up on other sites I can open another Mozilla instance
and
 return to the site and it still has my session open and identity.  I have
to
 close every Mozilla instance for the session to close.  If Mozilla is run
by
 one central process I would think maybe it could do this onwindowclose
 behaviour?  Maybe a good question for the Javascript list but since it
 sounds like you guys have seen this tried before maybe you already know.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 10, 2003 12:02 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] session_destroy problem

 Yes, the JavaScript code can run before the browser is closed but it would
 not be finish running because the browser closing had been executed.
 Someone had tried it before and struggled with it.   But that is a good
 advice, thanks for jumping in.

 Tamas Arpad [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Friday 10 January 2003 17:39, Scott Fletcher wrote:
   Javascript has a function for performing actions on window close
  That would work only if the webserver IP address is '127.0.0.1' (local
  machine), but not any other IP address.  Because of the ACK synchrious
  communication that get interrupted as result of the browser closing.
 I think the javascrit code runs before the browser is closed, other way
what
 would run it?

 Arpi



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





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



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




Re: [PHP] Re: HEEELP...please

2003-01-10 Thread Marek Kilimajer
only modify php.ini and restart the server (apache, not the computer), 
run as root:

/etc/init.d/httpd restart

[EMAIL PROTECTED] wrote:

I want to thank all those who made suggestions. All were helpful.
Question:
As my server is on LAN only, I could turn on the register_globals for 
debugging purposes etc. But, is the only way to turn register_globals 
on to uninstall and then reinstall mod_php4 with a modified php.ini file?
Or is there another temporary solution until I can modify all my php 
files?

PJ

At 08:39 PM 1/9/2003 -0500, you wrote:

$DOCUMENT_ROOT is now $_SERVER['DOCUMENT_ROOT'] unless 
register_globals is
on.

You need

include $_SERVER['DOCUMENT_ROOT'].'/../lib/somefile.conf';

take care,
Greg
--
phpDocumentor
http://www.phpdoc.org

[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I absolutely cannot understand the include_path directive.
 Can somebody, please, explain this?
 I have a situation that I find absolutely incomprehensible: I moved my
 experimental web-site from FreeBSD 4.5 running php4 v. 4.0 (or 
something),
 apache 1.13 where thesite worked just fine to another box with 
FreeBSD 4.7
 running php4 v. 4.2.3, apache 1.13.27_1.
 All of a sudden, I get the message:
 Warning: Failed opening '/../lib/somefile.conf' for inclusion
 (include_path='.:/usr/local/lib/php') in 
/usr/local/www/html/index.php on
 line 6

 I can find nothing in the httpd.conf files that could account for 
this;
 there is no configuration in them for include_path.

 Obviously, the php file is being parsed correctly, but there is a 
problem
 with the line :
 include $DOCUMENT_ROOT/../lib/somefile.conf.

 It works on one machine, but not on the latest version of php4 an 
apache.

 I see there are others on the net who have had this problem, but I 
have
not
 yet found an explanation or a cure.

 HELP please,

 PJ








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







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




[PHP] Re: Converting Excel Spreadsheet to MySQL table ...

2003-01-10 Thread David Eisenhart
as a 'one off' exercise I recently did something similar except the data was
from Access, but would work the same from an excel file:- saved as
a CSV file and then used phpMyAdmin to import the CSV file data into a MySQL
table (of course, didn't have to use phpMyAdmin for this but it did make the
import process very quick and straight forward)

D


Adam Ferguson [EMAIL PROTECTED] wrote in message
002001c2b86e$34514590$6601a8c0@FERG">news:002001c2b86e$34514590$6601a8c0@FERG...
Hello ...

I was wondering if anyone had a good resource or code sample for opening (
or accessing ) an excel spreadsheet using php.  I need to be able to convert
a spreadsheet of products and info to a table of products in a mysql
database.  Also ... I need to be able to perform this on a Linux machine.
Any help would be great.

Thanks guys!
Adam Ferguson






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




Re: [PHP] Session Expiration?

2003-01-10 Thread Matt Silva
Ok I think I understand this better, my garbage collection is working but I just
didn't see it before.  Until I check to see if the data was actually being deleted 
from the /tmp 
directory (der!).

I was using just one browser to test this.  So when I navigated through some test 
pages passing
the PHPSESSID in the url and let it expire, the session_start() wouldn't do a garbage 
clean up
against itself (if that makes sense) being the parent browser.

Now I didn't see the garbage clean up until I launched the second browser and when it 
ran the
session_start() it cleaned up the expired session of the first browser, thus any other 
activity on 
the first browser would cause the browser to go back to the login page.

Thanks for your reply
Matt
 
- Original Message - 
From: Jason Sheets [EMAIL PROTECTED]
To: Matias Silva [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, January 09, 2003 8:38 PM
Subject: Re: [PHP] Session Expiration?


 First are you sure the data was not deleted?  If the cookie is still set
 in your browser a new session file will be created with the same session
 id.
 
 I believe you adjust the session gc and the session max lifetime,
 additionally if you are concerned about someone bookmarking a sessionid
 or storing it in history take a look at the session.referer_check
 configuration directive:
 
 ; Check HTTP Referer to invalidate externally stored URLs containing
 ids.
 ; HTTP_REFERER has to contain this substring for the session to be
 ; considered as valid.
 session.referer_check =
 
 Obviously it wont work with some browsers and referer is sent by the
 client but every little bit helps.
 
 Jason
 
 On Thu, 2003-01-09 at 20:09, Matias Silva wrote:
  I have gone through the past posts and can't find an answer to my problem
  
  I'm using a URL based session management schema, and I was wondering how to
  set
  the session duration time.  I know there is the session.gc_probability and
  session.gc_maxlifetime but
  that's only for garbage collection.  Just for testing I set the probability
  to 100 and the maxlifetime to 60
  just to see if my session would automatically expire, as my luck would have
  it didn't.  I use session_start()
  in my test scripts so that should run with a 100% probability any garbage
  clean up of any sessions
  that are 1 minute old.
  
  I have the session.use_cookies set to 0 and, the session.cookie_lifetime
  only applies to cookies.  So I don't
  know why my sessions are not expiring.  Does anybody have any Idea?  Should
  I just be manually checking
  for the duration of the session(?) and then delete it if it has expired?
  
  Best,
  Matt
  
  
  Matt Silva
  
  -
  Empower Software Technologies
  [EMAIL PROTECTED]
  PH 909.672.6257
  FX 909.672.6258
  
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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




RE: [PHP] HEEELP...please

2003-01-10 Thread pippo
At 12:01 PM 1/10/2003 +, you wrote:

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 10 January 2003 01:00

 All of a sudden, I get the message:
 Warning: Failed opening '/../lib/somefile.conf' for inclusion
 (include_path='.:/usr/local/lib/php') in
 /usr/local/www/html/index.php on
 line 6

 I can find nothing in the httpd.conf files that could account
 for this;
 there is no configuration in them for include_path.

Have you also checked in php.ini? -- that would seem to be a more likely
place!


The only php.ini files are in work directories for installation of mod_php4 
and there is no reference to register_globals, which seems to be my problem 
(by default, php4.2 has register_globals = off)
I suppose the only way to temporarily turn the globals on is by modifying 
the php.ini file. But I am not sure just what the directive should be... :((
Thanks for your help,
PJ



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



[PHP] Re: Medium to Large PHP Application Design

2003-01-10 Thread David Eisenhart
 I'm looking for online
 references, personal experience and opinion and even examples of open
 source code which you think demonstrate the above criteria on this one.

I have found the Smarty template engine (http://smarty.php.net/) to be a
most excellent tool for separating business logic and presentation.



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




RE: [PHP] checking status of a HTML checkbox

2003-01-10 Thread - Edwin
Larry Brown [EMAIL PROTECTED] wrote:
 Also look at empty().  I don't know if the $_POST array will send the 
 key if it as no variable.  I know on a regular post it does send the 
 variable, but it has no value.

What's a regular post anyway?

Well, the key is passed even when there's even though the field might be 
empty.

 I have used isset with just receiving post data and got
 strange results.  On one I had an isset statement that ran a result 
 that

Maybe you can post the code--I'm sure somebody here can fix it...

...[snip]...

 then isset may not always work.

At least not in my experience--it always served its purpose ;)

- E

...[snip]...
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


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




  1   2   >