[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-05 Thread Grant
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

 - Grant

 Is this a known issue?

 - Grant

Is there anything I can do?

- Grant

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



[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Grant
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

 - Grant

Is this a known issue?

- Grant

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



[PHP] PHP-5.5.2 +opcache segfaults with Piwik

2013-08-25 Thread Grant
I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
opcache is disabled.  Someone filed a piwik bug but was told it's a
php bug:

http://dev.piwik.org/trac/ticket/4093

- Grant

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



[PHP] PHP as CGI-CLI on FreeBSD/Apache22

2011-06-27 Thread Grant Peel
Hi all,

Up to this point we have been running PHP as an Apache 22 module.

We would like to rebuild PHP over the next few weeks to run it as a CGI/CLI 
PHPSuexec system.

I am hoping there may be others that have made this migration and might have a 
step by step how to (so far research shows it should be reasonably simple to 
do), and would be willing to share it.

Right now we have 

FreeBSD 8.0
Apache22 built from ports, with apache suexec enabled,
PHP5 Built from ports,

Any hints are appreciated,

-G

[PHP] PHP Security

2009-06-02 Thread Grant Peel
Hi all,

I am currently setting up the next generation web server for our company and am 
in need of general consulting/advice on php set up security issues.

Any one with knowledge and expierience please feel free to reply :-).

-Grant

Re: [PHP] PHP Security

2009-06-02 Thread Grant Peel

Thanks for the reply,

Dell R200, Xenon Quad Core 2.8 GHz,, 3GB RAM, 160GB SAS Drive,
FreeBSD 7.0, Developer package, no XWin, mod_security installed,
Apache 2.2.4, Suexec enabled, HTTPS enabled,
Proftp 1.3 (if memory serves),
Exim 4.6,
vm-pop3d, triggered from Inetd,
Spamassassin 3.2 (if memory serves),
MySQL 5.1,
PHP 5, with Sohosin patch,
BSD Firewall, (IPFW),
PERL 5.8.something,

All software installed from port,
INET 6 not enabled,

Server is setup as a virtual server, each domain has its own IP (apache3 
using virtual hosts), no Jails installed.


Each Domain owner has thier own ftp login, no SSH or Telnet access granted.

What I am looking for is to secure ftp from cross site scripting; disable 
any php.ini options that may be flakey (security wise); possibly setup php 
suexec. - most of all, ensure any scripts installed cannot intrude on other 
sites or be used as rootkits


-Grant

- Original Message - 
From: Phpster phps...@gmail.com

To: Grant Peel gp...@thenetnow.com
Cc: php-general@lists.php.net
Sent: Tuesday, June 02, 2009 5:53 PM
Subject: Re: [PHP] PHP Security



H, how about some details on OS, etc

Bastien

Sent from my iPod

On Jun 2, 2009, at 17:26, Grant Peel gp...@thenetnow.com wrote:


Hi all,

I am currently setting up the next generation web server for our  company 
and am in need of general consulting/advice on php set up  security 
issues.


Any one with knowledge and expierience please feel free to reply :-).

-Grant


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







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



Re: [PHP] Re: PHP Security

2009-06-02 Thread Grant Peel

???

- Original Message - 
From: Shawn McKenzie nos...@mckenzies.net

To: php-general@lists.php.net
Sent: Tuesday, June 02, 2009 7:39 PM
Subject: [PHP] Re: PHP Security



Grant Peel wrote:

Hi all,

I am currently setting up the next generation web server for our company 
and am in need of general consulting/advice on php set up security 
issues.


Any one with knowledge and expierience please feel free to reply :-).

-Grant


Do not under any circumstances put the web server on the Internet.

--
Thanks!
-Shawn
http://www.spidean.com

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







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



Re: [PHP] Security Support

2009-03-30 Thread Grant Peel
- Original Message - 
From: Michael A. Peters mpet...@mac.com

To: Grant Peel gp...@thenetnow.com
Cc: php-general@lists.php.net
Sent: Sunday, March 29, 2009 10:00 PM
Subject: Re: [PHP] Security Support



Grant Peel wrote:

Good Morning / Afternoon,

We run several of our own servers:

- Dell Power Edge 1U, Pentium,
- FreeBSD (6.x soon to be 7.x)
- along with all the standard Web Application installation (PHP Apache 
Exim, Pop3, Proftp, MySQL etc etc).


What I am asking here, is if any one in this community has the knowledge 
to act as a security consultant in an occasional, as required basis. 
Anyone interested should have expience with Apache, PHP, Perl on the 
FreeBSD platform.


No experience with FreeBSD and probably not enough with Perl - but whoever 
you hire, make sure they suggest your php build is hardened by suhosin - 
both the core php patch and the loadable module.




Hi Again all,

I am not sure what to make of all the chatter on this post 

To date, I have not recieved any sincere replies, which is a bit suprising. 
I am thinking that this job would be easy money for someone who already 
knows the ins and outs of php/Apache from a secuirty standpoint.


I already have sohosin patch applied (it is applied as part of the default 
FreeBSD - php port).


Anyways, the offer is still out there if anyone is interested.

-Grant 



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



[PHP] Security Support

2009-03-29 Thread Grant Peel

Good Morning / Afternoon,

We run several of our own servers:

- Dell Power Edge 1U, Pentium,
- FreeBSD (6.x soon to be 7.x)
- along with all the standard Web Application installation (PHP Apache Exim, 
Pop3, Proftp, MySQL etc etc).


What I am asking here, is if any one in this community has the knowledge to 
act as a security consultant in an occasional, as required basis. Anyone 
interested should have expience with Apache, PHP, Perl on the FreeBSD 
platform.


We are more than willing to compensate for services rendered, and are more 
than willing to discuss terms.


In the end, we would be more than willing to share any non-fudiciary 
information with anyone who could find it useful (via this or other mailing 
lists).


We are asking any interested parties to contact us off-list such that we 
don't need to make any private matters public.


This is a bonified request, as we can setup servers ourselves, but simply do 
not have the time to research various run time, and security related items.


TIA,

-Grant 



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



[PHP] php suexec

2007-10-22 Thread Grant
Hi again all,

Has anyone on this had succees setting up php to use suexec?

If I am reading things right, it appears that php must be run as CGI and 
then it will use the built in (Apache2) suexec wrapper in the same fassion 
as perl does.

If the above is correct I am looking for a primer on how to set this all up.

TIA,

-Grant 

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



Re: [PHP] Securing PHP

2007-10-21 Thread Grant
Hi Nathan,

Thanks for taking the time to reply.

Yes, this is a shared server. Each (UNIX) user's home directory is thier 
domain name i.e. /home/usersdomainnamehere.com and thier http root is www 
i.e. /home/usersdomainnamehere.com/www

I am running apache 2. and mod_php. Most servers are running php 4.x right 
now, but we will be upgrading to 5 soon.

Also, apache is running suexec for perl (cgi).

When files are written via ftp and cgi they are owned by the user who logged 
in, and in both cases are limited to writing to thier home directory.

In the case of PHP, the files are owned by www.

Should I consider phpsuexec? Or will the apache directives you mentioned 
below take care of it?

-Grant

Nathan Hawks [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Are you running a multi-user hosting service?

 If so you can create include files on a per-user or per-domain basis.
 Use the Apache config directive php_value to set your include_path and
 open_basedir appropriately for each account; and other options as
 desired.

 I don't know of a particular site, but that is the config framework that
 Plesk uses.

 As for building PHP, make sure you run the testing battery ('make test'
 after you 'make' and before you 'make install') in order to see how
 'hardened' your build is.



 On Sat, 2007-10-20 at 21:00 -0400, Grant wrote:
 Hi all,

 You've all likely heard this beforeI was hacked... , Had register
 globals on... etc etc.

 Well, this is true of me as well.

 Does anyone know of a site that would help a semi professional lock down
 php, i.e.

 Perhaps how to install phpsuexec,

 Jail users to only have the ability to read/write to thier own files and
 directories,

 php.ini directives that have simiar affect as mentioned above.

 Any help appreciated.

 -Grant
 

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



[PHP] Securing PHP

2007-10-20 Thread Grant
Hi all,

You've all likely heard this beforeI was hacked... , Had register 
globals on... etc etc.

Well, this is true of me as well.

Does anyone know of a site that would help a semi professional lock down 
php, i.e.

Perhaps how to install phpsuexec,

Jail users to only have the ability to read/write to thier own files and 
directories,

php.ini directives that have simiar affect as mentioned above.

Any help appreciated.

-Grant 

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



[PHP] I am lost

2007-07-14 Thread Grant
Previously I had PHP on my older computer using IIS 5.1 it worked fine. But 
I'm on my new computer using IIS 7 and features like include or completely 
normal scripts that use to work no longer work. I have try to see if it's 
the web server and some of the times for the exception of the include 
function  it is. How would I fix my main server IIS 7, is the new PHP 5.2 
fully compatible with it? If not when will a fully functional PHP be 
available for work with IIS 7. In my php.ini file I began by using the 
recommended file and slightly modifying it enabling gd2, openssl and mysql.




Thanks,

Grant

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



Re: [PHP] Best authentication method for user

2006-04-03 Thread Grant Young

Hi Alain.

On the authentication front, you can use HTTP basic authentication for 
this kind of thing too - and it means you're not having to re-invent the 
wheel in a lot of ways.  The Auth_HTTP PEAR module makes this pretty 
simple to implement:

http://pear.php.net/package/Auth_HTTP/

You can integrate you're own authentication mechanisms (i.e. DB stored 
passwords, LDAP authentication, whatever you like really) quite easily.


