OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 12 Jan 2007 09:36:44 -0000 Issue 4565

php-general-digest-helplists.php.net
Date: Fri Jan 12 2007 - 03:36:44 CST


php-general Digest 12 Jan 2007 09:36:44 -0000 Issue 4565

Topics (messages 246947 through 246980):

Re: CSV date issue - Solved
        246947 by: Danny Brow

Re: file_get_contents gets 404 error
        246948 by: Frank Arensmeier

Re: Weird behaviour with IE
        246949 by: Frank Arensmeier

Re: Anybody have any experience with outsite-in? [Quite a bit 0T]
        246950 by: Skip Evans
        246952 by: Satyam

IMPORTANT: PHP does NOT cause browser issues.
        246951 by: Raphael Martins
        246959 by: Jochem Maas

Variance Function
        246953 by: Richard Lynch
        246962 by: Jochem Maas
        246967 by: Andrew Brampton

Normalized Numbers
        246954 by: Brian P. Giroux
        246960 by: Jochem Maas

Re: Stored Procedure returns nothing on ROLLBACK
        246955 by: Chris

Re: uploaded fiel size limitiation
        246956 by: Jochem Maas
        246957 by: Jochem Maas
        246965 by: Chris

Re: Handling SimpleXMLElements
        246958 by: Jochem Maas
        246975 by: Satyam

CHMOD a file in windows server 2003
        246961 by: Kencana
        246963 by: Jochem Maas
        246964 by: John Comerford

Re: Progressiv display with IE7
        246966 by: Chris

password protecting files, only allowing authorized users
        246968 by: Dave
        246969 by: Casey Chu
        246970 by: Chris

Pear on WinNT
        246971 by: Mark

Re: Javascript detection , working version
        246972 by: Jürgen Wind
        246974 by: Ruben Rubio

Re: Downloading a binary file
        246973 by: Miguel J. Jiménez

Forms and destroying values
        246976 by: Beauford
        246977 by: Fredrik Thunberg
        246978 by: Miguel J. Jiménez
        246979 by: clive

Re: web analytics
        246980 by: Kencana

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Seems my problem was a data issue and I needed to compensate for missing
dates.

thanks,
Dan

On Thu, January 11, 2007 2:31 pm, Danny Brow wrote:
> Hi,
>
>
> It's been a while since I've used php and I'm trying to organize some
> data by date. The problem I'm having is that when the data changes from
> say 2006 to 2005 the first few rows of 2005 data goes into my 2006 data
> and the date for 2006 is lost. My code for separating dates is below with
> some sample data. I'm sure I'm missing something simple here. The date
> within the 3rd column can be ignored.
>
> TIA
>
>
>
> $num = count($data);
> for ($c=0; $c < $num; $c++) { if ($c == 5) { $data[5] =
> strftime("%m/%d/%G",strtotime('-1 Day', strtotime($data[5]))); //Fix date,
> data is off by 1 day. }
> $date = strftime("%G",strtotime($data[5]));
> if ($date == "") { //Skip row if date field is empty. // Skip
> } else {
> if ($date == 2006) { $data2006 .= "\"" . $data[$c] ."\",";
> } elseif ($date == 2005) {
> $data2005 .= "\"" . $data[$c] ."\",";
> } elseif ($date == 2004) {
> $data2004 .= "\"" . $data[$c] ."\",";
> } elseif ($date == 2003) {
> $data2003 .= "\"" . $data[$c] ."\",";
> } elseif ($date == 2002) {
> $data2002 .= "\"" . $data[$c] ."\",";
> } elseif ($date == 2001) {
> $data2001 .= "\"" . $data[$c] ."\",";
> } elseif ($date < 2000) {
> $data1999pre .= "\"" . $data[$c] ."\",";
> }
> }
> }
>
>
>
> Sample data
> "60609C49.PCX","PG 1","BLUEWATER HEALTH, LAB, 04/06/06","10003533S","BUNNY
> BUGS","06/10/2006"
> "60609C50.PCX","PG 1","Cake walk, other, 04/06/06","10003533T","Tweedy
> Bird","06/11/2006"
> "50609C49.PCX","PG 1","HEALTH, LAB, 04/06/06","10003533g","Smurf
> Grumpy","06/10/2005"
> "50699C55.PCX","PG 1","Lab 101, 04/06/06","10003533p","Smurf
> Pappy","04/10/2005"
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


In the manual it says:

"You can use a URL as a filename with this function if the fopen
wrappers have been enabled...".

First of all, I would check your php.ini file. If everything is ok
(fopen wrappers are on), maybe you could post some code. The last
option would be to use an other way round by using e.g. curl or
anything else. If anybody else is able to open the URL you provided,
it must be either you code or your server / PHP config that is
messing things up.

//frank
11 jan 2007 kl. 17.01 skrev Németh Zoltán:

> 2007. 01. 11, csütörtök keltezéssel 16.55-kor Jochem Maas ezt írta:
>> Németh Zoltán wrote:
>>> Hi all,
>>>
>>> I have some php websites, for example http://www.alterationx.hu/
>>>
>>> Now I'm trying to get the site with file_get_contents, and I'm
>>> getting
>>> this error:
>>>
>>> Warning: file_get_contents(http://www.alterationx.hu/): failed to
>>> open
>>> stream: HTTP request failed! HTTP/1.1 404 Not Found
>>
>> try this?:
>>
>> file_get_contents("http://www.alterationx.hu/index.php");
>>
>> (it works for me. that said it works for me without the
>> 'index.php' at the end also.)
>
> I tried this also, and get the same error still...
>
>>
>> also check you logs on the site in question to figure out what
>> exactly is going
>> on (i.e. what is being requested, if anything).
>
> Yes, I'll contact our system administrator to check the apache logs
>
> Thanks
> Zoltán Németh
>
>>
>>>
>>> can anyone tell me why?
>>>
>>> The site otherwise is working, and also getting other sites (not
>>> php) on
>>> the same server with file_get_contents is working.
>>>
>>> Thanks in advance
>>> Zoltán Németh
>>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


And where does PHP come in here? The issue you describe could be
anything - CSS related, html related, server related, php / asp /
java you name it - maybe it is MS Explorer that sucks. Do some more
research first and then - if you still feel that this might be
related to PHP, you are welcome back again.

//frank

11 jan 2007 kl. 17.54 skrev André Medeiros:

> Hi list.
>
> I know this may be a bit out of topic, but I've decided to try.
>
> This website I'm maintaining opens just fine in firefox, and loads
> everything. However, the same doesn't happen in IE, since the status
> bar reads "1 item(s) remaining" on most of the pages.
>
> That issue raises another problem, because I really need that onLoad
> event to be fired ;)
>
> Has anyone had problems like this? What did you do to solve them?
>
> Thanks in advance,
> André
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Hey all,

When you say it lets you run it off a CD does that
mean the CD is totally self contained, as in you
can pop it into any machine, sans web server DB,
etc, and it runs just peachy?

Skip

Ryan A wrote:
> Hey all!
>
> This is a bit OT as its not really php programming, but it does involve PHP and MySql etc so....
>
> The company I work for has decided to use the software from outsite-in.com,
> for those of you who dont know (and i'm guessing a lot of you dont, as I kinda just found out about it myself) their software allows you to run php+mysql etc on a CD/DVD.
>
> Just curious to know if anybody has had any experience with their software?
> I have tried their free demo's and it looks pretty good.
>
> Note: Others on this list have in the past advised me on how to do this using different methods, but my company wants to go with this... needless to say I am in NO way connected to outsite-in.com and i have *nothing* to gain if you visit their site, buy anything from them, shoot them, kiss them or whatever. :)
>
> Thanks!
> Ryan
>
>
>
>
>
> ------
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
> ---------------------------------
> Everyone is raving about the all-new Yahoo! Mail beta.

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

attached mail follows:


It is not a new concept, even Wikipedia has a long list of them:

http://en.wikipedia.org/wiki/List_of_LiveDistros

Most of those distros have individual articles ... not the one mentioned
below, though.

Satyam

----- Original Message -----
From: "Skip Evans" <skipbigskypenguin.com>
To: "Ryan A" <genphpyahoo.com>
Cc: "php php" <php-generallists.php.net>
Sent: Thursday, January 11, 2007 10:35 PM
Subject: Re: [PHP] Anybody have any experience with outsite-in? [Quite a bit
0T]

> Hey all,
>
> When you say it lets you run it off a CD does that mean the CD is totally
> self contained, as in you can pop it into any machine, sans web server DB,
> etc, and it runs just peachy?
>
> Skip
>
> Ryan A wrote:
>> Hey all!
>>
>> This is a bit OT as its not really php programming, but it does involve
>> PHP and MySql etc so.... The company I work for has decided to use the
>> software from outsite-in.com,
>> for those of you who dont know (and i'm guessing a lot of you dont, as I
>> kinda just found out about it myself) their software allows you to run
>> php+mysql etc on a CD/DVD.
>>
>> Just curious to know if anybody has had any experience with their
>> software?
>> I have tried their free demo's and it looks pretty good.
>>
>> Note: Others on this list have in the past advised me on how to do this
>> using different methods, but my company wants to go with this... needless
>> to say I am in NO way connected to outsite-in.com and i have *nothing* to
>> gain if you visit their site, buy anything from them, shoot them, kiss
>> them or whatever. :)
>>
>> Thanks!
>> Ryan
>>
>>
>>
>>
>>
>> ------
>> - The faulty interface lies between the chair and the keyboard.
>> - Creativity is great, but plagiarism is faster!
>> - Smile, everyone loves a moron. :-)
>> ---------------------------------
>> Everyone is raving about the all-new Yahoo! Mail beta.
>
> --
> Skip Evans
> Big Sky Penguin, LLC
> 61 W Broadway
> Butte, Montana 59701
> 406-782-2240
> =-=-=-=-=-=-=-=-=-=
> Check out PHPenguin, a lightweight and
> versatile PHP/MySQL development framework.
> http://phpenguin.bigskypenguin.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Hi everybody.

Due some recent messages in this list and other CSS/XHTML list, I´ve decided
to post this to clarify a very common question: PHP is compatible with ALL
browsers. Why? Because PHP runs at the server, aside from the browser. The
only thing the browser will see is the response (in plain text or html
code). The response code may be incompatible, but not the PHP code. So,
again: PHP is compatible with ALL browsers because PHP does not run at the
browser.

The other issue is: "I would like to run some PHP code when the user click a
link or press a button". Sorry pal... unless you use AJAX or iFrames, it
will not gonna happen. Consider post this types of questions in Javascript
or AJAX lists.
As said before, PHP runs at the server and this kind of problem require
client-side scripting.

