[PHP] tag and PHP

2006-06-16 Thread weetat

Hi all ,

  I have a  for country in the php file . I would like to load 
the country and city belong to the country dynamically  from the database.


Anyone have ideas how to do it ?

Thanks
- weetat

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



[PHP] Re: tag and PHP

2006-06-16 Thread Barry

weetat schrieb:

Hi all ,

  I have a  for country in the php file . I would like to load 
the country and city belong to the country dynamically  from the database.


Anyone have ideas how to do it ?

Thanks
- weetat

www.php.net/foreach

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Re: tag and PHP

2006-06-16 Thread weetat

Thanks barry for input .
Barry wrote:

weetat schrieb:

Hi all ,

  I have a  for country in the php file . I would like to load 
the country and city belong to the country dynamically  from the 
database.


Anyone have ideas how to do it ?

Thanks
- weetat

www.php.net/foreach



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



Re: [PHP] tag and PHP

2006-06-16 Thread Jochem Maas
weetat wrote:
> Hi all ,
> 
>   I have a  for country in the php file . I would like to load
> the country and city belong to the country dynamically  from the database.
> 
> Anyone have ideas how to do it ?

below is a function that generates a select tag based on the
criteria you give it, the first argument, $items, you give it is the most
important - it should contain the data used to populate the list where by each
key in the array is the value of an  and the corresponding value in
the array is the display text of corresponding .

to create the $items array you would perform a query on your database and
loop the results, e.g. (untested query code)

$res = mysql_query('SELECT id, name FROM foo ORDER BY name');
if ($res && mysql_numrows($res)) {
while ($row = mysql_fetch_assoc($res)) {
$items[ $row['id'] ] = $row['name']
}
}

here is the function (linewrapping in the email may have screwed the code layout
a bit) - this function is quite old and by no means perfect (Richard Lynch gave 
good
argument as to the possible 'cons' of such a fucntion, but nonetheless here it 
is):

/** selectTag()
 *  generate an html select list using the given $items as options.
 *
 * @param   array   $items  - list of items to display as options
 * @param   array   $selected   - value of selected item in $items
 * @param   string  $selectname - value of select tag's name attribute
 * @param   numeric $addnone- add a 'blank' option to the top of the list 
(different types depending on value passed)
 * @param   string  $onchange   - value of select tag's onchange attribute
 * @param   string  $selectid   - value of select tag's id attribute
 * @param   boolean $readonly   - whether the select tag is readsonly or not
 * @param   boolean $option_class_arr   - optional CSS class names for 
individual option tags
 * @param   string  $selectHTMLattribs  - passthru HTML (attributes for the 
select tag)
 *
 * @return  string
 */
function selectTag($items, $selected = '', $selectname = '', $addnone = 0, 
$onchange = '', $selectid = '', $readonly =
0, $option_class_arr = array(), $selectHTMLattribs = '')
{
// must have an array of items
if (!is_array($items)) {
return '';
}

// determine the value of the selected item
$selected = strtolower(trim($selected));

// list of options we will generate
$opts = array();

// add item with value 0 ?
$add_none_value = 0;
switch ( $addnone )  {
case '1':   // item display = 'none'
$zero_id_item = getStr('None');
break;
case '3':   // item display = '0'
$zero_id_item = getStr('zero_digit');
break;
case '2':   // item display = 'all'
case '4':   // item display = 'all ' e.g. 'all 3'
$zero_id_item = getStr('All');
break;
default:
if(!empty($addnone) && $addnone != '0') {
if(is_array($addnone)) {
list($add_none_value, $zero_id_item) = @each($addnone);
} else {
// here we can drop in a custom 'blank' item:
$zero_id_item = $addnone;
}
}
break;
}
if (isset($zero_id_item)) {
$thisselected = ($selected > '')  ? '' : ' selected="selected"';
// FIX THE NEXT LINE - BUT NOT IMPORTANT
$class_var  = (false && 
isset($option_class_arr[IAJ_OPTION_ZERO_ITEM_CLASS_VALUE] )) ? ' class="' .
$option_class_arr[IAJ_OPTION_ZERO_ITEM_CLASS_VALUE] . '"' : '';
$opts[] = ''.$zero_id_item.'';
}

$thisselected = '';
foreach ($items as  $value => $displayname) {
$thisselected = ($selected > '' && $selected == strtolower($value)) ? ' 
selected="selected"' : '';
$class_var= (isset($option_class_arr[$value])) ? ' class="' . 
$option_class_arr[$value] . '" ' : '';
$opts[]   = ''.$displayname.'';
}

// various select tag attribute values
$onchange = (($onchange = trim($onchange)) > '')
  ? " onchange=\"$onchange\""
  : ''
  ;
$id   = ($selectid = strval($selectid))
  ? " id=\"{$selectid}\""
  : ''
  ;
$readonly = ($readonly == 1)
  ? ' readonly="readonly"'
  : ''
  ;

return "\n".
   join("\n\t", $opts).
   "\n";
}

> 
> Thanks
> - weetat
> 

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



[PHP] Javascript & PHP

2006-06-16 Thread Rob W.
Ok. I am trying to figure out if this would be the correct thing to do. I start 
off with Java script that looks like this.

/*
function getType(what,available,owner) {
var serverid = serveradd.serverid.value;
var cabinetid = serveradd.cabinetid.value;
var rowid = serveradd.rowid.value;
var dcid = serveradd.dcid.value;
var colour = serveradd.colour.value;
var spec = serveradd.spec.value;
var mainip = serveradd.mainip.value;
var oldip = serveradd.oldip.value;
var switchid = serveradd.switchid.value;
var switchport = serveradd.switchport.value;
var apcid = serveradd.apcid.value;
var apcport = serveradd.apcport.value;
document.location=('admin.php?page=serveradd&action=' + add + 
'&myid=&serverid=' + serverid + '&cabinetid=' +
cabinetid + '&rowid=' + rowid + '&dcid=' + dcid + '&colour=' + colour + 
'&spec=' + spec + '&mainip=' + mainip +
'&oldip=' + oldip + '&switchid=' + switchid + '&switchport=' + switchport + 
'&apcid=' + apcid + '&apcport=' + apcport +
'&available=' + available + '&owner=' + owner);
}*/

Do I, Before that exec's, add in my mysql get to set the variables to the java 
variables or how do I enter that in?

