Re: [PHP] Attaching File to be Emailed

2006-11-24 Thread Frank Arensmeier
I think the OP was about how to send e-mail attachments - not a  
question about send a file to the client browser...


1) Read the manual about the function "mail" (especially the user notes)
http://se2.php.net/manual/en/ref.mail.php
2) Google for e.g. "php mail attachment"

Come back to this list when you have further questions.

/frank
24 nov 2006 kl. 06.30 skrev Travis Doherty:


[EMAIL PROTECTED] wrote:


I need to take a word document or pdf file from either a MySQL db or
from a
directory, which will then be sent via php script.  How can I go  
about

doing
this?  Can anyone provide sample code or point me in the right  
direction.


Brian Dunning started a thread about nine minutes before you on  
sending

a file to the browser. "Serving out a file to Firefox ... headers?"
That's pretty much all you need to do to read from a file (adding in
whatever fixes the problem he is experiencing with FireFox of course.)

If you wanted to store the data in a MySQL database it would be the  
same

procedure, except you would query the database (BLOB column type) and
echo that data instead of using readfile() to get your data.

Travis

--
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] Attaching File to be Emailed

2006-11-24 Thread David Robley
Frank Arensmeier wrote:

> I think the OP was about how to send e-mail attachments - not a
> question about send a file to the client browser...
> 
> 1) Read the manual about the function "mail" (especially the user notes)
> http://se2.php.net/manual/en/ref.mail.php
> 2) Google for e.g. "php mail attachment"
> 
> Come back to this list when you have further questions.
> 
> /frank
> 24 nov 2006 kl. 06.30 skrev Travis Doherty:
> 
>> [EMAIL PROTECTED] wrote:
>>
>>> I need to take a word document or pdf file from either a MySQL db or
>>> from a
>>> directory, which will then be sent via php script.  How can I go
>>> about
>>> doing
>>> this?  Can anyone provide sample code or point me in the right
>>> direction.
>>>
>> Brian Dunning started a thread about nine minutes before you on
>> sending
>> a file to the browser. "Serving out a file to Firefox ... headers?"
>> That's pretty much all you need to do to read from a file (adding in
>> whatever fixes the problem he is experiencing with FireFox of course.)
>>
>> If you wanted to store the data in a MySQL database it would be the
>> same
>> procedure, except you would query the database (BLOB column type) and
>> echo that data instead of using readfile() to get your data.
>>
>> Travis
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

3) Check out Phpmailer - http://phpmailer.sourceforge.net/ and the tutorial
at http://phpmailer.sourceforge.net/tutorial.html


Cheers
-- 
David Robley

Fife. n. Small shrill instrument that rhymes with wife.
Today is Pungenday, the 36th day of The Aftermath in the YOLD 3172. 

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



Re: [PHP] Attaching File to be Emailed

2006-11-24 Thread David Robley
Frank Arensmeier wrote:

> I think the OP was about how to send e-mail attachments - not a
> question about send a file to the client browser...
> 
> 1) Read the manual about the function "mail" (especially the user notes)
> http://se2.php.net/manual/en/ref.mail.php
> 2) Google for e.g. "php mail attachment"
> 
> Come back to this list when you have further questions.
> 
> /frank
> 24 nov 2006 kl. 06.30 skrev Travis Doherty:
> 
>> [EMAIL PROTECTED] wrote:
>>
>>> I need to take a word document or pdf file from either a MySQL db or
>>> from a
>>> directory, which will then be sent via php script.  How can I go
>>> about
>>> doing
>>> this?  Can anyone provide sample code or point me in the right
>>> direction.
>>>
>> Brian Dunning started a thread about nine minutes before you on
>> sending
>> a file to the browser. "Serving out a file to Firefox ... headers?"
>> That's pretty much all you need to do to read from a file (adding in
>> whatever fixes the problem he is experiencing with FireFox of course.)
>>
>> If you wanted to store the data in a MySQL database it would be the
>> same
>> procedure, except you would query the database (BLOB column type) and
>> echo that data instead of using readfile() to get your data.
>>
>> Travis
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

3) Check out Phpmailer - http://phpmailer.sourceforge.net/ and the tutorial
at http://phpmailer.sourceforge.net/tutorial.html


