php-general Digest 15 May 2008 08:51:05 -0000 Issue 5460

2008-05-15 Thread php-general-digest-help

php-general Digest 15 May 2008 08:51:05 - Issue 5460

Topics (messages 274334 through 274358):

Re: Tracking down the elusive expecting T_PAAMAYIM_NEKUDOTAYIM
274334 by: mike
274337 by: Boyd, Todd M.
274338 by: Daniel Brown
274340 by: Tyson Vanover
274348 by: Gabriel Sosa

Re: Mic check 1, 2, 3...
274335 by: tedd
274336 by: Bastien Koert
274339 by: Daniel Brown
274342 by: Tyson Vanover

Variable Scope from child to parent
274341 by: Tyson Vanover
274351 by: Gabriel Sosa

Re: Good HTML parser needed
274343 by: Shelley
274345 by: Yi Wang
274352 by: Yi Wang

Validating Form input
274344 by: Chris W
274346 by: Yi Wang
274347 by: Dan Joseph
274350 by: Robert Cummings
274355 by: Adam Richardson

Using SVN w/ Zend Studio for Eclipse
274349 by: Steve Finkelstein
274358 by: Colin Guthrie

Can I install a newer version of php over an older version
274353 by: Tony M

Re: Scottish Devs
274354 by: Manuel Lemos

SCanning text of PDF documents
274356 by: Angelo Zanetti
274357 by: David Otton

Administrivia:

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

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

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
I've got that before and I am not using a Hebrew version of PHP :)

On 5/14/08, Daniel Brown [EMAIL PROTECTED] wrote:

You're using a Hebrew version of PHP?

That means something along the lines of two times the two marks in 
 Hebrew.
---End Message---
---BeginMessage---
In your code, it appears you forgot to close a pair of parentheses:

---
 foreach($set  as  $key=value)
 {
   if  (array_key_exists($key,$this-titles)
   {
 $this-a[$key]  =  $value;
   }
 }
---

It looks like that 3rd line should be:

---
if  (array_key_exists($key,$this-titles))
---

I hope that helps. Having another set of eyes take a look at it usually
does. ;)

Todd Boyd
Web Programmer

---End Message---
---BeginMessage---
On Wed, May 14, 2008 at 4:51 PM, mike [EMAIL PROTECTED] wrote:
 I've got that before and I am not using a Hebrew version of PHP :)

Yeah, just a joke.  I forgot to put the Trademark ;-P in its place.

The etymology of that message could be attributed to the fact that
Zeev and Andi are Israeli.  Just taking a guess at it though.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
---End Message---
---BeginMessage---

Daniel Brown wrote:

