[PHP] Sunset/Sunrise

2012-03-20 Thread Tedd Sperling
Hi gang:

What's wrong with this?

echo date("D M d Y"). ', sunrise time : ' .date_sunrise(time(), 
SUNFUNCS_RET_STRING, 42.57, 84.3320, 90, -5);
echo('');
echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), 
SUNFUNCS_RET_STRING, 42.57, 84.3320, 90, -5);

It gives exactly the wrong time -- Sunset is reported as Sunrise and vice 
versa. What's up?

Thanks,

tedd


_
tedd.sperl...@gmail.com
http://sperling.com






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



Re: [PHP] Sunset/Sunrise

2012-03-20 Thread Andrew Ballard
On Tue, Mar 20, 2012 at 9:23 AM, Tedd Sperling  wrote:
> Hi gang:
>
> What's wrong with this?
>
> echo date("D M d Y"). ', sunrise time : ' .date_sunrise(time(), 
> SUNFUNCS_RET_STRING, 42.57, 84.3320, 90, -5);
> echo('');
> echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), 
> SUNFUNCS_RET_STRING, 42.57, 84.3320, 90, -5);
>
> It gives exactly the wrong time -- Sunset is reported as Sunrise and vice 
> versa. What's up?
>
> Thanks,
>
> tedd

tedd,

I think you used the incorrect longitude. Did you want a location in
northern China (as you entered above) or near Dansville, MI (in which
case I believe your longitude above should be negative rather than
positive)?

http://maps.google.com/maps?q=42.57,84.3320&hl=en&sll=42.57,-84.332&sspn=0.023008,0.038581&t=m&z=8

http://maps.google.com/maps?q=42.57,-84.3320&hl=en&sll=42.554092,-84.324188&sspn=0.736459,1.234589&t=m&z=15

Andrew

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



RE: [PHP] Graphing

2012-03-20 Thread Ross Hansen

Thanks Everyone for your responses.

I apologize for not responding sooner however i was away from the computer and 
was not able to check my email or look into this further.

I am quite interested in a few of them so i will do further testing and 
research. I was also hoping to learn how to create them my self but that is 
more just because i enjoy trying to learn.

Regards
Ross

> CC: php-general@lists.php.net
> From: phps...@gmail.com
> Date: Sun, 18 Mar 2012 11:27:23 -0400
> To: hansen.r...@live.com.au
> Subject: Re: [PHP] Graphing
> 
> 
> 
> On 2012-03-18, at 9:33 AM, Ross Hansen  wrote:
> 
> > Hey all,
> > 
> > I have been working with php for a few years but mostly simple stuff. I'm 
> > now looking at doing some graphing but have no experience with dynamic 
> > images. 
> > 
> > I have never used imagecreate but have seen one example of it and not sure 
> > if it is really what i'm after.
> > It needs to graph changing data from a mysql db.
> > I also understand php might not be the best option due to the server load.
> > 
> > Just want to get peoples thoughts and suggestions.
> > Was so looking at jquery.
> > 
> > Looking forward your responses.
> > 
> > Regards
> > Ross
> > 
> 
> If you are looking at a js type dataviz, check out kendo-ui ( built on jquery 
> )
> 
> If you want php based then there are tons of options (YMMV)
> 
> - phpplot
> - jgraph
> - etc ( a quick google will give you more)
> 
> Bastien
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
  

[PHP] php upload does not work proper, ["tmp_name"] and other are missing in $_FILES

2012-03-20 Thread Meike Stone
Hello,

I try the upload files, but in "tmp_name" and other variables are
missing in $_FILES.
I use php 5.3.8 on SLES11SP2

I can repeat this with:
===





   

   

   

   Send this file: 




===

The $_FILES shows only:
array(1) { ["userfile"]=> array(1) { ["name"]=> string(14) "ask_script.xml" } }

I traced (strace) the apache process, and I saw, that a temporary
file was opened, the text from the file written and than later
unlinked.

What can be the problem?



Kindly regards

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



Re: [PHP] php upload does not work proper, ["tmp_name"] and other are missing in $_FILES

2012-03-20 Thread Matijn Woudt
On Tue, Mar 20, 2012 at 4:33 PM, Meike Stone  wrote:
> Hello,
>
> I try the upload files, but in "tmp_name" and other variables are
> missing in $_FILES.
> I use php 5.3.8 on SLES11SP2
>
> I can repeat this with:
> ===
>  if(isset($_FILES)) {
> var_dump($_FILES);
> }
> ?>
> 
>
> 
>
>   
>
>   
>
>   
>
>   Send this file: 
>
> 
>
> 
> ===
>
> The $_FILES shows only:
> array(1) { ["userfile"]=> array(1) { ["name"]=> string(14) "ask_script.xml" } 
> }
>
> I traced (strace) the apache process, and I saw, that a temporary
> file was opened, the text from the file written and than later
> unlinked.
>
> What can be the problem?
>
>
>
> Kindly regards
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