Permissions systems are harder to implement.  The PEAR LiveUser package 
is attempting to make this a bit easier too:

http://pear.php.net/package/LiveUser/

HTH. Grant

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



Re: [PHP] Get class name in static method

2006-03-20 Thread Grant Young

Not sure about PHP5, but for PHP4 I found this hack solution at:
http://passivedigressive.com/archives/2005-02/php-static-class-name-solution/

There are probably all sorts of issues with this approach, but it solved 
the problem at the time...


HTH.  Grant

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



Re: [PHP] DB calls vs Session solution

2006-03-13 Thread Grant Young

Hi Jochem.


the nice thing about programming with my 'data framework' is that its
very generic, flexible and interspective (generating abitrarily complex
sql/html/? from objects) ... which comes with a great cost.

so I have code that is really very very heavy but if you consider
the (complete|discount|standard|bundeled) price calculation routines
for the site I was speaking of, are 1000's of lines in themselves you
might agree that a more structured apporach to the code bear fruits
in maintainability/extensability (which has been my finding overall).
bottom line is [they] have to buy a bigger box. :-)

actually my real problem lies in not being [cap]able of using the
Smarty cache (I can't figure out how it works/how to use it)


I'm thinking that output (HTML) caching might be an option for you - you 
seem to be hinting at that with the Smarty reference above.  Probably 
depends mostly on how many variables you have to deal with.  And I would 
still look into using MySQL level caching as well if the query execution 
time is more than a second or two.


I'm in the process of optimising a CMS at the moment which fits your 
description of very generic, flexible and interspective (generating 
abitrarily complex sql/html/? from objects) ... which comes with a great 
cost.  The biggest bottleneck in my app was not complex SQL, but PHP 
picking up all the include files (classes etc.), but that's beside the 
point.


In my project I implemented an output cache (caching just the HTML) 
based on the full URI for text/html content-type GET requests - taking 
into consideration the query string parameters.  Admittedly it's a very 
aggressive cache, and I may have to change it to allow for flexibility 
based on user ID or other parameters, but it does improve performance 
significantly.  I query the cache before loading my framework, which is 
where most of the performance benefit comes from in my particular app.


Another benefit to this approach is that it would be fairly easy to code 
the caching system around your existing framework i.e. if no cache 
hit, handle the request using your framework, then store to the cache 
via the output buffer.


As far as I know you would be able to use APC for this type caching (I 
haven't used APC but have read up on it a little recently).  It might 
even be possible to GZIP the output before caching to reduce memory 
requirements, at a small performance cost when dynamically generating 
the content.  The approach could also be used for HTML fragments (i.e. 
just the changing area - the results listing HTML etc.)


FWIW, Smarty probably doesn't do quite what you want (I use Smarty in 
the CMS, but afaict you need to know the template name + a unique ID to 
use the cache - if the template name can be hard coded, no dramas, but 
if it's dynamically loaded, it becomes trickier - including the Smarty 
class also incurs a performance overhead).


Not sure if any of that's useful?

BTW, if anyone sees any serious issues with this approach, let me know.  
I don't intend to roll out the solution to a live system for a while, so 
I still have plenty of time to revisit.


Regards, Grant

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



Re: [PHP] Where can I find nice Web icons for custom admin interface?

2006-03-02 Thread Grant Young

Hi Nicolas.

I've collected some pointers over the past few months to royalty free 
icons and designers at:

http://del.icio.us/braquin/icons

HTH.

Regards, Grant

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



Re: [PHP] html area

2006-02-28 Thread Grant Young
Tiny_MCE is another fairly simple editor - although I've experienced 
some quirks that can be quite annoying/tricky.

http://tinymce.moxiecode.com/

Regards, Grant

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



Re: [PHP] About date time...

2006-02-28 Thread Grant Young

Hi Gustav.



I'm a swede, and I we use hours 0 - 24.

8 pm = 20 for us.
9 pm = 21 for us
10 pm = 22...

and so on...

But with date()-function there is 10 pm that shows (and I want 22 to 
show instead)


I'm using PHP 4.0.3...

Do I have to use getdate() then? (getdate()-function showed 22...)


The docs for date() (http://www.php.net/date) show that there are a 
number of different options for the first parameter.  If you check out 
the table on that page, you'll find:


 H | 24-hour format of an hour with leading zeros | 00 through 23

With this in mind, the following will work (if I understand your 
question correctly):


$t = date('H\:\ i\:\ s');

HTH, Grant

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



Re: [PHP] File permissions do not seem to be my friend

2006-02-02 Thread David Grant
Brian,

This is a php.ini setting, so a FS permissions problem.  The sysadmin
needs to disable safe mode on your behalf.

David

Brian Dunning wrote:
 I have a script that scans an images folder and creates a thumbnail for
 each and writes it to a new subfolder. Runs fine on my development box.
 But I'm using a new host that I'm unfamiliar with (servage.net), and
 when I run the script I get the following error. I set the permissions
 on the enclosing folder to 777, and all the attempted writes are within
 this folder:
 
 SAFE MODE restriction in effect. The script is not allowed to access
 /blah/blah/blah...
 
 Any suggestions? Anything I can do on my end to allow this?
 
 --PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.2.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] Print extended/parent classes

2006-02-01 Thread David Grant
Mathijs,

Mathijs wrote:
 I have the following situation :
 
 ?php
 
 class A {
 public $var1;
 }
 
 class B extends A {
 public $var2;
 }
 
 ?
 
 Now I want to print this object
 ?php
 
 $obj = new B;
 print_r($obj);
 
 ?
 
 Does anybody know how I can print class A also ?

The above prints out:

B Object
(
[var2] =
[var1] =
)

Is this not what you expected?  You can't print out *just* the
properties of A.  If this isn't what you want, you shouldn't be extending A.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] How to destroy HTTP authentication (from PHP)?

2006-02-01 Thread David Grant
Olaf,

How about generating a hash-enhanced (TM) realm name, such as:

Basic Realm Session HASH

Then store that timestamp-based hash in the session.  When you want to
user to  bugger off, change the realm name.  This is just a theory, and
I've not tested it at all.

David

Olaf Greve wrote:
 Hi all,
 
 Alright: here's a bit of a challenge (so as to avoid the word issue)
 ;) my colleagues have run into previously: how to kill HTTP
 authentication...
 
 I remember that they never did figure that one out, and I too will now
 have to get my hands dirty with trying to find a proper way to do so.
 
 Simply unsetting the PHP_AUTH_USER and PHP_AUTH_PWD variables doesn't
 seem to do any magic, and using a forced 401 ('Unauthorized') HTTP
 header is also highly ideal (not to say blatantly dirty)...
 
 S, has anyone found a proper way of achieving this (ideally from PHP)?
 
 Also, in case this cannot be done from PHP, does anyone know of any
 Apache modules (or tricks/tweaks/settings) that will allow HTTP
 authentication to be neatly destroyed?
 
 Thanks in advance, and cheers,
 Olafo
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] Hide email addresses from spam bots

2006-02-01 Thread David Grant
Gerry,

If a human being can read it, so can a spambot.  New techniques might be
developed all the time, but you shouldn't bet against spammers bringing
themselves up to date with those techniques too.

If the user wishes to display their e-mail address on a web page, they
should ensure they have good spam-filtering.

You might consider using some sort of CAPTCHA image, but that isn't
guaranteed to work flawlessly, and reading an e-mail address in a
CAPTCHA image would be hard work.

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Print extended/parent classes

2006-02-01 Thread David Grant
Jochem,

Good point.  I thought he meant object given his example. :P

David

Jochem Maas wrote:
 David Grant wrote:
 Mathijs,

 Mathijs wrote:

 I have the following situation :

 ?php

 class A {
 public $var1;
 }

 class B extends A {
 public $var2;
 }

 ?

 Now I want to print this object
 
 ***object***
 
 ?php

 $obj = new B;
 print_r($obj);

 ?

 Does anybody know how I can print class A also ?
 
 ***class***
 
 (class and object are not interchangable concepts - yet
 they are closely related :-)
 
 you printed $obj which is an instance of B, which happens to
 be a subclass of A. if you are interested to find out which classes
 an objects is defined by try something like:
 
 class A {}
 class B extends A {}
 class C extends B {}
 $c = C; $classes = array($c);
 while($c = get_parent_class($c))
 $classes[] = $c;
 print_r($classes);
 


 The above prints out:

 B Object
 (
 [var2] =
 [var1] =
 )

 Is this not what you expected?  You can't print out *just* the
 properties of A.  If this isn't what you want, you shouldn't be
 extending A.

 David
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] Question about C++ like macros on PHP

