RE: [PHP] sort multidimension array

2006-06-22 Thread Ford, Mike
On 22 June 2006 02:22, weetat wrote:

> Hi all,
> 
>   I have multi-arrays as shown below:
>   I implemented usort() to sort the array by 'country' field
> in the array.
>   However there some empty string value in the array and i setup my
> cmpcountry() function to sort array, however , some country
> empty string
> value are sort first .
> 
> Any ideas what happen in the cmpcountry() function ?
> 
>   The result of sort array below is :
> 
> Singapore
> Singapore
> Thailand
> ''
> Thailand
> ''
> ''
> Malaysia
> Phillipines
> 
> 
>   function cmpcountry($a, $b)
>{
> 
>  $country1 = $a['country'];
>  $country2 = $b['country'];
> 
>  if($country1 == ''){
>if($country1 < $country2){
>   return 1;
>}
>   }
> 
>  if($country2 == '') {
>if($country1 < $country2){
>   return 1;
>}
>   }
> 
>   return ($country1 < $country2) ? -1 : 1;
>}

I can't see what your additional if statements give you that a straight 
comparison wouldn't.  Under normal circumstances, '' will sort exactly where 
you want it, so this is an ideal case for a straight strcmp:

   function cmpcountry($a, $b)
   {
  return strcmp($a['country'], $b['country']);
   }

If, however, what you're trying to do is send all blank entries to the end, you 
only need the tests for empty string:

   function cmpcountry($a, $b)
   {
  $country1 = $a['country'];
  $country2 = $b['country'];
 
  if($country1 == '') return 1;
  if($country2 == '') return -1;

  return strcmp($country1, $country2);
   }

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] detect user click "stop" button in browser

2006-06-22 Thread weetat

Hi all,

  Can we detected if user have clicked the "X" button in browser or 
close browser ?
  I have tested in my php program ,when i click "X" in IE6 , the 
execution did not stop , it still running .
 Any ways to stop the program execution when user click the "X" button 
or close browser ?


Thanks
- weetat

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



Re: [PHP] detect user click "stop" button in browser

2006-06-22 Thread Andrei
Check int connection_aborted ( ) in the PHP manual

Andy

weetat wrote:
> Hi all,
> 
>   Can we detected if user have clicked the "X" button in browser or
> close browser ?
>   I have tested in my php program ,when i click "X" in IE6 , the
> execution did not stop , it still running .
>  Any ways to stop the program execution when user click the "X" button
> or close browser ?
> 
> Thanks
> - weetat
> 

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



[PHP] templating

2006-06-22 Thread Ryan A
Hi,

A pal of mine needed some help on his project, he is
using a "header" and "footer" file to "template" his
project... but its gotten a bit complicated as he has
a few dynamic parts in the header and footer files, so
I told him to go with a proper templating method of
templating the whole page rather than includ()ing the
top and bottom.

After having a better look at his scripts, I am just
not sure if something big (like SMARTY for instance)
would be good for him. He just needs maybe 5 template
pages, same pages, different color.