?php
foreach($set as $key = $value) { // You just missed the $ before value.
?

This seems to be the culprit.



Also, check this line:

?php
 if  (array_key_exists($key,$this-titles)
?

You're missing a ')' to close the if() statement.  It's not
causing this problem, but it will cause a problem afterward.



Thanks for catching that.
---End Message---
---BeginMessage---
On Wed, May 14, 2008 at 5:43 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Wed, May 14, 2008 at 4:05 PM, Tyson Vanover [EMAIL PROTECTED] wrote:
 I have a class that is throwing the error:
 syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM ...

You're using a Hebrew version of PHP?

not necessary should be  the hebrew PHP version.
by definition even in the english version T_PAAMAYIM_NEKUDOTAYIM is
used to name ::




That means something along the lines of two times the two marks in 
 Hebrew.

However, in your case, you're checking the error on the wrong
 line.  Look at your foreach() statement.  It should instead read as
 follows:

 ?php
foreach($set as $key = $value) { // You just missed the $ before value.
 ?

Also, check this line:

 ?php
 if  (array_key_exists($key,$this-titles)
 ?

You're missing a ')' to close the if() statement.  It's not
 causing this problem, but it will cause a problem afterward.

 --
 /Daniel P. Brown
 Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
 $59.99/mo. with no contract!
 Dedicated servers, VPS, and hosting from $2.50/mo.

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





-- 
Los sabios buscan la sabiduría; los necios creen haberla encontrado.
Gabriel Sosa
---End Message---
---BeginMessage---

At 1:50 PM -0700 5/14/08, Jim Lucas wrote:
Just wondering if the mailing list is working.  I have not received 
anything from this list today.


--
Jim Lucas


If you don't receive this, please let me know.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com
---End Message---
---BeginMessage---
On Wed, May 14, 2008 at 4:56 PM, tedd [EMAIL PROTECTED] wrote:

 At 1:50 PM 

php-general Digest 15 May 2008 21:26:39 -0000 Issue 5461

2008-05-15 Thread php-general-digest-help

php-general Digest 15 May 2008 21:26:39 - Issue 5461

Topics (messages 274359 through 274394):

the class as a namespace
274359 by: Iv Ray
274364 by: Iv Ray

Re: SCanning text of PDF documents
274360 by: Frank Arensmeier
274366 by: Eric Butera

Re: Using SVN w/ Zend Studio for Eclipse
274361 by: Iv Ray

Re: Can I install a newer version of php over an older version
274362 by: Iv Ray
274388 by: Brady Mitchell

Working with internal data formats
274363 by: John Gunther
274373 by: Iv Ray
274377 by: John Gunther
274378 by: Robert Cummings
274379 by: Iv Ray
274380 by: Robin Vickery

Re: Good HTML parser needed
274365 by: Eric Butera
274370 by: Andrew Ballard

Re: Variable Scope from child to parent
274367 by: Andrew Ballard

Re: how do I stop Firefox doing a conditional get?
274368 by: Al
274369 by: Robin Vickery
274375 by: Per Jessen
274383 by: Al
274387 by: Per Jessen

Re: Scripts slowing down?
274371 by: René Leboeuf
274376 by: Per Jessen

Re: Validating Form input
274372 by: tedd

Re: Tracking down the elusive expecting T_PAAMAYIM_NEKUDOTAYIM
274374 by: Daniel Brown

Flush file contents
274381 by: Mário Gamito
274384 by: Andrew Ballard

My open source php CMS
274382 by: Dmitri
274386 by: admin.buskirkgraphics.com

RE:Windows Service Call from linux php server
274385 by: admin.buskirkgraphics.com

changing order of items
274389 by: afan pasalic
274390 by: Iv Ray
274391 by: afan pasalic
274392 by: Eric Butera
274393 by: afan pasalic
274394 by: robert

Administrivia:

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

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

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

Is there a notion of the class as a namespace?

My understanding is that the namespaces are intended to help organize 
the classes in large projects (and are not perfect).


Is it considered good style to use a class simply to box related functions?

For instance, a class called files, contains functions I need for 
dealing with files - and the instantiated object is _simply_ used to 
access these functions - the instantiated object is not a file in 
itself. Thus what I do is not $INSTANTIATED_OBJECT-save(), but 
$INSTANTIATED_OBJECT-save($file) (though I could do the first if I 
first, say, do $INSTANTIATED_OBJECT-file = $file.


Accessing the functions using the scope resolution operator (::) avoids 
the need to instantiate an object, but does not allow the use of $this, 
and $this can be quite practical in order to group common logic into 
shared methods within the class and thus make the other methods smaller 
in terms of code (of course, one could use file::save, file::delete 
instead of $this-save and $this-delete, but it makes renaming objects 
more difficult).


I would be interested to hear opinions.

Iv
---End Message---
---BeginMessage---

Richard Heyes wrote:
 That's a common use of static classes. Eg:

 HTTP::Redirect($url);

 In fact this (from the article I've read) is exactly how namespaces will
 look like. So in the above example, HTTP could be either a namespace or
 a class.

Right. Namespaces do look similar. And PEAR employs similarly looking
packages naming convention.

So it seems the static classes (which are actually simply classes with
static methods/properties, right) are the best namespaces like way,
until the namespaces arrive.

Thanks for your note,
Iv
---End Message---
---BeginMessage---
A reliable solution depends partly on the pdf document itself.  
Consider if your pdf document contains roted text or text that spans  
about several different blocks/pages. My experience with ps2acsii and  
other ghostscript related tools is that sometimes it works quite  
well, sometimes the output is rather messy.


The most reliable way of extracting text from a pdf is (I think) a  
product called PDF TET from PDFlib Gmbh. Yes, it costs some money for  
a license, but you are able to get almost everything out of the pdf  
then.


http://www.pdflib.com/products/tet/

Maybe some magic with OpenOffice could do the trick as well?

//frank

15 maj 2008 kl. 10.19 skrev Angelo Zanetti:


Hi All.

This is a quick question.

A client of ours wants a solution that when a PDF document is  
uploaded that

we use PHP to scan the documents contents and save it in a DB.

I know you can do this with normal text documents using the file  
commands

and functions.

Is it possible with PDF documents?

My feeling is NO, but perhaps someone will prove me wrong.

Thanks in advance.

Angelo

Web: http://www.elemental.co.za



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

[PHP] Re: Scottish Devs

2008-05-15 Thread Manuel Lemos
Hello,

on 05/14/2008 01:37 PM Nathan Rixham said the following:
 Just had word of a freelance project on for the next 4 weeks, start
 immediately, basically 1 static site (design already done) - an easy
 job, and 1 static site + a bit of PHP, breadcrumb, site search - it's
 £200 GBP a day (so about £4k for the next 4 weeks), ideally for somebody
 who can pop into edinburgh to meet the client/agency and maybe work on
 site?
 
 I was offered but I'm committed at the minute, it's through a reputable
 recruitment agency for a top edinburgh design house - so worth going for
 if you have the time free.

You may want to take a look here to see if you find qualified PHP
developers in that region:

http://www.phpclasses.org/professionals/country/uk/

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Validating Form input

2008-05-15 Thread Adam Richardson
I completely agree, server-side validation does always have to exist.   
That said, I like providing feedback on the validity of a form before  
the user leaves the page AND I hate duplicating the validation logic  
in Javascript when it's already present in my PHP.


What I did in my PHP framework (probably framework 2 billion and 1)  
was set it up so you can use REST-ful calls to the PHP page that  
contains the validation so you can retrieve the results of the  
validation, allowing you to render whatever feedback you'd like on the  
calling page through AJAX, or allow the request to proceed if it was  
valid.  Additionally, I've set my framework up so it chunks web pages  
into various sections ('pipes'),  allowing for REST-ful calls to the  
PHP page that contains a pipe to easily render the HTML fragment  
associated with a particular section, so you can progressively enhance  
pages with javascript quite easily.


I'm pleased with this approach after using for it for a while now, and  
I recommend it to others.


Adam

On May 14, 2008, at 10:48 PM, Chris W wrote:

I was wondering what others think of my approach to form  
validation.  I know many use Java script to do various validation.   
However, since there is no way to be sure the data sent to the  
server is actually valid, you have to check it in your php code on  
the server anyway.  Granted you don't have to, but if you don't, you  
are just asking for someone to hack your system, or at the very  
least screw up your data.  So my question is since you have to do a  
validity check on the server, why bother with the Java script?  The  
only advantage I can see to doing it with Java script is it will cut  
down on the errors in data that get to the server and then in turn  
reduce the number for resubmits and keep traffic down a little.   
However since none of the projects I have worked on are very high  
traffic sites, that hasn't been much of a concern.


Any thoughts?


--
Chris W
KE5GIX

Protect your digital freedom and privacy, eliminate DRM, learn more  
at http://www.defectivebydesign.org/what_is_drm;


Ham Radio Repeater Database.
http://hrrdb.com


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



Adam Richardson
Envision Internet Consulting, LLC
Phone: (517)623-0485

Services and insight for building effective, user-oriented websites.




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



[PHP] SCanning text of PDF documents

2008-05-15 Thread Angelo Zanetti
Hi All.

This is a quick question.

A client of ours wants a solution that when a PDF document is uploaded that
we use PHP to scan the documents contents and save it in a DB.

I know you can do this with normal text documents using the file commands
and functions.

Is it possible with PDF documents?

My feeling is NO, but perhaps someone will prove me wrong.

Thanks in advance.

Angelo

Web: http://www.elemental.co.za 



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



Re: [PHP] SCanning text of PDF documents

2008-05-15 Thread David Otton
2008/5/15 Angelo Zanetti [EMAIL PROTECTED]:

  A client of ours wants a solution that when a PDF document is uploaded that
  we use PHP to scan the documents contents and save it in a DB.

  I know you can do this with normal text documents using the file commands
  and functions.

  Is it possible with PDF documents?

  My feeling is NO, but perhaps someone will prove me wrong.

There's a good chance your installation already has pdf2ps and ps2ascii

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



[PHP] Re: Using SVN w/ Zend Studio for Eclipse

2008-05-15 Thread Colin Guthrie

Steve Finkelstein wrote:

If any of you have run into similar frustrations, I'd love to hear it.
 So far I've spent the better part of the evening fiddling with
extremely rudimentary features which no IDE in any programming
environment I've ever worked with has imposed on me.  Perhaps this
thing isn't ready for mainstream yet, or perhaps I'm missing something
obvious.


Not had much experience with ZS for eclipse but working with IIRC PDE or 
some such name, I did use exiting projects (e.g. svn checkouts) and 
import them into an Eclipse project and everything worked out fine. I 
was able to override the location and I was able to join in Subclipse to 
the project for SVN capabilities.


I know this is not particularly useful to you but certainly it is 
possible with Eclipse generally. Whether ZS somehow masks this I can't say.


Col


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



[PHP] the class as a namespace

2008-05-15 Thread Iv Ray

Is there a notion of the class as a namespace?

My understanding is that the namespaces are intended to help organize 
the classes in large projects (and are not perfect).


Is it considered good style to use a class simply to box related functions?

For instance, a class called files, contains functions I need for 
dealing with files - and the instantiated object is _simply_ used to 
access these functions - the instantiated object is not a file in 
itself. Thus what I do is not $INSTANTIATED_OBJECT-save(), but 
$INSTANTIATED_OBJECT-save($file) (though I could do the first if I 
first, say, do $INSTANTIATED_OBJECT-file = $file.


Accessing the functions using the scope resolution operator (::) avoids 
the need to instantiate an object, but does not allow the use of $this, 
and $this can be quite practical in order to group common logic into 
shared methods within the class and thus make the other methods smaller 
in terms of code (of course, one could use file::save, file::delete 
instead of $this-save and $this-delete, but it makes renaming objects 
more difficult).


I would be interested to hear opinions.

Iv

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



Re: [PHP] Can I install a newer version of php over an older version

2008-05-15 Thread Iv Ray

Tony M wrote:
 Can I install a newer version of php over an older version?

Perhaps what you need is this -

Upgrading PHP with the Install

To upgrade, run the installer either graphically or from the command 
line as normal. The installer will read your current install options, 
remove your old installation, and reinstall PHP with the same options as 
before. It is recommended that you use this method of keeping PHP 
updated instead of manually replacing the files in the installation 
directory.


You can read it here -

http://at.php.net/install.windows

Iv

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



Re: [PHP] SCanning text of PDF documents

2008-05-15 Thread Frank Arensmeier
A reliable solution depends partly on the pdf document itself.  
Consider if your pdf document contains roted text or text that spans  
about several different blocks/pages. My experience with ps2acsii and  
other ghostscript related tools is that sometimes it works quite  
well, sometimes the output is rather messy.


The most reliable way of extracting text from a pdf is (I think) a  
product called PDF TET from PDFlib Gmbh. Yes, it costs some money for  
a license, but you are able to get almost everything out of the pdf  
then.


http://www.pdflib.com/products/tet/

Maybe some magic with OpenOffice could do the trick as well?

//frank

15 maj 2008 kl. 10.19 skrev Angelo Zanetti:


Hi All.

This is a quick question.

A client of ours wants a solution that when a PDF document is  
uploaded that

we use PHP to scan the documents contents and save it in a DB.

I know you can do this with normal text documents using the file  
commands

and functions.

Is it possible with PDF documents?

My feeling is NO, but perhaps someone will prove me wrong.

Thanks in advance.

Angelo

Web: http://www.elemental.co.za



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






Frank Arensmeier
 


Webmaster  IT Development

NIKE Hydraulics AB
Box 1107
631 80 Eskilstuna
Sweden

phone +46 - (0)16 16 82 34
fax +46 - (0)16 13 93 16
[EMAIL PROTECTED]
www.nikehydraulics.se
 







Re: [PHP] Using SVN w/ Zend Studio for Eclipse

2008-05-15 Thread Iv Ray

 I do not want to copy the project into a new
 directory as the existing directory is where Apache's DocumentRoot is
 set. And although that's simple to change, I really don't think any
 IDE should mandate where I set my project's directory on the
 filesystem.

I use PDT, and there is no problem to import a project from its current 
location.


It might take you a while to exactly figure out how to do it, Eclipse is 
a bit organic in respect to the organization and working of the menus.


 Also, if I try to create a new project from an SVN
 Repository, it doesn't allow me to select what directory I want the
 code checked out in.

This works very well with PDT and Subclipse.

 Otherwise I'd just cringe and let it overwrite
 what's in my existing document root, since that's all versioned code
 anyhow.

If your current document root is a checked out svn project, 
PDT/Subclipse will see this, no need to overwrite anything.


 If any of you have run into similar frustrations, I'd love to hear it.
 So far I've spent the better part of the evening fiddling with
 extremely rudimentary features which no IDE in any programming
 environment I've ever worked with has imposed on me. Perhaps this
 thing isn't ready for mainstream yet, or perhaps I'm missing something
 obvious.

Again, I work with PDT/Subclipse.

Eclipse is simply too organic compared to what you are used to. Just 
relax and give it a try and you'll love it.


Iv

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



[PHP] Working with internal data formats

2008-05-15 Thread John Gunther
What technique can I use to take an 8-byte double precision value, as 
stored internally, and assign its value to a PHP float variable without 
having the bytes misinterpreted as a character string.


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



Re: [PHP] the class as a namespace

2008-05-15 Thread Iv Ray

Richard Heyes wrote:
 That's a common use of static classes. Eg:

 HTTP::Redirect($url);

 In fact this (from the article I've read) is exactly how namespaces will
 look like. So in the above example, HTTP could be either a namespace or
 a class.

Right. Namespaces do look similar. And PEAR employs similarly looking
packages naming convention.

So it seems the static classes (which are actually simply classes with
static methods/properties, right) are the best namespaces like way,
until the namespaces arrive.

Thanks for your note,
Iv

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



Re: [PHP] Good HTML parser needed

2008-05-15 Thread Eric Butera
On Wed, May 14, 2008 at 10:56 PM, Yi Wang [EMAIL PROTECTED] wrote:
 Can anyone provide some code that can't be stripped by strip_tags?


 On 5/15/08, Eric Butera [EMAIL PROTECTED] wrote:
 On Wed, May 14, 2008 at 11:38 AM, Robert Cummings [EMAIL PROTECTED] wrote:
  
  
On Wed, 2008-05-14 at 11:18 -0400, Eric Butera wrote:
 On Tue, May 13, 2008 at 4:07 AM, James Dempster [EMAIL PROTECTED] 
 wrote:
  http://htmlpurifier.org/
 
   --
   /James
 

 This is the only real solution.
  
That depends... if I'm the webmaster and I want to input arbitrary HTML,
then htmlpurifier is unnecessary.
  
  
  
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
  
  


 OP said users.  Strip tags doesn't bother with tag attributes so
  that is a security hole.  Any regex type solution will encounter the
  same set of issues.

  Htmlpurifier actually strips down and re-builds your html from the
  ground against a nice whitelist filtering system that you can
  customize to your needs.  No nasty tags/attributes will get through
  unless you want them to.


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




 --
 Regards,
 Wang Yi


I meant if you used the allow tags parameter.  If you allow say the
b tag, then you could say b key=value and it would pass right
through.

?php

$str = bhi/bb onMouseOver='alert(/xss/);'xss/b;

echo raw:\n;
var_dump($str);

echo strip tags:\n;
var_dump(strip_tags($str));

echo allow b:\n;
var_dump(strip_tags($str, 'b'));
?

raw:
string 'bhi/bb onMouseOver='alert(/xss/);'xss/b' (length=47)
strip tags:
string 'hixss' (length=5)
allow b:
string 'bhi/bb onMouseOver='alert(/xss/);'xss/b' (length=47)

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



Re: [PHP] SCanning text of PDF documents

2008-05-15 Thread Eric Butera
On Thu, May 15, 2008 at 4:19 AM, Angelo Zanetti [EMAIL PROTECTED] wrote:
 Hi All.

 This is a quick question.

 A client of ours wants a solution that when a PDF document is uploaded that
 we use PHP to scan the documents contents and save it in a DB.

 I know you can do this with normal text documents using the file commands
 and functions.

 Is it possible with PDF documents?

 My feeling is NO, but perhaps someone will prove me wrong.

 Thanks in advance.

 Angelo

 Web: http://www.elemental.co.za



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



You might want to look at Zend_Pdf.

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



Re: [PHP] Variable Scope from child to parent

2008-05-15 Thread Andrew Ballard
Ok, I forgot to reply-all to the list. Here we go again.

On Wed, May 14, 2008 at 6:33 PM, Tyson Vanover [EMAIL PROTECTED] wrote:
 I am trying to get a child class to pass an array of valid keys to it's
 parent when the constructor is run, and the parent appends the data to one
 of it's array of valid keys.  Then it walks through an array pulling out
 values that have valid keys, and putting them in an array for processing
 later.  I have tried explicitly stating the variable scope.

 abstract class parentclass
 {
  protected $vkeys= array('title1','title2','title3');
  protected $a;

  function __construct($set = NULL, $special = NULL)
  {
self::$this-vkeys= array_merge(self::$this-vkeys, $special);
foreach($set as $key=$value)
{
  if (in_array($key,self::$this-vkeys))
  {
$this-a[$key] = $value;
  }
}
print_r(self::$this-vkeys);  //output below
print_r(self::$this-a);  //output below
  }
 }

 class childclass extends parentclass
 {
  protected $vkeys= array('titleA', 'titleB', 'TitleC');

  function __construct($set, $special = NULL)
  {
parent::__construct($set, self::$this-vkeys);
unset(self::$this-vkeys);
  }
 }

 Unfortunately it seems to duplicate the child's array instead of appending.
  Explicitly stating scope does not seem to help.


 print_r(self::$this-vkeys);
 Array (
  [0] = titleA
  [1] = titleB
  [2] = titleB
  [3] = titleA
  [4] = titleB
  [5] = titleB
 )

 print_r(self::$this-a);
 Array()

 Any thoughts?

A couple. First, as Gabriel said, replace self::$this- with just
$this-. Second, the protected variable $vkeys in the childclass
effectively overwrites the variable of the same name in the parent
class, so it already has the values you are trying to merge
(array('titleA', 'titleB', 'TitleC')) when the childclass is
instantiated before you even call the constructor. That's why the
constructor duplicates the values. Try this  for the constructor for
your childclass:

function __construct($set, $special = array())
{
$merged = array_merge($special, array('titleA', 'titleB', 'TitleC'));
parent::__construct($set, $merged);
}



Andrew


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



Re: [PHP] how do I stop Firefox doing a conditional get?

2008-05-15 Thread Al

Make certain your steam is compressed http://www.whatsmyip.org/mod_gzip_test/



Per Jessen wrote:

Robin Vickery wrote:


2008/5/14 Per Jessen [EMAIL PROTECTED]:

 The issue is - I'd like this page to appear to be as real time as
 possible, and the occasional delay caused by the conditional get is
 a nuisance.  My images are clearly cached, so how do I prevent
 Firefox from doing the conditional get ?  There must be some HTTP
 header I  can use.

You can use either or both of 'Expires' or  'Cache-Control'


I've just now added 'Cache-Control' - I was already using 'Expires', but
that wasn't sufficient.  Thanks.


/Per Jessen, Zürich



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



Re: [PHP] how do I stop Firefox doing a conditional get?

2008-05-15 Thread Robin Vickery
On 15/05/2008, Al [EMAIL PROTECTED] wrote:
 Make certain your steam is compressed
 http://www.whatsmyip.org/mod_gzip_test/

Compressed steam can be dangerous:

http://en.wikipedia.org/wiki/2007_New_York_City_steam_explosion

-robin

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



Re: [PHP] Good HTML parser needed

2008-05-15 Thread Andrew Ballard
On Tue, May 13, 2008 at 6:06 AM, Per Jessen [EMAIL PROTECTED] wrote:
 Shelley wrote:

 I want to know whether there are some good HTML parsers written in
 PHP.

 That is,
 the parser checks whether html tags like table, tr, td, div, dt, dl,
 dd, script, ul, li, span, h1, h2, etc. are nested correctly.
 If any tags not matched, just remove them.

 Except for the last part, any XML parser will do.  Sablotron, xalan,
 libxsl etc.


 /Per Jessen, Zürich

... except when the HTML is not well formed XML, as I find is often
the case when accepting input from users. That last part, as you
say, is kind of essential. It could be as simple as tags that don't
close in HTML (e.g. img, br, hr) or it could be something much
trickier to clean up such as mismatched tags, improper nesting,
missing closing tags (since some browsers are too forgiving of not
closing td, li or option), HTML entities that are not valid in
XML, etc. In these cases, the DOM-type parsers will usually choke. You
might be able to salvage something with the stream-based parsers like
SAX. (I've never tried it.)

Andrew


Re: [PHP] Re: Scripts slowing down?

2008-05-15 Thread René Leboeuf

Per Jessen a écrit :

René Leboeuf wrote:


The user sending emails is trusted by sendmail, and the sending
program is located on the sendmail machine.



No need to use SMTP then.  You should just be calling sendmail to drop
the emails into the queue.  And that should not be slowing down. 


According to our tests, using SMTP is twice as fast as calling sendmail!




Mail is sent via PHPMailer. PHPMailer offers to send mail via PHP's
mail() function, or by calling the sendmail program or using SMTP.
SMTP may use persistent connections or not. All these modes were
tested and they all slow down after a while.


They _all_ slow down after a while?  How many emails are you sending in
this way?  


Some of our mailing are +100.000 emails...




It's easily tested.  Just generate a script with 1 calls to the
mail() function (send to [EMAIL PROTECTED] with N = random
number).  If that goes through without slowing down, mail() and your
sendmail daemon are not to blame. 


I had tried with 1000mails and noticed no slow down. I'll try with some 
more.


But if mail() and sendmail are not the problem, what could it be???

Thanks for helping.

DJL


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



Re: [PHP] Validating Form input

2008-05-15 Thread tedd

At 9:48 PM -0500 5/14/08, Chris W wrote:
I was wondering what others think of my approach to form validation. 
I know many use Java script to do various validation.  However, 
since there is no way to be sure the data sent to the server is 
actually valid, you have to check it in your php code on the server 
anyway.  Granted you don't have to, but if you don't, you are just 
asking for someone to hack your system, or at the very least screw 
up your data.  So my question is since you have to do a validity 
check on the server, why bother with the Java script?  The only 
advantage I can see to doing it with Java script is it will cut down 
on the errors in data that get to the server and then in turn reduce 
the number for resubmits and keep traffic down a little.  However 
since none of the projects I have worked on are very high traffic 
sites, that hasn't been much of a concern.


Any thoughts?


Use javascript to enhance the user experience, but always validate server-side.

If you are clever, you can tie the two together via ajax and present 
a nice data collection scheme that is both user-friendly and secure.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Working with internal data formats

2008-05-15 Thread Iv Ray

John Gunther wrote:
 What technique can I use to take an 8-byte double precision value, as
 stored internally, and assign its value to a PHP float variable without
 having the bytes misinterpreted as a character string.

Does it get misinterpreted, or do you just want to be sure?

The documentation says -

Some references to the type double may remain in the manual. Consider 
double the same as float; the two names exist only for historic reasons.


Does this cover your case?

Iv

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



Re: [PHP] Tracking down the elusive expecting T_PAAMAYIM_NEKUDOTAYIM

2008-05-15 Thread Daniel Brown
Since I keep getting off-list and on-list replies, apparently not
everyone reads the threads as they should.  As you'll see from the
message below, I'm aware that it's in all languages.  It was meant
jokingly, but I forgot to type in the smiley face.

Otherwise, thanks (to the eleven or so of you) who responded.  ;-P

-- Forwarded message --
From: Daniel Brown [EMAIL PROTECTED]
Date: Wed, May 14, 2008 at 5:05 PM
Subject: Re: [PHP] Tracking down the elusive expecting T_PAAMAYIM_NEKUDOTAYIM
To: mike [EMAIL PROTECTED]
Cc: Tyson Vanover [EMAIL PROTECTED], php-general@lists.php.net


On Wed, May 14, 2008 at 4:51 PM, mike [EMAIL PROTECTED] wrote:
 I've got that before and I am not using a Hebrew version of PHP :)

   Yeah, just a joke.  I forgot to put the Trademark ;-P in its place.

   The etymology of that message could be attributed to the fact that
Zeev and Andi are Israeli.  Just taking a guess at it though.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] how do I stop Firefox doing a conditional get?

2008-05-15 Thread Per Jessen
Al wrote:

 Make certain your steam is compressed
 http://www.whatsmyip.org/mod_gzip_test/
 

The files I was having the problem with are GIFs, so already LZW
compressed. 


/Per Jessen, Zürich


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



Re: [PHP] Re: Scripts slowing down?

2008-05-15 Thread Per Jessen
René Leboeuf wrote:

 Per Jessen a écrit :
 René Leboeuf wrote:
 
 The user sending emails is trusted by sendmail, and the sending
 program is located on the sendmail machine.

 
 No need to use SMTP then.  You should just be calling sendmail to
 drop
 the emails into the queue.  And that should not be slowing down.
 
 According to our tests, using SMTP is twice as fast as calling
 sendmail!

Really ??  That's very unusual as all sendmail does is file your email
into a disk-based queue, so using SMTP is only superfluous overhead. 
Anyway, if it works for you, it's not important.  

 Mail is sent via PHPMailer. PHPMailer offers to send mail via PHP's
 mail() function, or by calling the sendmail program or using SMTP.
 SMTP may use persistent connections or not. All these modes were
 tested and they all slow down after a while.
 
 They _all_ slow down after a while?  How many emails are you sending
 in this way?
 
 Some of our mailing are +100.000 emails...

There is a possibility that your filesystem is having difficulties
dealing with that many files, escpecially if they are all in one
directory.  Which mailserver and which filesystem are you using? 


/Per Jessen, Zürich


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



Re: [PHP] Working with internal data formats

2008-05-15 Thread John Gunther

Iv Ray wrote:

John Gunther wrote:
  What technique can I use to take an 8-byte double precision value, as
  stored internally, and assign its value to a PHP float variable without
  having the bytes misinterpreted as a character string.

Does it get misinterpreted, or do you just want to be sure?

The documentation says -

Some references to the type double may remain in the manual. Consider 
double the same as float; the two names exist only for historic reasons.


Does this cover your case?

Iv

No.

Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from an external 
file, which is the internal double precision float representation of the 
decimal value 99.99. Starting with that byte string, how can I create a 
PHP variable whose value is 99.99?


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



Re: [PHP] Working with internal data formats

2008-05-15 Thread Robert Cummings

On Thu, 2008-05-15 at 10:33 -0400, John Gunther wrote:
 Iv Ray wrote:
  John Gunther wrote:
What technique can I use to take an 8-byte double precision value, as
stored internally, and assign its value to a PHP float variable without
having the bytes misinterpreted as a character string.
  
  Does it get misinterpreted, or do you just want to be sure?
  
  The documentation says -
  
  Some references to the type double may remain in the manual. Consider 
  double the same as float; the two names exist only for historic reasons.
  
  Does this cover your case?
  
  Iv
 No.
 
 Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from an external 
 file, which is the internal double precision float representation of the 
 decimal value 99.99. Starting with that byte string, how can I create a 
 PHP variable whose value is 99.99?

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

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Working with internal data formats

2008-05-15 Thread Iv Ray

John Gunther wrote:
 Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from
 an external file

You mean you extract 40 58 FF 5C 28 F5 C2 8F, so to speak, as a 
string, right?


Sorry, for asking, but somehow I do not the case.

--

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



Re: [PHP] Working with internal data formats

2008-05-15 Thread Robin Vickery
On 15/05/2008, John Gunther [EMAIL PROTECTED] wrote:
 Iv Ray wrote:

  John Gunther wrote:
What technique can I use to take an 8-byte double precision value, as
stored internally, and assign its value to a PHP float variable without
having the bytes misinterpreted as a character string.
 
  Does it get misinterpreted, or do you just want to be sure?
 
  The documentation says -
 
  Some references to the type double may remain in the manual. Consider
 double the same as float; the two names exist only for historic reasons.
 
  Does this cover your case?
 
  Iv
 
  No.

  Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from an external
 file, which is the internal double precision float representation of the
 decimal value 99.99. Starting with that byte string, how can I create a PHP
 variable whose value is 99.99?

Reversing the order of bytes then using unpack('d') works for me.

?php
$bytes = pack('H*', '4058FF5C28F5C28F');

$output = unpack('d', strrev($bytes));
print array_shift($output) . \n;
// 99.99
?

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



[PHP] Flush file contents

2008-05-15 Thread Mário Gamito

Hi,

How do I open a file and flush all it's contents to insert new ones and 
close again ?


I've browsed through the fopen function aguments and didn't find one 
that do this (or I misunderstood one of them).


Any help would be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] My open source php CMS

2008-05-15 Thread Dmitri
Hello, first of all, sorry for this plug, I am looking for interested 
developers.
I just want to let you know about my open source project that uses over 
15 pear classes and uses pear installer as the primary means to install it
I also wrote a web-based interface for using pear installer to install 
upgrades and modules


I created some flash-based demos on how to install it.

I really hope to find some interested developers to join this project. 
It became too big for me.


Please at least look at it, watch the demos:

http://dev.sharedlog.com/index.php?a=personaluid=1002

I will be adding more demos on how to use other feature.

The anonymous svn is here for anyone who is interested.
http://dev.sharedlog.com/svn/

Is there a better more appropriate list to announce such project?

--

Open Source ALL content management
with streaming video
http://wiki.sharedlog.com



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



Re: [PHP] how do I stop Firefox doing a conditional get?

2008-05-15 Thread Al
Try by not LZW compressing and the use ob_start() and flush() so your files are gzip compressed. I 
don't know if Firefox knows how to readily handle LZW on the fly. It does know how to handle gzip.


Per Jessen wrote:

Al wrote:


Make certain your steam is compressed
http://www.whatsmyip.org/mod_gzip_test/



The files I was having the problem with are GIFs, so already LZW
compressed. 



/Per Jessen, Zürich



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



Re: [PHP] Flush file contents

2008-05-15 Thread Andrew Ballard
On Thu, May 15, 2008 at 11:20 AM, Mário Gamito [EMAIL PROTECTED] wrote:
 Hi,

 How do I open a file and flush all it's contents to insert new ones and
 close again ?

 I've browsed through the fopen function aguments and didn't find one that do
 this (or I misunderstood one of them).

 Any help would be appreciated.

 Warm Regards,
 Mário Gamito


That's what the mode parameter is for. You want w.

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

Andrew


[PHP] RE:Windows Service Call from linux php server

2008-05-15 Thread admin
I used soap to perfect the Windows service call and resolved the issue so 
simple it kills me. Not happy with the huge upgrade of php process but happy 
with final results.

Resolution:
?php
$wsdl= http://user:[EMAIL PROTECTED]/WebService/service.asmx?WSDL;
$soap = new soapclient($wsdl,wsdl);
$soap-setCredentials(user,password);
$proxy = $soap-getProxy();
$parameters = 
array(Username=,Password=,caltalk=,canum=,audio=,STime=,Email=);
$result = $proxy-makeCall($parameters); 
?

I have one more question if you have time?

I have been requested to give a live results query. I need to not only pull 
results from mysql using php, but I have to display the results like a cicso 
Switch. 

I have to display channels in use realtime. Without refreshing the page a 
gazillion times, is there another method of constantly pulling the data from 
mysql and displaying it in the php script for realtime switch status? 

I looked into AJAX but it seems to pull all the data up into a global of static 
data it does not refresh or regrab every so many seconds, so the display is not 
realtime. 

I do not know that Ajax has this ability does it?
 
Is there a way to refresh the mysql pull in php I am unaware of?

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



RE: [PHP] My open source php CMS

2008-05-15 Thread admin
Page Not Found.





Hello, first of all, sorry for this plug, I am looking for interested 
developers.
I just want to let you know about my open source project that uses over 
15 pear classes and uses pear installer as the primary means to install it
I also wrote a web-based interface for using pear installer to install 
upgrades and modules

I created some flash-based demos on how to install it.

I really hope to find some interested developers to join this project. 
It became too big for me.

Please at least look at it, watch the demos:

http://dev.sharedlog.com/index.php?a=personaluid=1002

I will be adding more demos on how to use other feature.

The anonymous svn is here for anyone who is interested.
http://dev.sharedlog.com/svn/

Is there a better more appropriate list to announce such project?

-- 

Open Source ALL content management
with streaming video
http://wiki.sharedlog.com



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

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



Re: [PHP] how do I stop Firefox doing a conditional get?

2008-05-15 Thread Per Jessen
Al wrote:

 Per Jessen wrote:
 Al wrote:
 
 Make certain your steam is compressed
 http://www.whatsmyip.org/mod_gzip_test/

 
 The files I was having the problem with are GIFs, so already LZW
 compressed.
 
 Try by not LZW compressing and the use ob_start() and flush() so your
 files are gzip compressed. I don't know if Firefox knows how to
 readily handle LZW on the fly. It does know how to handle gzip.

Al, thanks for suggestion, but you're talking rubbish.  _All_ browsers
understand GIFs, and they are all LZW compressed.  There's absolutely
zero point in trying to gzip them as well. 


/Per Jessen, Zürich


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



Re: [PHP] Can I install a newer version of php over an older version

2008-05-15 Thread Brady Mitchell


On May 14, 2008, at 854PM, Tony M wrote:


Can I install a newer version of php over an older version ?

I am new to php and am in the process of installing it and reading  
various tutorials.


I always suggest using XAMPP (http://xampp.org) or a similar package  
that will install MySQL, PHP and Apache all for you in one bundle on  
development machines. It's much faster, easier to manage and it just  
works!


That said, I don't advocate using XAMPP on a production server. For a  
production server it's worth taking the time to install each  
individually so you know exactly how each one is configured.


Brady

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



[PHP] changing order of items

2008-05-15 Thread afan pasalic
this one bugs me for a while. how to change order.

I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
status value stored in mysql. I can list tasks per status or all.
order number is stored in mysql too.
the easiest way to change order is to have form for each task where you
will enter manually number and then submit (one submit button for whole
form). but, if you change order number for any task you have to change
then all order numbers below the task manually

solution with arrows (or up/down buttons) where you click on arrow and
the task switch the place with its neighbor is easy and fancy. Though,
I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
to 0 and I have to move task 14 to place 6. I have to click first 4
times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
actually happening on screen (of course) before start switching places
with 9, 8, 7, and 6.

how do you avoid this gap?
what solution do you use at all?

thanks for any help.

-afan


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



Re: [PHP] changing order of items

2008-05-15 Thread Iv Ray

afan pasalic wrote:

this one bugs me for a while. how to change order.

I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
status value stored in mysql. I can list tasks per status or all.
order number is stored in mysql too.
the easiest way to change order is to have form for each task where you
will enter manually number and then submit (one submit button for whole
form). but, if you change order number for any task you have to change
then all order numbers below the task manually

solution with arrows (or up/down buttons) where you click on arrow and
the task switch the place with its neighbor is easy and fancy. Though,
I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
to 0 and I have to move task 14 to place 6. I have to click first 4
times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
actually happening on screen (of course) before start switching places
with 9, 8, 7, and 6.

how do you avoid this gap?
what solution do you use at all?


You have two different issues - a) how to execute the change, and b) 
what interface to provide.


To execute the change, basically you have to reorder. The best algorithm 
is question of mathematics - you can implement something and improve 
it independently from the interface.


As for the interface, the first is kind of the simplest, but somehow 
primitive. The second is a bit better, but you have noticed, not much 
better. The most elegant, considering the time we live in, would be drag 
 drop AJAX (here - http://tool-man.org/examples/, there are excellent 
examples, perhaps there are more).


It's also a question if tasks really need to be reordered manually. If 
all tasks have a deadline, you might sort them by date. If some don't, 
you can provide them unsorted, until they get one. Sorting tasks by 
moving them up/down works when you have 25 tasks, but it does not work 
when you have 50, 100, 1 000 (if you are a team leader and have 5-7 
people team) - in that case sort by date might be better.


If you get more advanced, and store time needed to complete a task, you 
could automatically shift all tasks (of a person) - when one gets 
delayed or takes longer, than planned.


Hope that helps,
Iv

--

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



Re: [PHP] changing order of items

2008-05-15 Thread afan pasalic


Iv Ray wrote:
 afan pasalic wrote:
 this one bugs me for a while. how to change order.

 I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
 status value stored in mysql. I can list tasks per status or all.
 order number is stored in mysql too.
 the easiest way to change order is to have form for each task where you
 will enter manually number and then submit (one submit button for whole
 form). but, if you change order number for any task you have to change
 then all order numbers below the task manually

 solution with arrows (or up/down buttons) where you click on arrow and
 the task switch the place with its neighbor is easy and fancy. Though,
 I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
 to 0 and I have to move task 14 to place 6. I have to click first 4
 times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
 actually happening on screen (of course) before start switching places
 with 9, 8, 7, and 6.

 how do you avoid this gap?
 what solution do you use at all?

 You have two different issues - a) how to execute the change, and b)
 what interface to provide.

 To execute the change, basically you have to reorder. The best
 algorithm is question of mathematics - you can implement something
 and improve it independently from the interface.

 As for the interface, the first is kind of the simplest, but somehow
 primitive. The second is a bit better, but you have noticed, not much
 better. The most elegant, considering the time we live in, would be
 drag  drop AJAX (here - http://tool-man.org/examples/, there are
 excellent examples, perhaps there are more).

 It's also a question if tasks really need to be reordered manually. If
 all tasks have a deadline, you might sort them by date. If some don't,
 you can provide them unsorted, until they get one. Sorting tasks by
 moving them up/down works when you have 25 tasks, but it does not work
 when you have 50, 100, 1 000 (if you are a team leader and have 5-7
 people team) - in that case sort by date might be better.

 If you get more advanced, and store time needed to complete a task,
 you could automatically shift all tasks (of a person) - when one gets
 delayed or takes longer, than planned.

 Hope that helps,
 Iv

thanks Iv,
though, in my case, the task list will never be more then 25 and we can
talk about small list.
and, I need to sort them by order_no (bitter to say priority_no)

thanks for link. the Dag  Drop sortable list is really cool!


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



Re: [PHP] changing order of items

2008-05-15 Thread Eric Butera
On Thu, May 15, 2008 at 2:49 PM, afan pasalic [EMAIL PROTECTED] wrote:


 Iv Ray wrote:
 afan pasalic wrote:
 this one bugs me for a while. how to change order.

 I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
 status value stored in mysql. I can list tasks per status or all.
 order number is stored in mysql too.
 the easiest way to change order is to have form for each task where you
 will enter manually number and then submit (one submit button for whole
 form). but, if you change order number for any task you have to change
 then all order numbers below the task manually

 solution with arrows (or up/down buttons) where you click on arrow and
 the task switch the place with its neighbor is easy and fancy. Though,
 I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
 to 0 and I have to move task 14 to place 6. I have to click first 4
 times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
 actually happening on screen (of course) before start switching places
 with 9, 8, 7, and 6.

 how do you avoid this gap?
 what solution do you use at all?

 You have two different issues - a) how to execute the change, and b)
 what interface to provide.

 To execute the change, basically you have to reorder. The best
 algorithm is question of mathematics - you can implement something
 and improve it independently from the interface.

 As for the interface, the first is kind of the simplest, but somehow
 primitive. The second is a bit better, but you have noticed, not much
 better. The most elegant, considering the time we live in, would be
 drag  drop AJAX (here - http://tool-man.org/examples/, there are
 excellent examples, perhaps there are more).

 It's also a question if tasks really need to be reordered manually. If
 all tasks have a deadline, you might sort them by date. If some don't,
 you can provide them unsorted, until they get one. Sorting tasks by
 moving them up/down works when you have 25 tasks, but it does not work
 when you have 50, 100, 1 000 (if you are a team leader and have 5-7
 people team) - in that case sort by date might be better.

 If you get more advanced, and store time needed to complete a task,
 you could automatically shift all tasks (of a person) - when one gets
 delayed or takes longer, than planned.

 Hope that helps,
 Iv

 thanks Iv,
 though, in my case, the task list will never be more then 25 and we can
 talk about small list.
 and, I need to sort them by order_no (bitter to say priority_no)

 thanks for link. the Dag  Drop sortable list is really cool!


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