2006-01-31 Thread David Grant
Andrei,

http://php.net/manual/en/function.debug-backtrace.php

David

Andrei wrote:
 
 Hi list,
 
 For debugging purposes I want to send to a function the line and
 file where it is called. The problem is that I want these parameters to
 be added to function as default parameters (changing all function calls
 would not be an option for me)
 
 function my_func( $param, $line = __LINE__, $file = __FILE__ )
 {
...
 }
 
 won't work as it always gets the file and line where function is defined.
 Also I don't want to change all function calls to put __LINE__ and
 __FILE__ parameters.
 I looked into assert too, but I have to change again all function calls
 to be assert( my_func(...) ); which again will be a pain in the a...
 as this function is often called in every scripts...
 
 Any1 has any ideea about it?
 
 Thnx,
 Andrei
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Class constructor

2006-01-31 Thread David Grant
Georgi,

Drop __construct, PHP5 will call Test() anyway.

From http://uk.php.net/manual/en/language.oop5.decon.php:

For backwards compatibility, if PHP 5 cannot find a __construct()
function for a given class, it will search for the old-style constructor
function, by the name of the class.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] html forms and php

2006-01-31 Thread David Grant
Philippe,

I recommend using an ID, instead of the NAME attribute to refer to the
various elements.  This ought to solve your problem.

David

Philippe Reynolds wrote:
 
 Greetings all,
 
 Currently I have a form that has two lists that contain options.
 I use javacript to dynamically move options from one select list to
 another.
 All this works fine...
 
 
 this is the select:
 
 select name=trucklist size=12 style=width: 150px multiple
  option value=LT680LT680/option
  option value=LT685LT685/option
  option value=LT690LT690/option
  option value=LT695LT695/option
  option value=LT700LT700/option
  option value=LT705LT705/option
  /select
 
 Now I wish to post all the options from one list to another page.  So
 I select all the options in that list and hit the submit button.
 
 Obviously, a select list, will return each value with the same name to
 the second web page.  Therefore we can only capture the last option posted.
 
 To resolve this we have to create an array out of our select name:
 select name=trucklist[] size=12 style=width: 150px multiple
 
 I added the square brakets to the name...now when I select all the
 options on the list I can read all values individually.
 
 Here is problem...my javascripts have stopped working, I can't move
 options from one list to the next.  Here is the javascript I use
 currently...I would like help in modifing it so that it may work while
 using the brakets on the name of the select:
 
 Thanks a bunch for the help!!  Always appreciated
 
 First the two list that transmit the options back and forth: (javascript
 below)
 select name=trucklist size=12 style=width: 150px multiple
  option value=LT680LT680/option
  option value=LT685LT685/option
  option value=LT690LT690/option
  option value=LT695LT695/option
  option value=LT700LT700/option
  option value=LT705LT705/option
  /select
 /td
 td
   input type=button name=SelectAll value= All style=width:
 100px; onClick=MoveAll(fleetForm.trucklist,
 fleetForm.reportinglist)br
   input type=button name=Select value= style=width: 100px;
 onClick=Move(fleetForm.trucklist, fleetForm.reportinglist)brbr
   input type=button name=Unselect value= style=width: 100px;
 onClick=Move(fleetForm.reportinglist, fleetForm.trucklist)br
input type=button name=UnselectAll value= All style=width:
 100px; onClick=MoveAll(fleetForm.reportinglist, fleetForm.trucklist)
 /td
 td
  select name=reportinglist[] size=12 style=width: 150px multiple
 
 
 here is the javascript:
 function Move(fromList, toList){
var tempArray = new Array();
var x = 0;
 
//looping through source element to find selected options
for (var i = 0; i  fromList.length; i++) {
if (fromList.options[i].selected) {
//need to move this option to the 'to' list
var selectionLen = toList.length++;
toList.options[selectionLen].text =
 fromList.options[i].text;
toList.options[selectionLen].value =
 fromList.options[i].value;
}
 else {
   //storing options that stay to recreate selected trucks
   var tempValues = new Object();
   tempValues.text = fromList.options[i].text;
   tempValues.value = fromList.options[i].value;
   tempArray[y] = tempValues;
   y++;
}
 
}
//resetting length of 'from' list
fromList.length = tempArray.length;
//looping through temp array to recreate intial selection
for (var i = 0; i  tempArray.length; i++) {
fromList.options[i].text = tempArray[i].text;
fromList.options[i].value = tempArray[i].value;
fromList.options[i].selected = false;
}
 }
 function MoveAll(from, to){
 selectAll(from);
 Move(from, to);
 }
 function selectAll(trucklist) {
 if (!hasTruck(trucklist)) { return; }
 for (var i=0; itrucklist.options.length; i++)
 trucklist.options[i].selected = true;
 
 }
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] Other than default grey button

2006-01-30 Thread David Grant
Peter,

You need to investigate CSS.

David

Jevos, Peter wrote:
 Hi all
 
 I'd like to ask you one ( probably ) simple question. I'm using webmail
 and I want to use other than default php grey button.
 I found on the pages how to use image instead of the default button. So
 I changed
 
 INPUT TYPE=submit NAME=move_button VALUE=Move
 
 to
 
 INPUT TYPE=image' NAME=move_button VALUE=Move
 SRC=../images/button.jpg width=19 height=50
 
 It works but I found the other important problem. This is image. What
 happend when I change the language ? Nothing cause this is permanent
 image and text Move is replaced by image
 
 So what should I do to change design of the button without using image ?
 
 Thanks a lot for an answers
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] Re: Does file_exists() 'honour' open_basedir?

2006-01-27 Thread David Grant
Hi,

Perhaps you refer to this (fixed in 4.3.3):

http://bugs.php.net/bug.php?id=24313

David

DRYALLS wrote:
 Let me try and answer my own question. I've *heard* that since PHP v4.3.2 
 file_exists() returne an open_basedir warning, but earlier PHP versions did 
 not. Is this true?
 
 DRYALLS [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 I have 2 different PHP installs, each are slightly different versions, and 
 each have different open_basedir restictions.

 I have a PHP script that fails on ONE of the installs but NOT the other.

 The line that fails is $foo = file_exists(/proc/loadavg);

 What I don't understand is why one script fails, yet the other does not 
 because NEITHER have /proc in the open_basedir path.

 What could be different about the PHP configs that makes one report a PHP 
 warning, yet the other does not? 
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] Re: Does file_exists() 'honour' open_basedir?

2006-01-27 Thread David Grant
Perhaps you saw it here:

http://php.net/file_exists

Search the page for ceo at l-i-e dot com or open_basedir.

David

DRYALLS wrote:
 Let me try and answer my own question. I've *heard* that since PHP v4.3.2 
 file_exists() returne an open_basedir warning, but earlier PHP versions did 
 not. Is this true?
 
 DRYALLS [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 I have 2 different PHP installs, each are slightly different versions, and 
 each have different open_basedir restictions.

 I have a PHP script that fails on ONE of the installs but NOT the other.

 The line that fails is $foo = file_exists(/proc/loadavg);

 What I don't understand is why one script fails, yet the other does not 
 because NEITHER have /proc in the open_basedir path.

 What could be different about the PHP configs that makes one report a PHP 
 warning, yet the other does not? 
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread David Grant
Laurent,

Laurent Vanstaen wrote:
 
 Hello,

 on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
  I see your point. Here in my case the server I want to copy a file on
  has 192.168.1.1 for IP address and thus cannot be found from outside a
  LAN, so the security problem is not that much important. But I agree
  with you and see what you mean.

 You may want to try sending files via form upload. Then on the
 destination end the you could have a PHP script that would take care of
 authentication and receiving and storing the uploaded files.
 
 The destination server doesn't have PHP 

When you say Livebox, are you in fact referring to the router given
out by your ISP?  If so, what makes you think it's writable in the first
place?

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread David Grant
Laurent,

Laurent Vanstaen wrote:
 If so, what makes you think it's writable in the first place?
 
 'Cause I work for this ISP 

So you don't have specs then I guess, since you're asking in a public
forum!  Have you considered using a HTTP PUT request (using cURL)?

php.net/curl

$curl = curl_init();
$file = replacementfile.txt;

curl_setopt($curl, CURLOPT_URL, 'http://192.168.1.1/cgi-bin/newCrontab');
curl_setopt($curl, CURLOPT_PUT, true);
curl_setopt($curl, CURLOPT_INFILESIZE, filesize($file));
curl_setopt($curl, CURLOPT_INFILE, fopen($file, 'r'));

curl_exec($curl);

Note: you might need to set the CURLOPT_USERPWD option too.

This is my best guess at a solution, but obviously I've not tested it.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] doubt regarding while loop

2006-01-27 Thread David Grant
Suresh,

suresh kumar wrote:
 hi,
for eg 
   
 while(list(t1,t2,...)=mysql_fetch_row($result)):
 endwhile;

You could start with list($t1, $t2, ...) instead.  Personally, I'd done
it without assuming mysql_fetch_row is returning an array.

Try:

$t1 = ;
$t2 = ;
while ($row = mysql_fetch_row($result)) {
list($t1, $t2) = $row;
...
}

echo $t1;

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] Recursive array_push?