Questions about rendering bugs in HTML should be posted at CSS or HTML
Lists.

Sorry if I sounded too cranky. But it´s for a good reason.

Good PHPíng.

P.S.: My suggestion is to send a message explaining that to every member
that joins the list.

--
"Love all. Trust a few. Do wrong to none."

attached mail follows:


it can never hurt to repeat this kind of thing!

Raphael Martins wrote:
> Hi everybody.
>
> Due some recent messages in this list and other CSS/XHTML list, I´ve
> decided
> to post this to clarify a very common question: PHP is compatible with ALL
> browsers. Why? Because PHP runs at the server, aside from the browser. The
> only thing the browser will see is the response (in plain text or html
> code). The response code may be incompatible, but not the PHP code. So,
> again: PHP is compatible with ALL browsers because PHP does not run at the
> browser.
>
> The other issue is: "I would like to run some PHP code when the user
> click a
> link or press a button". Sorry pal... unless you use AJAX or iFrames, it
> will not gonna happen. Consider post this types of questions in Javascript
> or AJAX lists.
> As said before, PHP runs at the server and this kind of problem require
> client-side scripting.
>
> Questions about rendering bugs in HTML should be posted at CSS or HTML
> Lists.
>
> Sorry if I sounded too cranky. But it´s for a good reason.

most us who are faced with such repeated questions occassionally lose it,
the frustration caused is a real reason for people to become cranky in the face
of the never ending barrage of questions (of the ilk you pointed out)

... but it's not a *good* reason - it's never a good thing to let oneself get
stressed out by the thing that one is confronted with - that said I certainly
understand your sentiment ;-)
>
> Good PHPíng.
>
> P.S.: My suggestion is to send a message explaining that to every member
> that joins the list.

it wouldn't be the first or last suggestion of it's kind - unfortunately I'm quite sure
that such a thing will not be implemented, mostly because the list is neither admin'ed nor
moderated by anyone (IIRC Rasmus Lerdorf occasionally steps in to fix some techincal issues
when the list goes completely tits up - other than that the list 'just is' - and I don't
think anyone is expecting Rasmus or someone with a similar level of karma [in the php group's
server/system] to take on such tasks as your suggestion implies, unfortunately they too only
have 24 hours in each day :-P)

such is life - onwards and upwards to the next newbie post about trying to run a
php function when he/she clicks a link :-)

>

attached mail follows:


It's been 20+ years since I took a stats class...

I didn't enjoy that class, and doubt if I remember 1% of what was
covered.

Given an input Unix date like:
1132565360

And an array of Unix dates like:
array(3) {
  [0]=>
  int(1132565342)
  [1]=>
  int(1132565360)
  [2]=>
  int(1132565359)
}

I would like to return the input date *IF* it is "reasonable" in its
variance from the date values in the array.

E.g, the above would output: 1132565360

If, however, the input date was "0" for the same array of dates, I'd
want to get, errr... Well, okay, the values in the array...

One of those might *ALSO* be wildly wrong. :-(

So I want the "most likely candidate" for a correct date out of all
this mess, where any of the date values might be wrong.

Any ideas?

Is there a nice built-in "sort out this variance mess for me" function
in PHP? :-)

The somewhat maybe obvious candidate of "stats_variance" is a bit
under-documented...

I'm not sure I'd even understand the numbers that came out of it, even
if I experimented with it and *THOUGHT* I understood the numbers
coming out of it.

And the sheer number of functions in the stats package is making my
head spin.

And I dunno if I could get statistics into the shared server anyway.

Maybe I should explain the "Big Picture", eh?

Okay, so the "Big Picture" is 14,000 emails in an Inbox, that need to
be processed, and tagged with their "date".
[And a whole lot more, but not relevant to this post...]

Seems simple enough, with that Date: header.

Except when it's not there. :-(

Okay, so take the Sent: header if there's no Date: header.

Okay.

No, wait... Damn!

Some fools have their PC clock set to, like, 1970 or whatever. So
let's be generous and assume their CMOS battery has died, and they
haven't had a chance to change it. Fine. Deal with it.

Okay, so *NOW* the algorithm is to do this:

Take the Date: header, or Sent: header if no Date: header -> $whatdate

Parse the Received: headers for the MTA date-stamps -> $fromdates[]

Compare the values in $fromdates array with $whatdate.

If the variance is "too high", then ignore the $whatdate, and take
the, errr, first?, average?, $fromdates[].

No, wait, maybe I should do a variance within the $fromdates in case
some stupid MTA server has a bad clock?

Any advice?

Anybody got a good "variance" function to do what I'm trying to do?

Am I on the entirely wrong path here?

Sheesh!

We may just ignore any obviously wrong dates, and process those by
hand...

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

attached mail follows:


hi Richard,

your email was hard to follow, and I don't have real answers for
you but maybe my simpleton's view of the situation might offer
you new avenues of thought to consider.

Richard Lynch wrote:
> It's been 20+ years since I took a stats class...

20 years ago I was mostly riding a push bike ... and I've never
taken a stats class as such (bare this in mind :-)

>
> I didn't enjoy that class, and doubt if I remember 1% of what was
> covered.

you'd be 1 up on me ;-)

>

...