Any help is appricated.

-Rob

Re: [PHP] Javascript & PHP

2006-06-16 Thread Jochem Maas
Rob W. wrote:
> Ok. I am trying to figure out if this would be the correct thing to do. I 
> start off with Java script that looks like this.
> 
> /*
> function getType(what,available,owner) {
> var serverid = serveradd.serverid.value;
> var cabinetid = serveradd.cabinetid.value;
> var rowid = serveradd.rowid.value;
> var dcid = serveradd.dcid.value;
> var colour = serveradd.colour.value;
> var spec = serveradd.spec.value;
> var mainip = serveradd.mainip.value;
> var oldip = serveradd.oldip.value;
> var switchid = serveradd.switchid.value;
> var switchport = serveradd.switchport.value;
> var apcid = serveradd.apcid.value;
> var apcport = serveradd.apcport.value;
> document.location=('admin.php?page=serveradd&action=' + add + 
> '&myid=&serverid=' + serverid + '&cabinetid=' +
> cabinetid + '&rowid=' + rowid + '&dcid=' + dcid + '&colour=' + colour + 
> '&spec=' + spec + '&mainip=' + mainip +
> '&oldip=' + oldip + '&switchid=' + switchid + '&switchport=' + switchport + 
> '&apcid=' + apcid + '&apcport=' + apcport +
> '&available=' + available + '&owner=' + owner);
> }*/
> 
> Do I, Before that exec's, add in my mysql get to set the variables to the 
> java variables or how do I enter that in?


I read that line 3 times - I know its english, but the meaning escapes me... 
maybe others have the same problem.
could you rephrase the question?

> 
> Any help is appricated.
> 
> -Rob

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



Re: [PHP] Javascript & PHP

2006-06-16 Thread Rob W.
Well i'm trying to figure out how to bind the php variables to the 
javascript variables after I pull them out of the mysql database.


- Rob

- Original Message - 
From: "Jochem Maas" <[EMAIL PROTECTED]>

To: "Rob W." <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, June 16, 2006 4:13 AM
Subject: Re: [PHP] Javascript & PHP



Rob W. wrote:
Ok. I am trying to figure out if this would be the correct thing to do. I 
start off with Java script that looks like this.


/*
function getType(what,available,owner) {
var serverid = serveradd.serverid.value;
var cabinetid = serveradd.cabinetid.value;
var rowid = serveradd.rowid.value;
var dcid = serveradd.dcid.value;
var colour = serveradd.colour.value;
var spec = serveradd.spec.value;
var mainip = serveradd.mainip.value;
var oldip = serveradd.oldip.value;
var switchid = serveradd.switchid.value;
var switchport = serveradd.switchport.value;
var apcid = serveradd.apcid.value;
var apcport = serveradd.apcport.value;
document.location=('admin.php?page=serveradd&action=' + add + 
'&myid=&serverid=' + serverid + '&cabinetid=' +
cabinetid + '&rowid=' + rowid + '&dcid=' + dcid + '&colour=' + colour + 
'&spec=' + spec + '&mainip=' + mainip +
'&oldip=' + oldip + '&switchid=' + switchid + '&switchport=' + switchport 
+ '&apcid=' + apcid + '&apcport=' + apcport +

'&available=' + available + '&owner=' + owner);
}*/

Do I, Before that exec's, add in my mysql get to set the variables to the 
java variables or how do I enter that in?



I read that line 3 times - I know its english, but the meaning escapes 
me... maybe others have the same problem.

could you rephrase the question?



Any help is appricated.

-Rob


--
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] Javascript & PHP

2006-06-16 Thread Jochem Maas
Rob W. wrote:
> Well i'm trying to figure out how to bind the php variables to the
> javascript variables after I pull them out of the mysql database.

something like this? ...

$data = getServerTypeDataOrSomething();

?>




... etc


or am I missing the point completely?


> 
> - Rob
> 
> - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]>
> To: "Rob W." <[EMAIL PROTECTED]>
> Cc: 
> Sent: Friday, June 16, 2006 4:13 AM
> Subject: Re: [PHP] Javascript & PHP
> 
> 
>> Rob W. wrote:
>>> Ok. I am trying to figure out if this would be the correct thing to
>>> do. I start off with Java script that looks like this.
>>>
>>> /*
>>> function getType(what,available,owner) {
>>> var serverid = serveradd.serverid.value;
>>> var cabinetid = serveradd.cabinetid.value;
>>> var rowid = serveradd.rowid.value;
>>> var dcid = serveradd.dcid.value;
>>> var colour = serveradd.colour.value;
>>> var spec = serveradd.spec.value;
>>> var mainip = serveradd.mainip.value;
>>> var oldip = serveradd.oldip.value;
>>> var switchid = serveradd.switchid.value;
>>> var switchport = serveradd.switchport.value;
>>> var apcid = serveradd.apcid.value;
>>> var apcport = serveradd.apcport.value;
>>> document.location=('admin.php?page=serveradd&action=' + add +
>>> '&myid=&serverid=' + serverid + '&cabinetid=' +
>>> cabinetid + '&rowid=' + rowid + '&dcid=' + dcid + '&colour=' + colour
>>> + '&spec=' + spec + '&mainip=' + mainip +
>>> '&oldip=' + oldip + '&switchid=' + switchid + '&switchport=' +
>>> switchport + '&apcid=' + apcid + '&apcport=' + apcport +
>>> '&available=' + available + '&owner=' + owner);
>>> }*/
>>>
>>> Do I, Before that exec's, add in my mysql get to set the variables to
>>> the java variables or how do I enter that in?
>>
>>
>> I read that line 3 times - I know its english, but the meaning escapes
>> me... maybe others have the same problem.
>> could you rephrase the question?
>>
>>>
>>> Any help is appricated.
>>>
>>> -Rob
>>
>> -- 
>> 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] Javascript & PHP

2006-06-16 Thread Rob W.

Well for example

when I pull my mysql db variable

$serverid=mysql_result($result,$i,"serverid");

How do I bind it so this ^^ to the java var below?

var serverid = serveradd.serverid.value;

- Rob

- Original Message - 
From: "Jochem Maas" <[EMAIL PROTECTED]>

To: "Rob W." <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, June 16, 2006 4:26 AM
Subject: Re: [PHP] Javascript & PHP