2006-01-26 Thread David Grant
Kim,

May the hack-o-rama commence:

?php
$str   = [layer1][layer2][layer3][layer4];
$parts = explode(][, substr($str, 1, -1));
$text  = ;
foreach ($parts as $part) {
$text .= 'a:1:{s:' . strlen($part) . ':' . $part . ';';
}
$text .= 'b:1;' . str_repeat('}',  count($parts));
print_r(unserialize($text));
?

It works, but I'm not proud. :P

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Recursive array_push?

2006-01-26 Thread David Grant
Kim,

After some contemplation (and slightly less crack):

?php
$str   = [layer1][layer2][layer3][layer4];
$parts = array_reverse(explode(][, substr($str, 1, -1)));
$array = FOO;
foreach ($parts as $part) {
$array = array($part = $array);
}
print_r($array);
?

Array
(
[layer1] = Array
(
[layer2] = Array
(
[layer3] = Array
(
[layer4] = FOO
)

)

)

)

David

David Grant wrote:
 Kim,
 
 May the hack-o-rama commence:
 
 ?php
 $str   = [layer1][layer2][layer3][layer4];
 $parts = explode(][, substr($str, 1, -1));
 $text  = ;
 foreach ($parts as $part) {
 $text .= 'a:1:{s:' . strlen($part) . ':' . $part . ';';
 }
 $text .= 'b:1;' . str_repeat('}',  count($parts));
 print_r(unserialize($text));
 ?
 
 It works, but I'm not proud. :P
 
 David


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] HTML Question?

2006-01-26 Thread David Grant
William,

William Stokes wrote:
 How to print tables to a page so that they are placed side by side 
 horizontally as long as there is screen width left and then continue to 
 second row below? Like in many image galleries where thumpnails are dumped 
 to screen and the lines of thumpnails scale dynamically according to screen 
 widht.
 
 I need to dump my thumpnails to screen and add some image info below every 
 thumpnail and I want to take advantage of the whole screen widht.

http://www.alistapart.com/articles/practicalcss/

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] How to check if an object exists

2006-01-25 Thread David Grant
Derrick,

Derrick Shoemake wrote:
 It appears that the error I was getting wasn't really related to my
 problem. I'm getting a error in httpd-error.log
 
 httpd in free(): error: junk pointer, too high to make sense
 [Tue Jan 24 17:11:32 2006] [notice] child pid 22665 exit signal Abort
 trap (6)
 
 Is there any way to track down where the code is failing? It's not
 creating any dump file that I can see. I don't mind digging into this to
 either report a bug to php.net,  apache.org or even just fix the code
 myself and submit a patch to someone, but I'm a little new to the php
 and apache working together.

This might be related to PHP, but I would start out by asking around the
Apache community.

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] function preg_match()

2006-01-25 Thread David Grant
Denyl,

You need to call the person responsible for maintaining your box.

Denyl Meneses Guillén wrote:
 sorry , what is PCRE ?

Regular Expression Functions (Perl-Compatible)

 I looking my configuration with phpinfo() and not exist PCRE or similar .

That's because someone disabled it in the ./configure step
(--disable-all).  Try using the following in the ./configure step:

--with-pcre-regex=DIR (where DIR is where PCRE's include and library
files are located)

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] forwarding from virtual email account to real email account

2006-01-25 Thread David Grant
Binay,

I guess you could set up PHP to listen on port 25 and rewrite the
headers of mail messages containing aliases, but that seems like a lot
of work for what could easily be handled by a (much quicker) MTA.

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Book Sample Code Help

2006-01-24 Thread David Grant
Poppy,

Poppy Alexandra wrote:
 Parse error: parse error in book-1.php on line 90

Please provide lines 89-91 of book-1.php only please.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] Re: Custom Usort Function

2006-01-24 Thread David Grant
Matt,

Personally, I'd do a logic case for each combination, e.g.

if (ctype_alpha($x[0])) {
if (ctype_alpha($y[0])) {
//strcmp
} elseif (ctype_digit([$y[0])) {
//-1
} else {
// 1;
}
} elseif (ctype_digit([$x[0])) {
if (ctype_alpha($y[0])) {
// 1;
} elseif (ctype_digit([$y[0])) {
// 
} else {
// 1;
}
} else {
if (ctype_alpha($y[0])) {
// -1;
} elseif (ctype_digit([$y[0])) {
// -1
} else {
// strcmp
}
}

It's not the prettiest, but it will work.

David

Matt Palermo wrote:
 Any ideas on how to accomplish this?
 
 
 Matt Palermo [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 I'm try to sort a list of items using a usort function.  Basically, I want 
 it to sort in this order:

 Numbers (0-9)
 Letters (Aa-Zz)
 Other (anything else)

 To explain a little further, I want anything that starts with a number to 
 show up first in the sorted list, then anything that starts with a letter, 
 and finally anything that starts with some other character.  My usort 
 function I'm using now gives me results close to this, but it sorts it as 
 follows (which is wrong for what I need):

 Numbers (0-9)
 Other (anything else)
 Letters (Aa-Zz)

 They are all sorted properly alphabetically, but not in the group order 
 that I need them in.  Here is the usort function I'm using right now:


 function myUsort($x, $y)
 {
  if(strtolower($x) == strtolower($y)) return 0;
  if(strtolower($x)  strtolower($y)) return -1;
  return 1;
 }

function myUsort($x, $y) {
if (ctype_digit($x[0])) {
} elseif (ctype_alpha($x[0]}
}

 As I stated above, this provides me with the proper alphabetical results, 
 but I need it tweaked.  Basically this function will give a sorted list 
 like this:

 007
 90210
 __underscore
 abra-cadabra
 Zebra

 But I need the function to provide a sorted list like this:

 007
 90210
 abra-cadabra
 Zebra
 __underscore


 Anyone know what I need to do to get these results?  Please let me know.

 Thanks,

 Matt Palermo
 http://sweetphp.com 
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] query problem.

2006-01-24 Thread David Grant
Angelo,

Angelo Zanetti wrote:
 Why does the   cause that not to be displayed? or is it retrieving it
 correctly but not showing it because of the   (which might be
 conflicting with HTML tags?

Look at the source!

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] How to check if an object exists

2006-01-24 Thread David Grant
Derrick,

Derrick Shoemake wrote:
 Does anyone know if this is the proper way to check for an Objects
 existence and where I can find more information on doing so?

php.net/is_object
php.net/instance_of

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Php4 with mysql flag

2006-01-23 Thread David Grant
Markus,

Markus Braun wrote:
 I have installed it with apt-get install php4 php4-mysql

I think you'll need libapache-mod-php4 too (p.d.o is down at the moment,
so can't be sure), as well as the mysql-server and mysql-client packages.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] Php4 with mysql flag

2006-01-23 Thread David Grant
Markus,

Markus Braun wrote:
 libapache2-mod-php4 is already the newest version.
 mysql-server is already the newest version.
 mysql-client is already the newest version.

That should be all you need then.  Have you restarted apache yet?

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] Re: PHP SSH2

2006-01-23 Thread David Grant
Vedanta,

I recommend contacting the author of the package, or posting to pecl-dev.

David

Vedanta Barooah wrote:
 On 1/23/06, Vedanta Barooah [EMAIL PROTECTED] wrote:
 hello all,
 this is in regard to PECL ssh2 ( http://pecl.php.net/package/ssh2 ) : how
 to i print the output of the command executed using ssh2_exec?
 thanks,
 vedanta

 
 
 
 --
 *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
 Vedanta Barooah
 YM! - vedanta2006
 Skype - vedanta2006
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Adventures in Cookies

2006-01-23 Thread David Grant
Tedd,

tedd wrote:
 Hi all:
 
 While I'm sure this is obvious for most, but I just discovered this.
 
 Using one browser (browser A) I can access one of my pages and create a
 cookie with a user input value.
 
 Then using a different browser (browser B), I can access the same page
 and create another cookie with another user value.
 
 Now, it would seem to me that I shouldn't have two cookies with the same
 name both having different contents, but that's exactly what I've found
 -- for browser A will produce one value and browser B will produce
 another value.

Can you provide some examples for what you mean?

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Adventures in Cookies

2006-01-23 Thread David Grant
Austin,

Austin Denyer wrote:
 On Mon, 23 Jan 2006 16:37:12 +
 David Grant [EMAIL PROTECTED] wrote:
 tedd wrote:
 ...
 Can you provide some examples for what you mean?
 
 I think he's referring to the fact that you can have one cookie in,
 say, Mozilla and another one in, say, Konqueror (or Internet Exploiter
 if you do Windoze).

Rightio.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] Adventures in Cookies

2006-01-23 Thread David Grant
Barry wrote:
 Austin Denyer wrote:
 On Mon, 23 Jan 2006 16:37:12 +
 David Grant [EMAIL PROTECTED] wrote:

 tedd wrote:

 Hi all:

 While I'm sure this is obvious for most, but I just discovered this.

 Using one browser (browser A) I can access one of my pages and
 create a cookie with a user input value.

 Then using a different browser (browser B), I can access the same
 page and create another cookie with another user value.

 Now, it would seem to me that I shouldn't have two cookies with the
 same name both having different contents, but that's exactly what
 I've found -- for browser A will produce one value and browser B
 will produce another value.

 Can you provide some examples for what you mean?


 I think he's referring to the fact that you can have one cookie in,
 say, Mozilla and another one in, say, Konqueror (or Internet Exploiter
 if you do Windoze).

 Regards,
 Ozz.

IE:

 No i think he is more referring to that some different values are stored.
 
 But unless we dont get an example, it's useless to discuss that further :P
 
 Barry
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Adventures in Cookies

2006-01-23 Thread David Grant
Please ignore the previous e-mail: I slipped on the keyboard. :)


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] Cookie reposted

2006-01-23 Thread David Grant
Tedd,

The cookie is being set on the www.xn--ovg.com domain.  The cookie is
being read on xn--ovg.com domain.  This is perceived to be a security
risk, so the cookie isn't sent.

David

tedd wrote:
 Hi:
 
 After I successfully writing a cookie, I'm having a problems reading the
 cookie repeatedly.
 
 The first time into my read the cookie page, the cookie is read.
 However, the second time, it's not.
 
 If I quit my browser and then reenter the read the cookie page, the
 cookie is there and read again. But leaving the page and returning
 produces no cookie. The cookie remains, but the page doesn't read it.
 
 I have set up an example at:
 
 http://xn--ovg.com
 
 Do 1, Set Cookie -- it will create a cookie and report it. Then go to
 main
 Do 2, Get Cookie -- it will report no cookie found.
 
 [A] Quit your browser.
 
 Return to:
 
 http://xn--ovg.com/cookie/getcookie.php
 
 It WILL report your cookie.
 
 Leave the page and return back from anywhere, and your cookie will not
 be reported as there. However, if you go to [A] and repeat, you'll find
 your cookie remains.
 
 Surely someone must know what's happening here.
 
 Does anyone have any ideas?
 
 It would be nice to have a persistent cookie. Do I also have to use a
 session to make this happen?
 
 tedd


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] date(H, $datevalue) always adds an hour?

2006-01-20 Thread David Grant
Murray,

What do you get if you print date(T)?

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] date(H, $datevalue) always adds an hour?