I use this:

http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html

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



Re: [PHP] changing order of items

2008-05-15 Thread afan pasalic
Eric Butera wrote:
 On Thu, May 15, 2008 at 2:49 PM, afan pasalic [EMAIL PROTECTED] wrote:
   
 Iv Ray wrote:
 
 afan pasalic wrote:
   
 this one bugs me for a while. how to change order.

 I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
 status value stored in mysql. I can list tasks per status or all.
 order number is stored in mysql too.
 the easiest way to change order is to have form for each task where you
 will enter manually number and then submit (one submit button for whole
 form). but, if you change order number for any task you have to change
 then all order numbers below the task manually

 solution with arrows (or up/down buttons) where you click on arrow and
 the task switch the place with its neighbor is easy and fancy. Though,
 I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
 to 0 and I have to move task 14 to place 6. I have to click first 4
 times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
 actually happening on screen (of course) before start switching places
 with 9, 8, 7, and 6.

 how do you avoid this gap?
 what solution do you use at all?
 
 You have two different issues - a) how to execute the change, and b)
 what interface to provide.

 To execute the change, basically you have to reorder. The best
 algorithm is question of mathematics - you can implement something
 and improve it independently from the interface.

 As for the interface, the first is kind of the simplest, but somehow
 primitive. The second is a bit better, but you have noticed, not much
 better. The most elegant, considering the time we live in, would be
 drag  drop AJAX (here - http://tool-man.org/examples/, there are
 excellent examples, perhaps there are more).

 It's also a question if tasks really need to be reordered manually. If
 all tasks have a deadline, you might sort them by date. If some don't,
 you can provide them unsorted, until they get one. Sorting tasks by
 moving them up/down works when you have 25 tasks, but it does not work
 when you have 50, 100, 1 000 (if you are a team leader and have 5-7
 people team) - in that case sort by date might be better.

 If you get more advanced, and store time needed to complete a task,
 you could automatically shift all tasks (of a person) - when one gets
 delayed or takes longer, than planned.

 Hope that helps,
 Iv
   
 thanks Iv,
 though, in my case, the task list will never be more then 25 and we can
 talk about small list.
 and, I need to sort them by order_no (bitter to say priority_no)

 thanks for link. the Dag  Drop sortable list is really cool!


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


 

 I use this:

 http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html
   