Cheers
-- 
David Robley

Fife. n. Small shrill instrument that rhymes with wife.
Today is Pungenday, the 36th day of The Aftermath in the YOLD 3172. 

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



RE: [PHP] RE: PHP and XML

2006-11-24 Thread Edward Kay
In that case you need to do some of your own research. Google is your
friend.

> Hello Edward
> Just i don't  now where to start.
>
>
> Edward Kay wrote:
> >
> > Hello,
> >
> > You say that you are "unable to store the files in XML". Why is
> this? Are
> > you getting an error message or do you just not know where to start?
> >
> > Edward
> >
> >> Dear All
> >>
> >> I am novice in PHP & XML, while trying I am creating a small
> application
> >> i.e. Address Book.
> >> In this I am using Apache2, PHP5 and XML no database is used.
> I have FC5
> >> machines. but I am unable to store the files in XML. If any one
> >> share their
> >> experience in this by providing Examples or tutorials etc...
> >> So far I have found tutorial related to porting the information
> >> of data from
> >> MySQL to XML and then php with help of DOM.
> >>
> >> Thanks
> >> onewaylife
> >> --
> >> View this message in context:
> >> http://www.nabble.com/PHP-and-XML-tf2692397.html#a7507917
> >> Sent from the PHP - General mailing list archive at Nabble.com.
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
> --
> View this message in context:
http://www.nabble.com/PHP-and-XML-tf2692397.html#a7517770
Sent from the PHP - General mailing list archive at Nabble.com.

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

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



[PHP] Storing objects in sessions recursively

2006-11-24 Thread Dave M G

PHP List,

I have a class called "Session", which creates an object stored in the 
$_SESSION variable. That object in turn holds on to a "User" object 
which keeps track of the activity of the individual user who has logged 
in and is using the web site. Then the $user object in turn holds on to 
an "Article" object, which keeps information about web content that the 
user is editing, previewing, and viewing.


The problem is that the "article" object keeps getting lost as the user 
clicks from page to page.


I'm hoping someone can explain to me why this might be happening.

As far as I can understand it, an object is basically just an array, and 
an object that "owns" an object as a member variable is just like 
storing an array in an array. I can't see any reason why there would be 
any limit to how many levels one could go down.


So I'm assuming there's no restriction on how many levels of objects 
owning objects there can be.


As for the code itself, I hope I don't strip out any key details, as 
it's all spread out across many classes. But here's what the basics of 
it look like:


In the User class, I have this method:

public function setCurrentArticle($currentArticle)
{
$this->currentArticle = $currentArticle;
}

In the Article class I have this line:

Session::getSession()->getUser()->setCurrentArticle($this);

In the Session class I have:

private static $session;
private $user;

public function __construct()
{
$this->user = new User();
}

public function getUser()
{
return $this->user;
}

public static function getSession()
{
if (!isset($_SESSION['session']))
{
$_SESSION['session'] = new Session();
}
return $_SESSION['session'];
}

I may have missed a detail in trying to keep this brief and readable. If 
so, please let me know and I will try to provide it.


Thank you for any advice.

--
Dave M G
Ubuntu 6.06 LTS
Kernel 2.6.17.7
Pentium D Dual Core Processor
PHP 5, MySQL 5, Apache 2

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



Re: [PHP] Storing objects in sessions recursively

2006-11-24 Thread Jochem Maas
Dave M G wrote:
> PHP List,
> 
> I have a class called "Session", which creates an object stored in the
> $_SESSION variable. That object in turn holds on to a "User" object
> which keeps track of the activity of the individual user who has logged
> in and is using the web site. Then the $user object in turn holds on to
> an "Article" object, which keeps information about web content that the
> user is editing, previewing, and viewing.
> 
> The problem is that the "article" object keeps getting lost as the user
> clicks from page to page.
> 
> I'm hoping someone can explain to me why this might be happening.
> 
> As far as I can understand it, an object is basically just an array, and

that might be true of php4 but php5 is rather more sophisticated with regard to 
objects.

> an object that "owns" an object as a member variable is just like
> storing an array in an array. I can't see any reason why there would be
> any limit to how many levels one could go down.
> 
> So I'm assuming there's no restriction on how many levels of objects
> owning objects there can be.