2006-01-20 Thread David Grant
Murray,

As far as I know, Queensland is in EST (Eastern Standard Time), so that
is the correct value.  Are you using the same machine or is it remote?

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] date(H, $datevalue) always adds an hour?

2006-01-20 Thread David Grant
Murray,

I can't think what else it might be.  Sorry!

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] New identification after an error...

2006-01-20 Thread David Grant
David

David BERCOT wrote:
 I've tried :
 $_SERVER[PHP_AUTH_USER] = NULL;
 without succes...

http://www.php.net/unset

e.g. unset($_SERVER['PHP_AUTH_USER']);

It might, however, be better practice to used an authorisation state
variable, or something similar, i.e.

if (! $auth) {
// HTTP Headers
}

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] problem encountered with stristr-based function

2006-01-20 Thread David Grant
George,

George Pitcher wrote:
 For info, I am trying to highlight search terms in results.

If you're searching and replacing within HTML, you ought to be aware of
issues if someone's search term happens to be an HTML tag or attribute.
 For example, Alice might search for href and get the following:

a bhref/b=URLText/a

back, which is clearly fubar, which highlights the necessity for some
handy regex skills.  Following a quick google, I found this page:

http://aidanlister.com/repos/?file=function.str_highlight.php

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] how 2 stroe images in Mysql Database using PHP

2006-01-16 Thread David Grant
Suresh,

suresh kumar wrote:
 i dont know how 2 store images in gif/jpeg format
 in Mysql Database.i also want 2 know PHP Code 2
 store images in Mysql Database .reply me soon its very
 urgent .

Storing the image in the database will result in a fairly large
performance hit, but if you want to do that, it's your lookout.  A quick
search turned this up:

http://www.zend.com/zend/trick/tricks-sept-2001.php

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] php script running as a cgi

2006-01-16 Thread David Grant
Hi,

zedleon wrote:
 I am running a php script as a cgi so to be able to run under my user name.
 The script seems to be working except for one major problem.
 the cgi script is not finding the variables passed by the html form...

How are you attempting to access them?

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] PHP for Mac

2006-01-13 Thread David Grant
Richard,

Caveat:  I'm not a OS X user, so this information may not help you.

Richard Correia wrote:
 I want to install PHP5 on Mac powerbook G4. Can someone please let me know
 where I can find it and it's related module?

The installation instructions for OS X on PHP.net[1] points to this[2]
resource for installing a portfile.  It appears to come with GD compiled
in already, but you'll have to look a bit further for Ming.

 I am mainly looking for GD and mingswf module on Mac.

1. http://www.php.net/manual/en/install.macosx.php
2. http://php5.darwinports.com/

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] PHP 4.4.2 released!

2006-01-13 Thread David Grant
Derick,

Derick Rethans wrote:
 The PHP Development Team would like to announce the immediate release of 
 PHP 4.4.2. This is a maintenance release that addresses a number of 
 minor security problems and fixes a few regressions that shown up in PHP 
 4.4.1. All users of PHP 4 are recommended to upgrade to PHP 4.4.2.

Any indication as to when the Windows binaries will become available?

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Lions and tigers and slashes, oh my!

2006-01-13 Thread David Grant
Jay,

Jay Blanchard wrote:
 I am having a problem with a an ampersand sign. I have a list of things on a
 page, in which one category is 'Oil  Gas'. I store it in the database as
 'Oil amp; Gas'. When the category is clicked the query string shows just an
 ampersand, i.e.
 Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm
 ents= and therefore just shows as an '' and the query only sees 'Oil'.
 
 I guess that I am too tired to deal with this or the answer would come to
 mind immediately. Can someone drop kick me in the right direction? Thanks!

Probably not the answer you're looking for, and somewhat site-stepping
the issue, but can't you use the category key instead of its title?

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Lions and tigers and slashes, oh my!

2006-01-13 Thread David Grant
Jay,

Jay Blanchard wrote:
 [snip]
 hope the kick didn't break anything. :-)
 [/snip]
 
 Nah, just having a senior moment. Since it is a query string issue I
 converted the database (even though it is strictly a web database in this
 case) to 'Oil  Gas'. The query string sees the ampersand and doesn't show
 anything past that in the condirion.

URL encoding the category ought to convert the text to Oil%20%26%20Gas,
which ought to work without any problems.  Have you tried this?

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] transferring db info

2006-01-12 Thread David Grant
Ross,

Ross wrote:
 Can you just export the mysql? Will the pdfs be exported as binary data? 
 Will I have to re-upload them? (there are hundereds).

Try using mysqldump to pull the data into a flat file full of SQL
statements.  You can then use the mysql command to reinsert the data.

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Image size?

2006-01-11 Thread David Grant
Will,

William Stokes wrote:
 Can I get pixel sizes from a uploaded web applicable image with PHP? I mean 
 width and height as pixels. If  so How?

http://www.php.net/getimagesize

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] php + mysql - timstamp - calculate hours remaining

2006-01-10 Thread David Grant
Gregory,

Gregory Machin wrote:
 I have a table with a timestamp column and would like to use his to
 calculate the age of the record . how would i go about this...
 I would also like to exicute a mysql stament that pasess the tables and
 removes fields older than say 72 hours. how would i go about this . ?

A timestamp is the time in seconds (since Jan 1 1970), so you can
ascertain the age in seconds by subtracting the stored timestamp from
the current timestamp.

You can find the current timestamp in MySQL using the
CURRENT_TIMESTAMP() function.

Once you have the age of the record, finding 72 hours is fairly trivial
- 72 hours is 259200 seconds (72hrs * 60mins * 60secs).

Therefore your query will be:

DELETE FROM TABLE WHERE CURRENT_TIMESTAMP() - FIELD  259200

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] php + mysql - timstamp - calculate hours remaining

2006-01-10 Thread David Grant
Gregory,