This one is good too.
But, actually, I need something more simple. Nothing fancy :D.



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



Re: [PHP] changing order of items

2008-05-15 Thread robert


On May 15, 2008, at 11:58 AM, afan pasalic wrote:


Eric Butera wrote:


I use this:

http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html


This one is good too.
But, actually, I need something more simple. Nothing fancy :D.




for something very simple how about add a drop down list for each item:

[chooose position..]
{ - before task 1 }
{ - before task 2 }
{ - before task 3 }
{ - before task 4 }
{ - at the end}

and when user clicks save, the php side will do it's magic and update.  
i think there is a limitation especially if the user decides to  
reorder many items. but then if you are handy with the javascript/ajax  
then just do a visual update which can make it easier for the user.


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



[PHP] Re: changing order of items

2008-05-15 Thread Nathan Rixham

afan pasalic wrote:

this one bugs me for a while. how to change order.

I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
status value stored in mysql. I can list tasks per status or all.
order number is stored in mysql too.
the easiest way to change order is to have form for each task where you
will enter manually number and then submit (one submit button for whole
form). but, if you change order number for any task you have to change
then all order numbers below the task manually

solution with arrows (or up/down buttons) where you click on arrow and
the task switch the place with its neighbor is easy and fancy. Though,
I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
to 0 and I have to move task 14 to place 6. I have to click first 4
times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
actually happening on screen (of course) before start switching places
with 9, 8, 7, and 6.