>
> And the sheer number of functions in the stats package is making my
> head spin.
>

...

>
> Some fools have their PC clock set to, like, 1970 or whatever. So
> let's be generous and assume their CMOS battery has died, and they
> haven't had a chance to change it. Fine. Deal with it.
>
> Okay, so *NOW* the algorithm is to do this:
>
> Take the Date: header, or Sent: header if no Date: header -> $whatdate
>
> Parse the Received: headers for the MTA date-stamps -> $fromdates[]
>
> Compare the values in $fromdates array with $whatdate.
>
> If the variance is "too high", then ignore the $whatdate, and take
> the, errr, first?, average?, $fromdates[].

does it matter so long as your consistent in what you pick/use/calculate?

I would tend to go for the oldest date in any given array of processed dates
as this would seem to be the closest to the likely actual send date.

>
> No, wait, maybe I should do a variance within the $fromdates in case
> some stupid MTA server has a bad clock?

I would start by setting out a few acceptable boundaries and 'knowns'
for instance:

1. the first mail was sent no earlier than timestampX
        (so any timestamp encountered that is earlier than this is bogus.)
2. a maximum time an email could be expected to hang out at any given MTA whilst
waiting to be moved on.
        (could be used to drop an outer timestamps [oldest & newest] from a given array of
        timestamps extracted from mail whose difference is to it's 'neighbour' is
        greater than this agreed maximum period.)

>
> Any advice?

1. don't forget to normalize all found dates in a given mails array of dates
into UTC (if that is even an issue) before doing any actual processing/analysis of
the collected dates.

2. I would consider the date's found in the Date: and/or Sent: headers with the same
brush as any dates found in the Recieved headers - your explanation suggest than no one
header could be construed as being more reliable than another.

3. er there is no 3, unless you consider 'buy a bigger brain' real advice ;-)

>
> Anybody got a good "variance" function to do what I'm trying to do?
>
> Am I on the entirely wrong path here?

dunno - but it's another typical Lynch problem that was just too interesting
for me to let slide :-) please do keep us posted as to your progress!

> Sheesh!
>
> We may just ignore any obviously wrong dates, and process those by
> hand...

indeed anything that is blatantly 'dodgy' with regard to dates is probably easier
to (and more accurately) processed by hand than it is to create some wizzo algo. for
it - it's a matter of getting the number of 'dodgy' down to an acceptable level of course.

>

attached mail follows:


----- Original Message -----
From: "Richard Lynch" <ceol-i-e.com>
To: <php-generallists.php.net>
Sent: Thursday, January 11, 2007 11:29 PM
Subject: [PHP] Variance Function

> Any advice?
>
> Anybody got a good "variance" function to do what I'm trying to do?
>

Hey,
I've seen you solve many questions on this list, and I feel honour to be
able to try and help :)

Well the solution that pops into my head is clustering. Since you have a set
of numbers and 1 or more of them may be abnormal, then you can cluster them
into one or more groups of similar values.

I quickly read up on clustering and coded a function to do something you
might find useful.

---- cluster.php ----
<?php

function mean($arr) {
 return array_sum($arr) / count($arr);
}

function find_k_clusters($arr, $k) {

 if ($k <= 1)
  return array($arr);

 // Setup n clusters (and their means)
 $cluster = array();
 $clusterMean = array();
 foreach ($arr as $a) {
  $cluster[] = array($a);
  $clusterMean[] = $a;
 }

 //populate an array of all the differences between pairs
 $diff = array();
 foreach ($clusterMean as $i => $c1) {
  $diff[$i] = array();
  foreach ($clusterMean as $j => $c2) {
    // Only loop until we get to j, so we don't duplicate results
   if ($i <= $j)
    break;
   $diff[$i][$j] = abs( $c1 - $c2 );
  }
 }

 while ( count($cluster) > $k ) {

  // find the smallest value (hence the closest pair)
  $p1 = false;
  $p2 = false;

  foreach ($diff as $i => $diffi) {
   foreach ($diffi as $j => $d) {
    if ($p1 === false || $d < $diff[$p1][$p2]) {
     $p1 = $i;
     $p2 = $j;
    }
   }
  }

  echo "$p1 $p2\n";
  //print_r($cluster);

  // Add the 2nd cluster to the first, and remove the 2nd
  $cluster[ $p1 ] = array_merge ($cluster[ $p1 ], $cluster[ $p2 ]);
  $clusterMean[$p1] = mean( $cluster[ $p1 ] );
  unset( $cluster[ $p2 ] );
  unset( $clusterMean[ $p2 ] );

  // Now recalc any diffs that would have changed
  unset( $diff[ $p2 ] ); // Remove the $p2 row

  // Remove the p2 col
  foreach( $diff as $i => &$ds ) {
   if ( $i > $p2 ) {
    unset($ds[$p2]);
   }
  }

  // recalc the full p1 row
  foreach ($diff[$p1] as $j => $d) {
   $diff[$p1][$j] = abs( $clusterMean[$p1] - $clusterMean[$j] );
  }

 }

 return array_values( $cluster );
}

$a = array( 1132565342 , 0, 1132565360, 1000000, 1132565359, 1132565360,
1 );

print_r ( find_k_clusters($a, 2) ) ;

?>
-------------

Now you pass the function a array of values, and the number of clusters you
wish to find. So for example entering the array
 1132565342 , 0, 1132565360, 1000000, 1132565359, 1132565360, 1