Rob W. wrote:

Well i'm trying to figure out how to bind the php variables to the
javascript variables after I pull them out of the mysql database.


something like this? ...

$data = getServerTypeDataOrSomething();

?>




... etc


or am I missing the point completely?




- Rob

- Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]>
To: "Rob W." <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, June 16, 2006 4:13 AM
Subject: Re: [PHP] Javascript & PHP



Rob W. wrote:

Ok. I am trying to figure out if this would be the correct thing to
do. I start off with Java script that looks like this.

/*
function getType(what,available,owner) {
var serverid = serveradd.serverid.value;
var cabinetid = serveradd.cabinetid.value;
var rowid = serveradd.rowid.value;
var dcid = serveradd.dcid.value;
var colour = serveradd.colour.value;
var spec = serveradd.spec.value;
var mainip = serveradd.mainip.value;
var oldip = serveradd.oldip.value;
var switchid = serveradd.switchid.value;
var switchport = serveradd.switchport.value;
var apcid = serveradd.apcid.value;
var apcport = serveradd.apcport.value;
document.location=('admin.php?page=serveradd&action=' + add +
'&myid=&serverid=' + serverid + '&cabinetid=' +
cabinetid + '&rowid=' + rowid + '&dcid=' + dcid + '&colour=' + colour
+ '&spec=' + spec + '&mainip=' + mainip +
'&oldip=' + oldip + '&switchid=' + switchid + '&switchport=' +
switchport + '&apcid=' + apcid + '&apcport=' + apcport +
'&available=' + available + '&owner=' + owner);
}*/

Do I, Before that exec's, add in my mysql get to set the variables to
the java variables or how do I enter that in?



I read that line 3 times - I know its english, but the meaning escapes
me... maybe others have the same problem.
could you rephrase the question?



Any help is appricated.

-Rob


--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript & PHP

2006-06-16 Thread Jochem Maas
Rob W. wrote:
> Well for example
> 
> when I pull my mysql db variable
> 
> $serverid=mysql_result($result,$i,"serverid");
> 
> How do I bind it so this ^^ to the java var below?

(I hope english is not you first language - or maybe you
write in shorthand *and* you don't bother to reread what you
have written)

btw it's not JAVA but JAVASCRIPT.

> 
> var serverid = serveradd.serverid.value;

have you thought of something like this:




> 
> - Rob
> 
> - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]>
> To: "Rob W." <[EMAIL PROTECTED]>
> Cc: 
> Sent: Friday, June 16, 2006 4:26 AM
> Subject: Re: [PHP] Javascript & PHP
> 
> 
>> Rob W. wrote:
>>> Well i'm trying to figure out how to bind the php variables to the
>>> javascript variables after I pull them out of the mysql database.
>>
>> something like this? ...
>>
>> $data = getServerTypeDataOrSomething();
>>
>> ?>
>>
>> 
>> 
>>
>> ... etc
>>
>>
>> or am I missing the point completely?
>>
>>
>>>
>>> - Rob
>>>
>>> - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]>
>>> To: "Rob W." <[EMAIL PROTECTED]>
>>> Cc: 
>>> Sent: Friday, June 16, 2006 4:13 AM
>>> Subject: Re: [PHP] Javascript & PHP
>>>
>>>
 Rob W. wrote:
> Ok. I am trying to figure out if this would be the correct thing to
> do. I start off with Java script that looks like this.
>
> /*
> function getType(what,available,owner) {
> var serverid = serveradd.serverid.value;
> var cabinetid = serveradd.cabinetid.value;
> var rowid = serveradd.rowid.value;
> var dcid = serveradd.dcid.value;
> var colour = serveradd.colour.value;
> var spec = serveradd.spec.value;
> var mainip = serveradd.mainip.value;
> var oldip = serveradd.oldip.value;
> var switchid = serveradd.switchid.value;
> var switchport = serveradd.switchport.value;
> var apcid = serveradd.apcid.value;
> var apcport = serveradd.apcport.value;
> document.location=('admin.php?page=serveradd&action=' + add +
> '&myid=&serverid=' + serverid + '&cabinetid=' +
> cabinetid + '&rowid=' + rowid + '&dcid=' + dcid + '&colour=' + colour
> + '&spec=' + spec + '&mainip=' + mainip +
> '&oldip=' + oldip + '&switchid=' + switchid + '&switchport=' +
> switchport + '&apcid=' + apcid + '&apcport=' + apcport +
> '&available=' + available + '&owner=' + owner);
> }*/
>
> Do I, Before that exec's, add in my mysql get to set the variables to
> the java variables or how do I enter that in?


 I read that line 3 times - I know its english, but the meaning escapes
 me... maybe others have the same problem.
 could you rephrase the question?

>
> Any help is appricated.
>
> -Rob

 -- 
 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript & PHP

2006-06-16 Thread Rob W.

Yeah, I think something like that might work.

( I also know it's javascript and not java - Little tired being up @ 5am and 
havnt slept for over 24 hrs already. )


- Rob


- Original Message - 
From: "Jochem Maas" <[EMAIL PROTECTED]>

To: "Rob W." <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, June 16, 2006 4:55 AM
Subject: Re: [PHP] Javascript & PHP



Rob W. wrote:

Well for example

when I pull my mysql db variable

$serverid=mysql_result($result,$i,"serverid");

How do I bind it so this ^^ to the java var below?


(I hope english is not you first language - or maybe you
write in shorthand *and* you don't bother to reread what you
have written)

btw it's not JAVA but JAVASCRIPT.



var serverid = serveradd.serverid.value;


have you thought of something like this:






- Rob

- Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]>
To: "Rob W." <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, June 16, 2006 4:26 AM
Subject: Re: [PHP] Javascript & PHP



Rob W. wrote:

Well i'm trying to figure out how to bind the php variables to the
javascript variables after I pull them out of the mysql database.


something like this? ...

$data = getServerTypeDataOrSomething();

?>





... etc


or am I missing the point completely?




- Rob

- Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]>
To: "Rob W." <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, June 16, 2006 4:13 AM
Subject: Re: [PHP] Javascript & PHP



Rob W. wrote:

Ok. I am trying to figure out if this would be the correct thing to
do. I start off with Java script that looks like this.