how do you avoid this gap?
what solution do you use at all?

thanks for any help.

-afan



flex 3 / dataset would handle all this for you extremely easily.

if you want to stick with html then I'd recommend splitting into two 
tables (todo / done) and having a simple ajax updater to re-order the 
tables.


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



[PHP] question about validation and sql injection

2008-05-15 Thread Sudhakar
A) validating username in php

as part of a registration form a user fills there desired username and this
is stored in a mysql. there are certain conditions for the username.

a) the username should only begin either letters or numbers, and Underscore
character
example = user123, 123user, u_ser123, user_123 = completely case insensitive
b) a user may choose not to have an underscore or numbers sometimes. example
= username

presently my validation for username is

$username = $_POST[username];
if( $username ==  || !eregi(^[a-zA-Z0-9_]+$, $username) )
{
$error.=User name cannot be blank or has special characters;
}

Question = how can i rewrite this php validation for username to meet the
above criteria or is my validation correct


B) preventing sql injection

till now i have been capturing the form values and directly inserting into
the table without considering sql injection however for this project as it
is for a forum i would like to implement prevention of sql injection. from
what i have read about preventing sql injection there are several steps that
need to be followed,

htmlentities
addslashes
trim
mysql-real-escape-string
magic_quotes_gpc is ON
magic_quotes_runtime is OFF
magic_quotes_sybase is OFF