will return 2 clusters like so:
[0] = 1132565342 , 1132565360, 1132565359, 1132565360
[1] = 0, 1000000, 1

It works by putting each value in its own cluster, and then finding the two
"closest" clusters again and again until you are left with $k clusters. I
haven't used the concept of variance.

Now its just up to you to figure out which cluster is correct, and voila you
can throw away (or correct) the bad cluster values.

The problem might get more complex if you have for example dates such as
1970, 1990, 2006... Because then the 1990 will be nearer to the 2006 and be
clustered in the "good" cluster. If you have values such as this you might
want to change this so instead of creating k cluster, it only clusters
values within a suitable distance of each other (for example within 72 hours
of each other, which is a max acceptable time for a email to be bounced
around).

I hope this helps in some way. If not it was fun quickly coding up a
clustering algorithm :)

On reflexation it might be a lot easier to not use clustering and instead
just look at todays date, and throw away any value more than X days out.

Andrew Brampton

attached mail follows:


I am just learning PHP and as a practical exercise I've been working on
a set of functions to process and manipulate what I call "normalized
number" (ISBNs, EANs, UPCs, etc...)

My ultimate goal is to create a normnum class and child classes for the
different types of numbers.

Because of my line of work, I am mostly interested in ISBN-10s,
ISBN-13s, EANs and UPCs, but it can also be expanded to credit card
numbers, Canadian Social Insurance Numbers, and many more.

So far I have functions to validate ISBN-10s and EANs although I've run
into a bit of a wall with the digit_sum function as explained in the B:
section of that functions header comments.

If anyone can help me out with that or provide any other advice about
the rest of it, I'd be grateful.

The file can be found at http://www.senecal.ca/normnums.php.txt

Thanks.
--
Brian P. Giroux

attached mail follows:


Brian P. Giroux wrote:
> I am just learning PHP and as a practical exercise I've been working on
> a set of functions to process and manipulate what I call "normalized
> number" (ISBNs, EANs, UPCs, etc...)
>
> My ultimate goal is to create a normnum class and child classes for the
> different types of numbers.
>
> Because of my line of work, I am mostly interested in ISBN-10s,
> ISBN-13s, EANs and UPCs, but it can also be expanded to credit card
> numbers, Canadian Social Insurance Numbers, and many more.
>
> So far I have functions to validate ISBN-10s and EANs although I've run
> into a bit of a wall with the digit_sum function as explained in the B:
> section of that functions header comments.

if you want to turn the direction around reverse the string before
you start the loop:
        http://php.net/manual/en/function.strrev.php

personally I would turn the string into an array of chars (which you can then also
reverse as need be) and then do a foreach loop on it ('array index'+1 can be used
to determine position) ... personal preference. anyway take a look at these functions:

        http://php.net/manual/en/function.str-split.php
        http://php.net/array_reverse
        http://php.net/foreach
>
> If anyone can help me out with that or provide any other advice about
> the rest of it, I'd be grateful.

keep commenting all your code to that extent! you do us proud :-)

>
> The file can be found at http://www.senecal.ca/normnums.php.txt
>
> Thanks.

attached mail follows:


Philip Thompson wrote:
> On Jan 10, 2007, at 6:36 PM, Chris wrote:
>
>> Philip Thompson wrote:
>>> Hi.
>>> I have been experiencing MSSQL woes lately. I have a stored procedure
>>> that I call in PHP using mssql_* functions. In my procedure, I have a
>>> transaction that rolls back on failure and commits on success (of
>>> course). If it commits, I get the proper return value (int) and the
>>> appropriate output parameters. However, if it rolls back, I get
>>> NOTHING... even if I try to return an error code (int) after the
>>> ROLLBACK TRANSACTION statement. The output parameter also does not
>>> get set upon rollback.
>>> Is there a way to grab the error even in a rollback? or at least
>>> return something besides an empty string/int? I would like to know
>>> what error message to provide the user/admin.
>>> SQL Server 2000, PHP 5.1.6, ntwdblib.dll version 8.00.194
>>
>> Does it work outside of php? That is - you run it manually in mssql
>> (whatever tools that has) you get the proper codes?
>
>
> Yes, it works perfectly from the server and returns the expected
> outcome. It's as though PHP sees the 'rollback' and automatically
> assumes that the whole thing failed... so why return a value or output
> parameters. Weird, I know. Any other suggestions?

Can you show us the part of the code that deals with the rollback?

If you are issuing a rollback yourself:

$result = mssql_query("rollback transaction");

then you need to handle that yourself because that's treated as a
separate query.

If you're not doing that (the transaction is rolling itself back), then
I'm out of ideas :)

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

attached mail follows:


afanafan.net wrote:
> Hi,
> I have a little script that was working fine when uploaded files up tp 16MB.
> I moved to other hosting company and use the same form/script. Not, I
> can't upload eitherr 2MB file.
>
> Where to look for limitation first?
>
> According to phpinfo() post_max_size in php.ini is 8M.

memory_limit, post_max_size and upload_max_filesize.

the third one is biting you AFAICT. note that upload_max_filesize should be
set somewhat smaller than post_max_size because a file upload forms *part*
of the total data posted.