/*
function getType(what,available,owner) {
var serverid = serveradd.serverid.value;
var cabinetid = serveradd.cabinetid.value;
var rowid = serveradd.rowid.value;
var dcid = serveradd.dcid.value;
var colour = serveradd.colour.value;
var spec = serveradd.spec.value;
var mainip = serveradd.mainip.value;
var oldip = serveradd.oldip.value;
var switchid = serveradd.switchid.value;
var switchport = serveradd.switchport.value;
var apcid = serveradd.apcid.value;
var apcport = serveradd.apcport.value;
document.location=('admin.php?page=serveradd&action=' + add +
'&myid=&serverid=' + serverid + '&cabinetid=' +
cabinetid + '&rowid=' + rowid + '&dcid=' + dcid + '&colour=' + colour
+ '&spec=' + spec + '&mainip=' + mainip +
'&oldip=' + oldip + '&switchid=' + switchid + '&switchport=' +
switchport + '&apcid=' + apcid + '&apcport=' + apcport +
'&available=' + available + '&owner=' + owner);
}*/

Do I, Before that exec's, add in my mysql get to set the variables to
the java variables or how do I enter that in?



I read that line 3 times - I know its english, but the meaning escapes
me... maybe others have the same problem.
could you rephrase the question?



Any help is appricated.

-Rob


--
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 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] Automatic email sending

2006-06-16 Thread Murtaza Chang

Hi everyone, my website need to automatically send an email to people
when thier account is about to expire, but iam not sure how to do it.
In other words its easy to put a check if an account is about to
expire and send automatic email when admin logs in to system, but how
is it possible to do it in background.


--
Murtaza Chang
http://dirtinme.blogspot.com/
A Place to throw personal trash

http://milddreamerz.blogspot.com
For Photoshopers And Digital Art Enthusiasts

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



Re: [PHP] Automatic email sending

2006-06-16 Thread Rob W.
If you have a unix box, Use cron to run a script to exec a php file to do 
it.


If you have a windows box, you can setup a scheduled time to run a php file 
as well.


- Rob

- Original Message - 
From: "Murtaza Chang" <[EMAIL PROTECTED]>

To: ; 
Sent: Friday, June 16, 2006 5:15 AM
Subject: [PHP] Automatic email sending



Hi everyone, my website need to automatically send an email to people
when thier account is about to expire, but iam not sure how to do it.
In other words its easy to put a check if an account is about to
expire and send automatic email when admin logs in to system, but how
is it possible to do it in background.


--
Murtaza Chang
http://dirtinme.blogspot.com/
A Place to throw personal trash

http://milddreamerz.blogspot.com
For Photoshopers And Digital Art Enthusiasts

--
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] Re: File Download Headers

2006-06-16 Thread tedd
At 1:44 AM -0400 6/16/06, Chris Shiflett wrote:
>Richard Lynch wrote:
>>It is possible that all "modern" browsers have given
>>in to whichever johnny-come-lately 'standard' made
>>up the Content-disposition header.
>
>The original RFC for it is dated June 1995, so it's not too recent. There are 
>plenty of useful aspects of HTTP not defined in RFC 2616.
>
>>Content-type: application/octet-stream
>
>There's no reason you can't use both.
>
>Chris

Chris:

Barry says you can use these three:

header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");

Richard says only use this one:

header("Content-type: application/octet-stream");

And, you say use both.  Which both?

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



Fwd: [PHP] Automatic email sending

2006-06-16 Thread kartikay malhotra

u can use PHP as an offline scripting language. it gives u the power of PHP
without the web interface. see tutorial on that. make a PHP and run it in
the background by appending &.

Or add it to  /etc/rc.d/rc.local/ and run it automatically from system
startup onwards

KM


On 6/16/06, Murtaza Chang <[EMAIL PROTECTED]> wrote:


Hi everyone, my website need to automatically send an email to people
when thier account is about to expire, but iam not sure how to do it.
In other words its easy to put a check if an account is about to
expire and send automatic email when admin logs in to system, but how
is it possible to do it in background.


--
Murtaza Chang
http://dirtinme.blogspot.com/
A Place to throw personal trash

http://milddreamerz.blogspot.com
For Photoshopers And Digital Art Enthusiasts

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




Re: [PHP] Re: File Download Headers

2006-06-16 Thread Barry

tedd schrieb:

At 1:44 AM -0400 6/16/06, Chris Shiflett wrote:

Richard Lynch wrote:

It is possible that all "modern" browsers have given
in to whichever johnny-come-lately 'standard' made
up the Content-disposition header.

The original RFC for it is dated June 1995, so it's not too recent. There are 
plenty of useful aspects of HTTP not defined in RFC 2616.


Content-type: application/octet-stream

There's no reason you can't use both.

Chris


Chris:

Barry says you can use these three:

header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");

Richard says only use this one:

header("Content-type: application/octet-stream");

And, you say use both.  Which both?

tedd


Either my three or the one richard mentioned.

Both are ok!

:)

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Re: Automatic email sending

2006-06-16 Thread Barry

Murtaza Chang schrieb:

Hi everyone, my website need to automatically send an email to people
when thier account is about to expire, but iam not sure how to do it.
In other words its easy to put a check if an account is about to
expire and send automatic email when admin logs in to system, but how
is it possible to do it in background.



Another solution.

Take the Page which is most viewed and put the function that checks in it.

So you have a very high possibility that it will run at least once a day.

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] file_exists() behind firewall

2006-06-16 Thread tedd
At 7:57 AM +0100 6/16/06, George Pitcher wrote:
>Hi,
>
>I have several websites that are using a common set of pages (to reduce
>maintenance, development and upgrading) and use configuration files to give
>the customer the feeling that it is their own unique site. The customers are
>all universities and use the sites to manage digitisation and copyright
>permission processes. These sites are all hosted om my company server.
>
>I would like them to be able to see whether a PDF file hosted by their
>universities is available or not.
>
>Using file_exists($url) won't work because the actual PDFs should be sitting
>behind the universities' firewalls.
>
>I think that something working on the client-side, such as JavaScript might
>work, because it would be able to look from the client's machine to the PDF,
>both of which should be behind the firewall to the PDF. However, I haven't
>been able to find any js that looks like it will do that for me.
>
>Does anyone have any constructive suggestions?
>
>MTIA
>
>George in Oxford

George in Oxford:

If it were my problem, I wouldn't use js.

Instead, I would setup cron scripts at each of the universities, which would 
scan the PDF folders for PDF files once a day and then send a report (files and 
urls) to a common dB located at your choice.

The common PDF-dB would be a repository for the existence and location of the 
PDF files and permissions would be granted to those universities and 
departments wanting to search your PDF-dB.

The only requirement here is that each University place it's PDF's in a 
location that's known to your cron script AND that a password protection scheme 
be adapted by those wanting to review IF certain PDF's are available.

Now, if someone searches your PDF-dB and finds a PDF they want to review, it's 
a simple matter to link and download the file once the url is known.

At least, that's the way I would do it.

You may make a contribution to me via PayPal :-)

hth's

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] Re: File Download Headers

2006-06-16 Thread tedd
At 12:44 PM +0200 6/16/06, Barry wrote:
>tedd schrieb:
>>At 1:44 AM -0400 6/16/06, Chris Shiflett wrote:
>>>Richard Lynch wrote:
It is possible that all "modern" browsers have given
in to whichever johnny-come-lately 'standard' made
up the Content-disposition header.
>>>The original RFC for it is dated June 1995, so it's not too recent. There 
>>>are plenty of useful aspects of HTTP not defined in RFC 2616.
>>>
Content-type: application/octet-stream
>>>There's no reason you can't use both.
>>>
>>>Chris
>>
>>Chris:
>>
>>Barry says you can use these three:
>>
>>header("Content-Type: application/force-download");
>>header("Content-Type: application/octet-stream");
>>header("Content-Type: application/download");
>>
>>Richard says only use this one:
>>
>>header("Content-type: application/octet-stream");
>>
>>And, you say use both.  Which both?
>>
>>tedd
>>
>Either my three or the one richard mentioned.
>
>Both are ok!
>
>:)
>
>Barry


Ahaaa, those four both.

I get it, thanks.

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



[PHP] How to run one php app from another? RECAP

2006-06-16 Thread tedd
Hi gang:

So, there is NOT a way for one running php-application to call another and have 
it run while having the parent quit?

For example, program "a" runs and presents the user with a web page. The user 
responds in some fashion (i.e., enters text) and clicks "Submit". Then the 
application analyzes the data and chooses to run application "d" from a list of 
possible applications. NOTE: This is different than the user clicking a link to 
run application "d". It is application "a" that's making the choice to run "d", 
not the user. Can this be done?

Let me recap the solutions offered:

1. There was the suggestion to use includes(). However, includes simply adds 
code into the current application. It does not terminate the parent nor start 
another application. It simply bloats the parent.

2. There was the suggestion to use ob_start with header("Location: ..."); and 
finish with ob_flush. However, the parent application never shows itself -- the 
process simply cascades down to the end application. In this case, the parent 
(as in the example above) would never show the user the text-box to enter 
his/her text.

3. There was the suggestion to use js, which works and is the way I'm doing it 
now. However, I wanted a php solution.

So, what say you fine php people, can anyone give me an example of a php 
application running (i.e., calling) another? I suspect that php can't, but I 
don't know why -- it doesn't seem logical. Is this one of those stateless 
problematic thingies, or what?

Thanks.

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



[PHP] Re: How to run one php app from another? RECAP

2006-06-16 Thread Barry

tedd schrieb:

1. There was the suggestion to use includes(). However, includes simply adds 
code into the current application. It does not terminate the parent nor start 
another application. It simply bloats the parent.


Well it would if the webpage showed would also be included.
You have one main code header which chooses what action to do and which 
code to load.

So every app would have that code header.
Applications run normally like that.

You could even have tha analyzing done with include.

But once output is made. You can't remove it.

That isn't possible with PHP.

Anything before that would not be seen by the user so you can do a lots 
of things before you output actually something.


Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Simple class declaration returns error [SOLVED]

2006-06-16 Thread Dave M G

Jochem,

Thank you for your advice. I was able to use your suggested code to 
develop the results I wanted.


I found I could simplify the "self" references down to just the name of 
the class.


The syntax I ended up with is

class database {
private static $database;
public static function getDB()
{
if (!isset($database))
$database = new database();
return $database;
}
private function __construct()
{
  $this->dbConnect();
}
private function dbConnect()
{
// Database connection
  return $result;
}
public function getData($type, $id)
{
// SQL Query
return $data;
}


And I call it like this:
$data = database::getDB()->getData($arg1, arg2);

Thank you for your time and advice.

--
Dave M G

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



Re: [PHP] Simple class declaration returns error [SOLVED]

2006-06-16 Thread Jochem Maas
Dave M G wrote:
> Jochem,
> 
> Thank you for your advice. I was able to use your suggested code to
> develop the results I wanted.
> 
> I found I could simplify the "self" references down to just the name of
> the class.

that sounds backwards - self == 'database' with the added bonus that if you
change tyhe class name you don't have to change the code inside the class
because self == 'yournewclassname'; not a deal breaker though.

another tip (going on the code you showed here): use indentation, and
use it consequently - it helps code readability/maintainability

> 
> The syntax I ended up with is
> 
> class database {
> private static $database;
> public static function getDB()
> {
> if (!isset($database))
> $database = new database();
> return $database;
> }
> private function __construct()
> {
>   $this->dbConnect();
> }
> private function dbConnect()
> {
> // Database connection
>   return $result;
> }
> public function getData($type, $id)
> {
> // SQL Query
> return $data;
> }
> 
> 
> And I call it like this:
> $data = database::getDB()->getData($arg1, arg2);

looks good; you might consider doing this instead:

// 'davedb' is short than 'database' :-)
class davedb {
// all the stuff from your class example here

public static function gd($type, $id)
{
return self::getDB()->getData($type, $id);
}
}

which allows for writing a little less code e.g.:

$data = davedb::gd(arg1, arg2);

my function names may not be any good but hopefully you get the idea.

> 
> Thank you for your time and advice.

no worries :-)

> 
> -- 
> Dave M G
> 

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



Re: [PHP] Re: File Download Headers

2006-06-16 Thread Chris Shiflett

tedd wrote:

Barry says you can use these three:

header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");

Richard says only use this one:

header("Content-type: application/octet-stream");

And, you say use both.


Both Content-Type and Content-Disposition.

Richard's example is the correct Content-Type to use. Barry's is no 
different than this:


header('Content-Type: foo/bar');

It's better to use a valid type and to not have superfluous header() 
calls that do nothing.


Hope that helps.

Chris

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



[PHP] bcdiv() function not recognized

2006-06-16 Thread Mauricio Pellegrini
Hi all, 
I'm usuing bcdiv like this

> $someVar=bcdiv($timedifference,86400);

and it works perfectly on my local server apache 1.329 , php 4.34 and
suse 8.2


But when I put that module on the production server I get this error 

Fatal error:Call to undefined function:bcdiv() in /www/tst.php on line 9




Production Server is Suse 8.2 apache 1.329 php 4.34 


What could be the problem here ?


Thanks
 Mauricio

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



[PHP] Re: How to run one php app from another? RECAP

2006-06-16 Thread tedd
At 2:35 PM +0200 6/16/06, Barry wrote:
>But once output is made. You can't remove it.
>
>That isn't possible with PHP.

I think I get it now.

PHP does everything before the user see's anything. Any links (direct or via a 
form) are objects that the browser can act upon per the user through html or 
js, but not php. Interesting.