as i have not done preventing sql injection i am not sure what is the
correct process.

Question =

a) please advice a step by step process of how to go about avoiding the sql
injection before the insert sql query is executed starting from

$username = $_POST[username];   till the

insert into tablename(field1, field2) values($value1, $value2) SQL query is
executed which will prevent sql injection even if the user enters any
special characters while filling the form.

b) should i consider the setting of magic quotes as in should it be ON or
OFF or should i ignore it if so should it be
ON or OFF

c) also with the prevention methods if a user types a special character in
the data will that character be written in the table as a escaped character
or how does it store those special characters

d) a very important point here, i have a feature where a user can check if a
username is available or not. so while storing a username if the username is
stored as john\smith in mysql and if the user is searching for johnsmith
this would not match, so even in the table the username should be stored
without slashes as i have to read the username and compare with what the
user has typed to see if they both are same or different.
please advice if i have missed any other steps to prevent sql injection.

thanks a lot for your help.


Re: [PHP] changing order of items

2008-05-15 Thread Jason Murray
On Thu, May 15, 2008 at 2:09 PM, afan pasalic [EMAIL PROTECTED] wrote:

 this one bugs me for a while. how to change order.

 I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
 status value stored in mysql. I can list tasks per status or all.
 order number is stored in mysql too.
 the easiest way to change order is to have form for each task where you
 will enter manually number and then submit (one submit button for whole
 form). but, if you change order number for any task you have to change
 then all order numbers below the task manually

 solution with arrows (or up/down buttons) where you click on arrow and
 the task switch the place with its neighbor is easy and fancy. Though,
 I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
 to 0 and I have to move task 14 to place 6. I have to click first 4
 times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
 actually happening on screen (of course) before start switching places
 with 9, 8, 7, and 6.

 how do you avoid this gap?
 what solution do you use at all?

 thanks for any help.

 -afan
  http://www.php.net/unsub.php


