php-general Digest 30 Apr 2010 17:14:11 -0000 Issue 6720

Topics (messages 304765 through 304786):

Re: Getting root privs
        304765 by: Jim Lucas
        304766 by: Nilesh Govindarajan
        304779 by: Paul M Foster
        304780 by: Ashley Sheridan
        304781 by: Nilesh Govindarajan
        304782 by: Nilesh Govindarajan
        304783 by: Ashley Sheridan

Re: Two color rows in table inside while iteration
        304767 by: Daevid Vincent
        304771 by: Richard Quadling
        304772 by: Jay Blanchard
        304776 by: Paul M Foster
        304777 by: Ashley Sheridan
        304778 by: Jay Ess

Re: CURL cannot connect to URL - IP address - after successful connection
        304768 by: Pete Ford
        304769 by: ioannes.btinternet.com

Re: In need of CVS/SVN checkout script for Production servers
        304770 by: David Otton

ldap add Invalid DN syntax
        304773 by: Manolis Vlachakis
        304774 by: Ashley Sheridan
        304775 by: Manolis Vlachakis

How to simplify the management of 250+ nodes and 1000+ users , in Drupal
        304784 by: ebhakt

How to Force IE to download text file?
        304785 by: Ali Asghar Toraby Parizy
        304786 by: Andre Polykanine

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Nilesh Govindarajan wrote:
> Hi,
> 
> As you know there are lot of control panels lying around like Cpanel,
> Lxadmin, most of them based on PHP. The control panels allow editing of
> system files which requires root privileges, can somebody tell me how to
> gain root privileges inside the script so that it can be useful if I
> want to give my users a DNS editing interface instead of loading a big
> bloated control panel.
> 

We use an interface that writes everything to a DB. Then, every 5 minutes, a
cron job comes around and dumps the db and builds the zone files for us.

Might try something similar.  It would be a lot safer then giving root access
via PHP... :)

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
On 04/30/2010 11:26 AM, Jim Lucas wrote:
Nilesh Govindarajan wrote:
Hi,

As you know there are lot of control panels lying around like Cpanel,
Lxadmin, most of them based on PHP. The control panels allow editing of
system files which requires root privileges, can somebody tell me how to
gain root privileges inside the script so that it can be useful if I
want to give my users a DNS editing interface instead of loading a big
bloated control panel.


We use an interface that writes everything to a DB. Then, every 5 minutes, a
cron job comes around and dumps the db and builds the zone files for us.

Might try something similar.  It would be a lot safer then giving root access
via PHP... :)


Hmm that's a great idea. But my question is in general, suppose I get some freelance job to write a control panel for managing httpd, etc.

Same procedure can be used ? I think so ?

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

--- End Message ---
--- Begin Message ---
On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:

> On 04/30/2010 11:26 AM, Jim Lucas wrote:
>> Nilesh Govindarajan wrote:
>>> Hi,
>>>
>>> As you know there are lot of control panels lying around like Cpanel,
>>> Lxadmin, most of them based on PHP. The control panels allow editing of
>>> system files which requires root privileges, can somebody tell me how to
>>> gain root privileges inside the script so that it can be useful if I
>>> want to give my users a DNS editing interface instead of loading a big
>>> bloated control panel.
>>>
>>
>> We use an interface that writes everything to a DB. Then, every 5
> minutes, a
>> cron job comes around and dumps the db and builds the zone files for us.
>>
>> Might try something similar.  It would be a lot safer then giving
> root access
>> via PHP... :)
>>
>
> Hmm that's a great idea. But my question is in general, suppose I get
> some freelance job to write a control panel for managing httpd, etc.
>
> Same procedure can be used ? I think so ?

If you can find an open source control panel (like webmin), you could
download the code and examine it.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
On Fri, 2010-04-30 at 10:40 -0400, Paul M Foster wrote:

> On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:
> 
> > On 04/30/2010 11:26 AM, Jim Lucas wrote:
> >> Nilesh Govindarajan wrote:
> >>> Hi,
> >>>
> >>> As you know there are lot of control panels lying around like Cpanel,
> >>> Lxadmin, most of them based on PHP. The control panels allow editing of
> >>> system files which requires root privileges, can somebody tell me how to
> >>> gain root privileges inside the script so that it can be useful if I
> >>> want to give my users a DNS editing interface instead of loading a big
> >>> bloated control panel.
> >>>
> >>
> >> We use an interface that writes everything to a DB. Then, every 5
> > minutes, a
> >> cron job comes around and dumps the db and builds the zone files for us.
> >>
> >> Might try something similar.  It would be a lot safer then giving
> > root access
> >> via PHP... :)
> >>
> >
> > Hmm that's a great idea. But my question is in general, suppose I get
> > some freelance job to write a control panel for managing httpd, etc.
> >
> > Same procedure can be used ? I think so ?
> 
> If you can find an open source control panel (like webmin), you could
> download the code and examine it.
> 
> Paul
> 
> -- 
> Paul M. Foster
> 


You could use exce() to run a sudo command (piping the password through
to it or add the apache user into the sudoers list) to run things at the
root level. You must be very very careful with this though, and only use
it as a last resort if you absolutely have to, as any sort of
vulnerability in your script could compromise your entire server.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On 04/30/2010 08:10 PM, Paul M Foster wrote:
On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:

On 04/30/2010 11:26 AM, Jim Lucas wrote:
Nilesh Govindarajan wrote:
Hi,

As you know there are lot of control panels lying around like Cpanel,
Lxadmin, most of them based on PHP. The control panels allow editing of
system files which requires root privileges, can somebody tell me how to
gain root privileges inside the script so that it can be useful if I
want to give my users a DNS editing interface instead of loading a big
bloated control panel.


We use an interface that writes everything to a DB. Then, every 5
minutes, a
cron job comes around and dumps the db and builds the zone files for us.

Might try something similar.  It would be a lot safer then giving
root access
via PHP... :)


Hmm that's a great idea. But my question is in general, suppose I get
some freelance job to write a control panel for managing httpd, etc.

Same procedure can be used ? I think so ?

If you can find an open source control panel (like webmin), you could
download the code and examine it.

Paul


Webmin is written in perl. I will see the code of web-cp which is php based.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

--- End Message ---
--- Begin Message ---
On 04/30/2010 08:12 PM, Ashley Sheridan wrote:
On Fri, 2010-04-30 at 10:40 -0400, Paul M Foster wrote:

On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:

On 04/30/2010 11:26 AM, Jim Lucas wrote:
Nilesh Govindarajan wrote:
Hi,

As you know there are lot of control panels lying around like Cpanel,
Lxadmin, most of them based on PHP. The control panels allow editing of
system files which requires root privileges, can somebody tell me how to
gain root privileges inside the script so that it can be useful if I
want to give my users a DNS editing interface instead of loading a big
bloated control panel.


We use an interface that writes everything to a DB. Then, every 5
minutes, a
cron job comes around and dumps the db and builds the zone files for us.

Might try something similar.  It would be a lot safer then giving
root access
via PHP... :)


Hmm that's a great idea. But my question is in general, suppose I get
some freelance job to write a control panel for managing httpd, etc.

Same procedure can be used ? I think so ?

If you can find an open source control panel (like webmin), you could
download the code and examine it.

Paul

--
Paul M. Foster



You could use exce() to run a sudo command (piping the password through
to it or add the apache user into the sudoers list) to run things at the
root level. You must be very very careful with this though, and only use
it as a last resort if you absolutely have to, as any sort of
vulnerability in your script could compromise your entire server.

Thanks,
Ash
http://www.ashleysheridan.co.uk




That was what my basic idea about implementing it, but just put up a discussion here to see if there is really any other method except sudo- and there is that cron one as suggested by Jim Lucas.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