(someone please correct me if I've been living under an incorrect assumption)

> Thanks.
>
> -afan
>

attached mail follows:


afanafan.net wrote:
> Hi,
> I have a little script that was working fine when uploaded files up tp 16MB.
> I moved to other hosting company and use the same form/script. Not, I
> can't upload eitherr 2MB file.
>
> Where to look for limitation first?
>
> According to phpinfo() post_max_size in php.ini is 8M.

as an aside - do yourself a favour. grab a copy of the default php.ini
(whatever it's called these days) and read it top to bottom. It will take
you a little while but I'm sure you will, by the end of it, have learned
about some previously unknown ini settings and probably picked up quite a
bit of useful info from the extensive comments that it contains.

it can't hurt right?

>
> Thanks.
>
> -afan
>

attached mail follows:


afanafan.net wrote:
> Hi,
> I have a little script that was working fine when uploaded files up tp 16MB.
> I moved to other hosting company and use the same form/script. Not, I
> can't upload eitherr 2MB file.

If you can't upload *any* files check that the upload_tmp_dir is set and
see if that's writable by php (see php.net/is_writable).

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

attached mail follows:


I'm guessing you have php5.0.x running - you really want a php5.1.x
version if your going to use XML - it will avoid *alot* headaches with
regarding to using var_dump() (or print_r() or even echo) to figure out
what the simpleXML objects are/contain.

Satyam wrote:
> I have a problem trying to handle SimpleXml objects. Though I can manage
> some workaround the problem, I would like to understand it better.
>

....

> cell.
> Function dump() just does a var_dump() of whatever is given in the first
> argument within a <pre> tag and uses the second argument as a heading,
> surrounded by dashes. In this case I copied the expression of what I am
> dumping as the title (within single quotes so it does not expand).
>
> foreach($row as $cell) {
> dump($cell,'$cell);
> dump($cell->p,'$cell->p');
> dump((array)$cell->p,'(array)$cell->p');
> dump($cell->p[1],'$cell->p[1]');
> }
>
> The section in question is shown below. Though $cell is shown as a
> SimpleXMLElement containing one 'p' property which contains an array of two
> elements:
> ----------------------------$cell-----------------
> object(SimpleXMLElement)#8 (1) {
> ["p"]=>
> array(2) {
> [0]=>
> string(12) "Indian Rupee"
> [1]=>
> string(8) "Ngultrum"
> }
> }
>
>
> If I dump that 'p' element, I don't get an array but an object with just
> one element, the first value in the array
> ----------------------------$cell->p-----------------
> object(SimpleXMLElement)#7 (1) {
> [0]=>
> string(12) "Indian Rupee"
> }
>
>
> If I typecast it to an array, I still get a single element
> ----------------------------(array)$cell->p-----------------
> array(1) {
> [0]=>
> string(12) "Indian Rupee"
> }
>
> Nevertheless, if I explicitly index into the 'p' element, without even
> typecasting it into an array, the second element is there.
> ----------------------------$cell->p[1]-----------------
> object(SimpleXMLElement)#10 (1) {
> [0]=>
> string(8) "Ngultrum"
> }
>
>
> So, now you see it, now you don't, or do you? What's happening?
>
> Satyam
>

attached mail follows:


----- Original Message -----
From: "Jochem Maas" <jochemiamjochem.com>

> I'm guessing you have php5.0.x running - you really want a php5.1.x

PhpInfo reports it's 5.2.0 so I'm covered there.

> version if your going to use XML - it will avoid *alot* headaches with
> regarding to using var_dump() (or print_r() or even echo) to figure out
> what the simpleXML objects are/contain.
>
> Satyam wrote:
>> I have a problem trying to handle SimpleXml objects. Though I can manage
>> some workaround the problem, I would like to understand it better.
>>
>
> ....
>
>> cell.
>> Function dump() just does a var_dump() of whatever is given in the first
>> argument within a <pre> tag and uses the second argument as a heading,
>> surrounded by dashes. In this case I copied the expression of what I am
>> dumping as the title (within single quotes so it does not expand).
>>
>> foreach($row as $cell) {
>> dump($cell,'$cell);
>> dump($cell->p,'$cell->p');
>> dump((array)$cell->p,'(array)$cell->p');
>> dump($cell->p[1],'$cell->p[1]');
>> }
>>
>> The section in question is shown below. Though $cell is shown as a
>> SimpleXMLElement containing one 'p' property which contains an array of
>> two
>> elements:
>> ----------------------------$cell-----------------
>> object(SimpleXMLElement)#8 (1) {
>> ["p"]=>
>> array(2) {
>> [0]=>
>> string(12) "Indian Rupee"
>> [1]=>
>> string(8) "Ngultrum"
>> }
>> }
>>
>>
>> If I dump that 'p' element, I don't get an array but an object with just
>> one element, the first value in the array
>> ----------------------------$cell->p-----------------
>> object(SimpleXMLElement)#7 (1) {
>> [0]=>
>> string(12) "Indian Rupee"
>> }
>>
>>
>> If I typecast it to an array, I still get a single element
>> ----------------------------(array)$cell->p-----------------
>> array(1) {
>> [0]=>
>> string(12) "Indian Rupee"
>> }
>>
>> Nevertheless, if I explicitly index into the 'p' element, without even
>> typecasting it into an array, the second element is there.
>> ----------------------------$cell->p[1]-----------------
>> object(SimpleXMLElement)#10 (1) {
>> [0]=>
>> string(8) "Ngultrum"
>> }
>>
>>
>> So, now you see it, now you don't, or do you? What's happening?
>>
>> Satyam
>>
>