First of all, check your apache log files for any hints. There's
probably a warning/error in there that explains why.
If not, check your php.ini settings, there are a few settings that can
affect uploads (see [1]).

- Matijn

[1] http://nl3.php.net/manual/en/ini.core.php#ini.sect.file-uploads

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



Re: [PHP] php upload does not work proper, ["tmp_name"] and other are missing in $_FILES

2012-03-20 Thread Meike Stone
>
> First of all, check your apache log files for any hints. There's
> probably a warning/error in there that explains why.

I switched to "LogLevel debug" but in error_log is nothing found,
the access_log showes only:
192.168.1.89 - - [20/Mar/2012:16:43:53 +0100] "POST /i3.php HTTP/1.1"
200 539 "http://172.16.1.170/i3.php"; "Mozilla/5.0 (Windows NT 5.1;
WOW64; rv:11.0) Gecko/20100101 Firefox/11.0"

> If not, check your php.ini settings, there are a few settings that can
> affect uploads (see [1]).
>
> [1] http://nl3.php.net/manual/en/ini.core.php#ini.sect.file-uploads

Yes, I know this settings and checked this and disabled suhosin too.
Nothing helped.
I did this before "stracing" ...


Thanks Meike

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



[PHP] Bug zlib.output_compression not normal work in IIS7.5

2012-03-20 Thread 小鱼虾
How I do fix it ?


https://bugs.php.net/bug.php?id=61434 




ID: 61434  User updated by:info at ongod dot org  Reported 
by:info at ongod dot org  Summary:zlib.output_compression 
not normal work in IIS7.5  Status: Not a bug  Type:   
Bug  Package:Zlib related  Operating System:   windows2008R2x64  
PHP Version:5.4.0  Block user comment: N  Private report: N  New 
Comment: it is Should be clean code for check. php5.4 not normal work.  but 
php5.3.10  normal work in the same server.  who tell me why this ? 
http://www.ongod.org/test/phpinfo.php Web page compressed?  No Compression 
type?none Size, Markup (bytes)   83,611 Size, Compressed (bytes) 0 
Compression % 0.0 php5.3.10 http://mail.ipv6china.com/phpinfo.php Web page 
compressed?Yes Compression type?   gzip Size, Markup (bytes)   
87,124 Size, Compressed (bytes) 13,730 Compression %84.2 check from 
http://www.gidnetwork.com/tools/gzip-test.php Previous Comments: 
 
[2012-03-19 14:14:54] paj...@php.net ok, not a bug but a support issue. @info 
at ongod dot org Please ask further support on the PHP general mailing list or 
any other support  channel, thanks! 
 
[2012-03-19 14:10:56] a...@php.net I cannot reproduce the issue, tried with the 
latest php 5.4 and IIS7. IIS7 has  compression turned off and the php.ini has 
both zlib.output_compression=on and  zlib.output_compression_level=-1 set. The 
page is merely a phpinfo() page. Here  the simple ping pong: GET /i.php 
HTTP/1.1 Host: localhost Connection: keep-alive Cache-Control: max-age=0 
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.11 (KHTML, like Gecko) 
 Chrome/17.0.963.79 Safari/535.11 Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Encoding: gzip,deflate,sdch Accept-Language: 
de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4 Accept-Charset: 
ISO-8859-1,utf-8;q=0.7,*;q=0.3 HTTP/1.1 200 OK Content-Type: text/html 
Content-Encoding: gzip Vary: Accept-Encoding Server: Microsoft-IIS/7.5 
X-Powered-By: PHP/5.4.1RC1-dev Date: Mon, 19 Mar 2012 14:00:09 GMT 
Content-Length: 6182 The output compression seems to work.  @info at ongod dot 
org Could you please try such a simple page scenario and post the 
request/response  headers? 
 
[2012-03-19 14:01:26] nacin at wordpress dot org I can confirm that WordPress 
3.3.1 does not set zlib.output_compression. Looks  like WP never has. 
 
[2012-03-19 11:40:20] info at ongod dot org Security reasons, I would also send 
an email to you. 
 
[2012-03-19 11:25:40] m...@php.net zlib.output_compression can be disabled at 
runtime at later stage in PHP 5.4. I'd probably be lost on a Windows box, so I 
don't think I could help you there. 
 The 
remainder of the comments for this report are too long. To view the rest of the 
comments, please view the bug report online at 
https://bugs.php.net/bug.php?id=61434

[PHP] PHP 5.3.2 on IIS Fast CGI Timeout error

2012-03-20 Thread Jay Blanchard

Good afternoon PHP gurus,

I am trying to troubleshoot a problem on a Windows server (*UGH*). This 
is the error -


The FastCGI Handler was unable to process the request.