well you can run out of memory - but what you describe should not be a 
problem...
and it's not recursive either, it's merely some 'nesting' of objects.

are you loading the Session, User and Article classes BEFORE you start the 
session?

> 
> As for the code itself, I hope I don't strip out any key details, as
> it's all spread out across many classes. But here's what the basics of
> it look like:
> 
> In the User class, I have this method:
> 
> public function setCurrentArticle($currentArticle)
> {
> $this->currentArticle = $currentArticle;
> }
> 
> In the Article class I have this line:
> 
> Session::getSession()->getUser()->setCurrentArticle($this);

seesm to me you might as well not use an instance of the Session
class and just use it statically (i.e. creating the Session object
just seems to be overhead as afar as I can tell) e.g.

class Session
{
static function getUser()
{
if (!$_SESSION['user'] instanceof User)
throw new Exception('There is no Spoon.');

return $_SESSION['user'];
}

/* bla */
}

Session::getUser()->setCurrentArticle($this);


> 
> In the Session class I have:
> 
> private static $session;
> private $user;
> 
> public function __construct()
> {
> $this->user = new User();
> }
> 
> public function getUser()
> {
> return $this->user;
> }
> 
> public static function getSession()
> {
> if (!isset($_SESSION['session']))
> {

echo "new session object created. (was this expected)";

> $_SESSION['session'] = new Session();
> }

echo "does the session object contain an article? should it? have a look...";
var_dump($_SESSION['session']);

> return $_SESSION['session'];
> }
> 
> I may have missed a detail in trying to keep this brief and readable. If
> so, please let me know and I will try to provide it.
> 
> Thank you for any advice.

echo(), var_dump(), print_r() - keep sticking in them in your code
till you spot when/where the article object goes missing.

> 
> --
> Dave M G
> Ubuntu 6.06 LTS
> Kernel 2.6.17.7
> Pentium D Dual Core Processor
> PHP 5, MySQL 5, Apache 2
> 

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



RE: [PHP] Storing objects in sessions recursively

2006-11-24 Thread Vincent DUPONT

Hi,

are you sure you did not forget a include of the Article source code ?
You need all sources codes aiavlable (included) when getting the object back 
from the session.

vincent

-Original Message-
From: Dave M G [mailto:[EMAIL PROTECTED]
Sent: Fri 24/11/2006 11:22
To: php-general@lists.php.net
Subject: [PHP] Storing objects in sessions recursively
 
PHP List,

I have a class called "Session", which creates an object stored in the 
$_SESSION variable. That object in turn holds on to a "User" object 
which keeps track of the activity of the individual user who has logged 
in and is using the web site. Then the $user object in turn holds on to 
an "Article" object, which keeps information about web content that the 
user is editing, previewing, and viewing.

The problem is that the "article" object keeps getting lost as the user 
clicks from page to page.

I'm hoping someone can explain to me why this might be happening.

As far as I can understand it, an object is basically just an array, and 
an object that "owns" an object as a member variable is just like 
storing an array in an array. I can't see any reason why there would be 
any limit to how many levels one could go down.

So I'm assuming there's no restriction on how many levels of objects 
owning objects there can be.

As for the code itself, I hope I don't strip out any key details, as 
it's all spread out across many classes. But here's what the basics of 
it look like:

In the User class, I have this method:

public function setCurrentArticle($currentArticle)
{
$this->currentArticle = $currentArticle;
}

In the Article class I have this line:

Session::getSession()->getUser()->setCurrentArticle($this);

In the Session class I have:

private static $session;
private $user;

public function __construct()
{
$this->user = new User();
}

public function getUser()
{
return $this->user;
}

public static function getSession()
{
if (!isset($_SESSION['session']))
{
$_SESSION['session'] = new Session();
}
return $_SESSION['session'];
}

I may have missed a detail in trying to keep this brief and readable. If 
so, please let me know and I will try to provide it.

Thank you for any advice.

?--
Dave M G
Ubuntu 6.06 LTS
Kernel 2.6.17.7
Pentium D Dual Core Processor
PHP 5, MySQL 5, Apache 2

-- 
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] header