--- End Message ---
--- Begin Message ---
On Fri, 2010-04-30 at 20:23 +0530, Nilesh Govindarajan wrote:

> On 04/30/2010 08:12 PM, Ashley Sheridan wrote:
> > On Fri, 2010-04-30 at 10:40 -0400, Paul M Foster wrote:
> >
> >> On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:
> >>
> >>> On 04/30/2010 11:26 AM, Jim Lucas wrote:
> >>>> Nilesh Govindarajan wrote:
> >>>>> Hi,
> >>>>>
> >>>>> As you know there are lot of control panels lying around like Cpanel,
> >>>>> Lxadmin, most of them based on PHP. The control panels allow editing of
> >>>>> system files which requires root privileges, can somebody tell me how to
> >>>>> gain root privileges inside the script so that it can be useful if I
> >>>>> want to give my users a DNS editing interface instead of loading a big
> >>>>> bloated control panel.
> >>>>>
> >>>>
> >>>> We use an interface that writes everything to a DB. Then, every 5
> >>> minutes, a
> >>>> cron job comes around and dumps the db and builds the zone files for us.
> >>>>
> >>>> Might try something similar.  It would be a lot safer then giving
> >>> root access
> >>>> via PHP... :)
> >>>>
> >>>
> >>> Hmm that's a great idea. But my question is in general, suppose I get
> >>> some freelance job to write a control panel for managing httpd, etc.
> >>>
> >>> Same procedure can be used ? I think so ?
> >>
> >> If you can find an open source control panel (like webmin), you could
> >> download the code and examine it.
> >>
> >> Paul
> >>
> >> --
> >> Paul M. Foster
> >>
> >
> >
> > You could use exce() to run a sudo command (piping the password through
> > to it or add the apache user into the sudoers list) to run things at the
> > root level. You must be very very careful with this though, and only use
> > it as a last resort if you absolutely have to, as any sort of
> > vulnerability in your script could compromise your entire server.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
> 
> That was what my basic idea about implementing it, but just put up a 
> discussion here to see if there is really any other method except sudo- 
> and there is that cron one as suggested by Jim Lucas.
> 
> -- 
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मेरा भारत महान !
> मम भारत: महत्तम भवतु !
> 