Error Details:

 * The FastCGI process exceeded configured activity timeout
 * Error Number: 258 (0x80070102).
 * Error Description: The wait operation timed out.


   HTTP Error 500 - Server Error.
   Internet Information Services (IIS)


Here is the code it appears to be choking on -

/* open the file for reading and/or writing */
$csvFile = fopen(CSV_FILE, "rb");
$csvTemp = fopen(CSV_TEMP_FILE, "wb");
if(!$csvTemp) {
echo 'failed tp open '.CSV_TEMP_FILE;
}

/* create the edit vehicle info */

/* create a stock number for this vehicle */
$vinPart = substr($_POST['vin-number'], -6);
$stockNumber = 'EC'.$vinPart;

/* create a line to be inserted into the .csv file */
$csvContent = $stockNumber.',';
$csvContent .= mysql_real_escape_string($_POST['vehUser']).',';
$csvContent .= mysql_real_escape_string($_POST['vmake']).',';
$csvContent .=mysql_real_escape_string($_POST['vmodel']).',';
$csvContent .= mysql_real_escape_string($_POST['vyear']).',';
$csvContent .=
mysql_real_escape_string($_POST['vin-number']).',';

$csvContent .=mysql_real_escape_string($_POST['vprice']).',';
$csvContent .= 
mysql_real_escape_string($_POST['vdescription'])."\r\n";


/* loop through and write edited lines back in while 
maintaining non-edited lines */

while(!FEOF($csvFile)) {

/* get current line information */
$originalLineArray = fgetcsv($csvFile, 4096, ',');

/* test and replace as required */
if(is_array($originalLineArray)) {
if($stockNumber == $originalLineArray[0]) {
fwrite($csvTemp, $csvContent);
} else {
$currentLine = implode(",", $originalLineArray);
$currentLine = $currentLine."\r\n";
fwrite($csvTemp, $currentLine);
}
}
}
/* close the files */
fclose($csvFile);
fclose($csvTemp);

/* rename the temp file */
rename(CSV_TEMP_FILE, CSV_FILE);

Anyone have any clue why this might be happening? I have followed the 
events using Process Monitor which doesn't complain at all, yet the temp 
file gets created but never written to. I have been all over the web for 
a couple of hours now with no clue as to what is going on. I'd really 
appreciate any hints or tips.


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



Re: [PHP] PHP 5.3.2 on IIS Fast CGI Timeout error (SOLVED)

2012-03-20 Thread Jay Blanchard
[snip]
..the craziness of it all
[/snip]

Found out that the PostGreSQL .dll was not loaded and that the server had been 
configured to not give up any errors regardless of how I set error reporting. 
Reconfigured the server and restarted it. Viola'! It all works now.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sunset/Sunrise

2012-03-20 Thread Tedd Sperling
On Mar 20, 2012, at 9:50 AM, Andrew Ballard wrote:

> On Tue, Mar 20, 2012 at 9:23 AM, Tedd Sperling  
> wrote:
>> Hi gang:
>> 
>> What's wrong with this?
>> 
>> echo date("D M d Y"). ', sunrise time : ' .date_sunrise(time(), 
>> SUNFUNCS_RET_STRING, 42.57, 84.3320, 90, -5);
>> echo('');
>> echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), 
>> SUNFUNCS_RET_STRING, 42.57, 84.3320, 90, -5);
>> 
>> It gives exactly the wrong time -- Sunset is reported as Sunrise and vice 
>> versa. What's up?
>> 
>> Thanks,
>> 
>> tedd
> 
> tedd,
> 
> I think you used the incorrect longitude. Did you want a location in
> northern China (as you entered above) or near Dansville, MI (in which
> case I believe your longitude above should be negative rather than
> positive)?
> 
> http://maps.google.com/maps?q=42.57,84.3320&hl=en&sll=42.57,-84.332&sspn=0.023008,0.038581&t=m&z=8
> 
> http://maps.google.com/maps?q=42.57,-84.3320&hl=en&sll=42.554092,-84.324188&sspn=0.736459,1.234589&t=m&z=15
> 
> Andrew

Andrew:

That's what I get for not checking it myself. I was assured by one of my 
students that was our correct lat/long. Boy, will he hear from me -- he's going 
to find his next assignment in China. :-)

Thanks,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com




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



Re: [PHP] Sunset/Sunrise

2012-03-20 Thread Andrew Ballard
On Tue, Mar 20, 2012 at 6:00 PM, Tedd Sperling  wrote:
> That's what I get for not checking it myself. I was assured by one of my 
> students that was our correct lat/long. Boy, will he hear from me -- he's 
> going to find his next assignment in China. :-)
>
> Thanks,
>
> tedd

That's the spirit! Truly world-class education!

Andrew

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



Re: [PHP] Getting knotted with quotes encoding - (one possible solution)