Thanks.

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] bcdiv() function not recognized

2006-06-16 Thread Jochem Maas
Mauricio Pellegrini wrote:
> Hi all, 
> I'm usuing bcdiv like this

(you wouldn't believe the number of times I type 'I sue' instead
of 'I use' - and I don't even live on the continental US ;-)

> 
>> $someVar=bcdiv($timedifference,86400);
> 
> and it works perfectly on my local server apache 1.329 , php 4.34 and
> suse 8.2
> 
> 
> But when I put that module on the production server I get this error 
> 
> Fatal error:Call to undefined function:bcdiv() in /www/tst.php on line 9

the bc extension is not available on the production server it seems
(have a look at the output of phpinfo() to see if '--enable-bcmath'
is part of the configure line, my guess it that it's not.

more info on this here: http://php.net/bc

> 
> 
> 
> 
> Production Server is Suse 8.2 apache 1.329 php 4.34 
> 
> 
> What could be the problem here ?
> 
> 
> Thanks
>  Mauricio
> 

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



Re: [PHP] How to run one php app from another? RECAP

2006-06-16 Thread Rabin Vincent

On 6/16/06, tedd <[EMAIL PROTECTED]> wrote:

So, what say you fine php people, can anyone give me an example of a php 
application running (i.e., calling) another?


What about something like the code below? I use an extension of
that to fake some threading/multi-processing.

echo file_get_contents('http://domain.com/other.php');
exit;

Rabin

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



[PHP] Need to recompile php 4.3.4

2006-06-16 Thread Mauricio Pellegrini
Hi , 
In order to enable bcmath I need to recompile php 4.3.4 on suse 8.2.


but , I would like to preserve the actual installation just in case
anything goes wrong ( as this is my production server)

What files should I backup / restore if after compilation php is not
working?


My actual installation consists of php 4.3.4 With the Zend Optimizer
and apache 1.329 


Thanks 
MAuricio

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



Re: [PHP] How to run one php app from another? RECAP

2006-06-16 Thread Martin Alterisio

2006/6/16, tedd <[EMAIL PROTECTED]>:


Hi gang:

So, there is NOT a way for one running php-application to call another and
have it run while having the parent quit?

For example, program "a" runs and presents the user with a web page. The
user responds in some fashion (i.e., enters text) and clicks "Submit".
Then the application analyzes the data and chooses to run application "d"
from a list of possible applications. NOTE: This is different than the user
clicking a link to run application "d". It is application "a" that's making
the choice to run "d", not the user. Can this be done?

Let me recap the solutions offered:

1. There was the suggestion to use includes(). However, includes simply
adds code into the current application. It does not terminate the parent nor
start another application. It simply bloats the parent.

2. There was the suggestion to use ob_start with header("Location: ...");
and finish with ob_flush. However, the parent application never shows itself
-- the process simply cascades down to the end application. In this case,
the parent (as in the example above) would never show the user the text-box
to enter his/her text.

3. There was the suggestion to use js, which works and is the way I'm
doing it now. However, I wanted a php solution.

So, what say you fine php people, can anyone give me an example of a php
application running (i.e., calling) another? I suspect that php can't, but
I don't know why -- it doesn't seem logical. Is this one of those stateless
problematic thingies, or what?

Thanks.

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



You can fork a new process a run the other script in the child process. But
forking is not always available so I also use another approach: emulate a
web page request through sockets or curl to the script I want to run.


[PHP] Serving a graphic downloads it instead of displaying it

2006-06-16 Thread Brian Dunning

I'm trying to serve up a jpeg like this:

header("Content-type: image/jpg");
readfile('images/banner-ad.jpg');

It works on other browsers, but on Safari it downloads the graphic  
like a file, rather than displaying it. What's up with that


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



[PHP] Re: tag and PHP

2006-06-16 Thread Manuel Lemos
Hello,

on 06/16/2006 04:46 AM weetat said the following:
>   I have a  for country in the php file . I would like to load
> the country and city belong to the country dynamically  from the database.
> 
> Anyone have ideas how to do it ?

Take a look at this forms class. It comes with a linked select custom
input plug-in that does exactly what you want.

It can switch the group of options of one select input when another
linked input changes its value.

It can use static arrays to define groups of options or retrieve them
dynamically from a database using AJAX.

Here is the class

http://www.phpclasses.org/formsgenaration

Here is an example of a form with linked select inputs generated with
the class:

http://www.phpclasses.org/browse/view/html/file/9879/name/test_linked_select_page.html


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

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

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



RE: [PHP] Re: File Download Headers

2006-06-16 Thread Kristen G. Thorson
> -Original Message-
> From: Chris Shiflett [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 16, 2006 9:11 AM
> To: tedd
> Cc: [EMAIL PROTECTED]; Barry; php-general@lists.php.net
> Subject: Re: [PHP] Re: File Download Headers
> 
> tedd wrote:
> > Barry says you can use these three:
> >
> > header("Content-Type: application/force-download");
> > header("Content-Type: application/octet-stream");
> > header("Content-Type: application/download");
> >
> > Richard says only use this one:
> >
> > header("Content-type: application/octet-stream");
> >
> > And, you say use both.
> 
> Both Content-Type and Content-Disposition.
> 
> Richard's example is the correct Content-Type to use. Barry's is no
> different than this:
> 
> header('Content-Type: foo/bar');
> 
> It's better to use a valid type and to not have superfluous header()
> calls that do nothing.
> 
> Hope that helps.
> 
> Chris


When you have three lines setting the same header, you're just replacing
one with the other anyways:

header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");

The actual header being sent for Content-Type in this case is
"application/download".  The first two are not sent unless you remember
to use the second parameter of header().

http://us2.php.net/manual/en/function.header.php



kgt

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



Re: [PHP] Serving a graphic downloads it instead of displaying it

2006-06-16 Thread Richard Lynch
On Fri, June 16, 2006 9:30 am, Brian Dunning wrote:
> I'm trying to serve up a jpeg like this:
>
> header("Content-type: image/jpg");
> readfile('images/banner-ad.jpg');
>
> It works on other browsers, but on Safari it downloads the graphic
> like a file, rather than displaying it. What's up with that

Perhaps the image file itself is not quite a kosher JPEG, and Safari
is getting confused?...

What happens when Safari surfs directly to images/banner-ad.jpg ?

-- 
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] Serving a graphic downloads it instead of displaying it

2006-06-16 Thread Mariano Guadagnini

Brian Dunning wrote:

I'm trying to serve up a jpeg like this:

header("Content-type: image/jpg");
readfile('images/banner-ad.jpg');

It works on other browsers, but on Safari it downloads the graphic 
like a file, rather than displaying it. What's up with that


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



--No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.0/367 - Release Date: 16/06/2006


Maybe you can try to embed the image in a blank html, inside  tag 
for example, to show only the image you want.



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.0/367 - Release Date: 16/06/2006

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



Re: [PHP] How to run one php app from another? RECAP

2006-06-16 Thread Richard Lynch
On Fri, June 16, 2006 7:26 am, tedd wrote:
> So, there is NOT a way for one running php-application to call another
> and have it run while having the parent quit?

> 1. There was the suggestion to use includes(). However, includes
> simply adds code into the current application. It does not terminate
> the parent nor start another application. It simply bloats the parent.

This is actually going to be the cheapest thing to do.

If there is monstrous data in the "parent" you could unset() it and
reduce "bloat"

But, really, the "cost" here is a hard drive seek to get the other
script, and you're going to incur that cost no matter what other
solution you use.

So this IS the cheapest way to achieve what you want.

> So, what say you fine php people, can anyone give me an example of a
> php application running (i.e., calling) another? I suspect that php
> can't, but I don't know why -- it doesn't seem logical. Is this one of
> those stateless problematic thingies, or what?

You could do an exec() and have the program being executed fork or use
& and then the parent would quit, but once the parent quits, you lose
your connection to the browser and stdout/stdin and all that for the
child.

You could also do a "Location:" header, but again losing all the data
from parent application, unless you pass it in URL or $_SESSION.

-- 
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] Re: How to run one php app from another? RECAP

2006-06-16 Thread Richard Lynch
On Fri, June 16, 2006 8:26 am, tedd wrote:
> At 2:35 PM +0200 6/16/06, Barry wrote:
>>But once output is made. You can't remove it.
>>
>>That isn't possible with PHP.
>
> I think I get it now.
>
> PHP does everything before the user see's anything.

This is not quite 100% correct...

PHP output is buffered, possibly by PHP with ob_start and friends, and
then possibly by Apache, and then possibly by TCP packets and their
ordered arrival (or not) and then by the browser, but...

It is entirely possible to construct a trivial example proving that
PHP can still be runing and finishing output while the browser has
rendered the beginning of the page.

You can mostly THINK of it as PHP finishing before user sees anything,
as that will get you in a lot less trouble than thinking the other way
around, but to be pedantic, you should be aware it's not quite that
simple.

-- 
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] How to run one php app from another? RECAP