attached mail follows:


Hi all,

anybody knows how to CHMOD a file to 777 or 666 or etc. in windows server
2003?

thank you

Regards,
Kencana
--
View this message in context: http://www.nabble.com/CHMOD-a-file-in-windows-server-2003-tf2962953.html#a8290007
Sent from the PHP - General mailing list archive at Nabble.com.

attached mail follows:


Kencana wrote:
> Hi all,
>
> anybody knows how to CHMOD a file to 777 or 666 or etc. in windows server
> 2003?

windows server 2003 (et al) uses a completely different mechanism to the std linux
way of doing things with regard to file permissions.

other than opening lots of dialogs and checking lots of boxs I don't really know ;-)

SingTFW didn't offer any obvious results regarding setting NTFS file permissions
directly from php.

maybe you can load a .NET module that has this capability?:
        http://php.net/manual/en/ref.dotnet.php

or likewise using the COM extension to gain access to something usable?
        http://php.net/manual/en/ref.com.php

or maybe this?:
        http://php.net/manual/en/ref.w32api.php

or this?:
        http://php.net/manual/en/ref.iisfunc.php

I would probably figure out what commandline functionality windows offers
to do this kind of thing and then call the relevant cmd using the functions
provided here:
        http://php.net/manual/en/ref.exec.php

of course a cynic might ask what the point was of bothering with permissions
on a windows system - but I'll restrain myself ;-)

>
> thank you
>
> Regards,
> Kencana

attached mail follows:


Check out the CACLS command

HTH,
  JC

Kencana wrote:
> Hi all,
>
> anybody knows how to CHMOD a file to 777 or 666 or etc. in windows server
> 2003?
>
> thank you
>
> Regards,
> Kencana
>

attached mail follows:


131 wrote:
> Btw, why is there those so ugly dbls quotes at each side of my so sweet
> nickname ?

Your mail program is doing that.

No idea about answering your original question.

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

attached mail follows:


Hello,
    I'm using php and apache2 on a freebsd box. I know about .htaccess that
the web server can provide, but i'm looking for something php can do, i want
it to pop up a page when a user requests certain files, asking for a
username and password. If those are valid the user is taken to a page where
the files requested can be downloaded. I'd rather not use a mysql database
and keep this user information in a flat file, as what i am trying to do is
on a small scale. I am also interested in blocking direct access to the
files, for instance if someone puts in their direct url they should not be
retrievable, but instead php should give an error msg. Any help appreciated.
Thanks.
Dave.

attached mail follows:


This is impossible with only PHP. You might need a combination of PHP
and AJAX [Javascript].

On 1/11/07, Dave <dmehler26woh.rr.com> wrote:
> Hello,
> I'm using php and apache2 on a freebsd box. I know about .htaccess that
> the web server can provide, but i'm looking for something php can do, i want
> it to pop up a page when a user requests certain files, asking for a
> username and password. If those are valid the user is taken to a page where
> the files requested can be downloaded. I'd rather not use a mysql database
> and keep this user information in a flat file, as what i am trying to do is
> on a small scale. I am also interested in blocking direct access to the
> files, for instance if someone puts in their direct url they should not be
> retrievable, but instead php should give an error msg. Any help appreciated.
> Thanks.
> Dave.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Dave wrote:
> Hello,
> I'm using php and apache2 on a freebsd box. I know about .htaccess
> that the web server can provide, but i'm looking for something php can
> do, i want it to pop up a page when a user requests certain files,
> asking for a username and password.

http://www.php.net/features.http-auth has some nice examples, though the
"popup" is the same as using htaccess.

> I am also interested in
> blocking direct access to the files, for instance if someone puts in
> their direct url they should not be retrievable, but instead php should
> give an error msg.

If it's in a publicly accessible folder and only a php file to "protect"
it, it won't work.

Put the files in a non-public folder (outside the webroot) and get php
to "pipe" them in.

http://php.net/readfile or http://php.net/fpassthru will work for small
files. For larger files you will need to use http://php.net/fread
(specifically the loop example) so you don't blow out memory.

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

attached mail follows:


I'm finally upgrading to PHP5, and when I try to run go-pear on my NT box, I get an ActiveX error. What actually happens is that it will not let me specify the CLI path. When I try to edit that line, it give me the following error: C:\TEMP\tmp27B.tmp\bf.vbs(18, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'Shell.Application' Has anyone encountered this? I made sure that WMI was installed and up to date. I've tried googling the error, but I get nothing useful. I tried microsoft.com and MSDN. No help. Any ideas? Thanks, Mark Mark Weinstock mark_weinstockyahoo.com *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. *************************************** ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news

attached mail follows:


tedd wrote:
>index.php, jstest110.php) , make it one.
ok
---8<---
>It would be cool if I could send js value via a
>POST instead of GET-- can that be done?
have a look http://149.222.235.16/jstest/70112/index.php ( POST version )

>tedd

>PS: I read somewhere that using <noscript> is not recommended.
any info?

have fun,
Jürgen

--
View this message in context: http://www.nabble.com/Javascript-detection-tf2905451.html#a8292741
Sent from the PHP - General mailing list archive at Nabble.com.

attached mail follows:


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A good way to detect if javascript exists is (cross-browser,
cross-platform):