2012-03-20 Thread tamouse mailing lists
On Mon, Mar 19, 2012 at 10:43 AM, Arno Kuhl  wrote:
> -Original Message-
> From: tamouse mailing lists [mailto:tamouse.li...@gmail.com]
> Sent: 19 March 2012 10:28 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Getting knotted with quotes encoding - (one possible 
> solution)
>
> On Sun, Mar 18, 2012 at 10:19 PM, Tamara Temple 
>  wrote:
>> On Tue, 13 Mar 2012 16:35:44 +0200, Arno Kuhl  sent:
>>
>>> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
>>> Sent: 13 March 2012 03:25 PM
>>> To: a...@dotcontent.net; php-general@lists.php.net
>>> Subject: Re: [PHP] Getting knotted with quotes encoding
>>>
>>>
>>> Arno Kuhl  wrote:
>>>
 I've been battling with quotes encoding when outputting javascript
 with php.
 It can't be unique, so I'm hoping someone has a working solution
 they're willing to share.

 The following works perfectly as long as there aren't any single
 quotes in the link text:
        echo ">>> class='linkSel'>$sTitle";

 if $sTitle has the value    What's new    it outputs:
        >>> onclick="insertLink('article/whats-new.html','What's
 new')" class='linkSel'>What's new

 It displays fine, but javascript complains with:
        Expected ')'  linkmanager.php Line:525 Char:63


 So I fix this by swapping the double and single quotes around:
        echo ">>> class='linkSel'>$sTitle";

 Now for that specific link it outputs:
        >>> onclick='insertLink("article/whats-new.html","What's
 new")' class='linkSel'>What's new And javascript is happy.

 But elsewhere there's a link     Fred "Buster" Cox     and it outputs:
        >>> onclick='insertLink("article/fred-buster-cox.html","Fred
 "Buster" Cox")' class='linkSel'>Fred "Buster"
 Cox

 Again it displays fine, but javascript complains with:
        Expected ')'  linkmanager.php Line:743 Char:77


 So it looks like I can't have links that include single quotes and
 double quotes, only one or the other.

 One work-around I thought of was to convert any link texts that
 included double quotes into single quotes when the content is
 posted, and it would then be displayed with single quotes even
 though the user entered double quotes. It's far from ideal but it
 would work, though I can think of a few situations where it would be
 quite confusing to the reader. Are there any other solutions that
 would allow both types of quotes without any conversions?

 Cheers
 Arno


 --
>>>
>>>
>>> You aren't escaping the quotes correctly when they go into your  output.
>>> You're escaping them for html not javascript. Javascript  (like php)
>>> escapes single quotes inside a single quote string with a  back slash.
>>>
>>>
>>>  Thanks,
>>> Ash
>>> http://ashleysheridan.co.uk
>>> -
>>>
>>> Thanks for that Ashley.
>>> You're right about the encoding.
>>> I had a line prior to that:
>>>        $sTitle = htmlentities($title, ENT_QUOTES, 'ISO-8859-1',
>>> FALSE); Which encoded the quotes.
>>>
>>>
>>> I couldn't find anything so made a function, which might be useful
>>> for others.
>>> It’s a first shot, I'm sure there are ways to improve performance.
>>> I also changed the encoding to exclude single quotes.
>>> (I'm sure the indenting will get screwed up in the mail)
>>>
>>>
>>> $sTitle = fixSingleQuotes(htmlentities($title, ENT_COMPAT,
>>> 'ISO-8859-1', FALSE));
>>>
>>> .
>>>
>>>
>>> /
>>> /// // convert single quotes to curly quotes, xml compliant
>>> // assumes apostrophes must be between 2 alpha chars // and any other
>>> ' is a single quote // ‘ = left single quote // ’ = right
>>> single quote and apostrophe function fixSingleQuotes($sText) {
>>>        if (strpos($sText, "'") !== FALSE) {
>>>                // there are quotes to convert
>>>                $bOpenQuote = FALSE;
>>>                $arrAlpha = explode(' ', "a b c d e f g h i j k l m n
>>> o p q r s t  u v w x y z A B C D E F G H I J K L M N O P Q R S T U V
>>> W X Y Z");
>>>                $arrText = str_split($sText);
>>>                while (($pos = strpos($sText, "'")) !== FALSE) {
>>>                        if ($pos == 0) {
>>>                                // must be an open quote in first pos
>>>                                $sText = "‘".substr($sText, 1);
>>>                                $bOpenQuote = TRUE;
>>>                        } else {
>>>                                if (in_array($arrText[$pos-1],
>>> $arrAlpha)
>>>  AND   in_array($arrText[$pos+1], $arrAlpha)) {
>>>                                        // apostrophe
>>>                                        $quote = "’";
>>>                                } else {
>>>                                        // quote
>>>                                        if (!$bOpenQuote) {
>>>