David Grant wrote:
 Gregory Machin wrote:
 I have a table with a timestamp column and would like to use his to
 calculate the age of the record . how would i go about this...
 I would also like to exicute a mysql stament that pasess the tables and
 removes fields older than say 72 hours. how would i go about this . ?
 
 A timestamp is the time in seconds (since Jan 1 1970), so you can
 ascertain the age in seconds by subtracting the stored timestamp from
 the current timestamp.
 
 You can find the current timestamp in MySQL using the
 CURRENT_TIMESTAMP() function.
 
 Once you have the age of the record, finding 72 hours is fairly trivial
 - 72 hours is 259200 seconds (72hrs * 60mins * 60secs).
 
 Therefore your query will be:
 
 DELETE FROM TABLE WHERE CURRENT_TIMESTAMP() - FIELD  259200

Following Albert's reply, the query ought to read:

DELETE FROM TABLE WHERE CURRENT_TIMESTAMP() - UNIX_TIMESTAMP(FIELD 
259200

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Is there a way to display data from database for Select Options in a form?

2006-01-10 Thread David Grant
Sue,

Sue wrote:
 We have a form that contains a Select option for a listing of available 
 dates for the user to choose from.  Right now we have to manually change the 
 dates within the form's Selection list as new dates become available to 
 choose from.  We currently store these available dates in our database, and 
 am wondering if we can somehow extract these dates from the table to display 
 in our form?  This would eliminate alot of maintenance needed to this form. 
 If anyone has any ideas as to reference material etc. that I may look which 
 would give me an idea how to do this using PHP, I'd appreciate it!

I'd recommend reading the PHP manual at:

http://www.php.net/docs.php

There you will find chapters on using various database functions, such as:

MySQL
http://www.php.net/manual/en/ref.mysql.php

PostgreSQL
http://www.php.net/manual/en/ref.pgsql.php

Microsoft SQL Server
http://www.php.net/manual/en/ref.mssql.php

Oracle
http://www.php.net/manual/en/ref.oracle.php

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Is there a way to display data from database for Select Options in a form?

2006-01-10 Thread David Grant
Jochem,

Jochem Maas wrote:
 teaching noobs to output html while (oun intended) looping thru a
 result set is counter-productive. discuss.

I disagree, however, I do believe attention should be drawn to reasons
why doing so might be considered bad practice.

Even the longest journeys start with small steps, and asking someone new
to PHP to separate various tiers might put them off.

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] replacing .shtml #exec cgi with php calls

2006-01-10 Thread David Grant
Dr.

The Doctor wrote:
 !--#exec cgi=/cgi-bin/script.pl -- and wish to replace it with a php call.

php.net/exec

 Similarly we want to hide a js script.

You want to disable direct requests to the javascript file?  I can't
think of a way that couldn't be trivially circumvented.  You're probably
better off obfuscating the code.

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Is there a way to display data from database for Select Options in a form?

2006-01-10 Thread David Grant
Jochem,

Jochem Maas wrote:
 David Grant wrote:
 1. your looping a result set which involves a db connection - lots
 of pontential things that could go wrong...

Absolutely, and lots of lessons to learn too.

 2. its not a centralized 'solution' - code reuse is a good thing.

However, what use is code reuse when you're using it only once.  If you
need to perform the same function again, then refactor the existing code.

 3. we should encourage people to aim a little higher?

I imagine my first PHP script with a database connection probably looked
much like Adrian's solution, and writing lots and lots of PHP has taught
be some best practices that I now stick to.  However, being told that I
need to write reusable functions for iterating a resultset would've had
me running off to another scripting language in a heartbeat.

Tell people to aim higher, sure, but let them make their own mind up,
make their own mistakes and learn from them. :)


 Even the longest journeys start with small steps, and asking someone new
 to PHP to separate various tiers might put them off.
 
 which I could spin as a positive thing - raising the lowest commom
 denominator
 so to speak. besides Sue was the one that came with the many-in-one
 question
 (i.e. how to a dynamically generate a select box AND how do I grab data
 from
 a DB).

I'm sure you're not being elitist, but where do you place the bar?
Should PHP be made a language that only the experienced can get into?
That sounds like a policy that would only harm the PHP community.

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Problem with fsockopen and SSL

2006-01-09 Thread David Grant
Hi Barry,

I'm not terrible au fait with the workings of SSL, but it strikes me as
potentially problematic that you are communicating in plain text over an
encrypted protocol.  Might that be the problem?

David

Barry wrote:
 Hi everyone!
 
 I want to connect to an SSL server but i can't get the content :(
 
 Here is the code i use:
 $xml = 'xmldataHello!/data/xml';
 
 function PostToHost($host, $path, $referer, $data_to_send) {
   $fp = fsockopen($host, 443);
   printf(Open!\n);
   fputs($fp, POST $path HTTP/1.1\r\n\r\n);
   fputs($fp, Host:$host\r\n);
   fputs($fp, Referer: $referer\r\n);
   fputs($fp, Content-type: text/xml\r\n);
   fputs($fp, Content-length: . strlen($data_to_send) .\r\n);
   fputs($fp, Connection: close\r\n);
   //fputs($fp, $data_to_send);
   printf(Sent!\n);
   while(!feof($fp)) {
   $res .= fgets($fp, 128);
   }
   printf(Done!\n);
   fclose($fp);
 
   return $res;
 }
 
 $data = $xml;
 
 printf(Go!\n);
 $x = PostToHost(
   ssl://easy-demo.tcinternet.de,
   /hosting/servlet/Dispatcher,
   $GLOBALS[HTTP_REFERER],
   $data
 );
 echo $x;
 
 And this is what i get:
 Go! Open! Sent! Done! HTTP/1.1 400 Bad Request Date: Mon, 09 Jan 2006
 10:28:48 GMT Server: Apache/2.0.53 (Unix) mod_ssl/2.0.53 OpenSSL/0.9.7e
 DAV/2 mod_jk/1.2.1 Content-Length: 363 Connection: close Content-Type:
 text/html; charset=iso-8859-1
 Bad Request
 
 Your browser sent a request that this server could not understand.
 Apache/2.0.53 (Unix) mod_ssl/2.0.53 OpenSSL/0.9.7e DAV/2 mod_jk/1.2.1
 Server at easy-demo.tcinternet.de Port 443
 
 What did the Webserver not understood?
 
 Btw. i can't use cURL because the server has an old version of PHP ()
 
 Would be glad if you can help or even have a code how to connect to a
 SSL webserver via fsockopen that works.
 
 Btw the PHP version on server is: PHP Version 4.2.2
 
 Thanks for any help!
 
 Greets Barry
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Php5 SOAP WSDL parsing

2006-01-09 Thread David Grant
Simon,

It would appear you've not included the full message.  Please look at
the source of the message in your web browser.  The space between
unexpected and in complexType probably contains an XML tag.

David

Simon Detheridge wrote:
 I'm trying to get PHP5 to talk to a web service that I am developing.
 
 I have created a wsdl for the service
 (http://www.symgate.com/symgate/symgate.wsdl) and am trying to get PHP
 to parse it. (The wsdl validates in a number of tools I've pointed at
 it, including mindreef soapscope and the wsdl analyser on xmethods.net)
 
 When I try and get PHP5 to read the file, I get an error that it not
 very helpful. My code says:
 
 try
 {
  $client = new SoapClient (
 http://www.symgate.com/symgate/symgate.wsdl; ) ;
 } catch ( SoapFault $fault ) {
  echo $fault ;
  exit ;
 }
 
 The output says:
 
 SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: unexpected  in
 complexType in /var/www/localhost/htdocs/soap1.php:5 Stack trace: #0
 /var/www/localhost/htdocs/soap1.php(5):
 SoapClient-__construct('http://www.symg...') #1 {main}
 
 This is obviously truncated. I've tried looking at the apache2 error_log
 but I can't see any further detail.
 
 I'd really like to know what PHP's problem is with my wsdl. How can I
 see the full output of this error?
 
 Thanks,
 Simon
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] include() problem

2006-01-09 Thread David Grant
Nuno,

Have you considered $_SERVER['DOCUMENT_ROOT']?

David

Nuno Trancoso wrote:
 This may sound dumb, but i have been up all night going through
 php/apache docs, and still have not found an answer..
 
 Throughout a site i need to include files that are scattered in subdirs,
 sometimes up in the dir tree, sometimes down. Bad design i know but i
 have to live w/ it...
 
 Problem is in the way Apache/PHP see stuff. If i include /somefile.htm
 in html, it means somefile.htm wich is at site root dir. In PHP it looks
 like it means somefile.htm at SERVER root dir.
 
 I can use getcwd() and go around truncating/adding to the string until i
 get a path to use with set_include_path() to add the site root dir to
 the include path, but it just seems wrong to waste cycles doing it...
 
 So, question is, is there a more direct/elegant way to add the site root
 (or any other dir for that matter) to the include path?
 
 TIA
 Nuno Trancoso
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] The meaning of and @

2006-01-09 Thread David Grant
Todd,

The @ operator suppresses error messages.

http://www.php.net/manual/en/language.operators.errorcontrol.php

David