You try to load javascript_exists.htm.

- ------------------------------------------------------------
javascript_exists.htm:
<noscript>
<meta http-equiv="refresh" content="0; URL=javascript_not_actived.htm">
</noscript>
<html>
 ...
Javascript is actived!!
</html>

- ------------------------------------------------------------
javascript_not_actived.htm:
<html>
 ...
Javascript is *NOT* actived!!
</html>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFpzemIo1XmbAXRboRAirXAKCo8LlqI0gv/7+Kfs7L6EHJGRdN3QCgo530
1YwBznS0B8p3KSFVCVcyyfc=
=DjZ8
-----END PGP SIGNATURE-----

attached mail follows:


El Thu, 11 Jan 2007 14:59:36 -0500
"Sugrue, Sean" <Sean.Sugrueanalog.com> escribió:

> I need download a binary file in php. I don't need to read the
> contents just download the whole file to a browsed directory.
> I know you can use the header function, does anyone know the syntax.
>
> Sean
>

Maybe you can do:

        <?php
                $file = file_get_contents(<URI>); // Must have wrapper
activated
                file_put_contents(<FILE>, $file);
        ?>

---
Miguel J. Jiménez
ISOTROL, S.A.
mjjimenezisotrol.com
+34 955036800
+34 607448764

"I try to save a life a day. Usually it's my own."
John Crichton, FARSCAPE (1x07)

attached mail follows:


Hi,

How do I stop contents of a form from being readded to the database if the
user hits the refresh button on their browser.

I have tried to unset/destroy the variables in several different ways, but
it still does it.

After the info is written I unset the variables by using unset($var1, $var2,
$etc). I have also tried unset($_POST['var1'], $_POST['var2'],
$_POST['etc']). I even got deperate and tried $var = ""; or $_POST['var'] =
"";

What do I need to do to get rid of these values??? Obviously I am missing
something.

Any help is appreciated.

Thanks

attached mail follows:


It doesn't help to reset any values. The form data is being resent by
the browser itself, just if the user presses the submit button again
with the same data.

What you could do is mabye use a session to see if the particular user
has sent form data before.

/Fredrik Thunberg

Beauford skrev:
> Hi,
>
> How do I stop contents of a form from being readded to the database if the
> user hits the refresh button on their browser.
>
> I have tried to unset/destroy the variables in several different ways, but
> it still does it.
>
> After the info is written I unset the variables by using unset($var1, $var2,
> $etc). I have also tried unset($_POST['var1'], $_POST['var2'],
> $_POST['etc']). I even got deperate and tried $var = ""; or $_POST['var'] =
> "";
>
> What do I need to do to get rid of these values??? Obviously I am missing
> something.
>
> Any help is appreciated.
>
> Thanks
>
>

attached mail follows:


El Fri, 12 Jan 2007 03:27:12 -0500
"Beauford" <phpusernetscan.ca> escribió:

> Hi,
>
> How do I stop contents of a form from being readded to the database
> if the user hits the refresh button on their browser.
>
> I have tried to unset/destroy the variables in several different
> ways, but it still does it.
>
> After the info is written I unset the variables by using unset($var1,
> $var2, $etc). I have also tried unset($_POST['var1'], $_POST['var2'],
> $_POST['etc']). I even got deperate and tried $var = ""; or
> $_POST['var'] = "";
>
> What do I need to do to get rid of these values??? Obviously I am
> missing something.
>
> Any help is appreciated.
>
> Thanks
>

Maybe you can check the IP and see if it has already save the data or
not.

--
Miguel J. Jiménez
Área de Internet/XSL
migueljose.jimenezisotrol.com

----------------------------------------------------

ISOTROL
Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.
Parque Tecnológico Cartuja '93, 41092 Sevilla.
Teléfono: 955 036 800 - Fax: 955 036 849
http://www.isotrol.com

"Siempre intento salvar una vida al día. Normalmente es la mía"
(John Crichton, FARSCAPE 1x07)

attached mail follows:


Beauford wrote:
> Hi,
>
> How do I stop contents of a form from being readded to the database if the
> user hits the refresh button on their browser.

Perhaps a session variable that is set once the form is submitted.

Depending on the data you could also look at having a primary key in the
database.

You could also have a hidden form variable that has some random value,
once used, it cant be used again.

clive

attached mail follows:


Hi,

can google analytics keep track on the search keywords of the website?
I got one search features (connected to my database) in my web page. so
i need to keep track on the user search history.

Thank you

Regards,
Kencana

Edward Kay wrote:
>
> It depends what you mean by web performance. Do you mean your visitors or
> your web server?
>
> Google analytics (like all hosted analytics services) works by inserting
> some code that gets the visitor's browser to connect to their servers.
> These
> requests therefore has no impact on your web server.
>
> If you implement something on your own server, e.g. by tracking their path
> in a session variable and/or storing stuff in a DB then yes, this will
> consume resources.
>
> We use Google analytics and are very happy with the results.
>
> Edward
>
>> hi Edward,
>>
>> thanks for the recommendation. will google analytics affect my web
>> performance?
>> did you try it before?
>>
>> thank you
>>
>> Regards,
>> Kencana
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--
View this message in context: http://www.nabble.com/web-analytics-tf2957837.html#a8295237
Sent from the PHP - General mailing list archive at Nabble.com.