Re: [PHP] Rewind foreach loop

2007-11-29 Thread Jeffery Fernandez
I think the best option for me is to refactorise my code a bit to cater to my 
situation. Thanks all for your help.

Jeffery

On Fri, 30 Nov 2007 02:32:11 pm Jeffery Fernandez wrote:
> On Fri, 30 Nov 2007 02:13:52 pm Chris wrote:
> > Jeffery Fernandez wrote:
> > > On Fri, 30 Nov 2007 02:01:47 pm Chris wrote:
> > >> Jeffery Fernandez wrote:
> > >>> Hi all,
> > >>>
> > >>> Is it possible to rewind a foreach loop? eg:
> > >>>
> > >>>
> > >>> $numbers = array(0,1,2,3,4,5,6,7,8,9,10);
> > >>>
> > >>> foreach ($numbers as $index => $value)
> > >>> {
> > >>> if ($value == 5)
> > >>> {
> > >>> prev($numbers);
> > >>> }
> > >>> echo "Value: $value" . PHP_EOL;
> > >>> }
> > >>>
> > >>> The above doesn't seem to work. In one of my scenarios, when I
> > >>> encounter and error in a foreach loop, I need the ability to rewind
> > >>> the array pointer by one. How can I achieve this?
> > >>
> > >> echo $numbers[$index-1] . PHP_EOL;
> > >
> > > That will only give me the value of the previous index. What I want is
> > > to rewind the array pointer and continue with the loop.
> >
> > and you're going to be in an endless loop then.. because each time it
> > gets rewound, it gets the same key again and rewinds and ...
>
> No, I am only rewinding if there is an error. Then I have the script
> auto-learning from the error, fix a config file and then want to go back to
> the array pointer to re-execute the process.
>
> > You could do it with a for or while loop probably.
>
> Thats what I am looking at now.
>
> > What are you trying to achieve? Maybe there's an alternative.
>
> As mentioned above.
>
> cheers,
> Jeffery
>
> > --
> > Postgresql & php tutorials
> > http://www.designmagick.com/
>
> --
> Internet Vision Technologies
> Level 1, 520 Dorset Road
> Croydon
> Victoria - 3136
> Australia
> web: http://www.ivt.com.au
> phone: +61 3 9723 9399
> fax: +61 3 9723 4899



-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899

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



Re: [PHP] Rewind foreach loop

2007-11-29 Thread Jeffery Fernandez
On Fri, 30 Nov 2007 02:13:52 pm Chris wrote:
> Jeffery Fernandez wrote:
> > On Fri, 30 Nov 2007 02:01:47 pm Chris wrote:
> >> Jeffery Fernandez wrote:
> >>> Hi all,
> >>>
> >>> Is it possible to rewind a foreach loop? eg:
> >>>
> >>>
> >>> $numbers = array(0,1,2,3,4,5,6,7,8,9,10);
> >>>
> >>> foreach ($numbers as $index => $value)
> >>> {
> >>> if ($value == 5)
> >>> {
> >>> prev($numbers);
> >>> }
> >>> echo "Value: $value" . PHP_EOL;
> >>> }
> >>>
> >>> The above doesn't seem to work. In one of my scenarios, when I
> >>> encounter and error in a foreach loop, I need the ability to rewind the
> >>> array pointer by one. How can I achieve this?
> >>
> >> echo $numbers[$index-1] . PHP_EOL;
> >
> > That will only give me the value of the previous index. What I want is to
> > rewind the array pointer and continue with the loop.
>
> and you're going to be in an endless loop then.. because each time it
> gets rewound, it gets the same key again and rewinds and ...

No, I am only rewinding if there is an error. Then I have the script 
auto-learning from the error, fix a config file and then want to go back to 
the array pointer to re-execute the process.

>
> You could do it with a for or while loop probably.
Thats what I am looking at now.

>
> What are you trying to achieve? Maybe there's an alternative.
As mentioned above.

cheers,
Jeffery
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/



-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899

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



Re: [PHP] Rewind foreach loop

2007-11-29 Thread Jeffery Fernandez
On Fri, 30 Nov 2007 02:01:47 pm Chris wrote:
> Jeffery Fernandez wrote:
> > Hi all,
> >
> > Is it possible to rewind a foreach loop? eg:
> >
> >
> > $numbers = array(0,1,2,3,4,5,6,7,8,9,10);
> >
> > foreach ($numbers as $index => $value)
> > {
> > if ($value == 5)
> > {
> > prev($numbers);
> > }
> > echo "Value: $value" . PHP_EOL;
> > }
> >
> > The above doesn't seem to work. In one of my scenarios, when I encounter
> > and error in a foreach loop, I need the ability to rewind the array
> > pointer by one. How can I achieve this?
>
> echo $numbers[$index-1] . PHP_EOL;

That will only give me the value of the previous index. What I want is to 
rewind the array pointer and continue with the loop.

>
> Of course that assumes that the value you're looking for isn't the first
> element :)
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/



-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899

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



[PHP] Rewind foreach loop

2007-11-29 Thread Jeffery Fernandez
Hi all,

Is it possible to rewind a foreach loop? eg:


$numbers = array(0,1,2,3,4,5,6,7,8,9,10);

foreach ($numbers as $index => $value)
{
if ($value == 5)
{
prev($numbers);
}
echo "Value: $value" . PHP_EOL;
}

The above doesn't seem to work. In one of my scenarios, when I encounter and 
error in a foreach loop, I need the ability to rewind the array pointer by 
one. How can I achieve this?

regards,
Jeffery
-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899

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



Re: [PHP] Array Slice without loosing index [SOLVED]

2007-11-27 Thread Jeffery Fernandez
oops me bad.. I just needed the last (4th) parameter added. 

cheers,
Jeffery

On Wed, 28 Nov 2007 04:59:35 pm Jeffery Fernandez wrote:
> Hi all,
>
> I am wanting to retain the array indexes after it being sliced. Here is
> what I have so far.
>
> if ($user_count > $group_count)
> {
>   for ($i = 0; $i < $user_count; $i+=$group_count)
>   {
>   $output = array_slice($properties['users'], $i, $group_count);
>   print_r($output);
>   }
> }
>
> Every time the array is sliced it results with arrays which have new
> idexes. Is there a way I can retain the array indexes when slicing the
> array.
>
> regards,
> Jeffery
> --
> Internet Vision Technologies
> Level 1, 520 Dorset Road
> Croydon
> Victoria - 3136
> Australia
> web: http://www.ivt.com.au
> phone: +61 3 9723 9399
> fax: +61 3 9723 4899



-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899

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



[PHP] Array Slice without loosing index

2007-11-27 Thread Jeffery Fernandez
Hi all,

I am wanting to retain the array indexes after it being sliced. Here is what I 
have so far.

if ($user_count > $group_count)
{
for ($i = 0; $i < $user_count; $i+=$group_count)
{
$output = array_slice($properties['users'], $i, $group_count);
print_r($output);
}
}

Every time the array is sliced it results with arrays which have new idexes. 
Is there a way I can retain the array indexes when slicing the array.

regards,
Jeffery
-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899

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



[PHP] Generating sequence of AlphaNumber

2007-11-14 Thread Jeffery Fernandez
Hi all,

I am having trouble generating a sequence of numbers from the following start 
value:
AX0001

what I have done so far is loop through each character and check if its a 
alphabet and separating the characters and digits.

But when I increment the digits, its strips of the leading zeros. How can I 
get a sequence of values like:

AX0001
AX0002
AX0003
AX0004
.
AX0099
AX0100

and so on ?

jeffery
-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899

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



Re: [PHP] Generating sequence of AlphaNumber

