php-general Digest 22 Nov 2005 17:02:57 -0000 Issue 3809

2005-11-22 Thread php-general-digest-help

php-general Digest 22 Nov 2005 17:02:57 - Issue 3809

Topics (messages 226251 through 226286):

Re: PHP 5.0.5
226251 by: Curt Zirzow
226252 by: Ashley M. Kirchner

Re: security question... man in the middle attacks
226253 by: bruce

Re: Including classes
226254 by: Marco Kaiser

Re: Cookie problem with IE
226255 by: n.g.
226270 by: Kristen G. Thorson
226277 by: Kristen G. Thorson
226279 by: Jay Blanchard
226281 by: Richard Davey

cms type session - how to ?
226256 by: Gregory Machin

GLOB sort order
226257 by: Mark Lucas
226258 by: Georgi Ivanov
226259 by: Jochem Maas

Re: Decision table/business rule parser?
226260 by: Jochem Maas
226262 by: Geoff - Creative Living
226263 by: Jay Blanchard
226266 by: Jochem Maas
226268 by: James Kaufman

calling static methods of variable class names
226261 by: Ahmed Saad
226264 by: Oliver Grätz
226265 by: David Grant
226267 by: Jochem Maas

readdir and mime types
226269 by: Graham Cossey
226271 by: Jay Blanchard
226272 by: Graham Cossey
226273 by: Jay Blanchard
226274 by: Graham Cossey
226275 by: David Grant
226276 by: Jay Blanchard
226278 by: Graham Cossey

can bind but cannot search?
226280 by: Bing Du
226282 by: Bing Du

Re: better way to mix html and php code?
226283 by: Dan Baker

Re: Zend + Eclipse + Standized Framework
226284 by: Jochem Maas

Re: Regex for balanced brackets?
226285 by: Al

Re: Problems with PHP5  phpMyAdmin
226286 by: Russ F

Administrivia:

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

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

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
On Mon, Nov 21, 2005 at 09:41:40PM -0700, Ashley M. Kirchner wrote:
 
Trying to compile APXS version of PHP5.05 and towards the end, when 
 it tries to compile the CLI version, it bombs with the following:
 
 ext/ftp/ftp.lo(.text+0x76): In function `data_close':
 /usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1566: undefined reference 
 to `SSL_shutdown'

This means basically that the header files (*.h) where found but
none of the libraries were found.

You're compile path looks awkward to me.

 
libphp5.so compiles just fine just before this bomb.  Any sugestions 
 anyone?

what does your ./configure line look like?


Curt.
-- 
cat .signature: No such file or directory
---End Message---
---BeginMessage---

Curt Zirzow wrote:


You're compile path looks awkward to me.

   How so?  /usr/local/src/apache is simply a folder where I have all 
apache related sources dumped and compiled prior to installation.  So 
naturally PHP's source becomes /usr/local/src/apache/php-5.0.5



what does your ./configure line look like?
 


   This same configure line compiles PHP4.4.1 just fine.  It's long:

   ./configure --sysconfdir=/etc/httpd/conf --mandir=/usr/share/man 
--with-apxs --enable-force-cgi-redirect --enable-discard-path 
--enable-fastcgi --with-config-file-path=/etc/httpd/conf/ 
--enable-safe-mode --with-exec-dir=/etc/httpd/php --enable-magic-quotes 
--with-zlib=shared --enable-bcmath --with-bz2=shared --enable-calendar 
--with-bcmath=shared --with-calendar=shared --with-jpeg=shared 
--with-tiff=shared --enable-dba --with-dba=shared --with-gdbm=shared 
--with-db4=shared --with-dom=shared --with-dom-xslt=shared 
--with-dom-exslt=shared --enable-ftp --with-gd=shared --with-png=shared 
--with-freetype-dir --enable-gd-native-ttf --with-gettext=shared 
--with-gmp=shared --with-imap=shared --with-kerberos --with-imap-ssl 
--with-mcrypt=shared --with-mime-magic=/etc/httpd/conf/magic 
--with-mysql=/usr --with-ncurses=shared --with-zlib=shared 
--enable-sockets --with-tsrm-pthreads --with-ldap=shared 
--with-openssl=shared --with-mcal=shared


--
R | I haven't lost my mind; it's backed up on tape somewhere.
 +
 Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
 IT Director / SysAdmin / WebSmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.
---End Message---
---BeginMessage---
your questions are on point...

if you're going to really talk about doing transactions... it appears to me
that you really need to solve this. www.passmarksecurity.com claims to have
solved this.. although i'm not sure i agree with them.. for one, i can't
find a thorough independent analysis, for two, from what i can tell... they
rely on the server app getting information from the browser. their approach
appears to depend on their belief that the intermediary 

Re: [PHP] Including classes

2005-11-22 Thread Marco Kaiser
hi,

 Here's what's going on. I have a page which calls itself in a form.
 On this page, I include two classes from other file I've created. On
 load, the page reads the class stuff just fine. If I submit the form
 (call the page again), then the class doesn't like to show any results.

can you post a working example that can show me the problem?

--
Marco Kaiser

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



[PHP] Re: Cookie problem with IE

2005-11-22 Thread n.g.
save below as testcookie.php, request it from your browser twice, what
do you get at 2nd time?
  ?php
   setcookie('sessioncookie', 1);
   setcookie('storedcookie',1,time()+3600);

   var_dump($_COOKIE);
  ?

On 11/22/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
 Anyone have any suggestions?  I'm still stuck.


 thanks,
 kgt



 Kristen G. Thorson wrote:

  I'm having problems with a customer who can't login to a wholesaler
  application.  To ensure the problem was that the cookie was not being
  set, I sent him to this script:
 
  if( !isset( $_REQUEST['page'] ) ) {
   setcookie('VATtest','Cookie has been set.',time()+5, /);
   echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
  } else if( $_REQUEST['page'] == '1' ) {
   if( isset( $_COOKIE['VATtest'] ) ) {
 echo $_COOKIE['VATtest'];
   } else {
 echo 'Cookie NOT set.';
   }
  }
  ?
 
 
  He got Cookie NOT set. which means exactly what it says.  He's using
  IE 6.0, and swears up and down that he's set it to always allow
  cookies from this domain.  I can't verify that he's set it correctly,
  but he has been told twice how to do it.  I also know his browser must
  be saving some cookies, as he is able to login to other sites.  Has
  anyone run into other sources of cookie-blockage in the past?  I
  cannot manage to duplicate this when I have IE set to always allow
  cookies from this domain.
 
  Thanks for any tips,
 
  kgt
 

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




--
Tomorrow will be a good day :-)

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



[PHP] GLOB sort order

2005-11-22 Thread Mark Lucas
Can anyone help me please? I'm not an advanced PHP user!

I'm looing for a way to sort the array returned by the GLOB function. I would
like to be able to sort the result by filemtime.

Any good ideas?

Thanks,

Mark


_



  St John's Church, Polegate - Making Disciples of Jesus Christ

_



This email is intended solely for the addressee and is strictly confidential. 

If you are not the addressee please delete the message from your computer.

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



Re: [PHP] GLOB sort order

2005-11-22 Thread Georgi Ivanov
On Tuesday 22 November 2005 11:41, Mark Lucas wrote:
 Can anyone help me please? I'm not an advanced PHP user!

 I'm looing for a way to sort the array returned by the GLOB function. I
 would like to be able to sort the result by filemtime.

 Any good ideas?

I think you can walk the array returned by glob and create a hash :
$arr=glob(..);
foreach($arr as $file){
$stat=stat($file);
$mtime=$stat[mtime];
$new[$file]=$mtime;
}

Now you should have array like this :
foo.txt = 19879823
foo1.txt = 1987987998
Now you can use array_sort function to sort the new  array.

Good luck.

 Thanks,

 Mark


 ___
__



   St John's Church, Polegate - Making Disciples of Jesus Christ

 ___
__



 This email is intended solely for the addressee and is strictly
 confidential.

 If you are not the addressee please delete the message from your computer.

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



Re: [PHP] GLOB sort order

2005-11-22 Thread Jochem Maas

Georgi Ivanov wrote:

On Tuesday 22 November 2005 11:41, Mark Lucas wrote:


Can anyone help me please? I'm not an advanced PHP user!

I'm looing for a way to sort the array returned by the GLOB function. I
would like to be able to sort the result by filemtime.

Any good ideas?