2006-11-24 Thread Jo�o C�ndido de Souza Neto
In my index.php file of my system i have got just one php tag in which it 
starts a smarty object, make a lot of includes of templates and use 
$smarty->display("index.tpl") to show the result.

Until i know, smarty do not send any data to browser before display method, 
but, in some cases i must do header(location: sompage.php") and it gives the 
follow error:

Warning: Cannot modify header information - headers already sent by (output 
started at 
/usr/local/apache2/htdocs/www2.superbanco.com.br/html/index.php:1) in 
/usr/local/apache2/htdocs/www2.superbanco.com.br/html/modules/loja/identificacao.php
 
on line 15

Anyone know why is it happen? If so, how can i avoid it?


-- 
João Cândido de Souza Neto
Curitiba Online
[EMAIL PROTECTED]
(41) 3324-2294 (41) 9985-6894
http://www.curitibaonline.com.br 

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



[PHP] Re: PHP and XML

2006-11-24 Thread Myron Turner
I'm not sure you are going about this the right way.  It's my impression 
that you may not yet have learned the basics of XML.  Really, the very 
basics are quite simple.  For your address book, for instance, you could 
create a simple XML structure such as this:















Then write a script which fills in the data.

1. Start out with the document root:
echo "";
2. Fill in the data:
echo "$first_name";
echo "$last_name";
   And so forth.

3. Finish off with the document root:
echo "";

You can include the XML header once at the top of your file:



You don't need a special class or set of third-party functions to do a 
simple task like this.  You can easily write your own, and it will parse 
with any XML parser.



Myron

onewaylife wrote:


Hello Edward
Just i don't  now where to start.


Edward Kay wrote:

Hello,

You say that you are "unable to store the files in XML". Why is this? Are
you getting an error message or do you just not know where to start?

Edward


Dear All

I am novice in PHP & XML, while trying I am creating a small application
i.e. Address Book.
In this I am using Apache2, PHP5 and XML no database is used. I have FC5
machines. but I am unable to store the files in XML. If any one
share their
experience in this by providing Examples or tutorials etc...
So far I have found tutorial related to porting the information
of data from
MySQL to XML and then php with help of DOM.

Thanks
onewaylife
--
View this message in context:
http://www.nabble.com/PHP-and-XML-tf2692397.html#a7507917
Sent from the PHP - General mailing list archive at Nabble.com.

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




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








--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



Re: [PHP] backing up a database

2006-11-24 Thread Sumeet

Brad Fuller wrote:


$command = "mysqldump -u $dbuser -p$dbpass $dbname | gzip >
$backupFile";

system($command);




what if system() has been disabled on the server?

--
Thanking You

Sumeet Shroff
http://www.prateeksha.com
Web Designers and PHP / Mysql Ecommerce Development, Mumbai India

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



[PHP] Select two table with DB_DataObject

2006-11-24 Thread Yves Tannier

Hi,

First, sorry for my bad english ;)

I'm looking for a simple way to provide query with two table like this :

SELECT t1.idperson, t1.lastname FROM table1 t1, table2 t2 WHERE
t1.idperson=t2.idperson AND t1.idperson=2

I try with joinAdd and selectAs but its always complexe query like :

SELECT t1.idperson, t1.lastname FROM table1 t1 INNER JOIN table2 t2 ect...

I can't use query() method because I need to use find() method after
(orderBy, Pager, limit ect...)

Any solution ?

Thanks !
Yves


Re: [PHP] security question

