Jim Lucas | 1 Jun 02:51 2011

Re: phpsadness

On 5/28/2011 12:34 PM, Andre Polykanine wrote:
> Hello Nathan,
> 
> Do you mean $x{8}?
> That is good but not for all situations.
> I  need sometimes to make an array with letters as keys and numbers as
> values,  like  this  (I  give  English alphabet just as an example, so
> please don't suggest str_split):
> $alphabet="abcdefghijklmnopqrstuvwxyz";
> // I wish that worked
> $alphabet_array=explode('', $alphabet);
> $letter_numbers=array_flip($alphabet_array);
> 
> this is just one case I encountered some time ago. Yes, I made this by
> separating  letters with commas... but it's not the unique case when I
> need it.

Why not do it the other way around...

$alphabet_array=range('a','z');
$alphabet=join($alphabet_array);
$letter_numbers=array_flip($alphabet_array);

Jim Lucas

--

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

(Continue reading)

Tamara Temple | 1 Jun 07:53 2011
Picon

Re: displaying a pdf


On May 30, 2011, at 10:01 AM, Jim Giner wrote:

> Thanks for the attempt Simon, but your code only displayed gibberish.
> While looking around again for help, I found this and it works  
> perfectly:
>
> <?php
> session_start();
> //
> //  Specify the name of the pdf here and the folder
> //
> $pdfname='VFD_ByLaws.pdf';
> $path='/pdfs/';
> //
> //  the rest will handle the displaying
> //
> header("Cache-Control: no-cache");
> header("Content-type: application/pdf");
> header("Location:$path$pdfname");
> ?>

I may not be fully understanding this, but if you set a Location:  
header, the other headers you've set don't matter at all, since the  
client will merely redirect to the page specified by the Location:  
header.

--

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

Tamara Temple | 1 Jun 08:04 2011
Picon

Re: https help


On May 31, 2011, at 12:34 AM, Negin Nickparsa wrote:

> I need to create a login page with HTTPS to yahoo
> Do I have to have a valid certificate?
>
> I have  not trust certification centre, so before anything under  
> HTTPS will
> be shown up, the window will come with information: valid  
> certificate: yes,
> valid domain: yes, valid authority for SSL key: no.
> am I right?
> <?php
> //if not on HTTPS
> if(empty($_SERVER['HTTPS'])) {
> //build link to https page; protocol, server and current script path
> $url = "Location: https://www.yahoo.com/";
> //addy querystring, if appropriate
> if(count($_GET) != 0) {
> $url .= "?";
> foreach($_GET as $key => $value) {
> $url .= "$key=$value&";
> }
> }
> //send permanent move redirect
> header($url, true, 301);
> }
> ?>
> but it goes to http://www.yahoo.com

(Continue reading)

Stephon Chen | 1 Jun 08:13 2011
Picon

Re: php causes HTTP 500, but results in blank page in apache

All 403, 404, 500.html are static html pages like:

<div>
500 error happens
</div>

On Wed, Jun 1, 2011 at 14:10, Tamara Temple <tamouse.lists <at> gmail.com> wrote:

>
> On May 31, 2011, at 8:14 AM, Stephon Chen wrote:
>
>  Hello Sean,
>>
>> Here is my apache config for error handling.
>> 403, 404 works fine, but 500 shows blank page
>>
>> Alias /errorpage/ "/usr/local/www/apache22/errorpage/"
>> <Directory "/usr/local/www/apache22/errorpage/">
>>   AllowOverride None
>>   Options -Indexes FollowSymLinks MultiViews
>>   Order allow,deny
>>   Allow from all
>> </Directory>
>> #
>> ErrorDocument 403 /errorpage/403.html
>> ErrorDocument 404 /errorpage/404.html
>> ErrorDocument 500 /errorpage/500.html
>>
>
> What's in 500.html?
(Continue reading)

Tamara Temple | 1 Jun 08:10 2011
Picon

Re: php causes HTTP 500, but results in blank page in apache


On May 31, 2011, at 8:14 AM, Stephon Chen wrote:

> Hello Sean,
>
> Here is my apache config for error handling.
> 403, 404 works fine, but 500 shows blank page
>
> Alias /errorpage/ "/usr/local/www/apache22/errorpage/"
> <Directory "/usr/local/www/apache22/errorpage/">
>    AllowOverride None
>    Options -Indexes FollowSymLinks MultiViews
>    Order allow,deny
>    Allow from all
> </Directory>
> #
> ErrorDocument 403 /errorpage/403.html
> ErrorDocument 404 /errorpage/404.html
> ErrorDocument 500 /errorpage/500.html

What's in 500.html?

--

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

Negin Nickparsa | 1 Jun 08:24 2011
Picon

Re: https help

Thank you
Richard Quadling | 1 Jun 10:47 2011
Picon

Re: displaying a pdf

On 1 June 2011 06:53, Tamara Temple <tamouse.lists <at> gmail.com> wrote:
>
> On May 30, 2011, at 10:01 AM, Jim Giner wrote:
>
>> Thanks for the attempt Simon, but your code only displayed gibberish.
>> While looking around again for help, I found this and it works perfectly:
>>
>> <?php
>> session_start();
>> //
>> //  Specify the name of the pdf here and the folder
>> //
>> $pdfname='VFD_ByLaws.pdf';
>> $path='/pdfs/';
>> //
>> //  the rest will handle the displaying
>> //
>> header("Cache-Control: no-cache");
>> header("Content-type: application/pdf");
>> header("Location:$path$pdfname");
>> ?>
>
> I may not be fully understanding this, but if you set a Location: header,
> the other headers you've set don't matter at all, since the client will
> merely redirect to the page specified by the Location: header.

Yes. That's true. But the URL you link to is the one responsible for
sending the headers to download a PDF.

Just like if it was a link ...
(Continue reading)

Jonesy | 1 Jun 16:50 2011
Picon

Re: smart auto download file

On Tue, 31 May 2011 21:01:09 +0100, Stuart Dallas wrote:
>
> Sometimes I miss the way the web was before javascript :/

  Sometimes???

Jonesy

--

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

Jim Giner | 1 Jun 16:54 2011

Re: displaying a pdf

Well - the code works just fine as is and that's all I care about.  As for 
Richard's comments - the url in my header(Location....) statement points to 
a pdf file, not a php file, so the target is not sending any headers (that I 
know of ). 

--

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

Adam Preece | 1 Jun 17:31 2011
Picon

building a key value pair dynamically

hi all,

is it possible to dynamically build a key value pair array in php from a database result?

if so how?

kind regards

Adam
--

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


Gmane