I think you can walk the array returned by glob and create a hash :
$arr=glob(..);
foreach($arr as $file){


// you can also write this like so, sometimes useful for keeping code
compact and minimizing variable usage:
foreach(glob(/* bla bla */) as $file) {


$stat=stat($file);
$mtime=$stat[mtime];


// don't forget to use quotes!:

$mtime=$stat['mtime'];


$new[$file]=$mtime;
}

Now you should have array like this :
foo.txt = 19879823
foo1.txt = 1987987998
Now you can use array_sort function to sort the new  array.


array_multi_sort() is a slightly different way of doing the same thing,
sometimes handy when you need to be able to switch between different
sort orders:

$mFilesFound = glob(/* bla bla */);
foreach ($mFilesFound as $file) {
$mTimes[] = filemtime($file);
}
array_multisort($mTimes, SORT_DESC, $mFilesFound);




Good luck.


Thanks,

   Mark


___
__



 St John's Church, Polegate - Making Disciples of Jesus Christ

___
__



This email is intended solely for the addressee and is strictly
confidential.

If you are not the addressee please delete the message from your computer.





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



Re: [PHP] Decision table/business rule parser?

2005-11-22 Thread Jochem Maas

Geoff - Creative Living wrote:

Hi

Does anyone know of an open source or commercial php library for parsing
decision tables? Or failing that, a more general business rules parser?
I can't find anything on the usual php script sites.

Unless I'm missing something, this seems to be a gap - in the Java world
there is a wide choice of native solutions.


I don't know if this is really what you are looking for, but I have repeatly
read and investigate the code/idea/writing found here:

http://www.tonymarston.net/php-mysql/workflow.html

if nothing else its a really impressive piece of work in terms of
bringing the subject matter within the grasp of us mere mortals




Geoff Caplan
Creative Living



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



[PHP] calling static methods of variable class names

2005-11-22 Thread Ahmed Saad
hi all,

how can i call static methods of a class whose name is variable.. something like
? $className::doSomething(); // throws a parser error ?
I can do this with reflection by creating a ReflectionMethod object
then invoke()ing it, but is there a better way?
Thanks

-ahmed


Re: [PHP] Decision table/business rule parser?

2005-11-22 Thread Geoff - Creative Living
Hi Mike

 I'm not aware of any. I am kind of developing my own for my current
 Materials System. 

Sounds as though, like me, you might just get away with a decision table
parser rather than a fully-fledged corporate rules engine. though your
application is a bit more complex than ours. 

It's surprising to me that we are faced with rolling our own or working
with Java - suggests that PHP still has a bit to go as a platform for
serious business systems.

 With jBPM I hope I'll be able to change routing/approval of
 electronic documents more easily than it is currently.
 
Are you planning to have PHP run as a servelet within JBoss? Does this
work reliably? I much prefer to keep things as simple as possible.

As an alternative, I worked briefly on a native PHP Petri-net workflow
engine with a guy called Tony Marston before we parted ways. He has
written it up here:

http://www.tonymarston.net/php-mysql/workflow.html



Geoff Caplan
Creative Living
Direct: 0121 515 1154
General: 01803 840 607

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



RE: [PHP] Decision table/business rule parser?

2005-11-22 Thread Jay Blanchard
[snip]
It's surprising to me that we are faced with rolling our own or working
with Java - suggests that PHP still has a bit to go as a platform for
serious business systems.
[/snip]

The lack of a decision table/business rule parser does not suggest that PHP
has a way to go as a platform for serious business, as many serious
businesses will attest to. What it does suggest is that no one has had the
need or opportunity to construct one in PHP.

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



[PHP] Re: calling static methods of variable class names

2005-11-22 Thread Oliver Grätz
Ahmed Saad schrieb:
 hi all,
 
 how can i call static methods of a class whose name is variable.. something 
 like
 ? $className::doSomething(); // throws a parser error ?
 I can do this with reflection by creating a ReflectionMethod object
 then invoke()ing it, but is there a better way?
 Thanks
 
 -ahmed

For

$args=array('para1','para2');

use

call_user_func(array($className,'doSomething'),$args[0],$args[1]);

or

call_user_func_array(array($className,'doSomething'),$args);


Have Fun!
OLLi

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



Re: [PHP] calling static methods of variable class names

2005-11-22 Thread David Grant
Ahmed,

call_user_func(array($className, 'doSomething'));

Cheers,

David Grant

Ahmed Saad wrote:
 hi all,
 
 how can i call static methods of a class whose name is variable.. something 
 like
 ? $className::doSomething(); // throws a parser error ?
 I can do this with reflection by creating a ReflectionMethod object
 then invoke()ing it, but is there a better way?
 Thanks
 
 -ahmed

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



Re: [PHP] Decision table/business rule parser?

2005-11-22 Thread Jochem Maas

Geoff - Creative Living wrote:

Hi Mike



I'm not aware of any. I am kind of developing my own for my current
Materials System. 



Sounds as though, like me, you might just get away with a decision table
parser rather than a fully-fledged corporate rules engine. though your
application is a bit more complex than ours. 


It's surprising to me that we are faced with rolling our own or working
with Java - suggests that PHP still has a bit to go as a platform for
serious business systems.



With jBPM I hope I'll be able to change routing/approval of
electronic documents more easily than it is currently.


 
Are you planning to have PHP run as a servelet within JBoss? Does this

work reliably? I much prefer to keep things as simple as possible.

As an alternative, I worked briefly on a native PHP Petri-net workflow
engine with a guy called Tony Marston before we parted ways. He has
written it up here:

http://www.tonymarston.net/php-mysql/workflow.html


guess I didn't have to point you at that then ;-)





Geoff Caplan
Creative Living
Direct: 0121 515 1154
General: 01803 840 607



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



Re: [PHP] calling static methods of variable class names

2005-11-22 Thread Jochem Maas

Ahmed Saad wrote:

hi all,

how can i call static methods of a class whose name is variable.. something like
? $className::doSomething(); // throws a parser error ?
I can do this with reflection by creating a ReflectionMethod object
then invoke()ing it, but is there a better way?


try call_user_func() and/or call_user_func_array()

e.g.

call_user_func( array($className, 'doSomething') );

the array passed in this case is how one tells php the callback
function you are handing it is a class+method, you can also use this
callback notation to pass in an object+method.


Thanks

-ahmed


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



Re: [PHP] Decision table/business rule parser?

2005-11-22 Thread James Kaufman
On Tue, Nov 22, 2005 at 02:49:41PM +0100, Jochem Maas wrote:
 Geoff - Creative Living wrote:
 Hi Mike
 
 As an alternative, I worked briefly on a native PHP Petri-net workflow
 engine with a guy called Tony Marston before we parted ways. He has
 written it up here:
 
 http://www.tonymarston.net/php-mysql/workflow.html
 
 guess I didn't have to point you at that then ;-)
 
 
 
 Geoff Caplan
 Creative Living

I wrote to Tony a couple of months ago and he said that his workflow code might
be available someday, but wasn't available currently. His ideas are published
on his website, but only code snippets.

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619
CCNA, CISSP# 65668

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



[PHP] readdir and mime types

2005-11-22 Thread Graham Cossey
I'm attempting to read a list of files in a directory using readdir()
but am having problems with mpeg files not seemingly being read.

Cope snippet:

$count = 0;
while (false !== ($file = readdir($open_dir)))
{
if ($file != '.'  $file != '..')
{
if (file_exists($VID_DIR/$file))
{
$count++;

$count counts any 'avi' files but not 'mpg' files.

Any suggestions much apreciated.

--
Graham

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



Re: [PHP] Re: Cookie problem with IE

2005-11-22 Thread Kristen G. Thorson

n.g. wrote:


save below as testcookie.php, request it from your browser twice, what
do you get at 2nd time?
 ?php
  setcookie('sessioncookie', 1);
  setcookie('storedcookie',1,time()+3600);

  var_dump($_COOKIE);
 ?

On 11/22/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
 


Anyone have any suggestions?  I'm still stuck.


thanks,
kgt



Kristen G. Thorson wrote:

   


I'm having problems with a customer who can't login to a wholesaler
application.  To ensure the problem was that the cookie was not being
set, I sent him to this script:

if( !isset( $_REQUEST['page'] ) ) {
setcookie('VATtest','Cookie has been set.',time()+5, /);
echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
if( isset( $_COOKIE['VATtest'] ) ) {
  echo $_COOKIE['VATtest'];
} else {
  echo 'Cookie NOT set.';
}
}
?


He got Cookie NOT set. which means exactly what it says.  He's using
IE 6.0, and swears up and down that he's set it to always allow
cookies from this domain.  I can't verify that he's set it correctly,
but he has been told twice how to do it.  I also know his browser must
be saving some cookies, as he is able to login to other sites.  Has
anyone run into other sources of cookie-blockage in the past?  I
cannot manage to duplicate this when I have IE set to always allow
cookies from this domain.

Thanks for any tips,

kgt

 

 



Request from MY browser?  I get

array(2) { [sessioncookie]= string(1) 1 [storedcookie]= 
string(1) 1 }


This isn't a problem in my browser, however.  I don't want to keep 
sending this customer to random scripts, so can you explain the point of 
this script?  I mean, in what way might this help me figure out why his 
browser is not setting a cookie?



thanks,

kgt

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



RE: [PHP] readdir and mime types

2005-11-22 Thread Jay Blanchard
[snip]
I'm attempting to read a list of files in a directory using readdir()
but am having problems with mpeg files not seemingly being read.

Cope snippet:

$count = 0;
while (false !== ($file = readdir($open_dir)))
{
if ($file != '.'  $file != '..')
{
if (file_exists($VID_DIR/$file))
{
$count++;

$count counts any 'avi' files but not 'mpg' files.
[/snip]

Without seeing the rest of the code I am going to assume that $open_dir is
the handle for the directory the files are in. Given that, why would you
specify a directory in your file_exists function? I am unsure why
file_exists would be necessary at this point. Eliminate that condition and
see what the results are

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



Re: [PHP] readdir and mime types

2005-11-22 Thread Graham Cossey
On 11/22/05, Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
 I'm attempting to read a list of files in a directory using readdir()
 but am having problems with mpeg files not seemingly being read.

 Cope snippet:

 $count = 0;
 while (false !== ($file = readdir($open_dir)))
 {
 if ($file != '.'  $file != '..')
 {
 if (file_exists($VID_DIR/$file))
 {
 $count++;

 $count counts any 'avi' files but not 'mpg' files.
 [/snip]

 Without seeing the rest of the code I am going to assume that $open_dir is
 the handle for the directory the files are in. Given that, why would you
 specify a directory in your file_exists function? I am unsure why
 file_exists would be necessary at this point. Eliminate that condition and
 see what the results are

Yes $open_dir is the handle from opendir().

The file_exists is simply checking for an associated file elsewhere as
I'm looking for video files and thumbnails.

As I said, this works fine for avi suffixed files but not mpg or mpeg
suffixed files.

--
Graham

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



RE: [PHP] readdir and mime types

2005-11-22 Thread Jay Blanchard
[snip]
Yes $open_dir is the handle from opendir().

The file_exists is simply checking for an associated file elsewhere as
I'm looking for video files and thumbnails.

As I said, this works fine for avi suffixed files but not mpg or mpeg
suffixed files.
[/snip]

Make sure to always hit reply-all, or the e-mail will not go back to the
list.

If file exists is looking for an associated files is it probable that the
.mpg files do not have one associated with it in the other directory?

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



Re: [PHP] readdir and mime types

2005-11-22 Thread Graham Cossey
[snip]
 Make sure to always hit reply-all, or the e-mail will not go back to the
 list.

Yep, realised that after hitting 'send'. :-(

 If file exists is looking for an associated files is it probable that the
 .mpg files do not have one associated with it in the other directory?

It is probable, that's why the check is there, but in this case the
associated file(s) definitely does exist. If I simply change the file
extensions from mpg to avi the script works.


--
Graham

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



Re: [PHP] readdir and mime types

2005-11-22 Thread David Grant
Graham,

Is safe mode enabled in your config file?  If safe mode is on, PHP will
check the file to ensure it is owned by the same user executing the
script.  If this condition fails, file_exists() will not work on the file.

http://php.net/file_exists
http://php.net/manual/en/features.safe-mode.php

Cheers,

David Grant

Graham Cossey wrote:
 [snip]
 Make sure to always hit reply-all, or the e-mail will not go back to the
 list.
 
 Yep, realised that after hitting 'send'. :-(
 
 If file exists is looking for an associated files is it probable that the
 .mpg files do not have one associated with it in the other directory?
 
 It is probable, that's why the check is there, but in this case the
 associated file(s) definitely does exist. If I simply change the file
 extensions from mpg to avi the script works.
 
 
 --
 Graham
 

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



RE: [PHP] readdir and mime types

2005-11-22 Thread Jay Blanchard
[snip]
 If file exists is looking for an associated files is it probable that the
 .mpg files do not have one associated with it in the other directory?

It is probable, that's why the check is there, but in this case the
associated file(s) definitely does exist. If I simply change the file
extensions from mpg to avi the script works.
[/snip]

Try this simple example and see what is output...

if ($handle = opendir('/path/to/files')) {
   while (false !== ($file = readdir($handle))) {
   if ($file != .  $file != ..) {
   echo $file\n;
   }
   }
   closedir($handle);
}

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



Re: [PHP] Cookie problem with IE

2005-11-22 Thread Kristen G. Thorson

Jay Blanchard wrote:


But I sure would like to see the URL once he has clicked it. Have you tried
changing to $_GET['page']? Again, all of this is just for gigglesbut
there is likely to be a clue.

On privacy policies in IE (can he try another browser?) what is his setting?

 





I'm still waiting on definitive word as to what exactly his privacy 
settings are.  In my experiments, manually setting IE to Always Allow 
or Always Block cookies for a domain will completely override privacy 
settings.  I've had IE privacy set to allow no cookies, and manually 
added the domain to Always Allow and this overrode the no cookies setting.


For kicks and giggles, I changed $_REQUEST to $_GET, but he reported no 
difference.  Again, I don't see this as being the problem, since if it 
were so, he'd get no output at all instead of Cookie NOT set.  I'm 
quite convinced this is a matter of his cookie simply not being set.  He 
is not able to ever see a cookie for this domain in his temp internet 
files folder, though he tells us there are other cookies there.


I wish I could tell him to just use another friggin browser, but it 
would be nice to fix it so he can use the one he wants, no matter what 
words one can say about his choice. ;)


I have not looked into it, but do some internet security apps like 
Norton try to block certain cookies?  I've not come across this, as I 
don't really use those programs, but right now I'm grasping for straws.


thanks for the help so far,
kgt

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



Re: [PHP] readdir and mime types

2005-11-22 Thread Graham Cossey
[snip all]

OK, of course it's my fault !!  :o

My directory variables are using relative paths and I was trying to
access the parent directory from the sub-directory but not using '..'

Sorry.

Thanks for your help.

--
Graham

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



RE: [PHP] Cookie problem with IE

2005-11-22 Thread Jay Blanchard
[snip]
I have not looked into it, but do some internet security apps like 
Norton try to block certain cookies?  I've not come across this, as I 
don't really use those programs, but right now I'm grasping for straws.
[/snip]

Certain anti-virus/spyware programs can and do block cookies and can be very
specific. Do you know if he is using something loike that? If so, can you
determine the settings?

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



[PHP] can bind but cannot search?

2005-11-22 Thread Bing Du

Hello all,

The following script returns 'search failed...' after 'LDAP bind 
successful...'.


==
?php

$ldaprdn = CN=John Smith,OU=Users,DC=Coll,DC=some,DC=edu;
$ldappass = passwd;

$ds=ldap_connect(ad.coll.some.edu);

if ($ds) {
   echo Binding ...br /;
   $r=ldap_bind($ds, $ldaprdn, $ldappass);

   if ($r) {
   echo LDAP bind successful...br /;
   } else {
   echo LDAP bind failed...br /;
   exit;
   }

   $filter = (sAMAccountName=jsmith);
   $base = DC=Coll,DC=some,DC=edu;

   $sr=ldap_search($ds, $base, $filter);

   if ($sr)
   {
 echo Search result is  . $sr . br /;
   } else {
 echo search failed...br /;
  }
}
?
==

However, the following ldapsearch returns the result fine.

% ldapsearch -h ad.coll.some.edu -s sub -b dc=coll,dc=some,dc=edu -x 
-D 'CN=John Smith,OU=Users,DC=Coll,DC=some,DC=edu' -W 
samaccountname=jsmith


I'm in dark now and don't know where to look for more information on why 
  ldap_search did not work.  I'd appreciate any help.


Bing

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



Re[2]: [PHP] Cookie problem with IE

2005-11-22 Thread Richard Davey
Hi Kristen,

Tuesday, November 22, 2005, 3:21:31 PM, you wrote:

 I have not looked into it, but do some internet security apps like
 Norton try to block certain cookies? I've not come across this, as I
 don't really use those programs, but right now I'm grasping for
 straws.

Yes they do - I replied to your original message to this mailing list
saying exactly that. I will copy it again:

What about third party software? Norton for example has cookie
features that will totally over-ride any IE setting with regards to
blocking them, etc. It's not the only one.

Ok, so not much detail - but you get the drift!

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



[PHP] Re: can bind but cannot search?

2005-11-22 Thread Bing Du

Bing Du wrote:

Hello all,

The following script returns 'search failed...' after 'LDAP bind 
successful...'.


==
?php

$ldaprdn = CN=John Smith,OU=Users,DC=Coll,DC=some,DC=edu;
$ldappass = passwd;

$ds=ldap_connect(ad.coll.some.edu);

if ($ds) {
   echo Binding ...br /;
   $r=ldap_bind($ds, $ldaprdn, $ldappass);

   if ($r) {
   echo LDAP bind successful...br /;
   } else {
   echo LDAP bind failed...br /;
   exit;
   }

   $filter = (sAMAccountName=jsmith);
   $base = DC=Coll,DC=some,DC=edu;

   $sr=ldap_search($ds, $base, $filter);

   if ($sr)
   {
 echo Search result is  . $sr . br /;
   } else {
 echo search failed...br /;
  }
}
?
==

However, the following ldapsearch returns the result fine.

% ldapsearch -h ad.coll.some.edu -s sub -b dc=coll,dc=some,dc=edu -x 
-D 'CN=John Smith,OU=Users,DC=Coll,DC=some,DC=edu' -W 
samaccountname=jsmith


I'm in dark now and don't know where to look for more information on why 
  ldap_search did not work.  I'd appreciate any help.


Bing


I've figured out.  Adding 'ldap_set_option($ds, 
LDAP_OPT_PROTOCOL_VERSION, 3);' right after ldap_connect fixed the problem.


Bing

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



[PHP] Re: Re: Re: Re: better way to mix html and php code?

2005-11-22 Thread Dan Baker
Robert Cummings [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 I am interested in how this works, but am skeptical.

 No problem, the programming in X template instead of programming in
 PHP objection is raised often. I've given previous arguments about the
 merits of templates and concise data retrieval, display logic versus
 business logic, and meta tags versus traditional tags. Everything done
 in TemplateJinn can be done in PHP, absolutely since templates compile
 to PHP pages, but templates provide a layer between the soup of PHP
 necessary to accomplish that, and the designer. Even as a developer I
 don't want to engage in the soup necessary to accomplish everything
 TemplateJinn now does for me -- unfortunately I maintain some sites that
 do employ the soup system.

Thank you for the time and effort of explaining this.  It sounds 
fascinating, and worthy of investigating.
I will spend some time looking into this.

Thanks again.
DanB

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



Re: [PHP] Re: Zend + Eclipse + Standized Framework

2005-11-22 Thread Jochem Maas

Roman Ivanov wrote:

Greg Donald wrote:

Maybe Zend will get it right where all the previous attempts I've 
seen/used are less than great.



Personally, I would start creation of PHP framework by cleaning up PHP 
sytax. It's freakin' impossible to make complex OOP clean:


there is plenty wrong with php, but none of your comments are
even vaguely relevant.

btw you can 'clean up the syntax' - just don't expect it
to ever make it into the official build.



$this-output(array('dir', 'template'), new BlaBla($this-bla));


this is supposed to prove what exactly? apart from the fact that OO in
php is not something you are very familiar with, for starters if you
want to do OO in php these days you should be using php5 (assuming you
don't have a mountain of existing php4 OO code you have to work with -
if you do then moaning about syntax is completely pointless... php4 is
is 'bugfix only')

the '' sign for passing objects around in php5 is unnecessary because objects
are always passed around as references. and if you really know that you
need a reference to a reference you skill level should at the very least
be such that 'freakin' impossible' is not relevant at all.





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



[PHP] Re: Regex for balanced brackets?

2005-11-22 Thread Al

Jeffrey Sambells wrote:

I came across this method of matching brackets with regex in .NET

http://puzzleware.net/blogs/archive/2005/08/13/22.aspx

but I am wondering if it is possible to do the same in PHP?

I've tried it a bit but I can't seem to get it to work properly. I'm  
just wondering if I am doing something wrong or if it is just not  
possible.


Thanks.

here is the code I was playing with:

?php

$pattern = PATTERN
\{
(?
[^{}]+
|
\{ (?PDEPTH)
|
\} (?P-DEPTH)
)*
(?(DEPTH)(?!))

\}
PATTERN;

$subject = SUBJECT
test {
test2 {
test3
}
}

test4
{

}
SUBJECT;


preg_match_all(/$pattern/ix,$subject,$matches);

header(content-type: text/plain; );

var_dump($matches);

?


- Jeff



~~
Jeffrey Sambells
Director of Research and Development
Zend Certified Engineer (ZCE)

We-Create Inc.
[EMAIL PROTECTED] email
519.745.7374 office
519.897.2552 mobile

~~
Get Mozilla Firefox at
http://spreadfirefox.com


If I'm understanding what you want, consider this.  I use it to check matching 
tags.

First get an array of all the start tags:

$pattern= %([^/][a-z_\-]*)%i;   //all start tags used xxx

preg_match_all($pattern, $text_str, $matches);

$start_tags= $matches[1];

$start_tag_nums= array_count_values($start_tags);   //get count for each tag

Then do the same for your end tags, using the same pattern but with the end tag 
slash. /

Finally, you make a text list of the mismatches:

foreach($start_tag_nums as $tag= $num){

if($num != $end_tag_nums[$tag]) $end_error_msg .= lt;$taggt; || ;

}//end foreach

echo $end_error_msg;

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



Re: [PHP] Problems with PHP5 phpMyAdmin

2005-11-22 Thread Russ F
Curt Zirzow wrote:

 On Fri, Nov 18, 2005 at 12:07:00PM -0800, Russ F wrote:
 I've reinstalled Apache2, PHP5, phpMyAdmin and MYSQl several times. I
 still get the same error when i try to use phpmyadmin Can not load mysql
 extensions. I checked the path it is correct, the extensions exist
 in /etc/php5/extensions but they do not have a .so after them. The
 php.ini file and config files appear correct from a server setup. I read
 you need to put a loadmodule statement in httpd but am not sure when. The
 script says not to modify this file, put mods in /etc/sisconfig. But I'm
 not sure where as there are no loadmod commands in the scripts. My
 authorities all appear correct.
 
 Can anyone poiny me to the right configuration file.
 
 How you install all of apache2, php5, phpMyAdmin and Mysql all
 matters on what file to edit.  With your extension dir existing in
 /etc/php5/extension, i would assume you insalled via some package
 system.
 
 With out any of the information, it will be hard to help.
 
I installed all packages with SUSE 10.0 YaST rpms. I installed earlier
versions on SuSE 9.1 from rpms with no problems. After install I changed
mysql to run as user mysql. add root and damon to the group mysql. SuSe has
added stems in the install that (When I start the mysql server) that change
the my sql permisions. 

I recently uninstall php5 and went back to php4. The .so files are now
installed but I get a message now that access is denied when I try using my
browser running as root:  

http://localhost/phpMyAdmin/. 

I've configured php.ini and config.inc.php correctly I think. I can manually
get to mysql from the command line as root with no problem. I'm almost
certain its a permissions problem but I'm not sure where. 

/srv/www/htdocs
drwxr-xr-x   6 rootroot  3000 2005-11-21 17:25 phpMyAdmin

/srv/www/htdocs/phpMyAdmin
-rw-rw-r--  1 root root  38826 2005-11-21 17:25 config.inc.php

I can either reinstall php5 or stay with php4 as long as I get this working.
You help will be greatly appreciated.

Thanks

Russ

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



Re: [PHP] Problems with PHP5 phpMyAdmin

2005-11-22 Thread Russ F
Curt Zirzow wrote:

 On Fri, Nov 18, 2005 at 12:07:00PM -0800, Russ F wrote:
 I've reinstalled Apache2, PHP5, phpMyAdmin and MYSQl several times. I
 still get the same error when i try to use phpmyadmin Can not load mysql
 extensions. I checked the path it is correct, the extensions exist
 in /etc/php5/extensions but they do not have a .so after them. The
 php.ini file and config files appear correct from a server setup. I read
 you need to put a loadmodule statement in httpd but am not sure when. The
 script says not to modify this file, put mods in /etc/sisconfig. But I'm
 not sure where as there are no loadmod commands in the scripts. My
 authorities all appear correct.
 
 Can anyone poiny me to the right configuration file.
 
 How you install all of apache2, php5, phpMyAdmin and Mysql all
 matters on what file to edit.  With your extension dir existing in
 /etc/php5/extension, i would assume you insalled via some package
 system.
 
 With out any of the information, it will be hard to help.
 
Sorry I forgot this error message:

Welcome to phpMyAdmin 2.6.3-pl1

 
  
Error
MySQL said: Documentation 
 #2002 - The server is not responding (or the local MySQL server's socket is
not correctly configured) 

I 've tried most of the recommendations I could find by googling. Still get
this message.
-- 
Russ

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



[PHP] how to exist within the context?

2005-11-22 Thread Bing Du

Hi,

One webpage has its banner, left menu and footer ect that are controled 
by the template.  I want this php script to output the form and 
processing result within the page structure.  Without exit, if the 
'yourname' field is empty, the script would output 'Please enter your 
name!' fine within the page structure (that is, banner, menu and footer 
are all there).  But obviously the script does not terminate as it's 
supposed to.  With exit, the script terminates fine, but it outputs the 
result in a page without banner, menu and footer.  So what's the correct 
way to get the script stop and output its results always in the page 
structure.


form method=post
input name=yourname type=text size=20
input name=submit type=submit value=submit
/form

?php

$submit = $_POST['submit'];
$name = $_POST['yourname'];

if ($submit)
{
   if ($name==)
  {
print Please enter your name!;
//exit;
  }
}

echo Continue processing...;
?

Thanks in advance,

Bing

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



Re: [PHP] how to exist within the context?

2005-11-22 Thread David Grant
Hi,

Try this:

?php
$submit = $_POST['submit'];
$name = $_POST['yourname'];

if ($submit)
{
   do {
   if ($name==)
   {
 print Please enter your name!;
 break;
   }
   } while (0);
}
echo Continue processing...;
?

It's a hack, but it works.

Cheers,

David Grant

Bing Du wrote:
 Hi,
 
 One webpage has its banner, left menu and footer ect that are controled
 by the template.  I want this php script to output the form and
 processing result within the page structure.  Without exit, if the
 'yourname' field is empty, the script would output 'Please enter your
 name!' fine within the page structure (that is, banner, menu and footer
 are all there).  But obviously the script does not terminate as it's
 supposed to.  With exit, the script terminates fine, but it outputs the
 result in a page without banner, menu and footer.  So what's the correct
 way to get the script stop and output its results always in the page
 structure.
 
 form method=post
 input name=yourname type=text size=20
 input name=submit type=submit value=submit
 /form
 
 ?php
 
 $submit = $_POST['submit'];
 $name = $_POST['yourname'];
 
 if ($submit)
 {
if ($name==)
   {
 print Please enter your name!;
 //exit;
   }
 }
 
 echo Continue processing...;
 ?
 
 Thanks in advance,
 
 Bing
 

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



RE: [PHP] how to exist within the context?

2005-11-22 Thread Jay Blanchard
[snip]
form method=post
input name=yourname type=text size=20
input name=submit type=submit value=submit
/form

?php

$submit = $_POST['submit'];
$name = $_POST['yourname'];

if ($submit)
{
if ($name==)
   {
 print Please enter your name!;
 //exit;
   }
}

echo Continue processing...;
?
[/snip]

You have to POST the value back to the form. This is one of the harder
concepts to grasp when programming in a stateless environment;

?php
if(!isset($_POST['yourname'])){
   $theNameValue = 'Please enter your name';
} else {
   $theNameValue = $_POST['yourname'];
}
?

form action=?php echo $PHP_SELF; ?method=post
input name=yourname type=text size=20 value=?php echo
$_POST['yourname']; ?
input name=submit type=submit value=submit
/form

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



[PHP] Re: username format when binding to Active Directory?

2005-11-22 Thread Bing Du

Bing Du wrote:


Hello,

The following script returns 'LDAP bind failed...'.

?php
echo Connecting ...br /;

$ldaprdn = [EMAIL PROTECTED];
$ldappass = jsmithpass;

$ds=ldap_connect(ad.dept.some.edu);

if ($ds) {
   echo Binding ...br /;
   $r=ldap_bind($ds, $ldaprdn, $ldappass);

   if ($r) {
   echo LDAP bind successful...br /;
   } else {
   echo LDAP bind failed...br /;
   }
} else {
 echo LDAP connection failed...br /;
   }

?

If I change $ldaprdn to be CN=John 
Smith,OU=Users,OU=DEPT,DC=some,DC=edu, then bind returns 'LDAP bind 
successful...'.


However AD supports username to be in [EMAIL PROTECTED] format 
because querying from the command line works:


% ldapsearch -h ad.dept.some.edu -s sub -b dc=dept,dc=some,dc=edu -x 
-D [EMAIL PROTECTED] -W samaccountname=jsmith


Our AD only allows authenicated bindings.  We don't know user's DN 
before binding.  So anybody know how to make PHP allow 
$ldaprdn=[EMAIL PROTECTED]?


Thanks in advance,

Bing


Ok, I've figured it out again.  Removing the '\' in 
$ldaprdn=[EMAIL PROTECTED]' fixed the problem.  I thought it should 
be escaped.  But looks like it's not necessary.


Bing

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



Re: [PHP] how to exist within the context?

2005-11-22 Thread Bing Du

Thanks for the help.  But I still got:

Please enter your name! Continue processing...

What I want is if no name is entered, only 'Please enter your name!' 
should be returned.


Bing

David Grant wrote:


Hi,

Try this:

?php
$submit = $_POST['submit'];
$name = $_POST['yourname'];

if ($submit)
{
   do {
   if ($name==)
   {
 print Please enter your name!;
 break;
   }
   } while (0);
}
echo Continue processing...;
?

It's a hack, but it works.

Cheers,

David Grant

Bing Du wrote:


Hi,

One webpage has its banner, left menu and footer ect that are controled
by the template.  I want this php script to output the form and
processing result within the page structure.  Without exit, if the
'yourname' field is empty, the script would output 'Please enter your
name!' fine within the page structure (that is, banner, menu and footer
are all there).  But obviously the script does not terminate as it's
supposed to.  With exit, the script terminates fine, but it outputs the
result in a page without banner, menu and footer.  So what's the correct
way to get the script stop and output its results always in the page
structure.

form method=post
input name=yourname type=text size=20
input name=submit type=submit value=submit
/form

?php

$submit = $_POST['submit'];
$name = $_POST['yourname'];

if ($submit)
{
  if ($name==)
 {
   print Please enter your name!;
   //exit;
 }
}

echo Continue processing...;
?

Thanks in advance,

Bing



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



[PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Eric
I would like to have some assistance in debugging php. It's about a bug in
php not a script of mine.

I can't post a bug report as I do not exactly know why my code is
suffering from a php bug. It's related to a very complex objects-model
where objects, cross-referenced, wake up from a session. (note, these are
cross-references, not circular, all circular (parent - child) references
are unset before the objects are serialized)

During the wake up sequence, somehow, a not directly related object
variable, gets unset. However, this only occurs under very specific
circumstances. While I do not know what exact variables contribute to this
bug, I can consistantly reproduce it.

Fun-fact: I installed ZendPlatform to debug my script in order to rule out
any mistakes of my making. With ZendPlatform the object variable doesn't get
unset anymore, however, a specific value of an other object, related to the
issue appears to leak into another variable. Now I started to debug the code
with ZendPlatform/-Studio to try to watch when the leak occured, however,
httpd segfaults on debugging the script. All scripts appear to debug just
fine, accept this one, under these specific circumstances

This is globally what happens. If you're insterested in this issue,
willing to help me and if you think yourself to be cappable of helping me.
Please contact me by responding to this post or contact me directly:

Email/MSN:ericvanblokland 'AT' gmail.com
Skype:footsteps_eric

Thank you in advance and kind regards,
Eric van Blokland

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



RE: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Jay Blanchard
[snip]
This is globally what happens. If you're insterested in this issue,
willing to help me and if you think yourself to be cappable of helping me.
Please contact me by responding to this post or contact me directly:
[/snip]

There are several on this list who are willing and capable of helping. Put
it out here on the list, you'll get a better response. Let's see the code.

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



Re: [PHP] Re: Zend + Eclipse + Standized Framework

2005-11-22 Thread Roman Ivanov

Jochem Maas wrote:
 Roman Ivanov wrote:

 Greg Donald wrote:

 Maybe Zend will get it right where all the previous attempts I've
 seen/used are less than great.



 Personally, I would start creation of PHP framework by cleaning up PHP
 sytax. It's freakin' impossible to make complex OOP clean:


 there is plenty wrong with php, but none of your comments are
 even vaguely relevant.

 btw you can 'clean up the syntax' - just don't expect it
 to ever make it into the official build.

This comment is irrelevant. If I can install recompiled PHP on the 
machine, than I can install any other scripting engine with less hustle.


 $this-output(array('dir', 'template'), new BlaBla($this-bla));


 this is supposed to prove what exactly?

Examples illustrate, they do not have to prove anything.

 apart from the fact that OO in
 php is not something you are very familiar with for starters if you
 want to do OO in php these days you should be using php5 (assuming you
 don't have a mountain of existing php4 OO code you have to work with -
 if you do then moaning about syntax is completely pointless... php4 is
 is 'bugfix only')

This whole paragraph amounts to OMG, you're lame, so STFU. It has 
nothing to do with issues of PHP syntax.


 the '' sign for passing objects around in php5 is unnecessary because
 objects are always passed around as references.

Fair enough.

$this-output(array('dir', 'template'), new BlaBla($this-bla));

So PHP 5 eliminates 1 (one) character from _this particular example_.

 and if you really know that you
 need a reference to a reference you skill level should at the very least
 be such that 'freakin' impossible' is not relevant at all.

Another personal attack, plus you take my words out of context. The 
original statement was:  It's freakin' impossible to make complex OOP 
clean. You did not disprove it in any way.


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



[PHP] Re: Can't execute external program

2005-11-22 Thread Henry Castillo
That was on of the first things I checked:
safe mode is set to off
 Any ideas...
Henry
  Voip tech said the following on 11/20/2005 10:31 PM:
 Hello,
 I cannot get exec(), system() or passthru() to run an extenal program.
 From the command line it runs perfectly:

snip

 I'm getting frustrated, Any help will be deeply appreciated
 Henry

The answer is probably in your php.ini. Look into whether you are
running in safe mode or not, and if you are whether you have your
program in the safe_mode_exec_dir or not. Also check disable_functions
to see if any of the ones you are having trouble with are listed.

- Ben


Re: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Eric
That's just one of the problems, it's about a project with over tens of
thousands lines of code. As I said before, I don't know whats the exact
cause. There are so many variables that contribute to this issue and of most
of them I don't understand why they contribute. However, I'm convinced the
php compiler screws up really bad. Now I have to find out why it screws
up, to be able to file a complete bug-report or to find a work around.

As posting code isn't an option I will try to explain the issue more
thoroughly, tomorrow, I'll discuss the possibility of access to one of our
development servers with my employer.

A more thorough explanation:

As I said before, I have a very complex model of objects. First, I will
describe the piece of the model thats involved and how it works.

We have object A, B and C, they are children of each other in this order
Also we have property objects P1, P2 and PX P1 handles textbased property
changes, P2 and PX represent other types of properties, which types is not
interesting, the way they handle input is the same as defined in the parent
class P, the only difference is how they visually represent theirselfs.

Object A has properties:
(int) status
(array) properties
(object) B

Object B has properties:
(string) title
(array) properties
(object) C

Object C has properties:
(array) properties

Each object as a properties array. These arrays contain the objects P1, P2
and/or PX. When object A and B wakeup (in reversed order ofcourse) they both
call a function, giving themselve ($this) as parameter. This function,
checks the P-objects in the properties array, for changed values. If a value
is changed, the function will change the value on the object.

For example:
Object B has a P1 property with the name title in it's properties array.
The P1 object get's on wakeup a new value from $_POST or whatever, puts this
value in it's value property and sets it's changed flag.
Now Object B wakes up and calls the function, this functions loops through
the properties array and sees the P1 object with name title has it's
changed flag set. Now, the function copies the value from the P1 object to
the title property of Object B

So far so good, no errors there however, I'm doing some strange to the
model, call me stupid, but it just was de easiest way to fix this as Object
C handles to visual representation:

Object A has a PX object for it's state
Object B has a P1 object for it's title
Object C doesn't have any property objects (yet, perhaps future types of C
will)

Now Object B has set its C child and want C to have it's parental
properties so they can be displayed.
Object B creates references in the properties array of C to all the
properties of A and B, this is no problem as Object C doens't call the
function on wakeup so it won't do anything with the properties values and
even if it did, I really wouldn't care if C's nonexisting state or title
got set.

This all still works fine.

Now, Object B get's a new property of type P2, Object B doesn't care about
it's value, but has to initially set it. After it's set you might see P2 as
a read-only property object.
Still no issue, the P2 object is nicely, visually represented and we don't
care if it's value would change, Object B doesn't use a property with the P2
object name.

I repeated this trick and added another P2 object. Everything seemed fine
but then, when the P1 title object from Object B got it's value changed, an
error was generated: Object A noticed it's state property object PX
doens't exist and tries to add a new one to it's properties array. However,
this is no longer an array (which generated the error in the first place).
Objects B title get's changed correctly. My prove for php screwing up is the
following:

I never, reset the properties array, I just don't (which is proven by
ZendPlatform)

seccond: my error handler, displays backtraces of errors, and the backtrace
just didn't make sense. I have a helper function to add property objects
to the properties array of objects, the error was generated in this
function. De backtrace gave me a correct line-number for the error, a
correct filename for the error, but an incorrect function name, it repeated
the Object A function instead of showing the name of helper function.

Third: The issue seems only to occur when P1 changes and that magical third
property is of type P2 (that the 2nd property is also P2 doesn't seem to
mather also their order don't mather) and the name of this third property
contains something like keyword. (original name ssl_keywords but
keyword and even keywoord caused an error while key didn't) (when
using ZendPlatform, the name of the key doesn't matter anymore, the new
value of the P1 object title seems to leak into another not related array
and everything else seems to work fine. However, this script, with these
parameters can't be debugged with ZendPlatform, as httpd will segfault, all
other scripts, even this, without that title parameter debug just fine)


RE: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Jay Blanchard
[snip]
If anyone is still interested in helping me, please let me know, tell me
what you need, what you intend to check, a guess about the cause of the
issue?
[/snip]

Give us an example of the code where it breaks and also any error messages.
That will give us a starting point.

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



Re: [PHP] how to exist within the context?

2005-11-22 Thread Bing Du
Ummm...  but I don't see how that is related to my exit problem.  Any 
pointers for me to learn more about it?  Thanks much for the help.


Bing

Jay Blanchard wrote:


[snip]
form method=post
input name=yourname type=text size=20
input name=submit type=submit value=submit
/form

?php

$submit = $_POST['submit'];
$name = $_POST['yourname'];

if ($submit)
{
if ($name==)
   {
 print Please enter your name!;
 //exit;
   }
}

echo Continue processing...;
?
[/snip]

You have to POST the value back to the form. This is one of the harder
concepts to grasp when programming in a stateless environment;

?php
if(!isset($_POST['yourname'])){
   $theNameValue = 'Please enter your name';
} else {
   $theNameValue = $_POST['yourname'];
}
?

form action=?php echo $PHP_SELF; ?method=post
input name=yourname type=text size=20 value=?php echo
$_POST['yourname']; ?
input name=submit type=submit value=submit
/form


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



Re: [PHP] Trying to send data via POST

2005-11-22 Thread Anders Norrbring

On 2005-11-21 20:23 Richard Davey wrote:

Hi Anders,

Monday, November 21, 2005, 7:13:40 PM, you wrote:



I'm trying to set up a script that will post a picture file to a
hosting site. Normally, the site accepts uploads via a web form
using a POST action. How can I make this file transfer to the host
so it'll think it's posted by it's own web form? I just don't get
how to set it up..



Start with something like cURL or Snoopy, to make life a little
easier. Otherwise you can simulate this through standard socket
commands.

Cheers,

Rich


Thanks to Rich and Jay who suggested cURL, it works perfectly fine, and 
was really easy to implement!

--

Anders Norrbring
Norrbring Consulting

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



Re: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Richard Lynch
On Tue, November 22, 2005 2:37 pm, Eric wrote:
 $this-title=$this-B[$key]-title;

While this is SUPPOSED to work in PHP 5, it would be my first suspect
of under-tested code.

Try this:
$temp = $this-B[$key];
$this-title = $temp-title;

 This is not a typo, the key mysterialy changed to Nederlancs! The
 d
 became a c.

This sounds like you treated a STRING as if it were an ARRAY.

Keep in mind that PHP is quite happy to treat STRING variables is if
they were arrays of characters.

So it's entirely possible that your code is NOT altering array
elements but is altering string characters.

It sounds like you are storing an object property sometimes as a
string, and sometimes as an array.

Don't.

Or, if you must, then you had better type-check the data every time
you use it for anything.

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

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



Re: [PHP] how to exist within the context?

2005-11-22 Thread Richard Lynch

Put all your footer html/code into a function called 'foot'

Then do:

if (must_die(...)){
  foot();
  exit;
}

On Tue, November 22, 2005 11:27 am, Bing Du wrote:
 Hi,

 One webpage has its banner, left menu and footer ect that are
 controled
 by the template.  I want this php script to output the form and
 processing result within the page structure.  Without exit, if the
 'yourname' field is empty, the script would output 'Please enter your
 name!' fine within the page structure (that is, banner, menu and
 footer
 are all there).  But obviously the script does not terminate as it's
 supposed to.  With exit, the script terminates fine, but it outputs
 the
 result in a page without banner, menu and footer.  So what's the
 correct
 way to get the script stop and output its results always in the page
 structure.

 form method=post
 input name=yourname type=text size=20
 input name=submit type=submit value=submit
 /form

 ?php

 $submit = $_POST['submit'];
 $name = $_POST['yourname'];

 if ($submit)
 {
 if ($name==)
{
  print Please enter your name!;
  //exit;
}
 }

 echo Continue processing...;
 ?

 Thanks in advance,

 Bing

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




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

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



RE: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Eric
[snip]
Give us an example of the code where it breaks and also any error messages.
That will give us a starting point.
[/snip]

I think you don't understand completly, the project exists out of tens of
thousands lines of code.
- I don't have a short reproduce script
- I don't know if it's possible to create one, however, i'll try

My code may appear to be weird, but it's no broken. The php compiler is
broken though and I would like to have some assistance in finding out what's
broken. I'm talking about debugging the compiler, not my script.

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



Re: [PHP] PHP 5.0.5

2005-11-22 Thread Ashley M. Kirchner

Curt Zirzow wrote:


On Mon, Nov 21, 2005 at 09:41:40PM -0700, Ashley M. Kirchner wrote:
 


ext/ftp/ftp.lo(.text+0x76): In function `data_close':
/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1566: undefined reference 
to `SSL_shutdown'
   



This means basically that the header files (*.h) where found but
none of the libraries were found.

   Yeah, I wondered why.  Found out that -lssl doesn't get passed down 
to EXTRA_LIBS when it get to compiling the CLI.  Once I added it to my 
configure line, everything compiled fine.


   ( EXTRA_LIBS=-lssl ./configure ... )

--
W | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.

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



Re: [PHP] readdir and mime types

2005-11-22 Thread Richard Lynch
On Tue, November 22, 2005 8:23 am, Graham Cossey wrote:
 I'm attempting to read a list of files in a directory using readdir()
 but am having problems with mpeg files not seemingly being read.

 Cope snippet:

   $count = 0;
   while (false !== ($file = readdir($open_dir)))
   {
 if ($file != '.'  $file != '..')
 {
 if (file_exists($VID_DIR/$file))

What is $VID_DIR?

What directory is $open_dir pointing to?

Dollar gets you 10 that at least one of them is not what you think it is.

 {
   $count++;

 $count counts any 'avi' files but not 'mpg' files.

 Any suggestions much apreciated.

It's also remotely possible that your 'mpg' files are not readable by
the PHP user or something weird like that...  Though I don't THINK you
can do this, it's possible that your OS allows it...

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

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



RE: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Jay Blanchard
[snip]
I think you don't understand completly, the project exists out of tens of
thousands lines of code.
- I don't have a short reproduce script
- I don't know if it's possible to create one, however, i'll try

My code may appear to be weird, but it's no broken. The php compiler is
broken though and I would like to have some assistance in finding out what's
broken. I'm talking about debugging the compiler, not my script.
[/snip]

No, I understand perfectly. There is a point at which the code breaks, is
there not? There are error messages, are there not? You cannot unequivocally
state that the PHP compiler is broken until the code has been evaluated. We
are trying to help you here, but you have to show us something. We cannot
take wild-ass guesses (well, actually, we could) based on your description.
It is not the scientific method.

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



Re: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Eric
[snip]
It sounds like you are storing an object property sometimes as a
string, and sometimes as an array.
[/snip]

I can assure you, this has nothing to do with this issue, the only
type-juggling I do once in a while is byte/int/long/double/string

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



Re: [PHP] cms type session - how to ?

2005-11-22 Thread Richard Lynch
On Tue, November 22, 2005 3:24 am, Gregory Machin wrote:
 I'm looking for a how to , on creating sessions similar to those used
 my
 cms's
 that ref only a single page..

http://php.net/session_start

???

I don't understand what you mean by that ref only a single page and
suspect not many others understand that either.

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

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



Re: [PHP] Including classes

2005-11-22 Thread Richard Lynch




On Mon, November 21, 2005 5:14 pm, Philip Thompson wrote:
 Hi all.

 Here's what's going on. I have a page which calls itself in a form.
 On this page, I include two classes from other file I've created. On
 load, the page reads the class stuff just fine. If I submit the form
 (call the page again), then the class doesn't like to show any
 results.

 code

 ?
 require (myclass1.php);
 require (myclass2.php);

 if ($_POST[submitted]) {

if (isset($_POST['submitted'])){

might be better...

But what you have shown as example code should work I think.

Try posting the REAL code.

 // do stuff which includes the class - this does not work
 } else {
 // do stuff which includes the class - this works fine
 }
 ?

 form action=thispage.php
 !-- stuff that uses the class info --
 input type=hidden name=submitted value=1 /
 /form

 /code


 Any thoughts on why the class is not working after the submit? I have
 tried using coderequire_once (myclass1.php);/code, but that
 does not work either. Any suggestions would be greatly appreciated!

 Thanks in advance.
 ~Philip

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




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

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



[PHP] syntax checking?

2005-11-22 Thread Bing Du

Hi,

How should PHP syntax be checked before execution?  Anything similar to 
what option -c does in Perl?


% perl -c test.pl

Thanks,

Bing

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



RE: [PHP] syntax checking?

2005-11-22 Thread Jay Blanchard
[snip]
How should PHP syntax be checked before execution?  Anything similar to 
what option -c does in Perl?

% perl -c test.pl
[/snip]

from the command line

/usr/local/bin/php -i myScript.php

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



RE: [PHP] syntax checking?

2005-11-22 Thread Jay Blanchard
[snip]
How should PHP syntax be checked before execution?  Anything similar to 
what option -c does in Perl?

% perl -c test.pl
[/snip]

from the command line

/usr/local/bin/php -i myScript.php
[/snip]

Ooops, sorry, should be an ell l

/usr/local/bin/php -l myScript.php

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



Re: [PHP] syntax checking?

2005-11-22 Thread Bing Du

Jay Blanchard wrote:


[snip]
How should PHP syntax be checked before execution?  Anything similar to 
what option -c does in Perl?


% perl -c test.pl
[/snip]

from the command line

/usr/local/bin/php -i myScript.php
[/snip]

Ooops, sorry, should be an ell l

/usr/local/bin/php -l myScript.php


Too late :).  I've already tried -i.  Boy, that returns tons of 
information .  My machine was choked.


Bing

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



[PHP] Sending Mail (newbie)

2005-11-22 Thread schalk
Greetings All

I am using the following script to send mail via PHP. The script processes and
send the mail but the message is never displayed in the received email. Any
pointers will be much appreciated. Thank you.

?php
// Handle POST method.
if ($_POST)
{   
   
$name = $_POST['name'];
$phone = $_POST['phone'];
$comments = $_POST['comments'];

$to = '[EMAIL PROTECTED]';
$subject = Contact from OxfordPrice.com;
$headers = MIME-Version: 1.0\r\n.
   Content-type: text/html; 
charset=iso-8859-1\r\n.
   From: .$name.\r\n.   
   
   Date: .date(r).\r\n;

   // Compose message:
$message = 
html
body
h1Message From:  . $name . 
/h1
/body
/html
;

  // Send message
mail($to, $subject, $message, $headers);

  // Thank the generous user
echo div id=\message-response\h1Thank You!/h1/div\n;
}

--
Open WebMail Project (http://openwebmail.org)

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



RE: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Eric
[snip]
No, I understand perfectly. There is a point at which the code breaks, is
there not? There are error messages, are there not? You cannot unequivocally
state that the PHP compiler is broken until the code has been evaluated. We
are trying to help you here, but you have to show us something. We cannot
take wild-ass guesses (well, actually, we could) based on your description.
It is not the scientific method.
[/snip]

I understand your point, but I can't offer you the project as it's company
property. Again, I will try to make a reproduce/example script.
Meanwhile, try to believe my assumption that the PHP compiler is broken
because:
- At no point, it would be usefull to destroy that particular array, so,
there IS no specific code that does that.
- However, there could be, ofcourse, a bug involved in my code, accidentally
destroying the array, but I've searched my code for such a bug and I can't
find it.
- Still, to rule out any mistakes of mine, I tried the code at a
ZendPlatform enabled server and the bug seems to disappear. Not really,
though, because a value seem to leak to someplace else and even worse: while
ZendPlatform seems te work perfectly (I can debug everything, even this
specific piece of code) httpd segfaults when debugging this code with the
evil parameter
- Back to the error message: even the error message is corrupted, the
compiler doesn't seem to know what it's doing (what would explain de httpd
segfault with ZendPlatform: PHP does something it's not meant to do)
- Then again, maybe I told the compiler to something it isn't meant to do
(but if it isn't meant to do what I instruct it to do, it should give me an
error, so there would be a flaw in the compiler anyway, but in this case, a
minor one). Although I don't see the evil in what I'm doing. But perhaps you
could tell by my how-my-code-works-theory
- Finally, the strange behaviour is variables suddenly changing while there
is no reference or new assignment. This is most likely a symptom of a very
confused compiler.

So let's assume the PHP compiler is broken or my code is in theory
correct, but beyond the compilers capabillities. Wouldn't a shallow debug of
php shed more light on the issue? Memory leaks, a backtrace of the segfault
with ZendPlatform, php compiled with debug enabled and see what kind of
stuff pops up?

Some side information: At the beginning of this year, this project ran with
php4 however, it suddenly began to segfault. It also had to do with complex
object-architecture. Everybody said my code was the problem, however it ran
fine when it was modified for php5. Not very long ago, someone from the php
crew spotted a serieus problem in the way php4 handles object references
(very most likely the cause of my problem) which resulted in php 4.4.x
Some of the weird things that happen now (variables changing) seem somewhat
similliar to things happening now. It sure isn't the same problem (the php4
issue was solved by using php5 as example) Anyway I'm 99.99% sure the
compiler screws up, wether or not my code does something evil, so I think
the compiler is the best place to start looking instead of my code.

If you're not willing to make this assumption, I completly understand why,
but I can't and I won't post any code or links to code, here. Nonetheless, I
would like to thank you for the time you took, reading my posts. If you, or
anywone else would like to help me debug the compiler please let me know. If
so, we're probably doing this using something like a VNC terminal and we
will have a look at the code as well.

It's 11:45PM here so I'm off to bed, I'll be back in the morning.
Thanks again and goodnight,
Eric van Blokland

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



RE: [PHP] Sending Mail (newbie)

2005-11-22 Thread mwestern
Have you tried a very simple email example to make sure your server is
sending mail out.   Is sendmail running and working?

http://au2.php.net/function.mail 

 -Original Message-
 From: schalk [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, 23 November 2005 9:12 AM
 To: php-general@lists.php.net
 Subject: [PHP] Sending Mail (newbie)
 
 Greetings All
 
 I am using the following script to send mail via PHP. The 
 script processes and send the mail but the message is never 
 displayed in the received email. Any pointers will be much 
 appreciated. Thank you.
 
 ?php
   // Handle POST method.
   if ($_POST)
   {   
  
   $name = $_POST['name'];
   $phone = $_POST['phone'];
   $comments = $_POST['comments'];
   
   $to = '[EMAIL PROTECTED]';
   $subject = Contact from 
 OxfordPrice.com;
   $headers = MIME-Version: 1.0\r\n.
  
 Content-type: text/html; charset=iso-8859-1\r\n.
  From: 
 .$name.\r\n.  
  Date: 
 .date(r).\r\n;
 
  // Compose message:
   $message = 
   html
   body
   h1Message From:  . $name . 
   /h1
   /body
   /html
   ;
 
   // Send message
   mail($to, $subject, $message, $headers);
 
   // Thank the generous user
   echo div id=\message-response\h1Thank 
 You!/h1/div\n;
   }
 
 --
 Open WebMail Project (http://openwebmail.org)
 
 --
 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] Sending Mail (newbie)

2005-11-22 Thread schalk
Thanks All. I have got this working.

--
Open WebMail Project (http://openwebmail.org)

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



[PHP] Execute a program from PHP CLI and allow user interaction

2005-11-22 Thread Jasper Bryant-Greene

Hi all

This one's got me stumped. I'm working on a PHP CLI interface, and I 
need to allow the user to input a bit of HTML.


Rather than bandy around with readline() and the like, I thought it 
would be nice to just create a temporary file, pop nano up, and read and 
then delete the file once it's been edited. That way I get nano's syntax 
highlighting and other useful features.


However, I can't for the life of me figure out how to allow the user to 
interact with nano once the process has been launched. The usual culprits:


{exec,system,shell_exec}( nano tmpfile.txt );

all just hang (top shows nano is running, but it doesn't seem to be 
attached to the terminal).


How can I launch a process and attach it to the terminal PHP CLI was 
launched from so that the user can interact with it?


TIA
--
Jasper Bryant-Greene
General Manager
Album Limited

+64 21 708 334
[EMAIL PROTECTED]

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



[PHP] Unclonable objects

2005-11-22 Thread Matt Monaco
What situation would make a mysqli object unclonable?  This is a problem 
that occurs only on a linux machine with mysql4.  I am simply trying to 
declare a link resource and I get an error Trying to clone unclonable 
object of type mysqli  If I declare the link using a reference however, the 
code seems to work fine.  It still would be better not to use a reference 
though.

Thanks in advance,
Matt 

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




[PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-22 Thread twistednetadmin
I use this line in a script for uploading pictures to a website:

$_FILES['guildimage']['type'] == image/jpeg

This works fine when using Mozilla, but it doesn't work with IE.
How should I do it to get it working with both/all browsers?



if (isset($_POST['submit']))//If you
press submit
{
 $sysfolder=/guildimages/;
 $filename=.$_FILES['guildimage']['name'].;

if (file_exists($sysfolder . $filename))   //And the
file exists or there is no file chosen
 {
 echo Filename exists or no file selected. Please rename the file or select
a file;

}
 elseif ($_FILES['guildimage']['type'] == image/jpeg) //If the
filetype is correct (this is where the change should be I think)
 {

copy ($_FILES['guildimage']['tmp_name'],
/guildimages/.$_FILES['guildimage']['name'])//Copy the file to
folder (/guildimages)
 or die(Could not copy file);  //Or
die

echo Result:br\n;
 echo Filename: .$_FILES['guildimage']['name'].br\n;
 echo Filesize: .$_FILES['guildimage']['size']. bytebr\n;
 echo Filtype: .$_FILES['guildimage']['type'].br\n;
 echo Congrats! It worked!\n;
 }
 else
 {

echo Result:br\n;
 echo Now that didn't seem to work... br\n
 Have you checked the size and filetype? br\n
 File that failed-- (.$_FILES['guildimage']['name'].)br;

}
 }

Does anyone know the answer to this?


Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-22 Thread Stephen Leaf
I use the fileinfo pecl. http://pecl.php.net/Fileinfo

how to get a mime type:
$info = new finfo( FILEINFO_MIME );
$mime = $info-file($filename);

then my extention grabber:
function getExtention() {
switch ( $this-mimeType ) {
case image/jpeg: return 'jpg'; break;
case image/png:  return 'png';  break;
case image/gif:  return 'gif';  break;
default: throw new ImageTypeNotSupportedException();
}
}

This is all done in a Image Object.

On Tuesday 22 November 2005 08:15 pm, twistednetadmin wrote:
 I use this line in a script for uploading pictures to a website:

 $_FILES['guildimage']['type'] == image/jpeg

 This works fine when using Mozilla, but it doesn't work with IE.
 How should I do it to get it working with both/all browsers?



 if (isset($_POST['submit']))//If you
 press submit
 {
  $sysfolder=/guildimages/;
  $filename=.$_FILES['guildimage']['name'].;

 if (file_exists($sysfolder . $filename))   //And the
 file exists or there is no file chosen
  {
  echo Filename exists or no file selected. Please rename the file or
 select a file;

 }
  elseif ($_FILES['guildimage']['type'] == image/jpeg) //If
 the filetype is correct (this is where the change should be I think)
  {

 copy ($_FILES['guildimage']['tmp_name'],
 /guildimages/.$_FILES['guildimage']['name'])//Copy the file
 to folder (/guildimages)
  or die(Could not copy file);  //Or
 die

 echo Result:br\n;
  echo Filename: .$_FILES['guildimage']['name'].br\n;
  echo Filesize: .$_FILES['guildimage']['size']. bytebr\n;
  echo Filtype: .$_FILES['guildimage']['type'].br\n;
  echo Congrats! It worked!\n;
  }
  else
  {

 echo Result:br\n;
  echo Now that didn't seem to work... br\n
  Have you checked the size and filetype? br\n
  File that failed-- (.$_FILES['guildimage']['name'].)br;

 }
  }

 Does anyone know the answer to this?

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



[PHP] Re: Cookie problem with IE

2005-11-22 Thread n.g.
did i say it? sorry, i mean load the page in your customer browser.

the code you give simple test stored cookie, which might be blocked by
browser. however browser blocks stored cookie might allow session
cookie, they are not stored so are less insecurity.

bad thing is your customer have some antivirus/firewall software
installed you even cant rely on http referer header, as well as
cookies.

and you have to do something before you can find out what is
happening, isn't it ?

On 11/22/05, n.g. [EMAIL PROTECTED] wrote:
 save below as testcookie.php, request it from your browser twice, what
 do you get at 2nd time?
   ?php
setcookie('sessioncookie', 1);
setcookie('storedcookie',1,time()+3600);

var_dump($_COOKIE);
   ?

 On 11/22/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
  Anyone have any suggestions?  I'm still stuck.
 
 
  thanks,
  kgt
 
 
 
  Kristen G. Thorson wrote:
 
   I'm having problems with a customer who can't login to a wholesaler
   application.  To ensure the problem was that the cookie was not being
   set, I sent him to this script:
  
   if( !isset( $_REQUEST['page'] ) ) {
setcookie('VATtest','Cookie has been set.',time()+5, /);
echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
   } else if( $_REQUEST['page'] == '1' ) {
if( isset( $_COOKIE['VATtest'] ) ) {
  echo $_COOKIE['VATtest'];
} else {
  echo 'Cookie NOT set.';
}
   }
   ?
  
  
   He got Cookie NOT set. which means exactly what it says.  He's using
   IE 6.0, and swears up and down that he's set it to always allow
   cookies from this domain.  I can't verify that he's set it correctly,
   but he has been told twice how to do it.  I also know his browser must
   be saving some cookies, as he is able to login to other sites.  Has
   anyone run into other sources of cookie-blockage in the past?  I
   cannot manage to duplicate this when I have IE set to always allow
   cookies from this domain.
  
   Thanks for any tips,
  
   kgt
  
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 Tomorrow will be a good day :-)



--
Tomorrow will be a good day :-)

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



[PHP] Re: Execute a program from PHP CLI and allow user interaction

2005-11-22 Thread n.g.
use proc_open , connect stdin/out of php cli to nano, i guess

On 11/23/05, Jasper Bryant-Greene [EMAIL PROTECTED] wrote:
 Hi all

 This one's got me stumped. I'm working on a PHP CLI interface, and I
 need to allow the user to input a bit of HTML.

 Rather than bandy around with readline() and the like, I thought it
 would be nice to just create a temporary file, pop nano up, and read and
 then delete the file once it's been edited. That way I get nano's syntax
 highlighting and other useful features.

 However, I can't for the life of me figure out how to allow the user to
 interact with nano once the process has been launched. The usual culprits:

 {exec,system,shell_exec}( nano tmpfile.txt );

 all just hang (top shows nano is running, but it doesn't seem to be
 attached to the terminal).

 How can I launch a process and attach it to the terminal PHP CLI was
 launched from so that the user can interact with it?

 TIA
 --
 Jasper Bryant-Greene
 General Manager
 Album Limited

 +64 21 708 334
 [EMAIL PROTECTED]

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




--
Tomorrow will be a good day :-)

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



Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-22 Thread Stephen Leaf
The reason why I suggested the fileinfo idea was because IE and mozilla report 
the mime type differently.
image/x-jpeg vs image/jpeg I believe it is.

using fileinfo just standardizes what you need to check for.

On Tuesday 22 November 2005 09:56 pm, twistednetadmin wrote:
 I don't think that is quite what I'm after...
 I have restriction on only jpg images and filesize 300kb. The problem I
 have is that the IE browser doesn't recognize a =300kb jpg mage as a valid
 file while Mozilla do. The switch statement though seems interesting. Not
 sure how I should use it in this case.
 The fileupload is just a simple form with a browsebutton. I am not trying
 to get more fileinfo or anything like that. Only to get IE to understand
 that it actually IS a valid file and then upload it.

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



[PHP] Re: Can't execute external program

2005-11-22 Thread n.g.
is /var/www/html your web root dir ?
maybe its the plobrem.

On 11/23/05, Henry Castillo [EMAIL PROTECTED] wrote:
 That was on of the first things I checked:
 safe mode is set to off
  Any ideas...
 Henry
   Voip tech said the following on 11/20/2005 10:31 PM:
  Hello,
  I cannot get exec(), system() or passthru() to run an extenal program.
  From the command line it runs perfectly:

 snip

  I'm getting frustrated, Any help will be deeply appreciated
  Henry

 The answer is probably in your php.ini. Look into whether you are
 running in safe mode or not, and if you are whether you have your
 program in the safe_mode_exec_dir or not. Also check disable_functions
 to see if any of the ones you are having trouble with are listed.

 - Ben




--
Tomorrow will be a good day :-)

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



[PHP] NTLM, PHP and Apache

2005-11-22 Thread Joe Wollard
Greetings all,

I'm running a rogue (the company knows about it but doesn't support it) web
server for my dept and I'd like to be able to authenticate users
transparently. The company is currently doing this on their own supported
Intranet servers via NTLM on IIS. All I'm really looking for here is a way
to extract the user name from the 'Authentication:' HTTP header using PHP on
Apache (FC4). It seems that some of the string can be extracted using
base64_decode(). Unfortunately it is not the part of the string that I need.
It's just the domain name, the computer's NET BIOS name and the Auth-type
which of course is NTLMSSP.

I found a mod_ntlm for Apache, but even if I could compile it on FC4 (yes, I
tried) I'm not sure I need/want the full functionality of NTLM - just a way
to extract the user name of the user logged into the client machine from the
HTTP header using apache.

It seems that there are many sites out there that do this in Java and Perl,
but none describe a way to do this in PHP..any ideas?


Re: [PHP] Assistance debugging php 5.x.x

2005-11-22 Thread Curt Zirzow
On Tue, Nov 22, 2005 at 07:41:10PM +0100, Eric wrote:
 I would like to have some assistance in debugging php. It's about a bug in
 php not a script of mine.

First off there is a big difference between 5.0.x and 5.1.x as well
as 5.0.1 and 5.0.5, what version are we talking about?

 
 I can't post a bug report as I do not exactly know why my code is
 suffering from a php bug. It's related to a very complex objects-model
 ...

If it isn't your code is there ever a known state at which it did
work? 

...
 where objects, cross-referenced, wake up from a session. (note, these are
 cross-references, not circular, all circular (parent - child) references
 are unset before the objects are serialized)

This almost sounds like some douglas adams, story.. I'd wake up
dizzy with all those circular but not circular references.

Curt.
-- 
cat .signature: No such file or directory

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



[PHP] Is there a way to determine wich browser a visitor uses in php?

2005-11-22 Thread twistednetadmin
Is it possible to use PHP to find out wich type of browser is in use?
Or must is this done by javascript or something else?
I would like to have a little statistic on my page that tells me what
browser is currently moet used.


Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-22 Thread twistednetadmin
This did the trick:

elseif ($_FILES['guildimage']['type'] == image/pjpeg or image/jpeg)


Re: [PHP] Is there a way to determine wich browser a visitor uses in php?

2005-11-22 Thread Joe Wollard

On Nov 23, 2005, at 12:43 AM, twistednetadmin wrote:


Is it possible to use PHP to find out wich type of browser is in use?
Or must is this done by javascript or something else?
I would like to have a little statistic on my page that tells me what
browser is currently moet used.



Try:

?php
print $_SERVER['HTTP_USER_AGENT'];
?

-Joe W

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



[PHP] PHP and email

2005-11-22 Thread Angelo Zanetti

Hi

I have a dedicated server in the states.

I need to send about 8000 emails (once off). There pretty small +- 5KB.


so I want to write a php script and run it from the command line in the 
background. I was thinking of sending 50 emails then waiting 90 seconds 
then sending again.


Or

the same script gets run by cron every 90 seconds and just sends 50 emails.

What do you recommend?

thanks

clive
--

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052

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



[PHP] mysqli unclonable object

2005-11-22 Thread Matt Monaco
On a Fedora 4 machine running MySQL 4.1 I am having trouble declaring an 
instance of a mysqli extension.

class Data extends mysqli {
function __construct($host, $user, $password, $db = null)
{
@parent::__construct($host, $user, $password, $db)
or printf(There was an error (id: %d) connecting to the database:
   b%s/bbr /, mysqli_connect_errno(), 
mysqli_connect_error());
}



}

$link = new Data(localhost, user, password, db);

This invokes the error Trying to clone unclonable object of type Data. 
However if I create the link with a reference ...
$link = new Data();
...everything works fine.

This error is interesting because it only occurs on the machine mentioned 
above, in a Windows/MySQL 5.0 environment, everything works fine without the 
reference.


Thanks in advance!
Matt 

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



Re: [PHP] Is there a way to determine wich browser a visitor uses in php?

2005-11-22 Thread twistednetadmin
Thanks guys. That helps alot!

But this:
?php
print $_SERVER['HTTP_USER_AGENT'];
?

Returned this using Mozilla: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.12) Gecko/20050915 Firefox/1.0.7
And this using IE: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Does that just mean that it's not completely accurate?


[PHP] Autodeleting news when it has become yesterdays news

2005-11-22 Thread twistednetadmin
I have a news-script on a webpage. Or an eventscript you might call it.
This lists up events thats gonna happen on a given day. ie concerts and
sportsevents.
To get this deleted without having to log on to the adminpage when the event
is over would have been a great relief.

1. Is it just as simple as writing a query that executes and removes news
with yesterdays date?

2. And how should I set it to execute if so?

Just at the beginning of the page with the news is my thought. So that it
checks for the eventdate and erases the overdued ones before it collects the
news.

3. Is there any pitfalls I should be aware of?

I use Mysql for my db of course.

Could someone give me a start on this?


[PHP] Re: Newbie to PHP5

2005-11-22 Thread Yoyo

Danny wrote:

Hi there,
 I´m familiar with PHP syntax, but I´ve been reading some sample scripts, in
PHP5 and i´ve seen some strange things, like diferent ways to read a
collection of rows, magic functions, wrapers, and operators like :: and
-. I know that all is the manual, but before that anyone nows, a website
or a simple tutorial or explained samples, in order that the transition from
PHP4 and PHP5 were easiest as possible.
 Thanks

--
dpc




http://www.faqts.com/knowledge_base/view.phtml/aid/22154/fid/1150

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