2007-11-14 Thread Jeffery Fernandez
On Thu, 15 Nov 2007 11:48:07 am Stephen Edberg wrote:
> On Thu, 15 Nov 2007, Jeffery Fernandez wrote:
> > Hi all,
> >
> > I am having trouble generating a sequence of numbers from the following
> > start value:
> > AX0001
> >
> > what I have done so far is loop through each character and check if its a
> > alphabet and separating the characters and digits.
> >
> > But when I increment the digits, its strips of the leading zeros. How can
> > I get a sequence of values like:
> >
> > AX0001
> > AX0002
> > AX0003
> > AX0004
> > .
> > AX0099
> > AX0100
> >
> > and so on ?
> >
> > jeffery
> > --
>
> Probably the easiest way is sprintf(); for example,
>
>sprintf('%04.0d', 34) returns 0034

Thanks mate, that works like a charm. :)

cheers,
Jeffery

>
> See
>
>   http://www.php.net/sprintf
>
> ...
> . Steve Edberg   [EMAIL PROTECTED] .
> . Computer Consultant University of California, Davis .
> .   (530)754-9127 .
> ...



-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899

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



Re: [PHP] Problem with pasting text from word into php form

2007-09-30 Thread Jeffery Fernandez
On Monday 01 October 2007 16:01, Crab Hunt wrote:
> Hi,
> Is there a fix for removing the junk characters that appear when we copy
> and paste some text from Microsoft word into a php form ? For example the
> double quotes "" turn into something like *â??*
>
> thanks in advance.


Some WYSIWYG editors do this nicely. Look at the code of FCKeditor, it has 
some javascript functions to cleanup the Word document characters.

cheers,
jeffery
-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgpY7OEG5y4Bx.pgp
Description: PGP signature


Re: [PHP] SimpleXMLElement is not Simple

2007-09-30 Thread Jeffery Fernandez
On Friday 28 September 2007 11:21, Jeffery Fernandez wrote:
> On Friday 28 September 2007 11:09, Nathan Nobbe wrote:
> > just curious, what database are you using?
>
> I am using MySQL Ver 14.12 Distrib 5.0.22


Any clues Nathan? 

I have done some further testing and found that if I copy the working code 
(standalone script) and put it amongst the application code, that doesn't 
work either. I am thinking its a locale or character encoding problem. Any 
thoughts ?


cheers,
Jeffery