2006-06-16 Thread Richard Lynch
On Fri, June 16, 2006 9:25 am, Martin Alterisio wrote:
> You can fork a new process a run the other script in the child
> process. But
> forking is not always available so I also use another approach:
> emulate a
> web page request through sockets or curl to the script I want to run.

Forking in a web environment is a Bad Idea, as documented in the manual.

YMMV

-- 
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] Re: How to run one php app from another? RECAP

2006-06-16 Thread tedd
At 3:52 PM -0500 6/16/06, Richard Lynch wrote:
>On Fri, June 16, 2006 8:26 am, tedd wrote:
>> At 2:35 PM +0200 6/16/06, Barry wrote:
>>>But once output is made. You can't remove it.
>>>
>>>That isn't possible with PHP.
>>
>> I think I get it now.
>>
>> PHP does everything before the user see's anything.
>
>This is not quite 100% correct...
>
>PHP output is buffered, possibly by PHP with ob_start and friends, and
>then possibly by Apache, and then possibly by TCP packets and their
>ordered arrival (or not) and then by the browser, but...
>
>It is entirely possible to construct a trivial example proving that
>PHP can still be runing and finishing output while the browser has
>rendered the beginning of the page.
>
>You can mostly THINK of it as PHP finishing before user sees anything,
>as that will get you in a lot less trouble than thinking the other way
>around, but to be pedantic, you should be aware it's not quite that
>simple.

Good explanation and point.

How's this for the obvious -- the user doesn't see anything until php is done 
with it. That doesn't mean that the entire operation must be finished, but 
rather anything that the user see's (while and after loading) php has already 
finished with.

That about right?

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] Javascript & PHP

2006-06-16 Thread Richard Lynch
On Fri, June 16, 2006 3:51 am, Rob W. wrote:
> Ok. I am trying to figure out if this would be the correct thing to
> do. I start off with Java script that looks like this.

As far as PHP is concerned, Javascript is just "more HTML".

Just cram it into the text of your HTML, or put it into a .js file and
do it like that.

-- 
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] file_exists() behind firewall

2006-06-16 Thread Richard Lynch
I dunno if AJAX will let you quit partway through, but you could
definitely do this with the lean and mean hand-coded XmlHttpRequest
object and sending HEAD to see if the URL is "there" or not.

It will fail, of course, if they run this app from home or anything
not behind the firewall.