Searching google I see literally hundreds of
"templating solutions" can anyone recommend a simple
one or should I tell him to just use str_replace() for
tags like: {{menu_here}} {{header_here} etc?
Something like SMARTY would be like using a nuke to
kill a fly (IMHO) esp since this project will not
expand to anything much bigger or complicated.

Thanks!
Ryan

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

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



RE: [PHP] templating

2006-06-22 Thread George Pitcher
Ryan,

I would still recommend Smarty.

It can be as big as you like, but it can also be very simple to set up and
maintain. It has the features should your friend decide to expand his usage
in the future. If you opt now for something with limited features and later
decide to step beyond them, you'll be faced with making another major change
then.

Just my 2p worth.

George in Oxford

> -Original Message-
> From: Ryan A [mailto:[EMAIL PROTECTED]
> Sent: 22 June 2006 12:10 pm
> To: php php
> Subject: [PHP] templating
>
>
> Hi,
>
> A pal of mine needed some help on his project, he is
> using a "header" and "footer" file to "template" his
> project... but its gotten a bit complicated as he has
> a few dynamic parts in the header and footer files, so
> I told him to go with a proper templating method of
> templating the whole page rather than includ()ing the
> top and bottom.
>
> After having a better look at his scripts, I am just
> not sure if something big (like SMARTY for instance)
> would be good for him. He just needs maybe 5 template
> pages, same pages, different color.
>
> Searching google I see literally hundreds of
> "templating solutions" can anyone recommend a simple
> one or should I tell him to just use str_replace() for
> tags like: {{menu_here}} {{header_here} etc?
> Something like SMARTY would be like using a nuke to
> kill a fly (IMHO) esp since this project will not
> expand to anything much bigger or complicated.
>
> Thanks!
> Ryan
>
> --
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] templating

2006-06-22 Thread Jon Anderson



Ryan A wrote:

Hi,

A pal of mine needed some help on his project, he is
using a "header" and "footer" file to "template" his
project... but its gotten a bit complicated as he has
a few dynamic parts in the header and footer files, so
I told him to go with a proper templating method of
templating the whole page rather than includ()ing the
top and bottom.
  
This somewhat a "religious" issue for some, but my personal opinion is 
that PHP is often very good at being a simple template system. Just 
assign your variables beforehand, and display them with the  
tag. (I do this with entire pages, split up into chunks for various 
parts of content.)


I.e. template_head.php:


   
 
 
   @import "";
 
 
 
?>

etc...

Then your page would look like:


After having a better look at his scripts, I am just
not sure if something big (like SMARTY for instance)
would be good for him. He just needs maybe 5 template
pages, same pages, different color.
  

Smarty is also excellent. (I still prefer pure PHP though. :-)

Searching google I see literally hundreds of
"templating solutions" can anyone recommend a simple
one or should I tell him to just use str_replace() for
tags like: {{menu_here}} {{header_here} etc?
Something like SMARTY would be like using a nuke to
kill a fly (IMHO) esp since this project will not
expand to anything much bigger or complicated.

Why kill performance when you don't have to?

jon

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



Re: [PHP] templating

2006-06-22 Thread Miles Thompson

At 08:10 AM 6/22/2006, Ryan A wrote:


Hi,

A pal of mine needed some help on his project, he is
using a "header" and "footer" file to "template" his
project... but its gotten a bit complicated as he has
a few dynamic parts in the header and footer files, so
I told him to go with a proper templating method of
templating the whole page rather than includ()ing the
top and bottom.

After having a better look at his scripts, I am just
not sure if something big (like SMARTY for instance)
would be good for him. He just needs maybe 5 template
pages, same pages, different color.

Searching google I see literally hundreds of
"templating solutions" can anyone recommend a simple
one or should I tell him to just use str_replace() for
tags like: {{menu_here}} {{header_here} etc?
Something like SMARTY would be like using a nuke to
kill a fly (IMHO) esp since this project will not
expand to anything much bigger or complicated.

Thanks!
Ryan



Ryan,

Don't forget, PHP itself is a templating language. Just do a standard page, 
with includes for headers and footers, menus, and content.


If he wants to change colour, then load a different stylesheet for a given 
page or content section.


This way he can use the tool that's right in front of him, he's not adding 
another layer, he does not have to learn another "language" - the template 
system written in PHP, and he hones his PHP skills.


Whew!  Hope this is helpful.

Regards - Miles


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.394 / Virus Database: 268.9.2/372 - Release Date: 6/21/2006

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



Re: [PHP] templating

2006-06-22 Thread Dave Goodchild
On 22/06/06, Miles Thompson <[EMAIL PROTECTED]> wrote:
At 08:10 AM 6/22/2006, Ryan A wrote:>Hi,>>A pal of mine needed some help on his project, he is>using a "header" and "footer" file to "template" his>project... but its gotten a bit complicated as he has
>a few dynamic parts in the header and footer files, so>I told him to go with a proper templating method of>templating the whole page rather than includ()ing the>top and bottom.>>After having a better look at his scripts, I am just
>not sure if something big (like SMARTY for instance)>would be good for him. He just needs maybe 5 template>pages, same pages, different color.>>Searching google I see literally hundreds of
>"templating solutions" can anyone recommend a simple>one or should I tell him to just use str_replace() for>tags like: {{menu_here}} {{header_here} etc?>Something like SMARTY would be like using a nuke to
>kill a fly (IMHO) esp since this project will not>expand to anything much bigger or complicated.>>Thanks!>RyanI agree with Ryan - here is an example of a simple template I am using on a project at the moment. Stylesheets are used to control look and feel and the body tag is assigned a class so that different pages can use different layout elements. Hope this helps.
-- http://www.web-buddha.co.uk http://www.projectkarma.co.uk
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] templating

2006-06-22 Thread Joe Wollard
IMHO I would go with Smarty as it has excellent documentation and  
would fit almost anything that the project would require. I also  
think it would be a cleaner way of templating than using str_replace 
() over and over again. For what it's worth, I use Smarty on almost  
all of my projects, large and small. I find that once you learn it  
you can use it to develop new sites rather quickly.


...and it's not like using a nuke to kill a fly - Smarty only loads  
the files it needs as it needs them instead of loading everything -  
so it's quite fast really.


- Joe


On Jun 22, 2006, at 7:10 AM, Ryan A wrote:


Hi,

A pal of mine needed some help on his project, he is
using a "header" and "footer" file to "template" his
project... but its gotten a bit complicated as he has
a few dynamic parts in the header and footer files, so
I told him to go with a proper templating method of
templating the whole page rather than includ()ing the
top and bottom.

After having a better look at his scripts, I am just
not sure if something big (like SMARTY for instance)
would be good for him. He just needs maybe 5 template
pages, same pages, different color.

Searching google I see literally hundreds of
"templating solutions" can anyone recommend a simple
one or should I tell him to just use str_replace() for
tags like: {{menu_here}} {{header_here} etc?
Something like SMARTY would be like using a nuke to
kill a fly (IMHO) esp since this project will not
expand to anything much bigger or complicated.

Thanks!
Ryan

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

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.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] Need help with PEAR Quickform

2006-06-22 Thread Robert Graham

Good day

I am busy working on a form using QuickForm.

I would like to make use of a confirmation page where the user must
eitheir select to change the details or continue.  Does anyone know how
to achieve this?

Regards
Robert

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



Re: [PHP] templating

2006-06-22 Thread Micky Hulse

Miles Thompson wrote:
Don't forget, PHP itself is a templating language. Just do a standard 
page, with includes for headers and footers, menus, and content.
If he wants to change colour, then load a different stylesheet for a 
given page or content section.
This way he can use the tool that's right in front of him, he's not 
adding another layer, he does not have to learn another "language" - the 
template system written in PHP, and he hones his PHP skills.


I agree. I think this would be the best solution for a simple site. Good 
point about honing PHP skillz.


As far as a CMS goes, textpattern is pretty dope. Simple to setup, free, 
 and it has a kick-butt template system.


Gl,
Cheers,
Micky

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



RE: [PHP] Need help with PEAR Quickform

2006-06-22 Thread Chris Boget
> I am busy working on a form using QuickForm.
> I would like to make use of a confirmation page 
> where the user must eitheir select to change the 
> details or continue.  Does anyone know how to 
> achieve this?

On POST, you could redisplay the form in a "Frozen"
state.  If the form is frozen, you display a separate 
set of submit buttons and in checking to see if those
new buttons were clicked do you actually process the
form normally (access data store, etc).

This is just one of the many ways you can go about
achieving the same results.

thnx,
Chris

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



[PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Dave M G

PHP List,

Very frequently I use mysql_fetch_row in a while statement to

while($variable = mysql_fetch_row($mysqlResult)){
echo $variable[text1];
echo $variable[text2];
}

Pretty standard.

But what do I do when I want to do the same kind of while loop not with 
a MySQL result, but with just a regular array?


while (variable = ($array)){
echo $variable[text1];
echo $variable[text2];
}

I've been up and down the manual, and looked at foreach statements and 
functions like each(), but I can't seem to zero in on what I need.


Can anyone let me know what it is I'm missing?

Thank you for any advice.

--
Dave M G

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



Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread nicolas figaro

Dave M G a écrit :

PHP List,

Pretty standard.

But what do I do when I want to do the same kind of while loop not 
with a MySQL result, but with just a regular array?


while (variable = ($array)){
echo $variable[text1];
echo $variable[text2];
}


did you try something like this ?
foreach ($array as $variable)
{ echo $variable;
}

or for "associative array"
foreach ($array as $key => $value)
{ echo $key." ".$value;
}
I've been up and down the manual, and looked at foreach statements and 
functions like each(), but I can't seem to zero in on what I need.


Can anyone let me know what it is I'm missing?

Thank you for any advice.


hope this'll help

N F

--
Dave M G



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



[PHP] Re: Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread M. Sokolewicz

Dave M G wrote:

PHP List,

Very frequently I use mysql_fetch_row in a while statement to

while($variable = mysql_fetch_row($mysqlResult)){
echo $variable[text1];
echo $variable[text2];
}

Pretty standard.

But what do I do when I want to do the same kind of while loop not with 
a MySQL result, but with just a regular array?


while (variable = ($array)){
echo $variable[text1];
echo $variable[text2];
}

I've been up and down the manual, and looked at foreach statements and 
functions like each(), but I can't seem to zero in on what I need.


Can anyone let me know what it is I'm missing?

Thank you for any advice.

--
Dave M G


If we "translate" a mysql resultset to an array notation, you would have:
restultset[1][text1] = a;
restultset[1][text2] = b;
restultset[2][text1] = c;
restultset[2][text2] = d;
restultset[3][text1] = e;
restultset[3][text2] = f;
Thus, going trough it with a foreacht:
foreach(resultset as $key=>$val) {
   echo $val[text1];
}
will give you the same result as the original loop construct you did 
with while() (assuming an array resultset for purposes of demonstration).


foreach($mysqlResultSet as $variable) {
   echo $variable[text1];
   echo $variable[text2];
}

is what you're probably after though. Might I suggest reading the manual 
about foreach (and especially array) construct again please? very 
carefuly preferably, as it seems you're missing quite a lot of insight 
there :)


- tul

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



Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Jochem Maas
the foreach loop is probably better (it doesn't require
reset()ing the array pointer for instance) but you should also
look at the example on this page (using the current() function in a
while loop):

http://php.net/key


Dave M G wrote:
> PHP List,
> 
> Very frequently I use mysql_fetch_row in a while statement to
> 
> while($variable = mysql_fetch_row($mysqlResult)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> Pretty standard.
> 
> But what do I do when I want to do the same kind of while loop not with
> a MySQL result, but with just a regular array?
> 
> while (variable = ($array)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> I've been up and down the manual, and looked at foreach statements and
> functions like each(), but I can't seem to zero in on what I need.
> 
> Can anyone let me know what it is I'm missing?
> 
> Thank you for any advice.
> 
> -- 
> Dave M G
> 

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



Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Jochem Maas
Dave M G wrote:
> PHP List,
> 
> Very frequently I use mysql_fetch_row in a while statement to
> 
> while($variable = mysql_fetch_row($mysqlResult)){
> echo $variable[text1];
> echo $variable[text2];

another thing. $variable[text2] is bad because you very likely don't
have a constant in your code named 'text2' - you should be using string keys
(if you had error_reporting set to include E_NOTICE errors you would see
notices output regarding non-existent constants... do this instead:

echo $variable['text1'];
echo $variable['text2'];

> }
> 
> Pretty standard.
> 
> But what do I do when I want to do the same kind of while loop not with
> a MySQL result, but with just a regular array?
> 
> while (variable = ($array)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> I've been up and down the manual, and looked at foreach statements and
> functions like each(), but I can't seem to zero in on what I need.
> 
> Can anyone let me know what it is I'm missing?
> 
> Thank you for any advice.
> 
> -- 
> Dave M G
> 

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



Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Dave M G

Jochem, Tul, Nicolas,

Thank you for your help.

I must be doing something wrong with how my array is generated. It's 
actually just a MySQL result, but because it is returned from a 
function, it does not seem to behave as I would expect a MySQL result 
should.


I'm trying the foreach function and key values, but I'm clearly not 
quite getting it right. Perhaps there is something about my code which 
is wrong. So I'm presenting what I hope is all the relevant parts:


public function getData($row, $type, $column, $match) {
$query = "SELECT " . $row . " FROM " . $type . " WHERE " .$column . " = 
" . $match;

echo "query = " . $query . "";
$result = mysql_query($query);
$data = mysql_fetch_array($result);
return $data;
}

foreach($elements as $key => $val){
echo "val[type] = " . $val[type] . "";
echo "val[resource] = " . $val[resource] . "";
}


What I'm getting back doesn't make sense. I can't go all the way into my 
code, but $val[type] should be a string value containing the words 
"Article" or "Text".


But instead, I get:
val[type] = 2
val[resource] = 2

Am I still not doing the foreach correctly?

--
Dave M G

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



[PHP] rss feeds from db

2006-06-22 Thread Dan McCullough

I'm having some problems where some undefined entity are getting in,
these entities are usually html entities.

sad thing is"¦bringing in these large chains is putting

the xml doc points to the & in ";¦" as the problem.  what do I
need to do to get this stuff cleaned up?

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



[PHP] Oracle Commits

2006-06-22 Thread Jay Blanchard
Good afternoon and salutations denizens of the greatest list generated
by electrons!

I have a situation where I am trying to commit a transaction in Oracle
with PHP as follows;

$udGeocode = oci_parse($conn, "UPDATE CONT_ADDRESS SET GEOCODE =
'".$geocode[0]."' WHERE CONTRACT_ID = '".$row[0]."' AND POSTAL_CODE =
'".$ROW[1]."' AND ADDRESS_TYPE = 'S'");
oci_execute($udGeocode, OCI_DEFAULT);

// commit
$committed = oci_commit($conn);
if (!$committed) {
   $error = oci_error($conn);
   echo 'Commit failed. Oracle reports: ' . $error['message'];
} else {
   echo ' Commit succeeded';
}

The commit returns as successful, but it is not successful in the
database itself. Am I missing something here? I have RTFM on oci_execute
and oci_commit and cannot find anything.

Thanks!

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



Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Adam Zey

Dave M G wrote:

Jochem, Tul, Nicolas,

Thank you for your help.

I must be doing something wrong with how my array is generated. It's 
actually just a MySQL result, but because it is returned from a 
function, it does not seem to behave as I would expect a MySQL result 
should.


I'm trying the foreach function and key values, but I'm clearly not 
quite getting it right. Perhaps there is something about my code which 
is wrong. So I'm presenting what I hope is all the relevant parts:


public function getData($row, $type, $column, $match) {
$query = "SELECT " . $row . " FROM " . $type . " WHERE " .$column . " = 
" . $match;

echo "query = " . $query . "";
$result = mysql_query($query);
$data = mysql_fetch_array($result);
return $data;
}

foreach($elements as $key => $val){
echo "val[type] = " . $val[type] . "";
echo "val[resource] = " . $val[resource] . "";
}


What I'm getting back doesn't make sense. I can't go all the way into my 
code, but $val[type] should be a string value containing the words 
"Article" or "Text".


But instead, I get:
val[type] = 2
val[resource] = 2

Am I still not doing the foreach correctly?

--
Dave M G


First of all, you're using invalid syntax. You should have $val['type'] 
rather than $val[type].


Second of all, mysql_fetch_array returns only a single row, $elements. 
This is an array. From there, you're asking foreach to return each 
element of the array as $val. So each time through the foreach loop, 
$val will have the contents of that element. The element isn't an array, 
it's a scalar. So you're taking a scalar and trying to treat it like an 
array.


You really should read the manual, the pages for all these functions 
describe EXACTLY what they do.


Remember that mysql_fetch_array returns an associative array. You can 
refer to the SQL fields by their names. So if your select query was 
"SELECT foo, bar FROM mytable", after doing a mysql_fetch_array you 
could do this:


echo $row['foo'] . "";
echo $row['bar'] . "";

Regards, Adam.

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



[PHP] Re: rss feeds from db

2006-06-22 Thread Adam Zey

Dan McCullough wrote:

I'm having some problems where some undefined entity are getting in,
these entities are usually html entities.

sad thing is"¦bringing in these large chains is putting

the xml doc points to the & in ";¦" as the problem.  what do I
need to do to get this stuff cleaned up?


Not quite. That first ; is part of the previous entity, """. You 
want to do a search/replace for "¦"


And ¦ is a perfectly valid entity. It represents a pipe character 
("¦"), so it is NOT an undefined entity.


If you really don't want it there, do a search-replace for "¦" 
and either replace it with an alternative character (perhaps a ¦ 
directly), or an empty string to remove it entirely.


Regards, Adam.

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



Re: [PHP] helping people...

2006-06-22 Thread Wolf
fiberuplink.com -> unavailable..  looks like rob's ddos attack worked on
his own server, must be his testing before turning in his paper...

Wolf

Adam Zey wrote:
> Rob W. wrote:
>> No that wasnt a ddos threat you idiot, i dont play them games.
>>
>> And when you keep sending spam is when it starts to piss people off.

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



Re: [PHP] Oracle Commits

2006-06-22 Thread Jochem Maas
Jay Blanchard wrote:
> Good afternoon and salutations denizens of the greatest list generated
> by electrons!
> 
> I have a situation where I am trying to commit a transaction in Oracle
> with PHP as follows;
> 
> $udGeocode = oci_parse($conn, "UPDATE CONT_ADDRESS SET GEOCODE =
> '".$geocode[0]."' WHERE CONTRACT_ID = '".$row[0]."' AND POSTAL_CODE =
> '".$ROW[1]."' AND ADDRESS_TYPE = 'S'");
> oci_execute($udGeocode, OCI_DEFAULT);

did the execute actually succeed? does the data get into the DB if you
use OCI_COMMIT_ON_SUCCESS instead of OCI_DEFAULT?

I don't support using oci_internal_debug() gives you any extra info?

>   
> // commit
>   $committed = oci_commit($conn);
> if (!$committed) {
>$error = oci_error($conn);
>echo 'Commit failed. Oracle reports: ' . $error['message'];
> } else {
>echo ' Commit succeeded';
> }
> 
> The commit returns as successful, but it is not successful in the
> database itself. Am I missing something here? I have RTFM on oci_execute
> and oci_commit and cannot find anything.
> 
> Thanks!
> 

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



Re: [PHP] templating

2006-06-22 Thread Richard Lynch
On Thu, June 22, 2006 6:10 am, Ryan A wrote:
> He just needs maybe 5 template
> pages, same pages, different color.

For something THIS simple, I truly believe you are Better Off (tm)
with a simple head() and foot() function in a globals.inc file:

function head($title = "My Site", $bgcolor = '#ff'){
?>


  

  
  

  



Your header and footer are now in one "template-like" file which makes
it easy to match up tags.

And the 5 pages will look like:


Page One specific content here



The reason I prefer this to header/footer includes, is that it's too
easy to mess up closing tags in footer/header out of sync with
separate files, but with one file, they're right there and a decent
HTML editor will pick them out for you.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] detect user click "stop" button in browser

2006-06-22 Thread Richard Lynch
On Thu, June 22, 2006 4:16 am, weetat wrote:
>Can we detected if user have clicked the "X" button in browser or
> close browser ?
>I have tested in my php program ,when i click "X" in IE6 , the
> execution did not stop , it still running .
>   Any ways to stop the program execution when user click the "X"
> button
> or close browser ?

There is no RELIABLE way to do that.

An javascript thingie for "onStop" if it exists might help.

PHP's ignore_user_abort being on/off can sometimes pass back their
"stop" action, or not...

I suspect that the return value from feof('php://stdout') *MIGHT*
maybe change to FALSE when Apache recognizes that the browser is
"gone"...

But 100% reliable way probably does not exist, afaik.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Stream download problem

2006-06-22 Thread Richard Lynch
On Tue, June 20, 2006 7:32 pm, Michael Satterwhite wrote:
> I have a site that generates a file to be streamed down. The relevant
> code is:
> --
> header("Content-type: application/vnd.ms-excel");
> header("Content-disposition: attachment; filename=$EXPORT_TIME.txt");
> header("Content-disposition: attachment");

This is too funny...

Sorry.

We just had a big long flame-fest about this last week.

And today in IRC somebody else is going through your same grief.

Rather than repeat myself, I decided to just blog my answer:

http://richardlynch.blogspot.com/

Let the flame-fest (on blogspot, please) begin!

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Processing HTML in mail form

2006-06-22 Thread Richard Lynch
On Tue, June 20, 2006 4:56 pm, Jonas Rosling wrote:
> I've done the following code bellow for an e-mail form. But it handles
> the
> HTML tags as text. Is there anyway to get the HTML tags processed to
> form
> the mail?
>
> 
> @extract($_POST);

Errr.

You might as well just turn register_globals on, because there is NO
significant difference between the above one line of code and having
register_globals ON.

So if you already know register_globals ON is "bad" and you think
you've made your script "good" turning it OFF and doing this instead,
then you don't really understand what is going on, either with
register_globals, or with extract, or both.

> $subject = 'Intresseanmalan';
>
> $forname = stripslashes($forname);

This rigth here tells me that you magic_quotes_gpc on, and you could
easily turn that OFF in .htaccess (probably) for this script at least,
and save yourself a lot of grief as well...

> $lastname = stripslashes($lastname);

> $text = 'F-name: '.$forname.''.

If you want plain old regular text email, just make '' be "\n"

If you want HTML-enhanced (cough, cough) email, do not attempt to
re-invent the wheel, but use something from http://phpclasses.org for
that instead, or PEAR or PECL or whatever.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] shutting down a web app for maintenance

2006-06-22 Thread Oscar Gosdinski

On 6/20/06, Jon Anderson <[EMAIL PROTECTED]> wrote:

Assuming you're using a web server that supports htaccess files, you
could easily just pop in a .htaccess file that denies access to
everything. You could even add a PHP ini directive like:

php_value auto_prepend_file "maintenance.php"

where maintenance.php could contain something like:

Down for MaintenanceSite down
for maintenance! 


if this is the case, why don't you put clean session sentences in your
maintenance.php. With those sentences you are sure that anybody that
wants to access your application will be kicked off.

--
Saludos
Oscar

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



RE: [PHP] Oracle Commits SOLVED

2006-06-22 Thread Jay Blanchard
[snip]
did the execute actually succeed? does the data get into the DB if you
use OCI_COMMIT_ON_SUCCESS instead of OCI_DEFAULT?

I don't support using oci_internal_debug() gives you any extra info?
[/snip]

I finally did an oci_bind_by_name and then performed the commit. It
worked.  Oci_internal_debug gave me nada at that point. The reason for
using OCI_DEFAULT was so that I could perform a kind of bulk update and
check before committing. oci_commit_on_success would have committed each
time the update was performed and it seems that would have cost more
overhead. 

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



Re: [PHP] templating

2006-06-22 Thread tedd
At 6:26 PM -0500 6/22/06, Richard Lynch wrote:
>On Thu, June 22, 2006 6:10 am, Ryan A wrote:
>> He just needs maybe 5 template
>> pages, same pages, different color.
>
>For something THIS simple, I truly believe you are Better Off (tm)
>with a simple head() and foot() function in a globals.inc file:
>
>function head($title = "My Site", $bgcolor = '#ff'){
>?>
>
>
>  
>
>  
>  
>  }
>
>  function foot(){
>?>
>  
>
>  }
>?>
>
>Your header and footer are now in one "template-like" file which makes
>it easy to match up tags.
>
>-snip-
>
>The reason I prefer this to header/footer includes, is that it's too
>easy to mess up closing tags in footer/header out of sync with
>separate files, but with one file, they're right there and a decent
>HTML editor will pick them out for you.

Well... I prefer to separate the header and footer into two files and load them 
as needed in my web page. In addition, I would most certainly remove ALL 
attribute stuff that could/should be controlled by css out of html and php and 
into a css file.

I usually start my pages off with:



and end them with:



Inside the header, I have the DOCTYPE, ,  (with all the header 
stuff including css) and  tags.

The footer has my closing "Last Modified", Copyright, and the ending  
and  tags.

In between the two  tags it's pretty simple to manage the html and 
keep track of div's. I never have a header or footer that goes beyond the body 
tags -- so even if there is NO html in between, I still have a valid page.

I also use other includes, like for navigation. However, every include file is 
complete from its start tag to its finish tag so I never get my tags out of 
sync. It's just a matter of good housekeeping.

If I want to control the color of something, then I do it in css. If I have to 
do it via php, then I wrap css in php and do it there. But, I always try to 
keep presentation out of my code. Besides, I find it's much easier for me that 
way because I can do anything to my code and the presentation stays the same -- 
likewise, I can do anything I want to my css, and my code remains unaffected. 
It works for me.

tedd

-- 

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

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



Re: [PHP] shutting down a web app for maintenance

2006-06-22 Thread Richard Lynch
On Tue, June 20, 2006 12:53 pm, Ben Liu wrote:
> I'm not sure this is strictly a PHP related question or perhaps a
> server admin question as well. What do you do when you are trying to
> shutdown a web application for maintenance (like a membership or
> registration-required system)? I understand that you can temporarily
> upload or activate a holding page that prevents users from continuing
> to login/use the system, but how can you insure that there are no
> ongoing sessions or users still in the process of doing something?
> What's the best method for handling this, especially if you don't have
> full control of the server hosting the web app?

It's too late for this go-around, but...

If it's something you really want to "do right" and it's
mission-critical and you have a ton of time...

You *could* tag every user/record/session with a "version" number, and
then you *could* check what version they are currently "on" and then
"do the right thing" for them in that version.

Obviously, this could get very complicated, very very very fast...

Or, perhaps not.

Perhaps you'd have a special dir set up for each "old" version, and if
they submitted a page under the "old" version in their session, you'd
just include stuff from that old version directory, by munging
include_path() to use old code and not new code.

Then, when they logout, and get a new session later, "poof" they are
now in the "new" version.

This is obviously not a TRIVIAL solution, but it's at least feasible
if this problem truly must be solved rather than ignored. :-)

"Crude, but effective Captain" -- Spock _Bearskins and Knives_

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Problem displaying a mysql database field

2006-06-22 Thread Richard Lynch
On Tue, June 20, 2006 4:02 pm, Don wrote:
> I have a varchar field in a MySQL database that contains a line of
> text like
> so:
>
> "This is a line if text"
>
> The double quotes are included in the database field.
>
> I cannot seem to display it on my HTML page, it always shows as blank.
>  I
> have tried using both the stripslashes() and the html_entity_decode()
> but it
> still shows as blank.
>
> How can I display this please???

There is nothing you've said so far that would exhibit the symptoms
you describe...

Now, if the field also had < in it, so the browser was showing it as
an HTML tag, then you'd see "nothing"...

The best guess so far has been to use htmlentities, but, indeed, that
cannot be the "whole" answer if what you have posted is correct...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] User Login Problem

2006-06-22 Thread Richard Lynch
On Tue, June 20, 2006 6:43 am, suresh kumar wrote:
>  I am facing one problem in my project.i want to restrict more
> than one user login in the same account .Is there any functions
> available to check r we can implement using session.

You'll have to decide for yourself when a user is or isn't logged in
or out for this purpose.

it may match up exactly with the state of the $_SESSION or maybe
you'll have an even shorter time allowance on changing of IP,
User-Agent or so on.

Personally, though, I hate sites that do that, as if their site is
broken and I have to switch browsers to avoid a browser-dependency
issue, then I'm screwed. :-(

Think long and hard about this one...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Still trying to figure this out...

2006-06-22 Thread Richard Lynch
On Tue, June 20, 2006 1:37 am, Rob W. wrote:
> I still have not yet found anybody to help me with this. All the code
> that
> people have given me has not worked at all. I still get no output. So
> to add
> a little more to this, I'm gonna define how the database looks.
>
> --
> |switchid|switchport |
> --
> |1  | 1  |
> |1  | 2  |
> |1  | 3  |
> |1  | 4  |
> |1  | 7  |
> |1  | 10|
> --
>
> ect so on and so forth. There are other switch id's in there as well
> along
> with their switch port's which sorting the other switchid's is not a
> problem. I also know the maximum amount for each switchid so that's
> not a
> problem as well. I need to be able to display the missing numbers in
> there.
> I have no extra spaces in there for blank numbers. After a server has
> been
> entered in to the database, it take's that number that was not shown
> previously in the database and enters it in, there for displaying it
> and not
> making it available for the next time another server is added. I have
> no way
> to alter the database as I am trying to clone a program and this is
> the only
> thing haning me up as of right now. If I can find someone to solve
> this
> problem for me, I will be glad to send money via paypal for helping
> out
> solving this problem as I have been on it for 2 days now and this is
> the
> last bit of code for this program that is holding me up. Please read
> below
> for more information on what I am doing.

Here's the first problem I am seeing...

Between the time that you search for an "open" port and you then
assign it to something, ANOTHER script might run, get the same "open"
port, and then assign it to something.

That's pretty much your basic "race condition" right there.

If you've got that all solved, then I would go for a crude solution,
personally.

\n";
}
$last_used = $port;
  }
?>

But I'm a crude kind of guy, so there you go.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Still trying to figure this out...

2006-06-22 Thread Richard Lynch


Damn.

Tack on this at the end:

$max_port = 2048;
for ($p = $last_port + 1; $p < $max_port; $p++) echo "$p is open\n";


On Tue, June 20, 2006 1:37 am, Rob W. wrote:
> I still have not yet found anybody to help me with this. All the code
> that
> people have given me has not worked at all. I still get no output. So
> to add
> a little more to this, I'm gonna define how the database looks.
>
> --
> |switchid|switchport |
> --
> |1  | 1  |
> |1  | 2  |
> |1  | 3  |
> |1  | 4  |
> |1  | 7  |
> |1  | 10|
> --
>
> ect so on and so forth. There are other switch id's in there as well
> along
> with their switch port's which sorting the other switchid's is not a
> problem. I also know the maximum amount for each switchid so that's
> not a
> problem as well. I need to be able to display the missing numbers in
> there.
> I have no extra spaces in there for blank numbers. After a server has
> been
> entered in to the database, it take's that number that was not shown
> previously in the database and enters it in, there for displaying it
> and not
> making it available for the next time another server is added. I have
> no way
> to alter the database as I am trying to clone a program and this is
> the only
> thing haning me up as of right now. If I can find someone to solve
> this
> problem for me, I will be glad to send money via paypal for helping
> out
> solving this problem as I have been on it for 2 days now and this is
> the
> last bit of code for this program that is holding me up. Please read
> below
> for more information on what I am doing.
>
> - Original Message -
> From: "Rob W." <[EMAIL PROTECTED]>
> To: 
> Sent: Monday, June 19, 2006 3:39 PM
> Subject: [PHP] Still trying to figure this out...
>
>
> Ok, I am still trying to get this figured out from what I tried doing
> last
> night. If anybody wants to try it, please be my guest. This is the
> deal.
> Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like
> number
> 8, 9, 22, 23 ect.. Now create a php statement that will take and pull
> that
> out of the database, find out the missing numbers and display them as
> an
> html drop down selection.
>
> And tedd in response to why, is because the values that are already
> located
> in the database represent in use already. They represent a server port
> that
> a server is sitting on, so that's not the problem. I could have done
> that
> along time ago.
>
> Any help is appreciated but here is the current code that I have.
>
>
>   $query="SELECT switchport FROM network";
>   $result=mysql_query($query);
>   $sql_range=mysql_fetch_array($result);
>   $true_range=range(1,24);
>   $next_range=array_diff($true_range,$sql_range);
>   foreach ($next_range as $final_range) {
>  echo "$final_range\n";
>   }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] CDATA tag

2006-06-22 Thread weetat

Hi all,

I need to parse and write data to xml file ,

There some value as shown below:
 

I need to write the data to be valid value.
I am using PEAR:XMLSerializer to read the xml file, however , the PEAR 
XMLSerializer always prompt me the error message below:


 " No unserialized data available. Use XML_Unserializer::unserialize() 
first."


It cause by the CDATA above. I have attached for your reference.

Thanks

- weetat






RMEhostname
Tue Mar 28 14:37:43 CST 2006
1.0



1
WS-C6506
TBA04490054
wsc6506
6

giga16


1
WS-X6K-SUP1A-2GE
SAD04520AZD
1
wsx6ksup1a2ge
7.1
ok

Firmware
5.3(1)


Software
7.6(10)








2
WS-X6348-RJ-45
SAL04430RE9
2
wsx6348rj45
1.4
ok

Firmware
5.4(2)


Software
7.6(10)








3
WS-X6348-RJ-45
SAL04430M00
3
wsx6348rj45
1.4
ok

Firmware
5.4(2)


Software
7.6(10)
















1
Cisco Systems WS-C6506
Cisco Catalyst Operating System Software, Version 7.6(10)
Copyright (c) 1995-2004 by Cisco Systems

Network Services Asia Pacific Head 
Office


/Thailand/BANGKOK/208 Wireless Rd/
99.99.99.99.99.99.99.99.45 
 

hostname1

1
2

1
106


2
107






3
48

1
58


2
59


3
60


4
61


5
62


6
63


7
64


8
65


9
66


10
67


11
68


12
69


13
70


14
71


15
72


16
73


17
74


18
75


19
76


20
77


21
78


22
79


23
80


24
81


25
82


26
83


27
84


28
85


29
86


30
87


31
88


32
89


33
90


34
91


35
92


36
93


37
94


38
95


39
96


40
97


41
98


42
99


43
100


44
101


45
102


46
103


47
104


48
105






2
48

1
10


2
11


3
12


4
13


5
14


6
15


7
16


8
17


9
18


10
19


11
20


12
21


13
22


14
23


15
24


16
25


17
26


18
27


19
28


20
29


21
30


22
31


23
32


24
33


25
34


26
35


27
36


28
37


29
38


30
39


31
40


32
41


33
42


34
43


35
44


36
45


37
46


38
47


39
48


40
49


41
50


42
51


43
52


44
53


45
54


46
55


47
56


48
57






DRAM
1
0
true
49895592 Bytes
84191064 Bytes
44015728 Bytes


NVRAM
7
0
true
320028 Bytes
204260 Bytes
204260 Bytes


CLUSTER
9
0
true
3031040 Bytes
35651584 Bytes
2048 Bytes


FLASH
6
0
true
11362064 Bytes
5415152 Bytes
5415152 Bytes


MBUF
8
0
true
195072 Bytes
5629440 Bytes
128 Bytes


MALLOC
10
0
true
6210688 Bytes
44017280 Bytes
44015728 Bytes


3
sc1
propVirtual 
1000 Bytes
down
sc1
00:04:6d:e4:c3:ff


6
VLAN-1002
propVirtual 
0 Bytes
up
VLAN 1002
00:04:6d:e4:c3:e9


8
VLAN-1005
propVirtual 
0 Bytes
up
VLAN 1005
00:04:6d:e4:c3:ec


10
2/1
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:90


26
2/17
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a0


27
2/18
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a1


28
2/19
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a2


29
2/20
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a3


30
2/21
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a4


31
2/22
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a5


32
2/23
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a6


33
2/24
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a7


34
2/25
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a8


35
2/26
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:a9


36
2/27
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:aa


37
2/28
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:ab


38
2/29
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:ac


39
2/30
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:ad


40
2/31
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:ae


41
2/32
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:af


42
2/33
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:b0


43
2/34
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:b1


44
2/35
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:b2


45
2/36
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:b3


46
2/37
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:b4


47
2/38
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:b5


48
2/39
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:b6


49
2/40
ethernetCsmacd  
1000 Bytes
up
10/100 utp ethernet (cat 3/5)
00:03:6c:11:95:b7


50
2/41
et

Re: [PHP] GET, POST, REQUEST

2006-06-22 Thread Richard Lynch
On Tue, June 20, 2006 2:38 am, Satyam wrote:
> I come from languages
> where
> you not only have to initialize a variable but have to declare it as
> well so
> initializing comes natural, I feel wrong if I don't do it, even if the
> interpreter does not care.

Just to be pedantic...

The interpreter actually DOES care, but you have to be wise enough to
enable E_NOTICE messages for the interpreter to tell you that it does
care.

You may want to get in the habit of using .htaccess to do that, as you
will be more comfy with PHP helping you catch any typos in failing to
initialize vars.

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] detect user click "stop" button in browser

2006-06-22 Thread weetat

Hi Andrei,

 I have tried the connection_aborted() in my code , however it not 
working at all , below is my code:


If i close the browser window(IE) , the script still running and call 
the difference() function as shown below:

Any ideas what is happening ? Thanks

ignore_user_abort(true);
$options = array("complexType" => "object");
$xml_util = new XMLUtil($filepath, $options);
$xml_util->unserializer_XML(false);
$xml_error = $xml_util->getXMLError();
$_logger->logdebug("xml error listflag.php", $xml_error);

if (!$xml_error) {
$data = $xml_util->getUnserializedData();
} else {
$errorMessage = 'XML file is not well-formed. Please amend XML file 
before upload.';

echo $errorMessage;
}

if (!connection_aborted()) {
$diffresult = difference($data);  logdebug("program aborted");
header('Location: ../difference.php');
exit;
}

Andrei wrote:

Check int connection_aborted ( ) in the PHP manual

Andy

weetat wrote:

Hi all,

  Can we detected if user have clicked the "X" button in browser or
close browser ?
  I have tested in my php program ,when i click "X" in IE6 , the
execution did not stop , it still running .
 Any ways to stop the program execution when user click the "X" button
or close browser ?

Thanks
- weetat



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



Re: [PHP] templating

2006-06-22 Thread Richard Lynch
On Thu, June 22, 2006 7:23 pm, tedd wrote:
> At 6:26 PM -0500 6/22/06, Richard Lynch wrote:
>>On Thu, June 22, 2006 6:10 am, Ryan A wrote:
>>> He just needs maybe 5 template
>>> pages, same pages, different color.
>>
>>For something THIS simple, I truly believe you are Better Off (tm)
>>with a simple head() and foot() function in a globals.inc file:
>>
>>function head($title = "My Site", $bgcolor = '#ff'){
>>?>
>>
>>
>>  
>>
>>  
>>  
>>>  }
>>
>>  function foot(){
>>?>
>>  
>>
>>>  }
>>?>
>>-snip-
>>

> Well... I prefer to separate the header and footer into two files and
> load them as needed in my web page. In addition, I would most
> certainly remove ALL attribute stuff that could/should be controlled
> by css out of html and php and into a css file.

Putting the stuff into CSS is fine with what I did -- I do that all
the time.

> In between the two  tags it's pretty simple to manage the
> html and keep track of div's. I never have a header or footer that
> goes beyond the body tags -- so even if there is NO html in between, I
> still have a valid page.

The header and footer frequently contain the logo, site nav, possibly
a site-wide context-sensitive nav, maybe a mailing list signup, and
then copyright and so on.

There's no need to be doing a bunch of include files to hit the HD
(expensive) separately for each.

It's also all too easy to forget one of the include files on one of
the pages and never even notice it... I've done it too many times when
I went back to add some fluff page to some ancient site. :-(

A reasonable amount of the "all the same" stuff in head() handles all
that, and the footer, in one HD seek, with matching tags between
head() and foot() in a single file.

It's also very easy to call foot() in an error condition to be sure
all tags balance.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] detect user click "stop" button in browser

2006-06-22 Thread Richard Lynch
On Thu, June 22, 2006 9:48 pm, weetat wrote:
>   I have tried the connection_aborted() in my code , however it not
> working at all , below is my code:
>
> If i close the browser window(IE) , the script still running and call
> the difference() function as shown below:
> Any ideas what is happening ? Thanks
>
> ignore_user_abort(true);

Doesn't this tell PHP:

Keep going even if the window is closed.

I think you want FALSE here...

But I never did get this to work reliably back in PHP3 days...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] GD problems

2006-06-22 Thread Richard Lynch
On Wed, June 21, 2006 1:06 pm, Beauford wrote:
> This is the output from . As far as I can
> tell,
> jpeg support is enabled. It also says it is if I run phpinfo(). Yet is
> still
> doesn't work.
>
> Anyone know of a way I can test this further. A small script perhaps.



-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] GD problems

2006-06-22 Thread Beauford
Since I know nothing of how this works, does this actually create a physical
image, and if it does I'm assuming it would be in the originating directory
from where the script was run  - if this is the case, I got nothing.

This is a moot point now as I have done what I need without using gd, but it
would be nice to find out what the problem is.

Thanks.

> Anyone know of a way I can test this further. A small script perhaps.



--
Like Music?
http://l-i-e.com/artists.htm

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

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



Re: [PHP] GD problems

2006-06-22 Thread Chris

Beauford wrote:

Since I know nothing of how this works, does this actually create a physical
image, and if it does I'm assuming it would be in the originating directory
from where the script was run  - if this is the case, I got nothing.

This is a moot point now as I have done what I need without using gd, but it
would be nice to find out what the problem is.

Thanks.


Anyone know of a way I can test this further. A small script perhaps.





It creates it in memory and it's a 50 x 50 white square.

Change the 0xff to 0xFF6600 and it should be a red square.

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

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