To make things a little bit more secure when using exec() you could call
a series of custom Bash scripts which you can have set up to only accept
certain ranges of parameters, which would avoid someone passing a string
like "&& nasty_command here" to the command line.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
> -----Original Message-----
> while(foo){
> $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FFFFFF";
> echo "<tr style=\"background-color:".$tr."\">";
> ...

Don't do this modulus (%) math!!!! Just toggle a boolean!!

<tr class="<?= ($r = !$r) ? "dataRow1" : "dataRow2"; ?>">

Attachment: smime.p7s
Description: S/MIME cryptographic signature


--- End Message ---
--- Begin Message ---
On 30 April 2010 08:40, Daevid Vincent <dae...@daevid.com> wrote:
>> -----Original Message-----
>> while(foo){
>> $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FFFFFF";
>> echo "<tr style=\"background-color:".$tr."\">";
>> ...
>
> Don't do this modulus (%) math!!!! Just toggle a boolean!!
>
> <tr class="<?= ($r = !$r) ? "dataRow1" : "dataRow2"; ?>">
>

The modulus is a good option when there are more than 2 states.

Say a 5 row fade ...

$a=0;
while ($row=mysql_fetch_...){
echo "<tr class=‌‌‌‌‌‌\"alternate-row-".(1 + (++$a%5))."\"><..."
}

giving alternate-row-1, alternate-row-2, alternate-row-3,
alternate-row-4 and alternate-row-5


-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--- End Message ---
--- Begin Message ---
[snip]
Don't do this modulus (%) math!!!! Just toggle a boolean!!

<tr class="<?= ($r = !$r) ? "dataRow1" : "dataRow2"; ?>">
[/snip]

What is wrong with modulus math????

--- End Message ---
--- Begin Message ---
On Thu, Apr 29, 2010 at 05:34:38PM -0400, tedd wrote:

> At 11:01 AM -0300 4/29/10, Juan Rodriguez Monti wrote:

<snip>

>>
>> Tedd,
>> Thanks. I'm gonna check it. I finally solved it using:
>>
>> if ( CONDITIONS )) {
>>
>>   $results = query( QUERY );
>>       $colors = array('#97b7cd','#96bf8c');
>>       $index= 0;
>>      echo "<html>";
>>      echo "<head>";
>>      echo '<link rel="stylesheet" type="text/css" href="is.css" />';
>>      echo "</head>";
>>      echo "<body>";
>>      echo '<div id="container">';
>>
>>        echo "<table border='1'>";
>>      echo "<td><strong>a1</strong></td> <td><strong>a2</strong></td>
>> <td><strong>a3</strong></td>                  <td><strong>a4</strong></td>
>> <td><strong>a5</strong></td> ";
>>
>>   while ($row = CONDITIONS )) {
>>      echo '<tr style="background-color: ' .  $colors[$index ++ %
>> 2] .  ';">';
>>      echo "<td>$row[0]</td><td>$row[1]</td> <td>$row[2]</td>
>> <td>$row[3]</td><td>$row[4]</td> ";
>>                                                        }
>>      echo "</tr>";
>>      echo "</table>";
>>      echo "</div>";
>>      echo '<p><a href="back.html">back</a></p>';
>>      echo "</body>";
>>      echo "</html>";
>>
>> This solution was the best for me. It's solved with your help.
>>
>> Thanks a lot!.
>>
>> Juan
>
> The above is far more complicated than it has to be.
>
> Please critically review my example.

+1

This thread came up before, and tedd's solution was the least complex,
as far as I could tell. I shamelessly stole his code and regularly use
it in my own projects. ;-}

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
On Fri, 2010-04-30 at 06:14 -0500, Jay Blanchard wrote:

> [snip]
> Don't do this modulus (%) math!!!! Just toggle a boolean!!
> 
> <tr class="<?= ($r = !$r) ? "dataRow1" : "dataRow2"; ?>">
> [/snip]
> 
> What is wrong with modulus math????
> 


Modulus is the most elegant solution I reckon. Imagine if you only
needed to highlight every 3rd row, or 4th? Easy to change the modulus
for it, not so easy to re-work a binary switch. 

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Paul M Foster wrote:
+1

This thread came up before, and tedd's solution was the least complex,
as far as I could tell. I shamelessly stole his code and regularly use
it in my own projects. ;-}
Or if one choose to use Smarty template.
<tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">

http://www.smarty.net/manual/en/language.function.cycle.php

--- End Message ---
--- Begin Message ---
On 25/04/10 14:17, ioan...@btinternet.com wrote:
I can return a target page - once, but then on refresh within a few
hours the script curl_error is that it cannot connect to the host and
return is empty. The target URL is an ip address, not a named url, so
maybe it has something to do with DNS. I am on a shared server. Any
ideas on why this happens?

John

I've been watching this thread for a few days, and seen the various responses. It seems to me you should be asking the provider of the target page what the problem is! If you are consuming this service legitimately then they will tell you, and possibly provide a workaround. If not, then you probably shouldn't be doing what you are trying to do anyway - there a reason why they are blocking bots...

Cheers
Pete

--- End Message ---
--- Begin Message ---


On 2010/04/30 17:02, Pete Ford wrote:
On 25/04/10 14:17, ioan...@btinternet.com wrote:
I can return a target page - once, but then on refresh within a few
hours the script curl_error is that it cannot connect to the host and
return is empty. The target URL is an ip address, not a named url, so
maybe it has something to do with DNS. I am on a shared server. Any
ideas on why this happens?

John