Todd Cary wrote:
 I have not been able to find in the Online Manual the use of the @
 symbol as in
 
 while ([EMAIL PROTECTED]($sqlID, MYSQL_BOTH)){
 
 Is that a pointer...address of...?
 
 Todd
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Executing a string

2006-01-09 Thread David Grant
Philip Hallstrom wrote:
 http://us2.php.net/eval

Pay close attention to the oft-used quote from Rasmus Lerdorf:

If eval() is the answer, you're almost certainly asking the
wrong question

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Graphically displayed number to confirm user is a human

2006-01-04 Thread David Grant
Dave M G wrote:
   First, is there a term for these kinds of images, or that kind of
 verification system? What would be the best search terms to look for
 source scripts?

CAPTCHA

   Second, can anyone recommend a resource for that kind of PHP script. If
 I really worked at it, I could probably write the script to generate a
 small PNG image with a random number in it. But I haven't the faintest
 clue how to distort it so it's only legible to humans, nor how to
 correlate the image with a number that a user inputs into a form field.

http://pear.php.net/package/Text_CAPTCHA

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] PHP is OK in IE but not in Netscape

2005-12-22 Thread David Grant
Nanu,

Nanu Kalmanovitz wrote:
 The http://www.kalmanovitz.co.il/hello.php file appears OK in M$-IE but
 not in Netscape 7.0.

Looks fine to me.  What is the contents of hello.php?

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] PHP is OK in IE but not in Netscape

2005-12-22 Thread David Grant
Nanu,

Nanu Kalmanovitz wrote:
 Ok, I will forget Netscape, what other popular browsers beside M$-IE
 works with M$-Windows?

I wouldn't forget Netscape, because people still use it.  Just make
sure your code validates to W3C standards and so long as it isn't too
cutting edge, must browsers should display it fine.

To answer your question, Opera is probably the third most popular
browser on Windows.

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] can someone explain this query to me

2005-12-20 Thread David Grant
Ross,

Ross wrote:
 $query = delete from meetings where id IN (.implode(,, $ids).);
 
 Just the end bit, ids is an array of values (1,2,3,4,5) what does the IN 
 do??

It's the equivalent of WHERE id = 1 OR id = 2 OR id = 3 OR id = 4 OR id = 5.

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] problem: pgsql (unicode) = php5 = HTML (iso-8859-1)

2005-12-20 Thread David Grant
Michelle,

Michelle Konzack wrote:
 Please can anyone tell me the right META (???) Tag to get Motilla
 right to UNICODE?

Try:

meta http-equiv=Content-Type content=text/html; charset=UTF-8

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] ? Split string into smaller chunks

2005-12-19 Thread David Grant
Labunski wrote:
 I need to split a long string into smaler chunks (an array), as a separator 
 using every third \n (and not just every \n).
 I could use 'explode', but then it would produce too many chunks.

php.net/preg_split

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread David Grant
Paul Jinks wrote:
 $SQLQuery = SELECT * FROM project WHERE
 projTitle = .$HTTP_GET_VARS['projTitle']
 or die(SQLQuery 1 failed);

$SQLQuery = SELECT * FROM project WHERE projTitle = ' .
$HTTP_GET_VARS['projTitle'] . ';

Not sure why you've got the or die() there.

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread David Grant
Paul,

Paul Jinks wrote:
 David Grant wrote:
 $SQLQuery = SELECT * FROM project WHERE projTitle = ' .
 $HTTP_GET_VARS['projTitle'] . ';
 
 Yep, that fixed it. Thanks. I had a feeling there was a mix up with the
 s and 's. What's with the .  s?

The . is a concatenation operator, i.e. it joins two strings together.

 Not sure why you've got the or die() there.
 
 I had the idea that you could put an or die() after any command and it
 would tell you that it had screwed up at that point. Bad idea?

Bit hard to maintain I should think.  It's unlikely you're going to
screw up a string concatenation and it still be able to call the die().

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread David Grant
Rahul,

Rahul S. Johari wrote:
 The 4 Digit ID (beginning from 0001) will be used in two places:
 (a) It will be the ID for the record in the mySQL table, instead of the
 usual ID that we create in mySQL. It will be a Primary Key, Not Null,
 Auto_Increment

Adding ZEROFILL to that definition might be what you're after.

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Problem: Distortion while saving text file.

2005-12-14 Thread David Grant
Could it be the other way around, i.e. Windows is stripping slashes, and
Linux is not?  How does $contents come to exist in the script?

Check for any difference in your ini files for magic_quotes_runtime.

Cheers,

David Grant

Janne Miettunen wrote:
 What could be wrong when this is transformed:
 img src=graphics/auringonlasku2.jpg align=left
 to this form:
 img src=\graphics/auringonlasku2.jpg\ align=\left\
 
 The line is saved to text file with this function:
 
 function savesite($site, $lang, $contents){
 
 if (check_session()){
 $file=fopen('content/' . $site . '_' . $lang . '.txt', w);
 
 fwrite($file, $contents);
 
 fclose($file);
 }
 
 I run it through nl2br() before saving and this only happens on Linux
 server, on Windows server it works fine, no \ before .
 
 Tested with:
 On Windows: Apache2, PHP5
 Linux: Debian distro, Apache2, PHP4, also tried with PHP5
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] foreach $_FILES

2005-12-14 Thread David Grant
Shaun,

That is the documented behaviour for form fields in PHP.

See Dots in incoming variable names on the following page:

http://php.net/variables.external

Cheers,

David Grant

Shaun wrote:
 Hi,
 
 I have a form on my site with many file fields for users to upload files. I 
 am trying to verify that for each file uploaded it corresponds with the name 
 of the file field i.e.
 
 tr
tdFile_1.CSV:/td
tdinput type=file name=File_1.CSV/td
 /tr
 tr
tdFile_2.CSV:/td
tdinput type=file name=File_2.CSV/td
 /tr
 
 However if I loop through the $_FILES array like this:
 
 foreach( $_FILES as $key = $value ){
echo '$key = '.$key.'br /';
echo '$value = '.$value.'br /';
 }
 
 $key = File_1_CSV
 $value['name'] = File_1.CSV
 $key = File_2_CSV
 $value['name'] = File_2.CSV
 
 The . is replaced with an underscore in the $key value. I could get around 
 this with a substr() but it seems a little inelegant, can anyone tell me why 
 this is happening please?
 
 Thanks for your advice. 
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] 1 ip address go here all others go here

2005-12-13 Thread David Grant
Try $_SERVER['REMOTE_HOST'] instead of REFERER.

Dave Carrera wrote:
 Jay Blanchard wrote:
 
 [snip]
 Is there a way of sending users with a local ip address say 127.0.0.1
 and 192.168.xxx.xxx to goto one page and all other visitors to goto
 another?
 [/snip]


 Yes, there is.


 $_SERVER['REFERER'] will give you the referer mosy of the time. More info
 from TFM can be found here;

 http://us3.php.net/reserved.variables

 Header can then be used to redirect

 header(Location: http://www.example.com/;); /* Redirect browser */. More
 info from TFM can be found here;

 http://us3.php.net/header

  

 snip from TFM
 
 'HTTP_REFERER'
 
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
 
 notice the last 7 words 
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] 1 ip address go here all others go here

2005-12-13 Thread David Grant
Quick and (very) nasty:

$parts = split(., $_SERVER['REMOTE_HOST']);
if ($_SERVER['REMOTE_HOST'] == '127.0.0.1' || ($parts[0] == '192' 
$parts[1] == '168')) {
// Local
} else {
// Remote
}


Dave Carrera wrote:
 i know about
 
 $_SERVER['REMOTE_HOST']
 
 but i think i should of said how do i compare any address starting with
 192.168.
 
 sorry if my first question was to vague
 
 
 David Grant wrote:
 
 Try $_SERVER['REMOTE_HOST'] instead of REFERER.

 Dave Carrera wrote:
  

 Jay Blanchard wrote:

   
 [snip]
 Is there a way of sending users with a local ip address say 127.0.0.1
 and 192.168.xxx.xxx to goto one page and all other visitors to goto
 another?
 [/snip]


 Yes, there is.


 $_SERVER['REFERER'] will give you the referer mosy of the time. More
 info
 from TFM can be found here;

 http://us3.php.net/reserved.variables

 Header can then be used to redirect

 header(Location: http://www.example.com/;); /* Redirect browser */.
 More
 info from TFM can be found here;

 http://us3.php.net/header



 
 snip from TFM

 'HTTP_REFERER'

   The address of the page (if any) which referred the user agent to
   the current page. This is set by the user agent. Not all user agents
   will set this, and some provide the ability to modify HTTP_REFERER
   as a feature. In short, it cannot really be trusted.

 notice the last 7 words 

   


  

 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] 1 ip address go here all others go here

2005-12-13 Thread David Grant
Erm, REMOTE_ADDR, not REMOTE_HOST.  Sorry!