I am assuming that each time you click the up or down arrow you are
re-loading the page (via a GET request).  A simple solution to this, would
be to adjust the URLs assigned to the up and down arrows to carry an extra
variable, the item either directly above or directly below the one selected,
and instead of doing whole-sale renumbering, create a swap function.  That
just swaps the position of the two items.

example:

?php
$rows = get_items_in_list();
for ($i = 0 ; $i  count($rows); $i ++) {
  echo $rows[$i]['taskname'].nbsp;;
  // create move up link
  if ($i  0) {
echo 'a
href=page.php?this='.rows[$i]['position'].'other='.$rows[($i-1)]['position'].'move
up/anbsp;';
  }
  //create mode down link
  if ($i  (count($rows) -1)) {
echo 'a
href=page.php?this='.rows[$i]['position'].'other='.$rows[($i+1)]['position'].'move
up/abr/';
  }
}
?

Then your page would just have to watch for those two variables being set at
load and select the appropriate items in the database based on the order and
swap their two positions, this will allow you to handle gaps in the
positioning scheme, for example when you are only listing the status 1 items
and not all the items.

*note* The code above is completely off-the-cuff and not tested, don't blame
me if there are any bugs in it ;)

Regards,

Jason


[PHP] fsockopen + fputs

2008-05-15 Thread debussy007

Hello,

I use fsockopen and fputs to call a distant URL, but I have the following
error : 
The requested URL /registration/test was not found on this server.

This is my code:

$req = 
'username=' . $usr . 'password=' . $pass . 
'date_of_birth=' . $year . - . $month . - . $day . 
'email=' . $email . 'country=' . $country;

$fp = fsockopen(www.example.com, 80, $errno, $errstr, 30);
if (!$fp) {
echo $errstr ($errno)br\n;
} else {
$header = POST /registration/test HTTP/1.0\r\n;
$header .= Content-Type: application/x-www-form-urlencoded\r\n;
$header .= Content-Length:  . strlen($req) . \r\n\r\n;
fputs ($fp, $header . $req);

while (!feof($fp)) {
echo fgets($fp, 1024);
}
fclose($fp);
}

However the path www.example.com/registration/test exists
so why does it says it cannot find the requested url ?

Any idea ? Thank you for any help !!
-- 
View this message in context: 
http://www.nabble.com/fsockopen-%2B-fputs-tp17264395p17264395.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



Re: [PHP] question about validation and sql injection

2008-05-15 Thread Dmitri
your validation looks good enough to me. If you only allow 
alphanumerical chars, then your should not be worried about sql injection
also use addslashes($username) before you insert into database and you 
should be fine.


Usually addslashes is enough to prevent this, but the validation that 
you have is also enough. So if you worried about the sql injection, then 
use both and you should be fine.


Sudhakar wrote:


A) validating username in php

as part of a registration form a user fills there desired username and this
is stored in a mysql. there are certain conditions for the username.

a) the username should only begin either letters or numbers, and Underscore
character
example = user123, 123user, u_ser123, user_123 = completely case insensitive
b) a user may choose not to have an underscore or numbers sometimes. example
= username

presently my validation for username is

$username = $_POST[username];
if( $username ==  || !eregi(^[a-zA-Z0-9_]+$, $username) )
{
$error.=User name cannot be blank or has special characters;
}

Question = how can i rewrite this php validation for username to meet the
above criteria or is my validation correct


B) preventing sql injection

till now i have been capturing the form values and directly inserting into
the table without considering sql injection however for this project as it
is for a forum i would like to implement prevention of sql injection. from
what i have read about preventing sql injection there are several steps that
need to be followed,

htmlentities
addslashes
trim
mysql-real-escape-string
magic_quotes_gpc is ON
magic_quotes_runtime is OFF
magic_quotes_sybase is OFF

as i have not done preventing sql injection i am not sure what is the
correct process.

Question =

a) please advice a step by step process of how to go about avoiding the sql
injection before the insert sql query is executed starting from

$username = $_POST[username];   till the

insert into tablename(field1, field2) values($value1, $value2) SQL query is
executed which will prevent sql injection even if the user enters any
special characters while filling the form.

b) should i consider the setting of magic quotes as in should it be ON or
OFF or should i ignore it if so should it be
ON or OFF

c) also with the prevention methods if a user types a special character in
the data will that character be written in the table as a escaped character
or how does it store those special characters

d) a very important point here, i have a feature where a user can check if a
username is available or not. so while storing a username if the username is
stored as john\smith in mysql and if the user is searching for johnsmith
this would not match, so even in the table the username should be stored
without slashes as i have to read the username and compare with what the
user has typed to see if they both are same or different.
please advice if i have missed any other steps to prevent sql injection.

thanks a lot for your help.

 




--

Open Source ALL content management
with streaming video
http://wiki.sharedlog.com



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



Re: [PHP] question about validation and sql injection

2008-05-15 Thread Chris
Dmitri wrote:
 your validation looks good enough to me. If you only allow
 alphanumerical chars, then your should not be worried about sql injection
 also use addslashes($username) before you insert into database and you
 should be fine.
 
 Usually addslashes is enough to prevent this, but the validation that
 you have is also enough. So if you worried about the sql injection, then
 use both and you should be fine.

Ahh, that's just wrong.

I can encode an sql query into hex code and that'll pass alpha-numeric
validation.

Use mysql_real_escape_string when you save your data, or use
parameterized queries.

http://www.php.net/mysql_real_escape_string
http://www.php.net/manual/en/pdo.prepared-statements.php
http://www.php.net/manual/en/mysqli.prepare.php

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Good HTML parser needed

2008-05-15 Thread Yi Wang

On 5/15/08, Eric Butera [EMAIL PROTECTED] wrote:
 On Wed, May 14, 2008 at 10:56 PM, Yi Wang [EMAIL PROTECTED] wrote:
   Can anyone provide some code that can't be stripped by strip_tags?
  
  
   On 5/15/08, Eric Butera [EMAIL PROTECTED] wrote:
   On Wed, May 14, 2008 at 11:38 AM, Robert Cummings 
[EMAIL PROTECTED] wrote:



  On Wed, 2008-05-14 at 11:18 -0400, Eric Butera wrote:
   On Tue, May 13, 2008 at 4:07 AM, James Dempster 
[EMAIL PROTECTED] wrote:

http://htmlpurifier.org/
   
 --
 /James
   
  
   This is the only real solution.

  That depends... if I'm the webmaster and I want to input 
arbitrary HTML,

  then htmlpurifier is unnecessary.



  Cheers,
  Rob.
  --
  http://www.interjinn.com
  Application and Templating Framework for PHP


  
  
   OP said users.  Strip tags doesn't bother with tag attributes so
that is a security hole.  Any regex type solution will encounter the
same set of issues.
  
Htmlpurifier actually strips down and re-builds your html from the
ground against a nice whitelist filtering system that you can
customize to your needs.  No nasty tags/attributes will get through
unless you want them to.
  
  
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
  
   --
   Regards,
   Wang Yi
  


 I meant if you used the allow tags parameter.  If you allow say the
  b tag, then you could say b key=value and it would pass right
  through.

  ?php

  $str = bhi/bb onMouseOver='alert(/xss/);'xss/b;

  echo raw:\n;
  var_dump($str);

  echo strip tags:\n;
  var_dump(strip_tags($str));

  echo allow b:\n;
  var_dump(strip_tags($str, 'b'));
  ?

  raw:
  string 'bhi/bb onMouseOver='alert(/xss/);'xss/b' (length=47)
  strip tags:
  string 'hixss' (length=5)
  allow b:
  string 'bhi/bb onMouseOver='alert(/xss/);'xss/b' (length=47)


Yes, you are right. I always used to involved plain text.

Thanks!

--

cheers,
Yi Wang

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



Re: [PHP] SCanning text of PDF documents