>
> cheers,
> Jeffery
>
> > -nathan
> >
> > On 9/27/07, Jeffery Fernandez <[EMAIL PROTECTED]> wrote:
> > > I am having nightmares with this bit off code.
> > >
> > > The following code work perfectly fine:
> > >
> > > $soap_request_string = << > > 
> > > http://www.w3.org/2003/05/soap-envelope";
> > > xmlns:ns1="urn:Gateway_Proxy"
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc="
> > > http://www.w3.org/2003/05/soap-encoding";>
> > > 
> > >   http://www.w3.org/2003/05/soap-encoding";>
> > > 61ecc268-1cd0-f468
> > > 15495
> > >
> > >
> > > &payment_id=61ecc268-1cd0-f468 > >ry _string> Order from Student Library Fees with
> > > Payment Id: 61ecc268-1cd0-f468
> > >   
> > > 
> > > 
> > > XML;
> > >
> > > $xml = new SimpleXMLElement($soap_request_string, NULL, false, '
> > > http://www.w3.org/2003/05/soap-envelope');
> > > print_r($xml);
> > > $ns = $xml->getNamespaces(true);
> > > //print_r($ns);
> > >
> > > foreach ($xml->children($ns['env']) as $body)
> > > {
> > > //printf("%s", $body->getName());
> > >
> > > foreach ($body->children($ns['ns1']) as $function)
> > > {
> > > printf("function %s()", $function->getName());
> > >
> > > foreach ($function->children() as $parameters)
> > > {
> > > printf("%s => \"%s\"",
> > > $parameters->getName(), $parameters);
> > > }
> > > }
> > > }
> > >
> > >
> > > However when the XML string is coming from the database it does not
> > > work. The Field and table have a collation of "utf8_unicode_ci"
> > >
> > > $soap_request_string = trim(str_replace(array("\n"), '',
> > > $record['SoapRequestEnvelope']));
> > > $xml = new SimpleXMLElement($soap_request_string, NULL, false, '
> > > http://www.w3.org/2003/05/soap-envelope');
> > > print_r($xml);
> > >
> > >
> > > The above code is supposed to print out the following (for me to
> > > proceed further):
> > >
> > > SimpleXMLElement Object
> > > (
> > > [Body] => SimpleXMLElement Object
> > > (
> > > )
> > > )
> > >
> > >
> > > but only returns:
> > > SimpleXMLElement Object
> > > (
> > > )
> > >
> > >
> > > The XL string from the database looks exactly like this (after
> > > replacing new lines):
> > >
> > > http://www.w3.org/2003/05/soap-envelope"; xmlns:ns1="urn:Gateway_Proxy"
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="
> > > http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc="
> > > http://www.w3.org/2003/05/soap-encoding";> > >en t
> > > env:encodingStyle="http://www.w3.org/2003/05/soap-encoding";> > >>5
> > > ce30dcc-7df7-04e810 > >ack
> > > _query_string>&payment_id=5ce30dcc-7df7-04e8 > >>Order from Student Library Fees with Payment Id:
> > > 5ce30dcc-7df7-04e8 > >y> 
> > >
> > >
> > > I can't figure out whats wrong with the code. Any suggestions?
> > >
> > > cheers,
> > > Jeffery
> > > --
> > > Internet Vision Technologies
> > > Level 1, 520 Dorset Road
> > > Croydon
> > > Victoria - 3136
> > > Australia

-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgpd4X4Xvas84.pgp
Description: PGP signature


Re: [PHP] PHP and daylight savings

2007-09-30 Thread Jeffery Fernandez
On Monday 01 October 2007 10:08, Bruce Cowin wrote:
> Yet another update!  I managed to get rid of the CGI error by turning off
> error logging to the syslog.  But now I get this message:
>
> PHP Warning: PHP Startup: Unable to load dynamic library
> 'c:\php\ext\php_timezonedb.dll' - Access is denied. in Unknown on line 0

I don't know if this will make a difference.. have you checked the permissions 
of the file. I think you need to grant the extentions folder Full Control for 
IUSR_COMPUTERNAME

>
> As I say, this same dll works fine on a server running the same PHP version
> (5.1.2).  Any ideas?
>
>
>
> Regards,
>
> Bruce
>
> >>> "Bruce Cowin" <[EMAIL PROTECTED]> 1/10/2007 12:13 p.m. >>>
>
> I discovered that we needed to update the php_timezonedb.dll.  This worked
> fine on our servers and time is now correct.  But in my dev environment on
> my machine, when I put the same dll in (with the same version of PHP), I
> get a CGI error when PHP tries to do anything.  Anyone know why?
>
>
>
> Regards,
>
> Bruce
>
> >>> "Bruce Cowin" <[EMAIL PROTECTED]> 1/10/2007 11:02 a.m. >>>
>
> I'm using PHP 5.1.2 on IIS.  Here in New Zealand, our daylight savings
> started a week earlier than usual and went into affect this past weekend. 
> The time on my machine is correct.  The timezone settings on my machine are
> correct.  But if I display the time on a PHP page, it is 1 hour behind. 
> Setting the timezone with date_default_timezone_set() doesn't make any
> difference.  If I display the time on an ASP page, it shows the correct
> time so it can't be an IIS problem I don't think.
>
> Why would PHP be showing the time as if it hadn't changed?  Where is it
> getting the time from?  Here is the code I'm using:
>
>   date_default_timezone_set('Pacific/Auckland');
>   echo "time is " . date("h:i:s");
>
>
>
>
> Regards,
>
> Bruce
>
> --
> 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

-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgp6eqX1VWSRW.pgp
Description: PGP signature


Re: [PHP] counting with leading zeros

2007-09-30 Thread Jeffery Fernandez
gee you guys behave like kids. don't you all have other things to do than 
whinge, swear  and blame each other on the list? Take it elsewhere and sort 
it out. This is bad for the PHP community in general. It doesn't reflect what 
the community is about.

my 2c.

On Sunday 30 September 2007 13:47, brian wrote:
> tedd wrote:
> > At 8:30 PM -0400 9/27/07, brian wrote:
> >> I wasn't bitching! And i *thought* that my numerous attempts at
> >> explaining such would have been enough. Obviously not, but wtf can you
> >> do with people who seem to want only to stir up shit?
> >
> > It sure sounded like you were bitching.
>
> Gee, thanks for pointing that out, Jeeves. I'd say it's pretty damned
> obvious now that Rob thought i was bitching about his response to my
> query. However, if you'd have bothered to note my replies since, you
> might have twigged to the fact that i'd been trying to set that
> straight. But you just *had* to send off your own dickish response.
>
> > And, your off-list "fuck you, too, asswipe" to me certainly seems to
> > support that -- don't you think?
>
> How so? Had it crossed your little mind that maybe--just maybe--i was
> becoming not a little frustrated with the fact that my reply had been
> taken the wrong way? That, instead of accepting that and moving on, this
> had become far too OT with bullshit comments such as yours? So, yeah,
> you might say that i'm bitching *now*.
>
> You and i have had our run-ins on this list on more than one occasion.
> Until now, i've chosen to take your crap in stride. If you have nothing
> constructive to add then STFU.
>
> > Look, there's nothing you can say to me that hasn't been said before
> > (some of it deserving), so my advice is for you to refrain from such
> > conduct and at least try to look professional. That way you'll hide your
> > ignorance a little longer -- it's always worked for me.
>
> This is me laughing. I'm sure you have no bloody idea how funny that
> statement looks from where i'm sitting. See the paragraph above.
>
> > Dan Parry wrote:
> >> Can I please interject and say that I vastly respect Tedd(ddd) and
> >> Rob(bb?) and their opinions
>
> It's not so much that i disrespect Rob. It's just that i felt i had to
> call him out for being a dickhead by taking my statement out of context.
>
> Tedd ... not so very much at all.
>
> Robert Cummings wrote:
>  > On Fri, 2007-09-28 at 12:05 -0400, tedd wrote:
>  At 10:39 PM -0400 9/26/07, brian wrote:
>  >>>
>  >>>fuck you, too, asswipe
>  >
>  > Seems to be, an extra, comma, in the phrase. It reads, like Captain
>  > Kirk, saying, it.
>
> Funny. Reminds of a Capt. Kirk quote:
> "No more blah, blah, blah!"
>
> brian

-- 
Powered by openSUSE 10.2 (i586) Kernel: 2.6.18.8-0.5-default
KDE: 3.5.5 "release 45.4"
 10:55pm  up 10 days  2:22,  3 users,  load average: 0.13, 0.18, 0.17

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



Re: [PHP] SimpleXMLElement is not Simple

2007-09-27 Thread Jeffery Fernandez
On Friday 28 September 2007 11:09, Nathan Nobbe wrote:
> just curious, what database are you using?

I am using MySQL Ver 14.12 Distrib 5.0.22

cheers,
Jeffery
>
> -nathan
>
> On 9/27/07, Jeffery Fernandez <[EMAIL PROTECTED]> wrote:
> > I am having nightmares with this bit off code.
> >
> > The following code work perfectly fine:
> >
> > $soap_request_string = << > 
> > http://www.w3.org/2003/05/soap-envelope";
> > xmlns:ns1="urn:Gateway_Proxy"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc="
> > http://www.w3.org/2003/05/soap-encoding";>
> > 
> >   http://www.w3.org/2003/05/soap-encoding";>
> > 61ecc268-1cd0-f468
> > 15495
> >
> >
> > &payment_id=61ecc268-1cd0-f468 >_string> Order from Student Library Fees with Payment
> > Id: 61ecc268-1cd0-f468
> >   
> > 
> > 
> > XML;
> >
> > $xml = new SimpleXMLElement($soap_request_string, NULL, false, '
> > http://www.w3.org/2003/05/soap-envelope');
> > print_r($xml);
> > $ns = $xml->getNamespaces(true);
> > //print_r($ns);
> >
> > foreach ($xml->children($ns['env']) as $body)
> > {
> > //printf("%s", $body->getName());
> >
> > foreach ($body->children($ns['ns1']) as $function)
> > {
> > printf("function %s()", $function->getName());
> >
> > foreach ($function->children() as $parameters)
> > {
> > printf("%s => \"%s\"", $parameters->getName(),
> > $parameters);
> > }
> > }
> > }
> >
> >
> > However when the XML string is coming from the database it does not work.
> > The Field and table have a collation of "utf8_unicode_ci"
> >
> > $soap_request_string = trim(str_replace(array("\n"), '',
> > $record['SoapRequestEnvelope']));
> > $xml = new SimpleXMLElement($soap_request_string, NULL, false, '
> > http://www.w3.org/2003/05/soap-envelope');
> > print_r($xml);
> >
> >
> > The above code is supposed to print out the following (for me to proceed
> > further):
> >
> > SimpleXMLElement Object
> > (
> > [Body] => SimpleXMLElement Object
> > (
> > )
> > )
> >
> >
> > but only returns:
> > SimpleXMLElement Object
> > (
> > )
> >
> >
> > The XL string from the database looks exactly like this (after replacing
> > new lines):
> >
> > http://www.w3.org/2003/05/soap-envelope"; xmlns:ns1="urn:Gateway_Proxy"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc="
> > http://www.w3.org/2003/05/soap-encoding";> >t
> > env:encodingStyle="http://www.w3.org/2003/05/soap-encoding";>5
> >ce30dcc-7df7-04e810 >_query_string>&payment_id=5ce30dcc-7df7-04e8 >ransaction_note>Order from Student Library Fees with Payment Id:
> > 5ce30dcc-7df7-04e8
> >
> >
> >
> > I can't figure out whats wrong with the code. Any suggestions?
> >
> > cheers,
> > Jeffery
> > --
> > Internet Vision Technologies
> > Level 1, 520 Dorset Road
> > Croydon
> > Victoria - 3136
> > Australia

-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgpYLgM4DjM0T.pgp
Description: PGP signature


[PHP] SimpleXMLElement is not Simple

2007-09-27 Thread Jeffery Fernandez
I am having nightmares with this bit off code.

The following code work perfectly fine:

$soap_request_string = <<
http://www.w3.org/2003/05/soap-envelope"; 
xmlns:ns1="urn:Gateway_Proxy" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>

  http://www.w3.org/2003/05/soap-encoding";>
61ecc268-1cd0-f468
15495

&payment_id=61ecc268-1cd0-f468
Order from Student Library Fees with Payment Id: 
61ecc268-1cd0-f468
  


XML;

$xml = new SimpleXMLElement($soap_request_string, NULL, false, 
'http://www.w3.org/2003/05/soap-envelope');
print_r($xml);
$ns = $xml->getNamespaces(true);
//print_r($ns);

foreach ($xml->children($ns['env']) as $body)
{
//printf("%s", $body->getName());
   
foreach ($body->children($ns['ns1']) as $function)
{
printf("function %s()", $function->getName());
   
foreach ($function->children() as $parameters)
{
printf("%s => \"%s\"", $parameters->getName(), 
$parameters);
}
}
}


However when the XML string is coming from the database it does not work. The 
Field and table have a collation of "utf8_unicode_ci"

$soap_request_string = trim(str_replace(array("\n"), '', 
$record['SoapRequestEnvelope']));
$xml = new SimpleXMLElement($soap_request_string, NULL, false, 
'http://www.w3.org/2003/05/soap-envelope');
print_r($xml);


The above code is supposed to print out the following (for me to proceed 
further):

SimpleXMLElement Object
(
[Body] => SimpleXMLElement Object
(
)
)


but only returns:
SimpleXMLElement Object
(
)


The XL string from the database looks exactly like this (after replacing new 
lines):

http://www.w3.org/2003/05/soap-envelope"; 
xmlns:ns1="urn:Gateway_Proxy" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>http://www.w3.org/2003/05/soap-encoding";>5ce30dcc-7df7-04e810&payment_id=5ce30dcc-7df7-04e8Order
 from Student Library Fees with Payment Id: 
5ce30dcc-7df7-04e8


I can't figure out whats wrong with the code. Any suggestions?

cheers,
Jeffery
-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgpSwDIXaIYCH.pgp
Description: PGP signature


Re: [PHP] PDOStatement execute memory issue?

2007-09-26 Thread Jeffery Fernandez
On Thursday 27 September 2007 04:21, Carlton Whitehead wrote:
> Hi everyone,
>
> I'm working on a script that downloads archived fax images (TIFFs and PDFs)
> from a MS SQL Server using the PDO ODBC driver. I get the below error
> regardless of which fax I try to get from the database. Each fax is a
> different size, and both of the memory allocation numbers are always the
> same:
>
> Fatal error: Out of memory (allocated 262144) (tried to allocate 4294967295
> bytes) in C:\Inetpub\wwwroot\FMarchive\library\faxInbound.php on line 81

Ho big are those faxes? 4294967295 bytes = 4GB

have you tried executing that SQL directly into the database? Does it return 
the right results?

>
> The above error happened when querying a fax with a size of 17723 bytes. 
> According to my phpinfo(); page, the memory_limit is 128MB.
>
> My machine has the below specs:
> Windows Server 2003 SP2
> IIS 6
> 2GB RAM
> Microsoft SQL Server 2005 SP2
> PHP 5.2.4
>
> Here is the excerpt from my code:
>
>   public function downloadFax($id, $attid, $attsize)
>   {
>   try
>   {
>   $stmt = 'SELECT filename, attdata FROM 
> fm_faxin_att WHERE id = :id AND
> attid = :attid'; $pstmt = $this->db->prepare($stmt);
>   $pstmt->bindValue(':id', $id);
>   $pstmt->bindValue(':attid', $attid);
>   $pstmt->execute(); // this is the Line 81 
> referenced by the error
> message $pstmt->bindColumn('filename', $filename, PDO::PARAM_STR);
>   $pstmt->bindColumn('attdata', $data, 
> PDO::PARAM_LOB);
>   $pstmt->fetch(PDO::FETCH_BOUND);
>
>   return array('attdata' => $data, 'filename' => 
> $filename);
>   }
>   catch (PDOException $e)
>   {
>   die($e->getMessage());
>   }
>   }
>
> Any ideas?
>
> Regards,
> Carlton Whitehead

-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgp7uvSwuepL9.pgp
Description: PGP signature


[PHP] Extract SOAP Request Data

2007-09-26 Thread Jeffery Fernandez
I have a SOAP request logger which logs all SOAP requests/responses being made 
on the system. What I want to do is extract the function name being called and 
the params passed to it. The following is an example XML Request:


http://www.w3.org/2003/05/soap-envelope";
xmlns:ns1="urn:Gateway_Proxy"
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>

  http://www.w3.org/2003/05/soap-encoding";>
61ecc268-1cd0-f468
15495

&payment_id=61ecc268-1cd0-f468
Order from Student Library Fees with Payment Id: 
61ecc268-1cd0-f468
  

 

What I want to do is extract the function name and the parameter names and its 
values.

I have done the folloing so far:
$soap_request_string = <<
http://www.w3.org/2003/05/soap-envelope"; 
xmlns:ns1="urn:Gateway_Proxy" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>

  http://www.w3.org/2003/05/soap-encoding";>
61ecc268-1cd0-f468
15495

&payment_id=61ecc268-1cd0-f468
Order from Student Library Fees with Payment Id: 
61ecc268-1cd0-f468
  


XML;


$xml = new SimpleXMLElement($soap_request_string, NULL, false);
print_r($xml);
$ns = $xml->getNamespaces(true);
print_r($ns);
foreach ($xml->xpath('//env:Body') as $body)
{
//print_r($body);
foreach ($body->children($ns['env'], true) as $child)
{
print_r($child);
}
} 

which does not return any SimpleXMLElements Objects. I can't figure out how to 
extract the values which are tied to the Name Space.

A description of the problem is in detail here: 
http://www.devnetwork.net/forums/viewtopic.php?t=74161

regards,
Jeffery
-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgpBILHw2STMW.pgp
Description: PGP signature


Re: [PHP] session_decode from session handler

2007-07-21 Thread Jeffery Fernandez
On Sunday 22 July 2007 14:19, Jeffery Fernandez wrote:
> I have a similar problem I am facing with session data stored in the
> database from the set_session_handler.
>
> What I am trying to do is show a list of online users and the page they are
> currenlty viewing. For this purpose I am query the sessions table to get
> the list of session and from that I loop through to get the session data of
> each online user. But for some reason, I cannot decode/un-serialise the
> session data. Any pointers ?

just following up on this problem. I am using PHP 5.2.3. I also do remember 
that previously in older versions of PHP, I used to see the session data was 
the actual serialised data. But now with my testing it just seems to be one 
long string. Which leads me to beleive that there is some kind of encoding 
taking place.

>
> cheers,
> Jeffery
>
> On Friday 20 July 2007 08:25, Ryan Graciano wrote:
> > PHP passed $data to my write($id) function, and then I wrote it to the
> > database.  In the code below, I have retrieved it from the database.  I
> > presume that it used encode_session to generate $data.
> >
> > I tried calling unserialize() on it for good measure, but it wasn't able
> > to parse the data.  When I return $data from my method, though, PHP is
> > able to turn it into a $_SESSION.
> >
> > Thanks,
> > - Ryan
> >
> > - Original Message 
> > From: Tijnema <[EMAIL PROTECTED]>
> > To: Ryan Graciano <[EMAIL PROTECTED]>
> > Cc: php-general@lists.php.net
> > Sent: Thursday, July 19, 2007 5:28:32 PM
> > Subject: Re: [PHP] session_decode from session handler
> >
> > On 7/19/07, Ryan Graciano <[EMAIL PROTECTED]> wrote:
> > > I'm having an issue getting session_decode to work from my session
> > > handler in PHP 5.2.3.  Here's a short code snippet that demonstrates
> > > what I'm trying to do (from my read handler) -
> > >
> > > public function read($id) {
> > > 
> > > var_dump($data);  // prints out the serialized session correctly
> > > $retval = session_decode($data);
> > > var_dump($_SESSION);  // prints out "array(0) {}"
> > > echo $retval;  // prints false
> > > return $data;
> > > }
> > >
> > > In my calling function, $_SESSION is updated with everything that was
> > > held in $data, which means that $data was not corrupt - it worked when
> > > I returned it, but it did not work when I used session_decode.  This is
> > > a problem because I want to change my read($id) function so that it
> > > decodes $data, adds something extra to the $_SESSION, then re-encodes
> > > $data and returns it.
> > >
> > > Thanks,
> > > - Ryan
> >
> > How did you get $data?
> >
> > If it's just serialized data, you can simply call unserialize instead
> > of session_decode.
> >
> > Tijnema
>
> --
> Powered by openSUSE 10.2 (i586) Kernel: 2.6.18.8-0.5-default
> KDE: 3.5.5 "release 45.4"
>   2:19pm  up 11 days 18:32,  7 users,  load average: 0.42, 0.58, 0.54

-- 
Powered by openSUSE 10.2 (i586) Kernel: 2.6.18.8-0.5-default
KDE: 3.5.5 "release 45.4"
  2:24pm  up 11 days 18:38,  7 users,  load average: 0.45, 0.42, 0.47


pgpMhC1sICAJ7.pgp
Description: PGP signature


Re: [PHP] session_decode from session handler

2007-07-21 Thread Jeffery Fernandez
I have a similar problem I am facing with session data stored in the database 
from the set_session_handler.

What I am trying to do is show a list of online users and the page they are 
currenlty viewing. For this purpose I am query the sessions table to get the 
list of session and from that I loop through to get the session data of each 
online user. But for some reason, I cannot decode/un-serialise the session 
data. Any pointers ?

cheers,
Jeffery

On Friday 20 July 2007 08:25, Ryan Graciano wrote:
> PHP passed $data to my write($id) function, and then I wrote it to the
> database.  In the code below, I have retrieved it from the database.  I
> presume that it used encode_session to generate $data.
>
> I tried calling unserialize() on it for good measure, but it wasn't able to
> parse the data.  When I return $data from my method, though, PHP is able to
> turn it into a $_SESSION.
>
> Thanks,
> - Ryan
>
> - Original Message 
> From: Tijnema <[EMAIL PROTECTED]>
> To: Ryan Graciano <[EMAIL PROTECTED]>
> Cc: php-general@lists.php.net
> Sent: Thursday, July 19, 2007 5:28:32 PM
> Subject: Re: [PHP] session_decode from session handler
>
> On 7/19/07, Ryan Graciano <[EMAIL PROTECTED]> wrote:
> > I'm having an issue getting session_decode to work from my session
> > handler in PHP 5.2.3.  Here's a short code snippet that demonstrates what
> > I'm trying to do (from my read handler) -
> >
> > public function read($id) {
> > 
> > var_dump($data);  // prints out the serialized session correctly
> > $retval = session_decode($data);
> > var_dump($_SESSION);  // prints out "array(0) {}"
> > echo $retval;  // prints false
> > return $data;
> > }
> >
> > In my calling function, $_SESSION is updated with everything that was
> > held in $data, which means that $data was not corrupt - it worked when I
> > returned it, but it did not work when I used session_decode.  This is a
> > problem because I want to change my read($id) function so that it decodes
> > $data, adds something extra to the $_SESSION, then re-encodes $data and
> > returns it.
> >
> > Thanks,
> > - Ryan
>
> How did you get $data?
>
> If it's just serialized data, you can simply call unserialize instead
> of session_decode.
>
> Tijnema

-- 
Powered by openSUSE 10.2 (i586) Kernel: 2.6.18.8-0.5-default
KDE: 3.5.5 "release 45.4"
  2:19pm  up 11 days 18:32,  7 users,  load average: 0.42, 0.58, 0.54

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



Re: [PHP] Drag 'n Drop - File Upload

2006-07-03 Thread Jeffery Fernandez
On Mon, 3 Jul 2006 11:09 pm, Mariano Guadagnini wrote:
> I've seen some places using a java applet for this. A good example is
> the course uploading interface of Blackboard LMS.
>
> Martin Staiger wrote:
> > Dear group,
> >
> > we would like to have the possibility to upload files not via HTML-form
> > but via Drag 'n Drop of files. WebDav seem to offer potentials ... but
> > HOW? Are there any examples existing? Are there alternatives existing?
> >
> > Thanks,
> > Marc
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.9.8/380 - Release Date: 30/06/2006


Its called RadUpload .. works like a charm with all the bells and whistles... 
but hey its Java 

cheers,
Jeffery


pgpR3PNLZ9mR7.pgp
Description: PGP signature


Re: [PHP] How to Get URL?

2005-03-13 Thread Jeffery Fernandez
Labunski wrote:
How to get url of the page the php script is on?
In other words, I want to know whether I'm in page "news.php" or in 
"posts.php", or in some other page. Is there any simple way to get tis info?

Thanks,
Lab. 

 

if (basename($_SERVER['PHP_SELF']) == 'news.php')
{
   // do whatever you want
}
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PHP Frameworks

2005-03-13 Thread Jeffery Fernandez
Simon Reye wrote:
I'm moving away from Cold Fusion and am considering java or php.  I've 
mucked around with Struts and Coccoon on the java side and think they 
are great.  There does not however seem to be any well backed projects 
similar to these for php.

Can anyone point me to a good php MVC framework?
here you go: http://wact.sourceforge.net/index.php/MvcFrameworksWrittenInPhp
cheers,
Jeffery
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] LibMcrypt and Mcrypt and Mhash - OH MY!

2005-02-11 Thread Jeffery Fernandez
Steven Altsman wrote:
I’ve beaten my head against the desk repeatedly, RTFM’ing until my 
eyes are sore, the boss is still at my back.. and I’m completely lost. 
I’d love to grok intricacies of compiling C code and setting 
environment variables.. but I am dead once February 15^th rolls around 
and may have to find another job soon.

All I’m trying to do is get an OpenBSD 3.6 box with the following 
components installed:

MySQL 4.1 (or 5.0.2)
Apache 2
Mcrypt
Mhash
Libmcrypt
PHP
OpenSSL
And that’s it. Nothing fancy, just something that is highly secure and 
easy to lock down to 2 ports. I’ve gotten a bunch of shell scripts 
written up for each portion of the install.. most of them are 
./configure –prefix=/usr/local/(program name) with the configuration 
files in the conf directory for each.

I’m currently hung up on Mcrypt. It’s a total monster! It’s a key 
component in so many programs and libraries, and yet Googl’ing news 
groups, checking out the main site for them, and going through the 
config.log files I can’t understand a darn thing anyone is saying.

I’m an intro PHP fella.. I can tie into databases, loop through if 
statements, store images, handle usernames and passwords.. but 
encryption is something completely alien to me. I’ve done ASP before 
and installing the packages may not be as 
secure/customizable/reliable/intelligent.. it involved double-clicking 
and maybe doing something in DOS like adding a “-v” at the end.

Don’t get me wrong, I’d kindly RTFM and leave the vicious cerebral 
types be, but I don’t have that luxury. Surely someone else out there 
has experienced something like this before and can bestow a nugget of 
wisdom upon me.


Steven Altsman
//Webmaster and Program Analyst//
EFast Funding, LLC.
713.983.4069 - work
832.527.3786 - cell
[EMAIL PROTECTED] 
/“Only two things are infinite, the universe and human stupidity, and 
I'm not sure about the former.”/

*/- Albert Einstein/** *(1879 – 1955)
quick answer.. have you tried reading up on the installation method 
"ports" @ http://www.openbsd.org/ports.html#Use

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


Re: [PHP] Magic Quotes

2005-02-10 Thread Jeffery Fernandez
Jochem Maas wrote:
Ben Edwards (lists) wrote:
Am I correct in thinking Magic Quotes automatically adds quotes to all
posted variables, therefore if you are displaying post variables on a
form you have to remove the quotes.  They are only needed if you are
actually inserting/updating into the database.   Whether magic quotes
are on or not you do not actually have to do anything to data fetched
from the database. If magic quoted are not on you have to add slashes
before you add to the database.

you get the gist of it bare in mind _many_ people including actual 
php
developers avoid magic_quotes like the plague cos its a PITA.

basically your input to the DB should be properly escaped (there are 
special
functions for this also, depending on your DB, I use alot of firebird 
and its capable
of parameterized queries - making it impossible to do SQL injection if 
you use
the parameterized markup).

AND anything you output to the browser should be sanitized properly as 
well...
goto phpsc.net and read everything there - its a good/solid 
introduction to
writing secure php code (e.g. how to combat XSS etc). phpsc.net is 
headed by Chris
Shiflett - a veritable goldmine of php related knowledge do 
yourself a favor...
read his stuff :-) any questions that arise from reading that are 
welcome here :-)

There is also another function you need pass stuff through if you are
going to use it in an , what is that
function?

htmlentities()
Ben

http://phpsec.org/ it should be ;-)
cheers,
Jeffery
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] array_map() problems

2005-02-07 Thread Jeffery Fernandez
Guillermo Rauch wrote:
Hi Jeffery,
To use a class method as a valid callback, you should pass an array like
$_POST = array_map(array($this, 'StripSlashesDeep'), $_POST);
Hope this helps,
-Guillermo 

 

Ah thanks Guillermo,
I just about figured it out when you posted. It works now :-)
cheers,
Jeffery
On Mon, 7 Feb 2005 17:10:32 -0600, Greg Donald <[EMAIL PROTECTED]> wrote:
 

On Tue, 08 Feb 2005 09:37:11 +1100, Jeffery Fernandez
<[EMAIL PROTECTED]> wrote:
   

I have the following 2 functions which I intend to clean GPC off slashes
if magic_quotes_gpc is turned on.
 function StripGpcSlashes()
 {
   if (get_magic_quotes_gpc())
   {
 $_POST = array_map('StripSlashesDeep', $_POST);
 $_GET = array_map('StripSlashesDeep', $_GET);
 $_COOKIE = array_map('StripSlashesDeep', $_COOKIE);
   }
 }
 function StripSlashesDeep($value)
 {
   $value = is_array($value)
 ?  array_map('StripSlashesDeep', $value)
 :  stripslashes($value);
   return $value;
 }
However when I call $this->StripGpcSlashes(); from within a class, I get
the following error:
*/ array_map(): The first argument, 'StripSlashesDeep', should be either
NULL or a valid callback /*
Anyone have suggestions as to what I am doing wrong ?
 

Mine works fine, but I don't use it in any classes:
set_magic_quotes_runtime(0);
if(get_magic_quotes_gpc() == 0){
  $_GET = isset($_GET) ? array_map("slashes", $_GET) : array();
  $_POST  = isset($_POST) ? array_map("slashes", $_POST) : array();
  $_COOKIE = isset($_COOKIE) ? array_map("slashes", $_COOKIE) : array();
}
function slashes($var){
   if(is_array($var))
   return array_map("slashes", $var);
   else
   return addslashes($var);
}
--
Greg Donald
Zend Certified Engineer
http://destiney.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


[PHP] array_map() problems

2005-02-07 Thread Jeffery Fernandez
I have the following 2 functions which I intend to clean GPC off slashes 
if magic_quotes_gpc is turned on.

 function StripGpcSlashes()
 {
   if (get_magic_quotes_gpc())
   {
 $_POST = array_map('StripSlashesDeep', $_POST);
 $_GET = array_map('StripSlashesDeep', $_GET);
 $_COOKIE = array_map('StripSlashesDeep', $_COOKIE);
   } 
 }


 function StripSlashesDeep($value)
 {
   $value = is_array($value)
 ?  array_map('StripSlashesDeep', $value)
 :  stripslashes($value);
   return $value;
 }
However when I call $this->StripGpcSlashes(); from within a class, I get 
the following error:
*/ array_map(): The first argument, 'StripSlashesDeep', should be either 
NULL or a valid callback /*

Anyone have suggestions as to what I am doing wrong ?
cheers,
Jeffery
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Displaying a html line as html

2005-01-31 Thread Jeffery Fernandez
Todd Cary wrote:
I have the following:
$p = http://209.204.172.137/casesearch/php/home.php";>Home
However, when I have
print($p); or
echo $p;
the result page does not display as a link; just as the text above.
What have I missed?
Todd
try:
http://209.204.172.137/casesearch/php/home.php";>Home';
echo $p;
?>
cheers,
Jeffery
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sorting associative array

2005-01-24 Thread Jeffery Fernandez
Jochem Maas wrote:
Jeffery Fernandez wrote:
Jochem Maas wrote:
...

Yes the example sent by Kurt Yoder worked for me. I coudn't work out 
the errors with the class you sent me. I realised it was written for 
PHP5 in mind ?... or maybe I wasn't patient enough to spent time 
debugging it :-(

I did change it for php5 (to get rid of E_STRICT warnings IIR)
- but the change was fairly cosmetic:
the class def starts like:
class MDASort {
private $dataArray; //the array we want to sort.
private $sortKeys;  //the order in which we want the array to be 
sorted.

if you change that to:
class MDASort {
var $dataArray; //the array we want to sort.
var $sortKeys;  //the order in which we want the array to be sorted.
then the class should work under php4 as advertised (adding an '&' as you
do below in the callback definition wouldn't hurt either).
...
and within my class I am calling the following two lines:
   // Sort the array
   $this->mArraySortKey = 'score';
   usort($this->mSearchData, array(& $this, 'sort_array'));

cool, taking apart someone elses code and rewriting it one of the best 
ways
of learning/understanding IMHO. btw the '&' before $this is not 
strictly required,
but it should save you a few cycles :-)

You always learn by re-writing someone elses code ;-)
I had done the changes to the variable declaration and also changed the 
constructor name to be the name of the class and it still gave me 
errors. Perhaps I will test it without any Error reporting on... needs 
some tweaking I guess.

cheers,
Jeffery Fernandez
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sorting associative array

2005-01-24 Thread Jeffery Fernandez
Jochem Maas wrote:
...

This won't work for me as I have 500+ records to sort based on the 
score key.. looking at jochem's class now. Thanks


which wont help much - assuming what you say is true
(why wont it work? have you tried it).
sort method from the class:
function sort()
{
   if(count($this->sortKeys)) {
   usort($this->dataArray, array($this,"_sortcmp"));
   }
}

Thanks jochem, I had a second look at it and I figured it out. I had 
problem implementing it with a class but now I have figured how to 
use it.

cheers,
Jeffery

ok, does that mean using usort() on your array works? my class is just a
fancy wrapper around usort - and ofcourse it allows you to sort on 
more than
1 'column' in the second dimension of the array (kind of like a 
multi-column
sort in an SQL statement). -- the point being that the usort() example 
Kurt
(I think that was his name) sent would work also.

anyway glad you could use it. :-)

Yes the example sent by Kurt Yoder worked for me. I coudn't work out the 
errors with the class you sent me. I realised it was written for PHP5 in 
mind ?... or maybe I wasn't patient enough to spent time debugging it :-(

 /**
  * This function is to sort a multi-dimentional array. This is a 
call-back function.
  * Replace the value of $this->mArraySortKey with the appropriate key
  * before calling the call-back function
  */
 function sort_array($x, $y)
 {
   if ( $x[$this->mArraySortKey] == $y[$this->mArraySortKey] )
 return 0;
   else if ( $x[$this->mArraySortKey] < $y[$this->mArraySortKey] )
 return 1;
   else
 return -1;
 }

and within my class I am calling the following two lines:
   // Sort the array
   $this->mArraySortKey = 'score';
   usort($this->mSearchData, array(& $this, 'sort_array'));
cheers,
Jeffery Fernandez
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sorting associative array

2005-01-23 Thread Jeffery Fernandez
Jochem Maas wrote:
Jeffery Fernandez wrote:
Kurt Yoder wrote:
Use usort (stealing from php docs):

function cmp($a['score'], $b['score'])
{
   if ($a['score'] == $b['score']) {
   return 0;
   }
   return ($a['score'] < $b['score']) ? -1 : 1;
}
$data = array(...);
usort($data, "cmp");

This won't work for me as I have 500+ records to sort based on the 
score key.. looking at jochem's class now. Thanks

which wont help much - assuming what you say is true
(why wont it work? have you tried it).
sort method from the class:
function sort()
{
   if(count($this->sortKeys)) {
   usort($this->dataArray, array($this,"_sortcmp"));
   }
}

Thanks jochem, I had a second look at it and I figured it out. I had 
problem implementing it with a class but now I have figured how to use it.

cheers,
Jeffery

Jeffery
On Jan 23, 2005, at 8:39 AM, Jeffery Fernandez wrote:
I have the following multi-dimentional array and I want to sort it 
by the "score" key value

print_r($data);
Array
(
   [0] => Array
   (
   [video_id] => 71
   [old_id] => 7854
   [title] => When the fire comes
   [video_copies] => 1
   [running_time] => 48
   [date_published] => 06/02
   [place_published] => Australia
   [abstract] => ABC TV Gives details on many aspects of 
bushfires: ...
   [library_medium_id] => 5
   [library_type] => 4
   [score] => 6.3310546875
   )

   [1] => Array
   (
   [video_id] => 9
   [old_id] => 7792
   [title] => Fire awareness
   [video_copies] => 1
   [running_time] => 15
   [date_published] =>[place_published] => 
Victoria
   [abstract] => Safetycare Australia A general video 
lookin.
   [library_medium_id] => 5
   [library_type] => 4
   [score] => 3.1997931003571
   )

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

--
Kurt Yoder
http://yoderhome.com



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


Re: [PHP] sorting associative array

2005-01-23 Thread Jeffery Fernandez
Kurt Yoder wrote:
Use usort (stealing from php docs):

function cmp($a['score'], $b['score'])
{
   if ($a['score'] == $b['score']) {
   return 0;
   }
   return ($a['score'] < $b['score']) ? -1 : 1;
}
$data = array(...);
usort($data, "cmp");

This won't work for me as I have 500+ records to sort based on the score 
key.. looking at jochem's class now. Thanks

Jeffery
On Jan 23, 2005, at 8:39 AM, Jeffery Fernandez wrote:
I have the following multi-dimentional array and I want to sort it by 
the "score" key value

print_r($data);
Array
(
   [0] => Array
   (
   [video_id] => 71
   [old_id] => 7854
   [title] => When the fire comes
   [video_copies] => 1
   [running_time] => 48
   [date_published] => 06/02
   [place_published] => Australia
   [abstract] => ABC TV Gives details on many aspects of 
bushfires: ...
   [library_medium_id] => 5
   [library_type] => 4
   [score] => 6.3310546875
   )

   [1] => Array
   (
   [video_id] => 9
   [old_id] => 7792
   [title] => Fire awareness
   [video_copies] => 1
   [running_time] => 15
   [date_published] =>[place_published] => Victoria
   [abstract] => Safetycare Australia A general video 
lookin.
   [library_medium_id] => 5
   [library_type] => 4
   [score] => 3.1997931003571
   )

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

--
Kurt Yoder
http://yoderhome.com

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


[PHP] sorting associative array

2005-01-23 Thread Jeffery Fernandez
I have the following multi-dimentional array and I want to sort it by 
the "score" key value

print_r($data);
Array
(
   [0] => Array
   (
   [video_id] => 71
   [old_id] => 7854
   [title] => When the fire comes
   [video_copies] => 1
   [running_time] => 48
   [date_published] => 06/02
   [place_published] => Australia
   [abstract] => ABC TV Gives details on many aspects of bushfires: 
...
   [library_medium_id] => 5
   [library_type] => 4
   [score] => 6.3310546875
   )
   [1] => Array
   (
   [video_id] => 9
   [old_id] => 7792
   [title] => Fire awareness
   [video_copies] => 1
   [running_time] => 15
   [date_published] => 
   [place_published] => Victoria
   [abstract] => Safetycare Australia A general video lookin.
   [library_medium_id] => 5
   [library_type] => 4
   [score] => 3.1997931003571
   )

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


Re: [PHP] end of array

2005-01-22 Thread Jeffery Fernandez
Rasmus Lerdorf wrote:
Jeffery Fernandez wrote:
Hi all,
I have a foreach loop on an array and within that loop I need to find 
if the array has reached the last pointer. I have tried

if (next($row))
{
}
but that advances the pointer. Any tips on finding out if the array 
pointer has reached the last element ?

end($arr);
$last = key($arr);
foreach($arr as $key=>$elem) {
   if($key !== $last) {
  ...
   }
}
That would do exactly what you asked, however, it sounds like if you 
want to do something for every item in the array except the last you 
should just remove that last item before your loop.

$last = array_pop($arr);
foreach($arr as $elem) {
   ...
}
-Rasmus
Exactly what I wanted. Thanks everyone who contributed.
cheers,
Jeffery
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] end of array

2005-01-22 Thread Jeffery Fernandez
Hi all,
I have a foreach loop on an array and within that loop I need to find if 
the array has reached the last pointer. I have tried

if (next($row))
{
}
but that advances the pointer. Any tips on finding out if the array 
pointer has reached the last element ?

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


Re: [PHP] Any idea when 4.3.11 will be released?

2005-01-16 Thread Jeffery Fernandez
Gal wrote:
Hello,
I'm Working in organization which also using php on the Windows platform.
Because of the security holes in the older version and a COM bug at 
PHP 4.3.10 (http://bugs.php.net/bug.php?id=31159) we are using a 
problematic version.

Does anyone here knows - what is the status of the release of 4.3.11 ?
Regards,
Gal
*[23 Dec 2004 2:43am CET] [EMAIL PROTECTED]
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
cheers,
JefferyFernandez
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: How to set an absolute include path?

2004-12-27 Thread Jeffery Fernandez
Brian Dunning wrote:
I should add that I'd heard that the following will set the 
include_path to the server root, no matter where you call includes from:

  ini_set ("include_path", ini_get ("include_path") . 
':../:../../:../../../:../../../../');

But this doesn't seem to be doing it for me. Also my development 
server is Windows and my production server is BSD, in case that 
affects things...

Since you problem is also needs to be OS independent, I have written a 
short article about this subject. It covers both windows and linux based 
servers as the path to a folder is a bit different when it comes to 
windows. http://melbourne.ug.php.net/content/view/55/62/

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


Re: [PHP] IDE recommendation-- (Free?)

2004-12-17 Thread Jeffery Fernandez
Mat Harris wrote:
On Fri, Dec 17, 2004 at 08:20:36 -0500, GH wrote:
 

Hi...
I am looking for a FREE PHP IDE that uses syntax highlighting and
code completion amongst other features...
Do any of you have any recommendations... again I am looking for FREE
(not much budget for me)?
I use BOTH Linux and Windows
   

I can heartily recommend SciTE (http://www.scintilla.org/SciTE.html)
i believe it has the features you desire, plus, there is a version customised
for php, available here http://amip.tools-for.net/SciTE-CVS.exe
btw, there is a GTK+ version so you can use it on linux as well.
 

Thanks
Gary
   

hope this helps
mat
 

here you go.. a well maintained list: 
http://www.thelinuxconsultancy.co.uk/phpeditors/

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


Re: [PHP] logic with arrays

2004-12-15 Thread Jeffery Fernandez
Wee Keat wrote:
Hey Jeff,
How are you mate? Was lazying around and saw your email to the list. :)
What exactly do you need help with? Is it the following line?
 // Stuck here
 $html_menu .= "$sub_page";
   }
   $html_menu .= '';

Do you need to get the value of the link and the name of the link? If 
so, try this:

= begin snippet ===
$html_menu .= '';
 foreach ($menu_page[$menu_name[1]] as $sub_page => $sub_link)
   {
 // Stuck here
 $html_menu .= "$sub_page";
   }
   $html_menu .= '';
 }
= end snippet =
What about using recursive functions? I think it's easier as you can 
create unlimited numbers of sub-menus. It's slow though.


Ah Thanks Keat long time no hear/see .. it works now. :-)
How are you keeping anyway ? You totally ignore us now at phpMelb :-(
Come along to our next meeting on 13th Jan 2005
cheers,
Jeffery
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] logic with arrays

2004-12-15 Thread Jeffery Fernandez
I am trying to build a html menu dynamically from data sitting in an 
array. I have been successful so far until it came to the point of 
populating the sub-menu of the system. Can someone help me out with the 
logic or is there a simpler way of doing it? Thanks


/**
  * This function builds the applications menu system from and array of 
key/pair values
  * @param null
  * @return string $menu contains value of menu structure in html
  */  
 function BuildMenu()
 {

 $base_path = 'http://kangaroo.hotshot/dev/fpaa/DEVELOPMENT/TEST';
 $menu_structure =
   array
   (  
 array('Home' => '/'),
 array(
'News' => '/news', 'sub' =>
array(
'Archive' => '?news=archive'
 )
  ),
 array('Events' => '/events'),
 array('About' => '/about'),
 array('Membership' => '/membership'),
 array('Committees' => '/committee'),
 array('Safety' => '/safety'),
 array(
 'Providers' => '/providers', 'sub' =>
 array(
'Sprinklers' => '?providers=sprinklers',
'Detection' => '?providers=detection',
'Certification' => '?providers=certification',
'Monitoring' => '?providers=monitoring',
'Hose Reels' => '?providers=hosereels',
'Passive' => '?providers=passive',
'Portable' => '?providers=portable',
'Hazard' => '?providers=hazard',
'Maintenance' => '?providers=maintenance',
'Consultants' => '?providers=consultants',
'Emergency Training' => '?providers=training',

  )
  ),
 array('Licencing' => '/licencing'),
 array(
 'Training' => '/training', 'sub' =>
 array(
   'Tafe Courses' => '?courses=tafe',
   'Trade Courses' => '?courses=trade',
   'New Courses' => '?courses=new',
   'RTO Status' => '?courses=rtostatus',
   'Portable' => '?courses=portable',
   'Assessor' => '?courses=assessor',
   'Training Builetin' => '?courses=builetin',
   'Contact' => '?courses=contact'   
 )
  ),
 array('Publication' => '/publication'),
 array('Contact' => '/contact'),
   );

   $html_menu = '';
   
   foreach ($menu_structure as $menu_page)
   {
 $menu_name = array_keys($menu_page);
 $menu_value = array_values($menu_page);

 //$html_menu .= "$menu_name[0] - $menu_value[0]";
 
 $html_menu .= "$menu_name[0]";
 
 $sub_menu = sizeof($menu_name);
 
 if ($sub_menu > 1)
 {
   $html_menu .= '';
   foreach ($menu_page[$menu_name[1]] as $sub_page)
   {
 // Stuck here
 $html_menu .= "$sub_page";
   }
   $html_menu .= '';
 }
 
   }
   
   $html_menu .= '';
   
   echo $html_menu;
   
   
   // Example Structure of html menu
   /*
 
 Home
 News
 Events
 About
 Membership
 Committees
 Safety
 Providers
   
 Sprinklers
 Detection
 Certification
 Monitoring
 Hose Reels
 Passive
 Portable
 Hazard
 Maintenance
 Consultants
 Emergency Training
   
 
 Licencing
 Training
 Publication
 Contact
   
   */
   return $menu_structure;
 }

 print_r(BuildMenu());
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] HTTP Authenticate via PHP

2004-11-29 Thread Jeffery Fernandez
Hi,
I am trying to find out if its possible to authenticate a page against 
an HTTP authentication. Basically what I am trying to do is make 
available the stats page of the Cpanel to the admin interface of a site. 
When accessing the stats via the cpanel the user needs to login via http 
authentication.

Is it possible for me to store the username password credentials within 
the php page and pass that across via headers to authenticate the page 
for viewing the stats. The main purpose is to make the webstats 
transparent to the admin user so they don't have to enter any 
username/password. I tried putting the username:[EMAIL PROTECTED] into the 
url of an iframe page(session controlled) but stupid IE spits the 
authentication as a pop-up (login window). Hope I have explained well 
enough.

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


Re: [PHP] Re: intalling pear:db

2004-11-24 Thread Jeffery Fernandez
Merlin wrote:
Greg Beaver wrote:
Merlin wrote:
Hi there,
I am trying to get a class running which requires pear:DB.
I downloaded the package and executed:
# pear install DB-1.6.8.tgz
DB already installed

pear upgrade DB-1.6.8.tgz

Hi,
I successfully upgraded with this command. However the system still says:
Fatal error: Call to undefined function: fetchrow()
Is fetchrow a part from pear:db? And if so, why does it still not 
work? I have restarted the webserver.

Merlin
Make sure the pear libraries are within the include path of PHP. Open 
your php.ini and look for the "include_path" directive.  Read more here: 
http://au.php.net/manual/en/ini.sect.path-directory.php#ini.include-path

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


Re: [PHP] inline_C installation

2004-11-21 Thread Jeffery Fernandez
Burhan Khalid wrote:
Rayan Lahoud wrote:
Does anybody knows how to install a pear package. i have the inline_C 
package that i want to install and use. And can i have some sample 
functions using this package?

pear install Inline_C -- that's it.
You don't need to restart Apache, or load any modules. To find out 
examples on usage, try checking the pear repository.

hth,
Burhan
maybe try: 

pear install -f Inline_C
as its not stable yet
Jeffery
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: ending a session

2004-11-20 Thread Jeffery Fernandez
Greg Donald wrote:
On Sat, 20 Nov 2004 13:52:32 -0800, Jed Smith <[EMAIL PROTECTED]> wrote:
 

PHP attached to different Apaches can't share sessions, AFAIK. You'll
need to make sure it's the same copy of Apache, listening on both ports
   

The simplest solution is to use database managed PHP sessions, passing
the session id in the url.  As long as you connect to the same
database, your PHP session will follow you wherever your scripts live.
Someone probably has something better, but here's mine:
http://destiney.com/pub/php_db_sessions.tar.gz
 

Nice tutorial here: 
http://www.zend.com/zend/spotlight/code-gallery-wade8.php?article=code-gallery-wade8&id=4467&open=1&anc=0&view=1

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


Re: [PHP] PHP Supremacy...

2004-11-17 Thread Jeffery Fernandez
Octavian Rasnita wrote:
What do you mean by "perl discontinued"?
Perl 5 is continuu updated and this year I have seen perl 5.8.1, 5.8.3,
5.8.4, 5.8.5 is almost done.
 

That was meant to be a JOKE lol
Perl 6 is planned to run in a precompiled code (like Java programs) in an
environment that will also be able to run programs created in other
programming languages like Python...
For the programs that output web pages PHP is prefered even it is not so
complex like perl for the moment, because PHP is especially created for this
job.
I have seen a web page in which Yahoo explained why they have chosen PHP as
their programming language  for their dynamic web pages and not ASP, java or
C or perl.
(But they say that they also use perl programs for their backend tasks).
(and not ASP or Cold Fusion or other proprietary languages)
Teddy
- Original Message - 
From: "Mike" <[EMAIL PROTECTED]>
To: "'Lista de Php-General'" <[EMAIL PROTECTED]>
Sent: Thursday, November 18, 2004 2:05 AM
Subject: RE: [PHP] PHP Supremacy...

I was really sad to see Perl discontinued so many years ago... damned open
source community not taking care of it's own.
-Original Message-
From: Pedro Irán Méndez Pérez [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 17, 2004 5:18 PM
To: Lista de Php-General
Subject: [PHP] PHP Supremacy...
Hello my friends, I need your help in convince to my boss in adopt php for
 

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