On Fri, June 16, 2006 1:57 am, George Pitcher wrote:
> Hi,
>
> I have several websites that are using a common set of pages (to
> reduce
> maintenance, development and upgrading) and use configuration files to
> give
> the customer the feeling that it is their own unique site. The
> customers are
> all universities and use the sites to manage digitisation and
> copyright
> permission processes. These sites are all hosted om my company server.
>
> I would like them to be able to see whether a PDF file hosted by their
> universities is available or not.
>
> Using file_exists($url) won't work because the actual PDFs should be
> sitting
> behind the universities' firewalls.
>
> I think that something working on the client-side, such as JavaScript
> might
> work, because it would be able to look from the client's machine to
> the PDF,
> both of which should be behind the firewall to the PDF. However, I
> haven't
> been able to find any js that looks like it will do that for me.
>
> Does anyone have any constructive suggestions?
>
> MTIA
>
> George in Oxford
>
> --
> 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



Re: [PHP] Re: File Download Headers

2006-06-16 Thread Richard Lynch


I have now officially GIVEN UP on this thread.

On Fri, June 16, 2006 6:03 am, tedd wrote:
> At 12:44 PM +0200 6/16/06, Barry wrote:
>>tedd schrieb:
>>>At 1:44 AM -0400 6/16/06, Chris Shiflett wrote:
Richard Lynch wrote:
>It is possible that all "modern" browsers have given
>in to whichever johnny-come-lately 'standard' made
>up the Content-disposition header.
The original RFC for it is dated June 1995, so it's not too recent.
 There are plenty of useful aspects of HTTP not defined in RFC 2616.

>Content-type: application/octet-stream
There's no reason you can't use both.

Chris
>>>
>>>Chris:
>>>
>>>Barry says you can use these three:
>>>
>>>header("Content-Type: application/force-download");
>>>header("Content-Type: application/octet-stream");
>>>header("Content-Type: application/download");
>>>
>>>Richard says only use this one:
>>>
>>>header("Content-type: application/octet-stream");
>>>
>>>And, you say use both.  Which both?
>>>
>>>tedd
>>>
>>Either my three or the one richard mentioned.
>>
>>Both are ok!
>>
>>:)
>>
>>Barry
>
>
> Ahaaa, those four both.
>
> I get it, thanks.
>
> 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
>
>


-- 
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] Javascript & PHP

2006-06-16 Thread tedd
At 4:06 PM -0500 6/16/06, Richard Lynch wrote:
>On Fri, June 16, 2006 3:51 am, Rob W. wrote:
>> Ok. I am trying to figure out if this would be the correct thing to
>> do. I start off with Java script that looks like this.
>
>As far as PHP is concerned, Javascript is just "more HTML".

As far as PHP is concerned, whatever follows is irrelevant -- it could be 
nothing or anything including gibberish. PHP doesn't fail because of bad html 
of js, does it? After all, it all happens after php is cyberdust, right?

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] Re: How to run one php app from another? RECAP

2006-06-16 Thread Richard Lynch
On Fri, June 16, 2006 4:04 pm, tedd wrote:
> How's this for the obvious -- the user doesn't see anything until php
> is done with it. That doesn't mean that the entire operation must be
> finished, but rather anything that the user see's (while and after
> loading) php has already finished with.
>
> That about right?

Yes -- Though your concept of PHP being "finished with" and the
Reality *might* not match up.

They probably will, but, for example, if you had all of "War and
Peace" in $foo and did:

echo $foo;

I am not going to guarantee that PHP won't send it out chapter by
chapter and PHP won't be "finished" with the echo before the browser
gets and renders Chapter 1.

-- 
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] How to run one php app from another? RECAP

2006-06-16 Thread tedd
At 3:48 PM -0500 6/16/06, Richard Lynch wrote:
>On Fri, June 16, 2006 7:26 am, tedd wrote:
>> So, there is NOT a way for one running php-application to call another
>> and have it run while having the parent quit?
>
>> 1. There was the suggestion to use includes(). However, includes
>> simply adds code into the current application. It does not terminate
>> the parent nor start another application. It simply bloats the parent.
>
>This is actually going to be the cheapest thing to do.
>
>If there is monstrous data in the "parent" you could unset() it and
>reduce "bloat"
>
>But, really, the "cost" here is a hard drive seek to get the other
>script, and you're going to incur that cost no matter what other
>solution you use.
>
>So this IS the cheapest way to achieve what you want.
>
>> So, what say you fine php people, can anyone give me an example of a
>> php application running (i.e., calling) another? I suspect that php
>> can't, but I don't know why -- it doesn't seem logical. Is this one of
>> those stateless problematic thingies, or what?
>
>You could do an exec() and have the program being executed fork or use
>& and then the parent would quit, but once the parent quits, you lose
>your connection to the browser and stdout/stdin and all that for the
>child.
>
>You could also do a "Location:" header, but again losing all the data
>from parent application, unless you pass it in URL or $_SESSION.
>

Thanks for the additional information -- much to consider here.

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] Re: File Download Headers

2006-06-16 Thread Larry Garfield
On Friday 16 June 2006 08:10, Chris Shiflett wrote:

> Richard's example is the correct Content-Type to use. Barry's is no
> different than this:
>
> header('Content-Type: foo/bar');
>
> It's better to use a valid type and to not have superfluous header()
> calls that do nothing.
>
> Hope that helps.
>
> Chris

I think Richard's point, though, was that while it does nothing now, you have 
no way of knowing when it will start having meaning.  Sending garbage headers 
is sloppy, and opens yourself up to the environment changing out from under 
you.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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



Re: [PHP] Need to recompile php 4.3.4

2006-06-16 Thread chris smith

On 6/17/06, Mauricio Pellegrini <[EMAIL PROTECTED]> wrote:

Hi ,
In order to enable bcmath I need to recompile php 4.3.4 on suse 8.2.


but , I would like to preserve the actual installation just in case
anything goes wrong ( as this is my production server)

What files should I backup / restore if after compilation php is not
working?


My actual installation consists of php 4.3.4 With the Zend Optimizer
and apache 1.329


Install them in different paths (configure --prefix=...), it will make
it a lot easier.

If you installed originally from rpms, you should be able to find
where it put stuff (rpm -qpl php I think).. If you compiled then
phpinfo will show you the original prefix and you can backup that
structure.

Not sure whether ZO will cope with that, but I guess you'll soon find out ;)

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

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