I've been watching this thread for a few days, and seen the various
responses. It seems to me you should be asking the provider of the
target page what the problem is! If you are consuming this service
legitimately then they will tell you, and possibly provide a workaround.
If not, then you probably shouldn't be doing what you are trying to do
anyway - there a reason why they are blocking bots...

Cheers
Pete

That may work in theory but not in business terms. I am too small a mite to even get a hearing. It is not for a bot but to provide the information publicly available in response to human requests on another site.



--- End Message ---
--- Begin Message ---
On 29 April 2010 20:32, Daevid Vincent <dae...@daevid.com> wrote:

> I'm looking for a script (bash or php) that I would run on my production
> web server that would do this or close to it:
>
>        1. do a CVS/SVN checkout to a new timestamped directory
>        2. change the symlink from the old directory
>        3. change permissions to www-data:www-data on new directory
>        4. and possibly tarball up the old directory.

Phing has SVN tools out-of-the-box.

http://phing.info/
http://morethanseven.net/2008/01/30/simple-deployment-with-svn-and-phing.html

--- End Message ---
--- Begin Message ---
Hallo there everyone
although i have built my code correctly according to the examples i found on
the net..
i get Invalid DN syntax error when i try to insert some attributes with ldap
add..

i get and read a csv file where i get the data correctly as i can see on the
echos that follow:

                       *$data=split("[;\r]",$data);*
*
*
* **$info["cn"]= $data[$c];*
* **echo "|onoma-->";*
* **echo $info["cn"] ;//*
*    ** **       $c++;*
* **$info["sn"]= $data[$c];*
* **echo "|epwnimo-->";*
* **echo $info["sn"] ;*
* *
* **$info["objectclass"][0] = "top";*
*  ** **    $info["objectclass"][1] = "organizationalPerson";*
* *
* ** *
* ** $r = ldap_add($ldapconn,
"cn=".$info['cn'].",cn=*****,ou=@@@,ou=****.,ou=****,dc=.....dc=....",
$info);*

funny thing is that when i put them absolute like *$info["sn"]= "bla
bla";* it works fine...
any ideas?

--- End Message ---
--- Begin Message ---
On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote:

> Hallo there everyone
> although i have built my code correctly according to the examples i found on
> the net..
> i get Invalid DN syntax error when i try to insert some attributes with ldap
> add..
> 
> i get and read a csv file where i get the data correctly as i can see on the
> echos that follow:
> 
>                        *$data=split("[;\r]",$data);*
> *
> *
> * **$info["cn"]= $data[$c];*
> * **echo "|onoma-->";*
> * **echo $info["cn"] ;//*
> *    ** **       $c++;*
> * **$info["sn"]= $data[$c];*
> * **echo "|epwnimo-->";*
> * **echo $info["sn"] ;*
> * *
> * **$info["objectclass"][0] = "top";*
> *  ** **    $info["objectclass"][1] = "organizationalPerson";*
> * *
> * ** *
> * ** $r = ldap_add($ldapconn,
> "cn=".$info['cn'].",cn=*****,ou=@@@,ou=****.,ou=****,dc=.....dc=....",
> $info);*
> 
> funny thing is that when i put them absolute like *$info["sn"]= "bla
> bla";* it works fine...
> any ideas?


Are you using the correct split() delimiter? What happens if you just
output that array with print_r() or var_dump()? I see the delimiter as:

[;
]

Because the \r is recognised as a carriage return because your string is
in double quotes.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
on the array and on the server side i can see the names are added normally
and with the correct encode(despite what i show you )
and the only thing is tha i get that DN not valid...
i used the \r cause i use it on my csv file at least one...
but i am sure (i used a counter for the letters + i compered the name they
are the same)

so it is pretty strange why is not working...


1.trust me after many times faced problems with delimiters i can tell you
the correct is with [ ] and your delimiter in between
2.print_r seems good exactly what i have in csv file..
3.var_dump works fine counts everything and stuff but even though i get the
right attributes ...
i still have the same error....(see below)
it's made me crazy....