2008-05-15 Thread Ray Hauge

Angelo Zanetti wrote:

Hi All.

This is a quick question.

A client of ours wants a solution that when a PDF document is uploaded that
we use PHP to scan the documents contents and save it in a DB.

I know you can do this with normal text documents using the file commands
and functions.

Is it possible with PDF documents?

My feeling is NO, but perhaps someone will prove me wrong.

Thanks in advance.

Angelo

Web: http://www.elemental.co.za 






One thing you'll have to watch is that if the PDF was created by a 
scanner, then the text on the PDF is actually just an image and cannot 
be read without OCR.  I got stumped on that one for a while when I was 
doing something similar :)


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] SCanning text of PDF documents

2008-05-15 Thread Robert Cummings

On Thu, 2008-05-15 at 20:17 -0500, Ray Hauge wrote:

 One thing you'll have to watch is that if the PDF was created by a 
 scanner, then the text on the PDF is actually just an image and cannot 
 be read without OCR.  I got stumped on that one for a while when I was 
 doing something similar :)

I love the tables where you have something like the following:

.-.--.
| This is a short | This is a different  |
| paragraph about | piece of content |
| something in a  | about another thing. |
| table   |  |
`-^--'

And of course when you cut and paste you get the following:

This is a short This is a different
paragraph about piece of content
something in a about another thing.
table

Oh yes, that's what I expected too. It's not even something you can
clean with a macro. You have carefully piece them back together, or
copy/paste one line at a time-- or just type it :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



[PHP] Re: question about validation and sql injection

2008-05-15 Thread Chris W

Sudhakar wrote:

A) validating username in php


If you do what needs to be done to prevent sql injection, it doesn't
matter what you let users have for their user name.





B) preventing sql injection




htmlentities


this has nothing to do with sql injection it just is needed so when you
print data to the screen that may include html entities, they display right.



addslashes

This is a generic way to escape things and is a bad idea since it
doesn't know what system you are using for your DB so you can't be sure
it does it right.


trim


This is handy when reading form data just so you don't store any extra
spaces at the beginning and end of entries.  Often users will
inadvertently add a space to the end or have spaces the come in from
copy and paste.  Again nothing to do with sql injection.


mysql-real-escape-string

If you are using MySQL this is the only function you need to prevent sql
injection.  Simply run any variable that will be part of a query through
this function and then put single quotes around all variables in your
queries and sql injection will be a non issue.

Example
$UserName = mysql_real_escape_string($UserName);
$query = SELECT * FROM `user` WHERE `UserName` = '$UserName' ;

run the query and all will be good.  Many add the password to the where
clause too but I prefer to use a php if statement to be sure the
comparison is case sensitive (depending on the Collation you use in
MySQL your conditional tests may or may not be case sensitive).




magic_quotes_gpc is ON

If you can, you should have this off.  In php 6 Off will be the only
option.  With it on it adds slashes in an attempt to do a generic escape
of characters to prevent sql injection.  Since you can't be sure that
will work right, the best bet is to read in your form data like this

$UserName = trim(stripslashes($_POST['UserName']));

I do the same thing for all data read from forms.  Then before I use the
var as part of a query, I use the mysql_real_escape_string function on
it.  The only exception is when I am expecting an integer returned from
a form, in which case I use this...

$Status = (int) $_POST['Status'];
that way no mater what the user or some hacker tries to get in, I am
sure $Status contains an integer and I don't need to bother with the
mysql_real_escape_string on that var.


If magic_quotes_gpc is off, you can and should remove the strip slashes
function call.  Note the only reason I use trim is to get rid of any
white space that may be at the ends of the string.



magic_quotes_runtime is OFF
magic_quotes_sybase is OFF



These should both be off too.




--
Chris W
KE5GIX

Protect your digital freedom and privacy, eliminate DRM,
learn more at http://www.defectivebydesign.org/what_is_drm;

Ham Radio Repeater Database.
http://hrrdb.com

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



[PHP] Re: changing order of items

2008-05-15 Thread Chris W

afan pasalic wrote:

this one bugs me for a while. how to change order.

I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
status value stored in mysql. I can list tasks per status or all.
order number is stored in mysql too.
the easiest way to change order is to have form for each task where you
will enter manually number and then submit (one submit button for whole
form). but, if you change order number for any task you have to change
then all order numbers below the task manually

solution with arrows (or up/down buttons) where you click on arrow and
the task switch the place with its neighbor is easy and fancy. Though,
I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
to 0 and I have to move task 14 to place 6. I have to click first 4
times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
actually happening on screen (of course) before start switching places
with 9, 8, 7, and 6.

how do you avoid this gap?
what solution do you use at all?

thanks for any help.

-afan





If I understand you right the problem is because you are showing a list 
of items with the status of todo and there are other items with a status 
of done, that if shown would have a priority in between the the ones 
with a status of todo.  So if you simply swithch the priority value with 
the next record up in the priority order, it may not move because of 
unseen items with the done status.


I have had this problem before but in much different type of 
application.  Basically you have several groups of records in the same 
table and you want to sort them independent of each other.  What I have 
done is to specify what field(s) in the table define each group.  In my 
case I have often had 1 2 or even 3 fields needed to define the groups. 
 In your case it is just the todo / done status field.  What I do is 
have the up and down arrow and have the link pass the ID of the item I 
want to move, the sort order value(priority in your case), the value(s) 
of the group field(s) and the direction I want to move the item.  So the 
url for the move button would be something like this


Status ToDo = 1
Status Done = 2
ID of Record to move is say 34
priority of record 34 is say 21
Record has a status of ToDo.


Move.php?ID=34Order=21Status=1Move=Up

Then the move function does something like this.

if($Move == 'Up){
  $query = SELECT ID, Priority FROM `todolist \n;
  $query .= WHERE `Priority`  '$Order' AND `Status` = '$Status' \n;
  $query .= ORDER BY `Priority` DESC \n;
  $query .= LIMIT 1 \n;
}else{
  $query = SELECT ID, Priority FROM `todolist \n;
  $query .= WHERE `Priority`  '$Order' AND `Status` = '$Status' \n;
  $query .= ORDER BY `Priority` \n;
  $query .= LIMIT 1 \n;
}
run query
$TempID = $row['ID'];
$TempPriority = $row['Priority'];

$query = UPDATE `todolist` SET `Priority` = '$Order' \n;
$query .= WHERE `ID` = '$TempID' 
run query
$query = UPDATE `todolist` SET `Priority` = '$TempPriority' \n;
$query .= WHERE `ID` = '$ID' 
run query...












--
Chris W
KE5GIX

Protect your digital freedom and privacy, eliminate DRM,
learn more at http://www.defectivebydesign.org/what_is_drm;

Ham Radio Repeater Database.
http://hrrdb.com

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



[PHP] $_SESSION lost

2008-05-15 Thread hce
Hi,

I've just installed PHP 5.2.4 on a FC 7 with a web server.

$ php -v
PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

It seems some PHP module might be missing, I tested it with a page1.php:

session_start();
$_SESSION['favcolor'] = 'green';

Then I click a link in page1.php to go another page2.php:

session_start();
echo favcolr = . $_SESSION['favcolor'];

It only displayed favcolr =, it was empty in $_SESSION['favcolor'].
The test script page1.php and page2.php are working fine on other
machines.

I checked with php modules, the session is there.

What could I be missing in PHP modules or setup?

Thank you.

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



Re: [PHP] $_SESSION lost

2008-05-15 Thread Chris

 $ php -v
 PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58)
 Copyright (c) 1997-2007 The PHP Group
 Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

This shows the php command line version, not the webserver php version.
To do that, look at a phpinfo() page. They may indeed be the same but
don't think that they always will be. I can run php4 for my webserver
version and php5 command line and vice-versa.

 It seems some PHP module might be missing, I tested it with a page1.php:

More likely the session.save_path is either not writable or not
accessible by this script.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Plugins... (like wordpress?)

2008-05-15 Thread Ryan S
Hey,

Have just started screwing around with wordpress and I must say... it has a lot 
of really really nice bits and pieces... two of my favourites are widgets and 
plugins... not a hundred percent certain exactly what the diff is though! :)

Anyway, was thinking it would be a great way to program for my next project... 
instead of jumping into the code again and again... write specific code and 
throw the file into the directory... then it either gets read and executed 
automatically or have a feature like WP where you have to activate it... only 
problem is, i dont know where to begin... i did do a little google searching 
and have a rough idea.. but would appreciate it if YOU could give me some links 
or code that got you started... something that was easy when you were 
beginning... something that lit that lightbulb in your head when you read it...

Thanks in advance!
R

 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

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