David Grant wrote:
 Quick and (very) nasty:
 
 $parts = split(., $_SERVER['REMOTE_HOST']);
 if ($_SERVER['REMOTE_HOST'] == '127.0.0.1' || ($parts[0] == '192' 
 $parts[1] == '168')) {
   // Local
 } else {
   // Remote
 }
 
 
 Dave Carrera wrote:
 i know about

 $_SERVER['REMOTE_HOST']

 but i think i should of said how do i compare any address starting with
 192.168.

 sorry if my first question was to vague


 David Grant wrote:

 Try $_SERVER['REMOTE_HOST'] instead of REFERER.

 Dave Carrera wrote:
  

 Jay Blanchard wrote:

   
 [snip]
 Is there a way of sending users with a local ip address say 127.0.0.1
 and 192.168.xxx.xxx to goto one page and all other visitors to goto
 another?
 [/snip]


 Yes, there is.


 $_SERVER['REFERER'] will give you the referer mosy of the time. More
 info
 from TFM can be found here;

 http://us3.php.net/reserved.variables

 Header can then be used to redirect

 header(Location: http://www.example.com/;); /* Redirect browser */.
 More
 info from TFM can be found here;

 http://us3.php.net/header



 
 snip from TFM

 'HTTP_REFERER'

   The address of the page (if any) which referred the user agent to
   the current page. This is set by the user agent. Not all user agents
   will set this, and some provide the ability to modify HTTP_REFERER
   as a feature. In short, it cannot really be trusted.

 notice the last 7 words 

   

  

 
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Call to undefined function mysql_real_escape_string()]

2005-12-08 Thread David Grant
Try using mysqli, instead of mysql.

Have you tried Joomla! support channels?

Paul Hickey wrote:
 Can someone help me overcome this recurring problem? I am using the
 Joomla content management system and I keep coming across the following
 errors.  
 
 Fatal error: Call to undefined function mysql_real_escape_string()
 in /usr/local/apache2/htdocs/common.php on line 24
 
 Fatal error: Call to undefined function mysql_real_escape_string()
 in /usr/local/apache2/htdocs/class.inputfilter.php on line 344
 
 I notice in my Dynamic Extensions section of php.ini there are no
 extensions called for; if that helps. Joomla works fine, but when adding
 components or modules the problems start. One component author made a
 test for the mysql_real_escape_string and I think avoided using it then
 the component worked. I think that's probably not the best solution. 
 
 Fedora Core 3
 
 Apache 2.0.55
 
 PHP 5.0.5 (compiled with mysqli vice mysql)
 './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-ftp'
 '--enable-inline-optimization' '--enable-magic-quotes' '--enable-
 mbstring' '--enable-track-vars' '--enable-trans-sid' '--enable-
 wddx=shared' '--enable-xml' '--with-dom' '--with-gd' '--with-gettext'
 '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-regex=system'
 '--with-xml' '--with-zlib-dir=/usr/lib'
 
 MySQL 4.1.15
 
 
 TIA,
 
 
 Paul Hickey
 Christian Patriot 
 Palm Bay Fl
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Call to undefined function mysql_real_escape_string()]

2005-12-08 Thread David Grant
Is there no way to specify the database functions in Joomla?

You're getting undefined function because you haven't compiled it with
mysql, but mysqli instead, which means the functions you need are
prefixed with mysqli instead of mysql.

Paul Hickey wrote:
 I have PHP compiled with mysqli.
 
 The standard answer from the Joomla forums is that I need to have
 mysql vice mysqli. I was looking for a more global solution than
 having to modify the code for every component, module, mambot I want to
 use.
 
 I don't understand why I'm getting undefined function errors. 
 
 PHP.ini has no reference to mysqli. I don't know if changing this would
 enable the functions specific to PHP  4.x.
 
 Paul Hickey
 Christian Patriot 
 Palm Bay Fl
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Call to undefined function mysql_real_escape_string()]

2005-12-08 Thread David Grant
Hi John,

John Nichel wrote:
 Paul Hickey wrote:
 I don't understand why I'm getting undefined function errors.
 PHP.ini has no reference to mysqli. I don't know if changing this would
 enable the functions specific to PHP  4.x.
 
 In your configuration line (how php was configured then compiled), you
 have...
 
 --with-mysqli=/usr/local/mysql/bin/mysql_config
 
 That is why you are getting undefined function errors.  Your version of
 php is using mysqli, not mysql.  You have two options: a) Recompile php
 or b) Change all mysql_* functions to their counterparts in mysqli_*


Hmm, that's how I *should* have put it. :)

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] PEAR Validate email question

2005-12-08 Thread David Grant
Validate::email appears to check for a MX or A record.  I'm a bit rusty
on my RFCs, but isn't is possible the mail host could be specified using
a CNAME?

Cheers,

David

Eric Butera wrote:
 Hello,
 
 I'm using the PEAR Validate::email method to validate email addresses on our
 contact forms since the spam bots have gotten so bad.  I am using the
 check_domain flag which calls the php function checkdnsrr.  This form
 processor is used on several sites now and all is going well except one
 problem.  It seems this checkdnsrr function randomly returns false on
 valid email addresses.  I built a little debug feature into the processor to
 let me know when the script fails and any error messages it has generated
 along the way to try and stay ahead of the spammers.
 
 I've been getting randomly occurring failure notices.  Most of the time it
 works, sometimes it doesn't.  Every failure is a valid DNS and email
 address.  If I try running the email address against Validate::email later
 it works.  I was hoping somebody can shine some light on why checkdnsrr
 would work sometimes and why it wouldn't work others.  Any help or advice
 would be greatly appreciated.
 
 Thanks in advance!
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Non-trivial task of converting text to HTML

2005-12-08 Thread David Grant
Hi Roman,

Check out this: http://www.michelf.com/projects/php-markdown/

Would this help you?

Cheers,

David

Roman Ivanov wrote:
 Task:
 Create a script that converts text into HTML with paragraphs.
 
 Problem:
 Input text could use the book notation, as well as the web notation,
 plus it can contain HTML.
 
 ==
 h1This is a title/h1
 
This is a Book paragraph.
This is another book paragraph.
 This is yet another book paragraph, but it's not indented with spaces,
 because user wrote it in OpenOffice.
 ==
 
 ==
 This is a web paragraph.
 
 This is another web paragraph.
 
This is yet another web paragraph, which is indented with spaces for
 some unknown reason.
 ==
 
 Output text should be correctly formatted without using lots of br's and
 nbsp;'s. Doing so manually is not a problem, I would just use p for
 web paragraphs, and p class=book for book paragraphs. However,
 formatting such text with a scrip is very difficult. Does anyone knows a
 good exaple of such script?
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Anyone getting bounces from

2005-12-07 Thread David Grant
Jay Blanchard wrote:
 [EMAIL PROTECTED] ?
 
 I am getting failure notices out the wazoo for some very old messages to the
 general list.
 

Just got seven in a row, looks like the MTA is trying for three weeks
and then giving up.  The messages appear to be for:

[EMAIL PROTECTED]

Can this address be unsubscribed?

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Eval To String

2005-12-07 Thread David Grant
Shaun

Shaun wrote:
 Is it possible to return the result of eval function to a string rather than 
 outputting directly to the browser?

ob_start();
eval('$eval = evil;');
$output = ob_get_clean();

Cheers,

David Grant
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] help with preg_replace only part of the string

2005-12-06 Thread David Grant
Replace the middle (.*) with ([^]*).  This tells the regex engine to
ignore new opening tags.

Cheers,

David

Georgi Ivanov wrote:
 Hi,
 I want to replace the content of html links : a href=foo 
 name=blaREPLACETHIS/a.
 
 $html=preg_replace(/(a.*name=.*)(.*)\/a/isU,$link,$html,1);
 This generally works but removes a,/a tags too.
 How to make it work without removing anything else than (.*) in the middle of 
 a.*/a
 
 Thanks in advance.
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] What software do you use for writing PHP?

2005-12-06 Thread David Grant
Jeff,

Jeff McKeon wrote:
 Forever now I've been using Frontpage for all my web work including php.
 I'm sure there's better software out there that is more suited to
 writing and editing PHP pages.  What do you all use?

I use Zend Studio 5, but there are plenty of other (cheaper) options.
Take a look at the following link for a list of editors with reviews.

http://www.php-editors.com/review/

Cheers,

David Grant
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] What software do you use for writing PHP?

2005-12-06 Thread David Grant
Hi Jeff,

Jeff McKeon wrote:
 What is it you like about Zend Studio?

* Code completion
* Syntax highlighting for PHP, HTML and CSS
* Manual pages
* Debugging
* Code examination
* PHPDoc
* CVS  SVN support

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread David Grant
Jared Williams wrote:
 Why not
 
 for ($i = 0; $i  100/100; ++$i)

This involves dividing 100 by 100 for each iteration of the loop.
It would be better to test against 1.

There is also the unwanted side-effect of executing the code on each
hundredth iteration, which is unwanted (as far as I understand the
problem). :)

It would be interesting if Steve could divulge the greater problem that
he is seeking a solution to.

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



  1   2   3   >