onoma-->�������|epwnimo-->��������������
*Warning*: ldap_add()
[function.ldap-add<https://195.251.90.188:65007/~voiko/admin/function.ldap-add>]:
Add: Invalid DN syntax

Thank you for your answer


On 30 April 2010 16:53, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:

>  On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote:
>
> Hallo there everyone
> although i have built my code correctly according to the examples i found on
> the net..
> i get Invalid DN syntax error when i try to insert some attributes with ldap
> add..
>
> i get and read a csv file where i get the data correctly as i can see on the
> echos that follow:
>
>                        *$data=split("[;\r]",$data);*
> *
> *
> * **$info["cn"]= $data[$c];*
> * **echo "|onoma-->";*
> * **echo $info["cn"] ;//*
> *    ** **       $c++;*
> * **$info["sn"]= $data[$c];*
> * **echo "|epwnimo-->";*
> * **echo $info["sn"] ;*
> * *
> * **$info["objectclass"][0] = "top";*
> *  ** **    $info["objectclass"][1] = "organizationalPerson";*
> * *
> * ** *
> * ** $r = ldap_add($ldapconn,
> "cn=".$info['cn'].",cn=*****,ou=@@@,ou=****.,ou=****,dc=.....dc=....",
> $info);*
>
> funny thing is that when i put them absolute like *$info["sn"]= "bla
> bla";* it works fine...
> any ideas?
>
>
> Are you using the correct split() delimiter? What happens if you just
> output that array with print_r() or var_dump()? I see the delimiter as:
>
> [;
> ]
>
> Because the \r is recognised as a carriage return because your string is in
> double quotes.
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
Manolis Vlachakis

Nelly's Family Hotel
Visit    :   www.nellys-hotel.gr
              www.nellys.gr
Skype : manolis.vlachakis

--- End Message ---
--- Begin Message ---
Hi,

I have written this tool : < Portal Manager :: Drupal Management Assembly >
which is to remotely manage a drupal based website
You can manage and edit user properties
You can manage and edit posts
you can sort posts on the bases of taxonomies and then manage and edit
posts


The tool is written in C# WPF and needs .net framework 3.5 to be
pre-installed
Please find the software here: LINK <
http://ebhakt.com/content/portal-manager-drupal-

management-assembly  >

Please give your valuable feedback, its highly welcome...


NOTE: For working of this software you need to download and install services
module and

configure it to give permissions to anonymous users


-- 
Bhaskar Tiwari
GTSE Generalist
Directory Services
Microsoft

____________________________________________________________
All we have to decide is what to do with the time that has been given to us


http://www.ebhakt.com/
http://fytclub.net/
http://ebhakt.info/

--- End Message ---
--- Begin Message ---
I have written this code to export data to a text file and asks user
to save generated file. It works with Firefox perfectly, but IE shows
content of file instead of prompting the download window.
How can I force IE to show the download dialog?

<?php
Header("Content-disposition: attachement; filename=data.txt");
Header("Content-type: text/plain");
echo $some_data;
?>

-- 
Ali Asghar Torabi

--- End Message ---
--- Begin Message ---
Hello Ali,

It's attachment, not attachement. Maybe here's the reason? Just a
thought.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

----- Original message -----
From: Ali Asghar Toraby Parizy <aliasghar.tor...@gmail.com>
To: php-gene...@lists.php.net <php-gene...@lists.php.net>
Date: Friday, April 30, 2010, 7:19:38 PM
Subject: [PHP] How to Force IE to download text file?

I have written this code to export data to a text file and asks user
to save generated file. It works with Firefox perfectly, but IE shows
content of file instead of prompting the download window.
How can I force IE to show the download dialog?

<?php
Header("Content-disposition: attachement; filename=data.txt");
Header("Content-type: text/plain");
echo $some_data;
?>

-- 
Ali Asghar Torabi

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


--- End Message ---

Reply via email to