2006-11-24 Thread Richard Lynch
void session_set_cookie_params ( int lifetime [, string path [, string
domain [, bool secure [, bool httponly )

The "bool secure" part of that means you can set your cookie
parameters such that your cookies are sent/received only over SSL
connections.  Only available since PHP 4.0.4

On Thu, November 23, 2006 12:42 pm, Alain Roger wrote:
> Hi Richard,
>
> Could you be more precise on your suggestion
>
>>
>> You may want to use http://session_set_cookie_params to require the
>> your SSL cookie ONLY go through SSL, though.
>>
>
>
> i suppose you mean to use the SID in the address.
> I've never done this before and i'd be very glad to learn how to do it
> and
> to use it efficiently.
> Do you have any tutorial or help to suggest me regarding this topic ?
>
> thanks a lot,
> ALain
>


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

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



[PHP] Re: header

2006-11-24 Thread Jo�o C�ndido de Souza Neto
I found the trouble...

My index.php file had been corrupted. I deleted and recreated it and works 
fine.

Thanks a lot for your tips.

""João Cândido de Souza Neto"" <[EMAIL PROTECTED]> escreveu na 
mensagem news:[EMAIL PROTECTED]
> In my index.php file of my system i have got just one php tag in which it 
> starts a smarty object, make a lot of includes of templates and use 
> $smarty->display("index.tpl") to show the result.
>
> Until i know, smarty do not send any data to browser before display 
> method, but, in some cases i must do header(location: sompage.php") and it 
> gives the follow error:
>
> Warning: Cannot modify header information - headers already sent by 
> (output started at 
> /usr/local/apache2/htdocs/www2.superbanco.com.br/html/index.php:1) in 
> /usr/local/apache2/htdocs/www2.superbanco.com.br/html/modules/loja/identificacao.php
>  
> on line 15
>
> Anyone know why is it happen? If so, how can i avoid it?
>
>
> -- 
> João Cândido de Souza Neto
> Curitiba Online
> [EMAIL PROTECTED]
> (41) 3324-2294 (41) 9985-6894
> http://www.curitibaonline.com.br 

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



[PHP] problems re-reading from socket

2006-11-24 Thread Martin Marques

I have a daemon class which reads and answers using socket_read and 
socket_write functions. The things is that I connect to the daemon, 
sent a chain and the I get an answer, but after that the daemon get's
struck in the next socket_read.

The problem appears to be here (a method from my class). I put the 2 echos
for debugging purposses:

  function socketRead(){
echo "Vamos a leer nomas!\n";
$lectura = socket_read($this->conexion, 2048, PHP_NORMAL_READ);
echo $lectura;
return $lectura;
  }


In th output from the socket daemon I get the 2 strings (generated by 
the 2 echos), after that I get again the first echo, but no matter how
I try to send a new string to the socket, it just stays there reading 
from the socket.

By the way $this->conexion is a socket resource from socket_accept. Also
the socket reads and answers one time, so it is working, but after that 
first answer it stays reading. All this I'm testing from the console using
a telnet to the socket.

--
-
Lic. Martín Marqués |   SELECT 'mmarques' || 
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador, 
del Litoral |   Administrador
-



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



Re: [PHP] problems re-reading from socket

2006-11-24 Thread Richard Lynch
On Fri, November 24, 2006 1:21 pm, Martin Marques wrote:
> I have a daemon class which reads and answers using socket_read and
> socket_write functions. The things is that I connect to the daemon,
> sent a chain and the I get an answer, but after that the daemon get's
> struck in the next socket_read.

Have you set:
http://www.php.net/manual/en/function.socket-set-nonblock.php

It seems to me that if you don't, you are going to wait for 2048
bytes, no matter how little/much data is there...

Not an expert...

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

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



Re: [PHP] Select two table with DB_DataObject

2006-11-24 Thread Richard Lynch
On Fri, November 24, 2006 10:27 am, Yves Tannier wrote:
> First, sorry for my bad english ;)
>
> I'm looking for a simple way to provide query with two table like this
> :
>
> SELECT t1.idperson, t1.lastname FROM table1 t1, table2 t2 WHERE
> t1.idperson=t2.idperson AND t1.idperson=2
>
> I try with joinAdd and selectAs but its always complexe query like :
>
> SELECT t1.idperson, t1.lastname FROM table1 t1 INNER JOIN table2 t2
> ect...
>
> I can't use query() method because I need to use find() method after
> (orderBy, Pager, limit ect...)

I'm not quite sure what DB_DataObject is, or where it comes from...

But wherever that software came from, there is probably a better
list/forum/space to ask this, if nobody here answers.

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

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



Re: [PHP] header

2006-11-24 Thread Richard Lynch
On Fri, November 24, 2006 9:13 am, João Cândido de Souza Neto wrote:
> In my index.php file of my system i have got just one php tag in which
> it
> starts a smarty object, make a lot of includes of templates and use
> $smarty->display("index.tpl") to show the result.
>
> Until i know, smarty do not send any data to browser before display
> method,
> but, in some cases i must do header(location: sompage.php") and it

Nitpick:
header("Location: ...");
is supposed to have an "absolute URI", i.e., a full URL with http://
and everything.

> gives the
> follow error:
>
> Warning: Cannot modify header information - headers already sent by
> (output
> started at
> /usr/local/apache2/htdocs/www2.superbanco.com.br/html/index.php:1) in
> /usr/local/apache2/htdocs/www2.superbanco.com.br/html/modules/loja/identificacao.php
> on line 15

To anybody else stuck on a similar problem, the error message requires
a bit of re-reading to pull it all out into sense, but literally
EVERYTHING you need to work out what went wrong is in this error
message...

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

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



Re: [PHP] Serving out a file to Firefox ... headers?

2006-11-24 Thread Richard Lynch
On Thu, November 23, 2006 10:40 pm, Brian Dunning wrote:
> Sorry to revisit this issue YET ONE MORE TIME...  :)  :)
>
> My online store sends out the file for download upon purchase. Below
> are the headers I send, and I understood that it should work for all
> browsers. It does not work for Firefox. Suggestions?
>
> header('Content-Type: application/octet-stream');



> header('Content-Disposition: attachment; filename='.$filename);

This header is a bogus MS made-up header that "extends" the HTTP spec,
and will not work for anything but IE, and only kinda sorta works on
IE anyway...

Well, IE itself only kinda sorta works, but that's another topic or
twenty. :-)

Here is a rather long-winded rant on this very topic:
http://richardlynch.blogspot.com

You may be able to find a short and more concise version elsewhere.

OTOH, you may find the rant entertaining, as some have.




> $size = filesize('../../store/files/'.$filename);
> header('Content-Length: '.$size);
> readfile('../../store/files/'.$filename);


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

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



Re: [PHP] Problems to login via POST on a external site.

2006-11-24 Thread Richard Lynch
On Thu, November 23, 2006 11:10 am, Benny Pfitzner wrote:
> The traffic shows:
> user=seppl2&pass=seppl2&x=72&y=13
> but I don't know where the x and y values are from. They also change
> every time.

Also note that if the INPUT TYPE="image" has a NAME="foo" attribute,
the parameters change to:
foo.x=72&foo.y=13

PHP does not allow '.' in variable names, so for historic reasons
dating back to the dark ages of register_globals being "on", PHP
converts foo.x into foo_x and foo.y into foo_y, in all of
$_GET/$_POST/$_REQUEST.

And I would suspect PHP would do that in $_COOKIE as well, if you
manage to set/construct such a cookie in the first place; But I've
never tried that so don't know.

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

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



Re: [PHP] To install a small program from a web browser

2006-11-24 Thread Richard Lynch
On Thu, November 23, 2006 11:01 am, Navid wrote:
> I have a client that wants me to build a membership-based website
> soon. He has small programs for
> his members to install. He wants to post a link for them so that when
> they click on it the program
> installs on their machine automatically. I tried to discourage him
> from doing that, but he insists
> on it. His request sounds kind of fishy to me but then again it's for
> his members. Is this
> possible to do? Thanks in advance to all who can help.

Just get them all to use Windows and IE and enable ActiveX, and you're
all set. :-v

More seriously, though, you would need to explain what the program is,
what it does, how it works, etc to get a concrete answer on the
appropriate way to REALLY do this.

As it stands in the bare-bones question you've posted, the answer is:
Provide a link to an .exe file, and tell the user to run it.
Either they trust you and do that, or they don't.

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

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



Re: [PHP] PHP and XML

2006-11-24 Thread Richard Lynch
On Thu, November 23, 2006 6:57 am, onewaylife wrote:
> I am novice in PHP & XML, while trying I am creating a small
> application
> i.e. Address Book.
> In this I am using Apache2, PHP5 and XML no database is used. I have
> FC5
> machines. but I am unable to store the files in XML. If any one share
> their
> experience in this by providing Examples or tutorials etc...
> So far I have found tutorial related to porting the information of
> data from
> MySQL to XML and then php with help of DOM.

You could just slap the whole address book into a single file with:
http://php.net/file_put_contents
http://php.net/file_get_contents

This, however, will get unwieldy for more than a few hundred addresses...

To "fix" that, you're going to have to basically re-implement a bunch
of functionality that is pretty much the nuts and bolts of a database,
so I'd suggest that maybe your inexperience is causing you to make a
Bad Choice for how to go about making an address book in the first
place. :-)

Note that you could also store it all in a database, and then provide
an XML output for, say, RSS or other portable reasons. And while it's
"more" work, the extra effort of the DB will actually be LESS work
than Doing It Right with just the raw file system access you propose.

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

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



Re: [PHP] GD - Problem writing text

2006-11-24 Thread Richard Lynch
On Thu, November 23, 2006 9:30 am, Fredrik Thunberg wrote:
> imagettftext  ($im, 30,  0, 10, 40 , $black, TTF_DIR. "times.ttf",
> "Hello World!");

> FreeType Support enabled
> FreeType Linkage with freetype
> FreeType Version 2.1.3

> The one things that differs between the servers is:
> "FreeType Linkagewith TTF library" is set on the faulty one.
> Can
> this be the problem?

It sure seems suspicious to me.

Not that I can ever keep straight all those different font packages,
but  maybe you need that "other other" TTF library font format instead
of times.ttf to be installed on the non-working machine...

The only other thing would be to double-check that PHP actually can
find and read the full path to your times.ttf file, to be SURE it's
not paths/permissions getting you.

Oh.  Also try to compare any FreeType configuration files on both
machines.  I seem to recall there was some kind of config file... No,
that was the pdflib.upr file I was thinking of...  Still, any kind of
test/configuration check you can run on the font installations may
help.

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

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



Re: [PHP] problems re-reading from socket

2006-11-24 Thread Martin Marques

On Fri, 24 Nov 2006 13:41:59 -0600 (CST), "Richard Lynch" <[EMAIL PROTECTED]> 
wrote:
> On Fri, November 24, 2006 1:21 pm, Martin Marques wrote:
>> I have a daemon class which reads and answers using socket_read and
>> socket_write functions. The things is that I connect to the daemon,
>> sent a chain and the I get an answer, but after that the daemon get's
>> struck in the next socket_read.
> 
> Have you set:
> http://www.php.net/manual/en/function.socket-set-nonblock.php

If I set non-blocking, I get endless warnings when trying to accept connexions:

Warning: socket_accept(): unable to accept incoming connection [11]: Resource 
temporarily unavailable in /usr/local/php/offline/lib/daemonSocket.inc on line 
100
socket_accept() failed: reason: Success

> It seems to me that if you don't, you are going to wait for 2048
> bytes, no matter how little/much data is there...

>From the socket_read manual:

 The function socket_read() reads from the socket resource socket created by 
the 
socket_create() or socket_accept() functions. The maximum number of bytes read 
is specified by the length parameter. Otherwise you can use \r, \n, or \0 to 
end 
reading (depending on the type parameter, see below).

I'm using PHP_NORMAL_READ BTW.

--
-
Lic. Martín Marqués |   SELECT 'mmarques' || 
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador, 
del Litoral |   Administrador
-

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



Re: [PHP] Select two table with DB_DataObject

2006-11-24 Thread Yves Tannier

2006/11/24, Richard Lynch <[EMAIL PROTECTED]>:


On Fri, November 24, 2006 10:27 am, Yves Tannier wrote:
> First, sorry for my bad english ;)
>
> I'm looking for a simple way to provide query with two table like this
> :
>
> SELECT t1.idperson, t1.lastname FROM table1 t1, table2 t2 WHERE
> t1.idperson=t2.idperson AND t1.idperson=2
>
> I try with joinAdd and selectAs but its always complexe query like :
>
> SELECT t1.idperson, t1.lastname FROM table1 t1 INNER JOIN table2 t2
> ect...
>
> I can't use query() method because I need to use find() method after
> (orderBy, Pager, limit ect...)

I'm not quite sure what DB_DataObject is, or where it comes from...

But wherever that software came from, there is probably a better
list/forum/space to ask this, if nobody here answers.



So sorry. It's a mistake ;)

I've subcribe on php-general@lists.php.net but not on
[EMAIL PROTECTED]

DB_DataObject is a pear package.

bye.
Yves


<[EMAIL PROTECTED]>