[PHP] fpassthru() error after update

2009-12-12 Thread A. Mannini

Hi,

i use fpassthru() to "stream" video files in my webserver. I worked fine 
for weeks but yesterday, after updating the webserver, i get the error


"Allowed memory size of 268435456 bytes exhausted (tried to allocate 
1729609729 bytes) in ."


Now PHP version is 5.2.11.

Any ideas?

Thanks

Alessandro

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



Re: [PHP] fpassthru() error after update

2009-12-12 Thread Vincent Tumwijukye
This means that buffered video exceeded your memory limitof 260MB set in
your php.ini. Consider increasing it to higher value, if your computer has
say 1GB or more of RAM.

Kind regards

On Sat, Dec 12, 2009 at 11:33 AM, A. Mannini  wrote:

> Hi,
>
> i use fpassthru() to "stream" video files in my webserver. I worked fine
> for weeks but yesterday, after updating the webserver, i get the error
>
> "Allowed memory size of 268435456 bytes exhausted (tried to allocate
> 1729609729 bytes) in ."
>
> Now PHP version is 5.2.11.
>
> Any ideas?
>
> Thanks
>
> Alessandro
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Tumwijukye Vincent
Chief Executive Officer
Future Link Technologies
Plot 17 Bukoto Street,
P. O. BOX 14697,
KAMPALA - UGANDA
Tel: +256(0)774638790
Off:+256(0)41531274
Website: www.fl-t.com, www.savingsplus.info


[PHP] problem in Computing hash of certificates

2009-12-12 Thread Tanveer Chowdhury
Hi all,
I was willing to match two certificates using hash fn but the problem
is when I fetch the certificate from apache its in pem format and when
I fetch the cert from LDAP its in der so only this one needs
to be converted to .pem format which I m doing but its showing me two
diff. hashes.
When I read the cert from LDAP and convert it to pem then it cannot
print also when I use parse function and when print the cert then
inside the BEGIN and END it doesn't print the whole certificate.
Is it normal or it can't fetch the whole cert from ldap?

";

openssl_x509_export ($loginCert, $login_cert_String);
if (empty ($login_cert_String)) echo "empty";
$login_cert_hash = hash ($HASH_ALG, $login_cert_String);

echo "Browser HASH= ". $login_cert_hash;

//$ssl=openssl_x509_parse($loginCert);
//print_r ($ssl);
echo "";



$cn="John Albert";
$dn = "dc=example, dc=com";

$filter="(cn=$cn)";
    $justthese = array("userCertificate;binary","cn");
    $sr=ldap_search($ldapconnect, $dn, $filter, $justthese);
    $info = ldap_get_entries($ldapconnect, $sr);
    $entry =ldap_first_entry($ldapconnect, $sr);
    $attributes = ldap_get_attributes($ldapconnect,$entry);
    $certificate =$attributes["userCertificate;binary"][0];

    //convert certificate into .PEM format for further processing.
    //$cert2= der2pem($certificate);
    $pem = chunk_split(base64_encode($certificate), 64, "\n");
    $pem = "-BEGIN CERTIFICATE-\n".$pem."-END CERTIFICATE-\n";
    $cert2 = $pem;
// It does not print the certificate as array here
 $ssl2=openssl_x509_parse($cert2);
 print_r ($ssl2);
 echo "";
// here it prints the certificate but it doesn't print the whole
certificate between the BEGIN CERTIFICATE and END CERTIFICATE
// Does that mean it can't read the whole centent.
 echo $cert2;

//openssl_x509_export($cert2,$certS);
echo " LDAP HASH:";
echo hash("md5",$cert2);
?>

thanks in advance.

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



Re: [PHP] fpassthru() error after update

2009-12-12 Thread Vincent Tumwijukye
i

On Sat, Dec 12, 2009 at 12:51 PM, Vincent Tumwijukye
wrote:

> This means that buffered video exceeded your memory limitof 260MB set in
> your php.ini. Consider increasing it to higher value, if your computer has
> say 1GB or more of RAM.
>
> Kind regards
>
>
> On Sat, Dec 12, 2009 at 11:33 AM, A. Mannini  wrote:
>
>> Hi,
>>
>> i use fpassthru() to "stream" video files in my webserver. I worked fine
>> for weeks but yesterday, after updating the webserver, i get the error
>>
>> "Allowed memory size of 268435456 bytes exhausted (tried to allocate
>> 1729609729 bytes) in ."
>>
>> Now PHP version is 5.2.11.
>>
>> Any ideas?
>>
>> Thanks
>>
>> Alessandro
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Tumwijukye Vincent
> Chief Executive Officer
> Future Link Technologies
> Plot 17 Bukoto Street,
> P. O. BOX 14697,
> KAMPALA - UGANDA
> Tel: +256(0)774638790
> Off:+256(0)41531274
> Website: www.fl-t.com, www.savingsplus.info
>



-- 
Tumwijukye Vincent
Chief Executive Officer
Future Link Technologies
Plot 17 Bukoto Street,
P. O. BOX 14697,
KAMPALA - UGANDA
Tel: +256(0)774638790
Off:+256(0)41531274
Website: www.fl-t.com, www.savingsplus.info


Re: [PHP] fpassthru() error after update

2009-12-12 Thread Vincent Tumwijukye
I forgot to mention that you will need to restart your web server after
after making that change. Like I mentioned earlier, the script streaming the
video is trying to access more memory than the accessible 260MB, by any php
script on that server

On Sat, Dec 12, 2009 at 12:51 PM, Vincent Tumwijukye
wrote:

> This means that buffered video exceeded your memory limitof 260MB set in
> your php.ini. Consider increasing it to higher value, if your computer has
> say 1GB or more of RAM.
>
> Kind regards
>
>
> On Sat, Dec 12, 2009 at 11:33 AM, A. Mannini  wrote:
>
>> Hi,
>>
>> i use fpassthru() to "stream" video files in my webserver. I worked fine
>> for weeks but yesterday, after updating the webserver, i get the error
>>
>> "Allowed memory size of 268435456 bytes exhausted (tried to allocate
>> 1729609729 bytes) in ."
>>
>> Now PHP version is 5.2.11.
>>
>> Any ideas?
>>
>> Thanks
>>
>> Alessandro
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Tumwijukye Vincent
> Chief Executive Officer
> Future Link Technologies
> Plot 17 Bukoto Street,
> P. O. BOX 14697,
> KAMPALA - UGANDA
> Tel: +256(0)774638790
> Off:+256(0)41531274
> Website: www.fl-t.com, www.savingsplus.info
>



-- 
Tumwijukye Vincent
Chief Executive Officer
Future Link Technologies
Plot 17 Bukoto Street,
P. O. BOX 14697,
KAMPALA - UGANDA
Tel: +256(0)774638790
Off:+256(0)41531274
Website: www.fl-t.com, www.savingsplus.info


Re: [PHP] Transparent PNGs: Merging

2009-12-12 Thread Ashley Sheridan
On Sat, 2009-12-12 at 05:02 +, Alex Davies wrote:

> Hi All,
> 
> I apologise if this is a newbie post; i'm new to transparent graphics
> (PNGs in my case).
> 
> I have a transparent PNG on disk, which I want PHP to load into memory
> and add some text to ("watermarking", I guess). This seems to be what
> is achieved @ http://php.ca/manual/en/image.examples.merged-watermark.php
> 
> I have taken the following code almost entirely from the manual, but
> can not understand what I have done wrong:
> 
> 
> //Create the image
> $img = @imagecreatetruecolor($width, $height)
>   or die("Cannot Initialize new GD image stream");
> 
> //Make it transparent
> imagesavealpha($img, true);
> $trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127);
> imagefill($img, 0, 0, $trans_colour);
> 
> //Get the text color
> $text_color = imagecolorallocate($img, 255, 0, 0);
> 
> //Draw the string
> imagestring($img, $font_size, 0, 0,  $string, $text_color);
> 
> // Load background image, find position, print
> $img2 = imagecreatefrompng('xxx.png');
> $yoffset = (imagesx($img2)/2) - (imagesx($img)/2);
> imagecopymerge($img2, $img, $yoffset, 5, 0, 0, imagesx($img),
> imagesy($img), 100);
> 
> // Output the merged images
> header ("Content-type: image/png");
> imagepng($img2);
> 
> 
> This code prints the background image with transparancy removed with a
> light grey, and the text image in red on a black background in the
> correct position.
> If I change it to imagepng($img), the text image is printed correctly
> (transparency and all)
> 
> Suggestions appreciated, i'm lost!
> 
> Many thanks,
> 
> Alex
> 


The only thing I can obviously see is that you've told it to ignore
transparency on $img2 by not asking it to preserve it (the default is to
ignore). PNG doesn't handle transparency in the same way a GIF does,
each pixel can have a varying degree of opacity, which allows whatever
is beneath it to show through. Add the imagesavealpha($img, true); line
for $img2 and see what that does for you.

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




Re: [PHP] Server-side encryption to prevent form hacking: new idea?

2009-12-12 Thread AmirBehzad Eslami
Suppose you have the following array:
*
*

which is used to generate the following "Select":

*
   Tehran
   Isfahan
   Tabriz
*

You can check whether the submitted value is valid or not, using the
following code:

*if ($_SERVER['REQUEST_METHOD'] == "POST") {

   if (!in_array($_POST['city'], $cities) die('Invalid');

}
*
Hope this helps.


On Sat, Dec 12, 2009 at 12:18 AM, Andrew Ballard  wrote:

> On Fri, Dec 11, 2009 at 3:34 PM, Michael Shadle  wrote:
> > On Fri, Dec 11, 2009 at 12:29 PM, Mattias Thorslund
> >  wrote:
> >> Kelly Jones wrote:
> >>>
> >>> If you have an HTML form select field xyz with possible values
> >>> "apple", "banana", and "cucumber", anyone can easily set xyz to an
> >>> arbitrary value.
> >>>
> >>> To prevent this, I create a hidden field code[xyz] with value:
> >>> base64_encode(mcrypt_ecb(
> >>>  MCRYPT_RIJNDAEL_256,$salt,"apple,banana,cucumber",MCRYPT_ENCRYPT));
> >>>
> >>> where $salt is stored in a file outside my webroot.
> >>>
> >>> The script receiving the POST data uses:
> >>>
> >>> mcrypt_ecb(MCRYPT_RIJNDAEL_256,$salt,
> >>>  base64_decode($_REQUEST[code][xyz]), MCRYPT_DECRYPT);
> >>>
> >>> and confirms xyz is really one of "apple", "banana", or "cucumber".
>
> [snip]
>
> >>
> >> If the server-side script knows which values are expected, then there is
> no
> >> need to send that to the client (browser) and back. If this is not
> simply
> >> hard-coded in your script, you can keep it in a different file, in a
> >> database, or in the session, depending on your particular situation. For
> >> most of the fields, the number of acceptable values aren't limited to a
> >> small set, so it's more practical to check for expected length, data
> type,
> >> and escape the data before saving it.
> >>
> >> Cheers,
> >>
> >> Mattias
> > you don't necessarily need encryption, you could use digests instead
> > and issue a use-once ticket as well.
> >
>
> Why is any of this necessary? Most of the time I build select lists
> from arrays, so it is easy to test the value submitted by the client
> to make sure it exists in the array without any encryption or hashing.
> Am I missing something?
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Kind regards,
-behzad


Re: [PHP] move_uploaded_file

2009-12-12 Thread Roberto Aloi

This is exactly what I mean.
Documentation should never leave room to interpretation.
At least, this is what I think.

Roberto Aloi

On 11 Dec 2009, at 22:36, Ashley Sheridan   
wrote:



On Fri, 2009-12-11 at 22:14 +, Roberto wrote:


Hi Joseph,

I'm perfectly fine with the concepts of absolute/relative path and
webroot, trust me.
For me it was just unclear from the documentation the fact that the
"target path" in the move_uploaded_file function was "absolute" with
respect to the file system and not to the "webroot".
At the beginning I thought the function itself was taking care about
adding the server root on its own to that path.
Thinking carefully, it makes perfectly sense for the function to
behave the way it actually does, since otherwise it would be
impossible to get these files out of the server root in file system
terms.
Just, this should be written in CAPITAL LETTERS in the documentation.
Thanks for the interest,

Roberto Aloi
http://aloiroberto.wordpress.com
Twitter: @prof3ta

> When used in PHP, an absolute path does not go off the web root.  
In Premise
> 3 below, an absolute path of "/upload" will NOT bring up the  
directory
> "/home/prof3ta/projects/moodle/htdocs/upload" but rather simply "/ 
upload"

>  In Windows terms, an absolute path would be "C:\upload" versus
> "C:\home\prof3ta\projects\moodle\htdocs\upload".  The only time  
an absolute
> path is figured relative to the web root is when it is referenced  
in a
> browser.  At this point, for all intents and purposes, it locates  
the file
> based on the web root.  This is a fundamental difference between  
absolute

> and relative paths.
>
> Absolute:  begins at "/" in Linux operating systems and "C:\" in  
Windows OS
> Relative:  begins wherever the running script is located in the  
file system.

>
> Joseph
>
> Roberto wrote:
>>
>> HI,
>>
>> Premise 1:
>> echo exec("pwd"); -> "/home/prof3ta/projects/moodle/htdocs/ 
feedback_tool"

>>
>> Premise 2:
>> I have an "upload" folder with 777 permissions under:
>> /home/prof3ta/projects/moodle/htdocs/upload
>>
>> Premise 3:
>> The server root is obviously htdocs:
>> /home/prof3ta/projects/moodle/htdocs
>>
>> This said, the following doesn't work:
>>
>> > $uploads_dir = "/upload";
>> $tmp_name = $_FILES["file"]["tmp_name"];
>> $name = $_FILES["file"]["name"];
>> move_uploaded_file($tmp_name, "$uploads_dir/$name");
>> ?>
>>
>> The following does work:
>>
>> > $uploads_dir = "../upload";
>> $tmp_name = $_FILES["file"]["tmp_name"];
>> $name = $_FILES["file"]["name"];
>> move_uploaded_file($tmp_name, "$uploads_dir/$name");
>> ?>
>>
>> I consider it as a documentation bug (in the sample code they  
use an

>> absolute path).
>> I indeed believe I *should* be able to use both of them if not
>> documented otherwise.
>> I will dig into the C implementation of the move_uploaded_file
>> function and I'll check, though.
>>
>> Cheers,
>>
>> Roberto Aloi
>> http://aloiroberto.wordpress.com
>> Twitter: @prof3ta
>>
>>
>



I've never had any issue with the documentation for this function. I  
think it might just be an issue with interpretation? :p


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




Re: [PHP] move_uploaded_file

2009-12-12 Thread Ashley Sheridan
On Sat, 2009-12-12 at 11:49 +, Roberto Aloi wrote:

> This is exactly what I mean.
> Documentation should never leave room to interpretation.
> At least, this is what I think.
> 
> Roberto Aloi
> 
> On 11 Dec 2009, at 22:36, Ashley Sheridan   
> wrote:
> 
> > On Fri, 2009-12-11 at 22:14 +, Roberto wrote:
> >>
> >> Hi Joseph,
> >>
> >> I'm perfectly fine with the concepts of absolute/relative path and
> >> webroot, trust me.
> >> For me it was just unclear from the documentation the fact that the
> >> "target path" in the move_uploaded_file function was "absolute" with
> >> respect to the file system and not to the "webroot".
> >> At the beginning I thought the function itself was taking care about
> >> adding the server root on its own to that path.
> >> Thinking carefully, it makes perfectly sense for the function to
> >> behave the way it actually does, since otherwise it would be
> >> impossible to get these files out of the server root in file system
> >> terms.
> >> Just, this should be written in CAPITAL LETTERS in the documentation.
> >> Thanks for the interest,
> >>
> >> Roberto Aloi
> >> http://aloiroberto.wordpress.com
> >> Twitter: @prof3ta
> >>
> >> > When used in PHP, an absolute path does not go off the web root.  
> >> In Premise
> >> > 3 below, an absolute path of "/upload" will NOT bring up the  
> >> directory
> >> > "/home/prof3ta/projects/moodle/htdocs/upload" but rather simply "/ 
> >> upload"
> >> >  In Windows terms, an absolute path would be "C:\upload" versus
> >> > "C:\home\prof3ta\projects\moodle\htdocs\upload".  The only time  
> >> an absolute
> >> > path is figured relative to the web root is when it is referenced  
> >> in a
> >> > browser.  At this point, for all intents and purposes, it locates  
> >> the file
> >> > based on the web root.  This is a fundamental difference between  
> >> absolute
> >> > and relative paths.
> >> >
> >> > Absolute:  begins at "/" in Linux operating systems and "C:\" in  
> >> Windows OS
> >> > Relative:  begins wherever the running script is located in the  
> >> file system.
> >> >
> >> > Joseph
> >> >
> >> > Roberto wrote:
> >> >>
> >> >> HI,
> >> >>
> >> >> Premise 1:
> >> >> echo exec("pwd"); -> "/home/prof3ta/projects/moodle/htdocs/ 
> >> feedback_tool"
> >> >>
> >> >> Premise 2:
> >> >> I have an "upload" folder with 777 permissions under:
> >> >> /home/prof3ta/projects/moodle/htdocs/upload
> >> >>
> >> >> Premise 3:
> >> >> The server root is obviously htdocs:
> >> >> /home/prof3ta/projects/moodle/htdocs
> >> >>
> >> >> This said, the following doesn't work:
> >> >>
> >> >>  >> >> $uploads_dir = "/upload";
> >> >> $tmp_name = $_FILES["file"]["tmp_name"];
> >> >> $name = $_FILES["file"]["name"];
> >> >> move_uploaded_file($tmp_name, "$uploads_dir/$name");
> >> >> ?>
> >> >>
> >> >> The following does work:
> >> >>
> >> >>  >> >> $uploads_dir = "../upload";
> >> >> $tmp_name = $_FILES["file"]["tmp_name"];
> >> >> $name = $_FILES["file"]["name"];
> >> >> move_uploaded_file($tmp_name, "$uploads_dir/$name");
> >> >> ?>
> >> >>
> >> >> I consider it as a documentation bug (in the sample code they  
> >> use an
> >> >> absolute path).
> >> >> I indeed believe I *should* be able to use both of them if not
> >> >> documented otherwise.
> >> >> I will dig into the C implementation of the move_uploaded_file
> >> >> function and I'll check, though.
> >> >>
> >> >> Cheers,
> >> >>
> >> >> Roberto Aloi
> >> >> http://aloiroberto.wordpress.com
> >> >> Twitter: @prof3ta
> >> >>
> >> >>
> >> >
> >>
> >
> > I've never had any issue with the documentation for this function. I  
> > think it might just be an issue with interpretation? :p
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >


I can't see where you would find fault with the documentation though, as
all the PHP file functions require either an absolute path from the root
(not web root) or a relative one from the script performing the action.

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




[PHP] Best ajax library

2009-12-12 Thread Ali Asghar Toraby Parizy
Hi friends.
What ajax library do you suggest for php developers?
Can i use gwt with php, or It is compatible only with java web applications?

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



Re: [PHP] Best ajax library

2009-12-12 Thread shahrzad khorrami
salam ;)

JQuery is good one.



-- 
Shahrzad Khorrami


Re: [PHP] Best ajax library

2009-12-12 Thread Ashley Sheridan
On Sat, 2009-12-12 at 15:34 +0330, shahrzad khorrami wrote:

> salam ;)
> 
> JQuery is good one.
> 
> 
> 


JQuery is good for client-side, did you want something for the server?

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




Re: [PHP] Best ajax library

2009-12-12 Thread Ali Asghar Toraby Parizy
Thanks for your replies. Which one is better for GUI building? I'm looking
for a ajax library that is comfortable for client side applications. I think
php is plenty comfortable For server side issues, so I can't see any reason
to toil in experiencing new technologies.

On Sat, Dec 12, 2009 at 3:37 PM, Ashley Sheridan
wrote:

>  On Sat, 2009-12-12 at 15:34 +0330, shahrzad khorrami wrote:
>
> salam ;)
>
> JQuery is good one.
>
>
>
>
>
> JQuery is good for client-side, did you want something for the server?
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


Re: [PHP] Best ajax library

2009-12-12 Thread Floyd Resler
I've always been a big fan of prototype which does AJAX plus a whole lot more.

Take care,
Floyd

On Dec 12, 2009, at 7:00 AM, Ali Asghar Toraby Parizy wrote:

> Hi friends.
> What ajax library do you suggest for php developers?
> Can i use gwt with php, or It is compatible only with java web applications?
> 
> -- 
> 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] fpassthru() error after update

2009-12-12 Thread A. Mannini

Vincent Tumwijukye ha scritto:

This means that buffered video exceeded your memory limitof 260MB set in
your php.ini. Consider increasing it to higher value, if your computer has
say 1GB or more of RAM.

Kind regards



Dear Vicent,

i know what the error message is saying but...before upgrading i had the 
same PHP settings (256 memory limit), the same script with fpassthru and 
the same videos (greater than 256MB) and all worked fine.
At least before upgrading, i supposed fpassthru "streamed" videos in 
progress mode without buffering ALL before starting to send...

This is the problem...

Thanks

Alessandro

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



Re: [PHP] Transparent PNGs: Merging

2009-12-12 Thread Alex Davies
Hi Ash,

Thanks for your suggestion. Unfortunately,that did not help but i've found a
post via Google which gave a simple (and slightly counter-intuitive)
solution - replace

imagecopymerge($img2, $img, $yoffset, 5, 0, 0, imagesx($img), imagesy($img),
100);
with
imagecopy($img2, $img, $yoffset, 5, 0, 0, imagesx($img), imagesy($img));

And it works :)

It seems imagecopymerge does not work well with PNGs and Alpha Channels.

Many thanks for your help,

Alex

On Sat, Dec 12, 2009 at 11:20 AM, Ashley Sheridan
wrote:

>  On Sat, 2009-12-12 at 05:02 +, Alex Davies wrote:
>
> Hi All,
>
> I apologise if this is a newbie post; i'm new to transparent graphics
> (PNGs in my case).
>
> I have a transparent PNG on disk, which I want PHP to load into memory
> and add some text to ("watermarking", I guess). This seems to be what
> is achieved @ http://php.ca/manual/en/image.examples.merged-watermark.php
>
> I have taken the following code almost entirely from the manual, but
> can not understand what I have done wrong:
>
> 
> //Create the image
> $img = @imagecreatetruecolor($width, $height)
>   or die("Cannot Initialize new GD image stream");
>
> //Make it transparent
> imagesavealpha($img, true);
> $trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127);
> imagefill($img, 0, 0, $trans_colour);
>
> //Get the text color
> $text_color = imagecolorallocate($img, 255, 0, 0);
>
> //Draw the string
> imagestring($img, $font_size, 0, 0,  $string, $text_color);
>
> // Load background image, find position, print
> $img2 = imagecreatefrompng('xxx.png');
> $yoffset = (imagesx($img2)/2) - (imagesx($img)/2);
> imagecopymerge($img2, $img, $yoffset, 5, 0, 0, imagesx($img),
> imagesy($img), 100);
>
> // Output the merged images
> header ("Content-type: image/png");
> imagepng($img2);
> 
>
> This code prints the background image with transparancy removed with a
> light grey, and the text image in red on a black background in the
> correct position.
> If I change it to imagepng($img), the text image is printed correctly
> (transparency and all)
>
> Suggestions appreciated, i'm lost!
>
> Many thanks,
>
> Alex
>
>
>
> The only thing I can obviously see is that you've told it to ignore
> transparency on $img2 by not asking it to preserve it (the default is to
> ignore). PNG doesn't handle transparency in the same way a GIF does, each
> pixel can have a varying degree of opacity, which allows whatever is beneath
> it to show through. Add the imagesavealpha($img, true); line for $img2 and
> see what that does for you.
>
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
Alex Davies

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender immediately by e-mail and delete this e-mail permanently.


Re: Re: [PHP] move_uploaded_file

2009-12-12 Thread Carl Furst
It's also a security flaw... php should be chrooted to the webroot! Or
it should be chrooted to the users home directory. Especially on windows
systems where security is not so strict.

My 2 cents,
Carl.

Roberto wrote:
> Hi Joseph,
>
> I'm perfectly fine with the concepts of absolute/relative path and
> webroot, trust me.
> For me it was just unclear from the documentation the fact that the
> "target path" in the move_uploaded_file function was "absolute" with
> respect to the file system and not to the "webroot".
> At the beginning I thought the function itself was taking care about
> adding the server root on its own to that path.
> Thinking carefully, it makes perfectly sense for the function to
> behave the way it actually does, since otherwise it would be
> impossible to get these files out of the server root in file system
> terms.
> Just, this should be written in CAPITAL LETTERS in the documentation.
> Thanks for the interest,
>
> Roberto Aloi
> http://aloiroberto.wordpress.com
> Twitter: @prof3ta
>
>   
>> When used in PHP, an absolute path does not go off the web root. In Premise
>> 3 below, an absolute path of "/upload" will NOT bring up the directory
>> "/home/prof3ta/projects/moodle/htdocs/upload" but rather simply "/upload"
>>  In Windows terms, an absolute path would be "C:\upload" versus
>> "C:\home\prof3ta\projects\moodle\htdocs\upload".  The only time an absolute
>> path is figured relative to the web root is when it is referenced in a
>> browser.  At this point, for all intents and purposes, it locates the file
>> based on the web root.  This is a fundamental difference between absolute
>> and relative paths.
>>
>> Absolute:  begins at "/" in Linux operating systems and "C:\" in Windows OS
>> Relative:  begins wherever the running script is located in the file system.
>>
>> Joseph
>>
>> Roberto wrote:
>> 
>>> HI,
>>>
>>> Premise 1:
>>> echo exec("pwd"); -> "/home/prof3ta/projects/moodle/htdocs/feedback_tool"
>>>
>>> Premise 2:
>>> I have an "upload" folder with 777 permissions under:
>>> /home/prof3ta/projects/moodle/htdocs/upload
>>>
>>> Premise 3:
>>> The server root is obviously htdocs:
>>> /home/prof3ta/projects/moodle/htdocs
>>>
>>> This said, the following doesn't work:
>>>
>>> >> $uploads_dir =/upload";
>>> $tmp_name =_FILES["file"]["tmp_name"];
>>> $name =_FILES["file"]["name"];
>>> move_uploaded_file($tmp_name, "$uploads_dir/$name");
>>> ?>
>>>
>>> The following does work:
>>>
>>> >> $uploads_dir =../upload";
>>> $tmp_name =_FILES["file"]["tmp_name"];
>>> $name =_FILES["file"]["name"];
>>> move_uploaded_file($tmp_name, "$uploads_dir/$name");
>>> ?>
>>>
>>> I consider it as a documentation bug (in the sample code they use an
>>> absolute path).
>>> I indeed believe I *should* be able to use both of them if not
>>> documented otherwise.
>>> I will dig into the C implementation of the move_uploaded_file
>>> function and I'll check, though.
>>>
>>> Cheers,
>>>
>>> Roberto Aloi
>>> http://aloiroberto.wordpress.com
>>> Twitter: @prof3ta
>>>
>>>
>>>   

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



RE: [PHP] Backup to local drive

2009-12-12 Thread tedd

At 3:04 PM -0700 12/11/09, Ben Miller wrote:
That's exactly why I need something that will put all the needed 
files directly onto the flash drive - to take that responsibility 
away from the user.  Pulling the data from the DB and creating the 
folder structure is easy with PHP - just not sure how to copy that 
folder structure and related files to the flash drive without the 
user having to know much of anything about computers.  Was hoping 
there is maybe a PHP extension that I didn't know about, but sounds 
like a client side is going to be my best bet.


What you describe is an application that would run client-side. PHP 
will not be able to help you, nor will javascript for neither have 
that capability.


If the problem were mine, I would use Java to do this.

Cheers,

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: Re: [PHP] Backup to local drive

2009-12-12 Thread Carl Furst
Two words: Java Applet.. That's the stuff that Facebook and other social
sites do stuff like this, Although I've only seen it for upload.

One thing perhaps you can do is have the applet command the browser to
save the page as a complete web page onto the flash drive.

it's cross platform and cross browser compatible... Also, maybe with
some JQuery plugins you can have what you need.

Hoping that inspires/helps,
Carl.

Ashley Sheridan wrote:
> On Fri, 2009-12-11 at 16:52 -0600, Joseph Thayne wrote:
>
>   
>> PHP cannot create a folder structure on your local machine.  I don't 
>> think Javascript or VBScript can either.  Your best bet is with the zip 
>> files.  Windows users have it fairly simple actually (as much as I hate 
>> to admit it) as all they would have to do is right-click and "Extract".  
>> You can always include instructions in either an on-screen format or a 
>> README file (or both). 
>>
>> As I have been thinking about it, you are going to need to do a zip file 
>> so that the user only has to download a single file.
>>
>> Joseph
>>
>> Ashley Sheridan wrote:
>> 
>>> On Fri, 2009-12-11 at 15:04 -0700, Ben Miller wrote:
>>>   
>>>   
 That’s exactly why I need something that will put all the needed files
 directly onto the flash drive �C to take that responsibility away from
 the user.  Pulling the data from the DB and creating the folder
 structure is easy with PHP �C just not sure how to copy that folder
 structure and related files to the flash drive without the user having
 to know much of anything about computers.  Was hoping there is maybe a
 PHP extension that I didn’t know about, but sounds like a client side
 is going to be my best bet.

  


 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: Friday, December 11, 2009 2:39 PM
 To: Ben Miller
 Cc: 'Roberto'; php-general@lists.php.net
 Subject: RE: [PHP] Backup to local drive



  

 On Fri, 2009-12-11 at 14:36 -0700, Ben Miller wrote: 


  
 Too much reliance on the user knowing how to extract the files to the 
 flash drive �C need something that does it all for them so all they have 
 to do is insert the flash drive on their own computer to store the 
 preformatted presentation and then insert into a prospect’s computer and 
 either a) (preferred) run the presentation via an autoplay command or b) 
 open the presentation.html file.
  
  
 Ben
  
  
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: Friday, December 11, 2009 2:25 PM
 To: Ben Miller
 Cc: 'Roberto'; php-general@lists.php.net
 Subject: RE: [PHP] Backup to local drive
  
  
 On Fri, 2009-12-11 at 14:25 -0700, Ben Miller wrote: 
  
 Users would be updating data via form input (address, tel, product
 catalogues, etc.) as well as uploading files (images, PDFs, etc.), creating
 their own presentations and saving those presentations to a flash drive as
 HTML files with calls to the images/PDFs so that they can simply plug their
 drive into a USB port and present the info on the road, regardless of
 connection to the internet.
 Ben
 -Original Message-
 From: Roberto [mailto:prof...@gmail.com] 
 Sent: Friday, December 11, 2009 11:58 AM
 To: Ben Miller
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Backup to local drive
 Hi,
 you lost me a bit. Let say a user uploads a PDF file to one of your 
 servers.
 What do you mean when you say "I want the users to be able to save the
 HTML output of their data"?!?
 Roberto Aloi
 http://aloiroberto.wordpress.com
 Twitter: @prof3ta
 On Fri, Dec 11, 2009 at 6:44 PM, Ben Miller  wrote:
 
 
> Hello - I have an application I'm building that allows users to store
> personal information and files (images, PDFs, etc.) in our database, but I
> need a way for them to be able to save the HTML output of that personal
>   
>   
 data
 
 
> to a local (for the user) flash drive.  I'm guessing I'm going to need a
> clientSide language like javascript for this, but was wondering if maybe
> there was a PHP addon or something like that for downloading content to
>   
>   
 the
 
 
> user's PC.  Thanks in advance.
>
>
>
> Ben
>
>
>   
>   
  
  
  
  
 Why not create all the HTML files and images on the server, and zip it up 
 then send that down to the user?
  
  
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
  
  
  
  



 That could end up in a lot of HTML and image files. Also, if you can't
 rely on people to unzip a file, can you rely on them to know that they
 need to keep t

Re: Re: [PHP] move_uploaded_file

2009-12-12 Thread Ashley Sheridan
On Sat, 2009-12-12 at 09:42 -0500, Carl Furst wrote:

> It's also a security flaw... php should be chrooted to the webroot! Or
> it should be chrooted to the users home directory. Especially on windows
> systems where security is not so strict.
> 
> My 2 cents,
> Carl.
> 
> Roberto wrote:
> > Hi Joseph,
> >
> > I'm perfectly fine with the concepts of absolute/relative path and
> > webroot, trust me.
> > For me it was just unclear from the documentation the fact that the
> > "target path" in the move_uploaded_file function was "absolute" with
> > respect to the file system and not to the "webroot".
> > At the beginning I thought the function itself was taking care about
> > adding the server root on its own to that path.
> > Thinking carefully, it makes perfectly sense for the function to
> > behave the way it actually does, since otherwise it would be
> > impossible to get these files out of the server root in file system
> > terms.
> > Just, this should be written in CAPITAL LETTERS in the documentation.
> > Thanks for the interest,
> >
> > Roberto Aloi
> > http://aloiroberto.wordpress.com
> > Twitter: @prof3ta
> >
> >   
> >> When used in PHP, an absolute path does not go off the web root. In Premise
> >> 3 below, an absolute path of "/upload" will NOT bring up the directory
> >> "/home/prof3ta/projects/moodle/htdocs/upload" but rather simply "/upload"
> >>  In Windows terms, an absolute path would be "C:\upload" versus
> >> "C:\home\prof3ta\projects\moodle\htdocs\upload".  The only time an absolute
> >> path is figured relative to the web root is when it is referenced in a
> >> browser.  At this point, for all intents and purposes, it locates the file
> >> based on the web root.  This is a fundamental difference between absolute
> >> and relative paths.
> >>
> >> Absolute:  begins at "/" in Linux operating systems and "C:\" in Windows OS
> >> Relative:  begins wherever the running script is located in the file 
> >> system.
> >>
> >> Joseph
> >>
> >> Roberto wrote:
> >> 
> >>> HI,
> >>>
> >>> Premise 1:
> >>> echo exec("pwd"); -> "/home/prof3ta/projects/moodle/htdocs/feedback_tool"
> >>>
> >>> Premise 2:
> >>> I have an "upload" folder with 777 permissions under:
> >>> /home/prof3ta/projects/moodle/htdocs/upload
> >>>
> >>> Premise 3:
> >>> The server root is obviously htdocs:
> >>> /home/prof3ta/projects/moodle/htdocs
> >>>
> >>> This said, the following doesn't work:
> >>>
> >>>  >>> $uploads_dir =/upload";
> >>> $tmp_name =_FILES["file"]["tmp_name"];
> >>> $name =_FILES["file"]["name"];
> >>> move_uploaded_file($tmp_name, "$uploads_dir/$name");
> >>> ?>
> >>>
> >>> The following does work:
> >>>
> >>>  >>> $uploads_dir =../upload";
> >>> $tmp_name =_FILES["file"]["tmp_name"];
> >>> $name =_FILES["file"]["name"];
> >>> move_uploaded_file($tmp_name, "$uploads_dir/$name");
> >>> ?>
> >>>
> >>> I consider it as a documentation bug (in the sample code they use an
> >>> absolute path).
> >>> I indeed believe I *should* be able to use both of them if not
> >>> documented otherwise.
> >>> I will dig into the C implementation of the move_uploaded_file
> >>> function and I'll check, though.
> >>>
> >>> Cheers,
> >>>
> >>> Roberto Aloi
> >>> http://aloiroberto.wordpress.com
> >>> Twitter: @prof3ta
> >>>
> >>>
> >>>   
> 


Then hundreds of apps that use PHP to deliver files outside of web root
after a user has passed security validation would fail to work, and that
is just to name one specific example, as it's something I've used on
many sites. You'd lose access to a whole host of shell functionality,
because often the programs people call from the shell are not in the
PATH env variable for the user that Apache runs under (this is different
from the include path that Apache or PHP itself has). In my opinion,
chrooting PHP to the web root would cause major problems.

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




Re: [PHP] Server-side encryption to prevent form hacking: new idea?

2009-12-12 Thread tedd

At 1:53 PM -0600 12/11/09, Kelly Jones wrote:

-snip-

Is this a new idea, or have people done this before?


Not a new idea, nor one that is useful -- no offense meant.

I can prevent form hacking by simply checking and scrubbing incoming 
data without resorting to encryption.


Security techniques are very basic and it's probably best if you read 
a book on the subject. I recommend Essential PHP Security by Chris 
Shiflett. You can pick it up at Amazon for less than $20. It's a good 
read with lot's of useful information.


The $20 bucks you spend on that will save you more in time than 
trying to reinvent the security wheel.


Cheers,

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] Upload dir

2009-12-12 Thread Richard Quadling
2009/12/11 Ashley Sheridan 
>
> On Fri, 2009-12-11 at 15:44 +, Richard Quadling wrote:
>
> 2009/12/11 kranthi :
> > How can i change the temporary upload directory?
> > var_dump(ini_get('upload_tmp_dir'));      gives me (and that is set in 
> > php.ini)
> > string '/var/www/cgi-bin' (length=16)
> >
> > but
> > var_dump($_FILES)                                                     gives 
> > me
> > 'tmp_name' => string '/tmp/phpbSZ6WP' (length=14)
> >
> > var_dump(file_exists($_FILES['file']['tmp_name']));  gives me  (/tmp
> > has permissions drwxrwxrwt and i never used file_move_upload or any
> > similar functions)
> > boolean false
> >
> > am I missing something here?
> > Kranthi.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> Just assuming you could alter the upload_tmp_dir setting in your code
> (you can't) ...
>
> PHP puts the uploaded files into the upload_tmp_dir BEFORE your script
> runs, so changing it in your script essentially hides the uploaded
> files.
>
> PHP drops the files into directory A.
> PHP then runs your code.
> Your code changes the directory to B.
> Your code cannot see the files PHP put into A as your code is now looking in 
> B.
>
> But, as I said earlier, you can't use your code to change
> upload_tmp_dir. It can only be done at the system level (php.ini or
> httpd.conf). See [1] and [2].
>
> Regards,
>
> Richard Quadling.
>
> [1] http://docs.php.net/manual/en/ini.core.php#ini.sect.file-uploads
> [2] http://docs.php.net/manual/en/configuration.changes.modes.php
>
> --
> -
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
>
> The only reason I can see for wanting to do this would be where several sites 
> exist on the same server and you might want each site to have its own 
> temporary upload directory. It won't have any bearing on how you handle the 
> uploads unless it becomes full.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

Another way to handle this is via php.ini sections [1]

Regards,

Richard.

[1] http://docs.php.net/manual/en/ini.sections.php

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

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



Re: [PHP] Transparent PNGs: Merging

2009-12-12 Thread tedd

At 5:02 AM + 12/12/09, Alex Davies wrote:

-snip-

Suggestions appreciated, i'm lost!

Many thanks,

Alex


Watermark?

Try this:

http://webbytedd.com/b/watermark/

The code is there and the dog is actual size.

Cheers,

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] Best ajax library

2009-12-12 Thread Richard Quadling
2009/12/12 Floyd Resler :
> I've always been a big fan of prototype which does AJAX plus a whole lot more.
>
> Take care,
> Floyd
>
> On Dec 12, 2009, at 7:00 AM, Ali Asghar Toraby Parizy wrote:
>
>> Hi friends.
>> What ajax library do you suggest for php developers?
>> Can i use gwt with php, or It is compatible only with java web applications?
>>
>> --
>> 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
>
>

I REALLY like prototype, but it does do a lot to the standard objects,
which does mean it often doesn't play well with others.

If you use Prototype and Scriptaculous (the GUI side of things for
effects and such), then you've got a winner.

Something that is missing though is the more GUI-like components that
come with toolkits like BlueShoes (php CMS server and client side with
separatable JS components - license required depending upon usage).


For just the AJAX communication, then prototype is perfectly adequate.
Though the 'X' is often easier to work with if it is J as in JSON.

Prototype can return JS objects from an AJAX call. PHP support for
JSON is fine in this regard (though I would make sure you set
JSON_FORCE_OBJECT for json_encode() to make sure empty arrays are
returned as objects rather than an empty array if you are building
your objects dynamically).

Richard.


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

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



Re: [PHP] move_uploaded_file

2009-12-12 Thread Carl Furst
Depends on the configuration. If I have a bunch of web sites and they 
are all using files created, written and executed by the apache user, 
when the apache process sudo execs the php  from a specific web root I 
want it to stay in that root. I don't want it to be able to write files 
to another web root.


Believe me, I know administrators who have issues with php precisely 
because of this. It is especially true if you are using VirtualHosts. 
And even more true if you are using VirtualHosts with different users 
controlling those hosts. You a) have to be very careful about users, 
groups and permissions or b) chroot your php process. a) is much much 
simpler.. as long as the apache process can read the files you're 
golden. However on Windows, this is, of course, impossible; or at least 
very highly improbable.


C.


Ashley Sheridan wrote:

On Sat, 2009-12-12 at 09:42 -0500, Carl Furst wrote:

It's also a security flaw... php should be chrooted to the webroot! Or
it should be chrooted to the users home directory. Especially on windows
systems where security is not so strict.

My 2 cents,
Carl.

Roberto wrote:
> Hi Joseph,
>
> I'm perfectly fine with the concepts of absolute/relative path and
> webroot, trust me.
> For me it was just unclear from the documentation the fact that the
> "target path" in the move_uploaded_file function was "absolute" with
> respect to the file system and not to the "webroot".
> At the beginning I thought the function itself was taking care about
> adding the server root on its own to that path.
> Thinking carefully, it makes perfectly sense for the function to
> behave the way it actually does, since otherwise it would be
> impossible to get these files out of the server root in file system
> terms.
> Just, this should be written in CAPITAL LETTERS in the documentation.
> Thanks for the interest,
>
> Roberto Aloi
> http://aloiroberto.wordpress.com
> Twitter: @prof3ta
>
>   
>> When used in PHP, an absolute path does not go off the web root. In Premise

>> 3 below, an absolute path of "/upload" will NOT bring up the directory
>> "/home/prof3ta/projects/moodle/htdocs/upload" but rather simply "/upload"
>>  In Windows terms, an absolute path would be "C:\upload" versus
>> "C:\home\prof3ta\projects\moodle\htdocs\upload".  The only time an absolute
>> path is figured relative to the web root is when it is referenced in a
>> browser.  At this point, for all intents and purposes, it locates the file
>> based on the web root.  This is a fundamental difference between absolute
>> and relative paths.
>>
>> Absolute:  begins at "/" in Linux operating systems and "C:\" in Windows OS
>> Relative:  begins wherever the running script is located in the file system.
>>
>> Joseph
>>
>> Roberto wrote:
>> 
>>> HI,

>>>
>>> Premise 1:
>>> echo exec("pwd"); -> "/home/prof3ta/projects/moodle/htdocs/feedback_tool"
>>>
>>> Premise 2:
>>> I have an "upload" folder with 777 permissions under:
>>> /home/prof3ta/projects/moodle/htdocs/upload
>>>
>>> Premise 3:
>>> The server root is obviously htdocs:
>>> /home/prof3ta/projects/moodle/htdocs
>>>
>>> This said, the following doesn't work:
>>>
>>> >> $uploads_dir =/upload";
>>> $tmp_name =_FILES["file"]["tmp_name"];
>>> $name =_FILES["file"]["name"];
>>> move_uploaded_file($tmp_name, "$uploads_dir/$name");
>>> ?>
>>>
>>> The following does work:
>>>
>>> >> $uploads_dir =../upload";
>>> $tmp_name =_FILES["file"]["tmp_name"];
>>> $name =_FILES["file"]["name"];
>>> move_uploaded_file($tmp_name, "$uploads_dir/$name");
>>> ?>
>>>
>>> I consider it as a documentation bug (in the sample code they use an
>>> absolute path).
>>> I indeed believe I *should* be able to use both of them if not
>>> documented otherwise.
>>> I will dig into the C implementation of the move_uploaded_file
>>> function and I'll check, though.
>>>
>>> Cheers,
>>>
>>> Roberto Aloi
>>> http://aloiroberto.wordpress.com
>>> Twitter: @prof3ta
>>>
>>>
>>>   




Then hundreds of apps that use PHP to deliver files outside of web 
root after a user has passed security validation would fail to work, 
and that is just to name one specific example, as it's something I've 
used on many sites. You'd lose access to a whole host of shell 
functionality, because often the programs people call from the shell 
are not in the PATH env variable for the user that Apache runs under 
(this is different from the include path that Apache or PHP itself 
has). In my opinion, chrooting PHP to the web root would cause major 
problems.


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




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



[PHP] Learning PHP

2009-12-12 Thread Robert H
What is a good beginners programming book for PHP? I like "dead trees" 
more than reading stuff on my screen, so I am looking for a book.


Thanks!

Bob


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



Re: [PHP] Learning PHP

2009-12-12 Thread shiplu
On Sun, Dec 13, 2009 at 12:27 AM, Robert H  wrote:
> What is a good beginners programming book for PHP? I like "dead trees" more
> than reading stuff on my screen, so I am looking for a book.
>

There are plenty of books in amazon.com
Order one and start reading.
-- 
A K M Mokaddim
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

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



Re: [PHP] Learning PHP

2009-12-12 Thread Ashley Sheridan
On Sun, 2009-12-13 at 01:42 +0700, shiplu wrote:

> On Sun, Dec 13, 2009 at 12:27 AM, Robert H  wrote:
> > What is a good beginners programming book for PHP? I like "dead trees" more
> > than reading stuff on my screen, so I am looking for a book.
> >
> 
> There are plenty of books in amazon.com
> Order one and start reading.
> -- 
> A K M Mokaddim
> My talks, http://talk.cmyweb.net
> Follow me, http://twitter.com/shiplu
> SUST Programmers, http://groups.google.com/group/p2psust
> Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
> 


Pretty much anything by O'reilly is a good buy. I've not had them steer
me wrong yet.

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




Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-12 Thread Gaurav Kumar
Hi Rene,

The only thing which is a hurdle is that your system/computer is not
allowing external connections. There seems to be nothing else wrong.

I strongly suggest check your system firewall, any central server settings
through which your system gets internet access, any antivirus s/w installed
etc.. this can be the only reason. Something is stopping you to access
external connection.

Let me know when your problem is fixed.
Also I tried the below code and it works fine-

http://www.google.com');
echo $str;
?>

Thanks,

Gaurav Kumar



2009/12/11 René Fournier 

> Hi Gaurav,
>
> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>
> A very typical problem. Good you sent the error message.
>
> This problem can be caused due to one of the following-
>
> 1. I have faced similar problem due to local firewall settings.
>
>
> Don't think this is it, since (1) the firewall settings haven't changed,
> and (2) other machines on the same network can execute this same code and
> function (but they aren't running OS X Server 10.6.
>
> 2. Try some other domain; i.e. other than google com. Try some of the local
> area website with a particular page like www.somedomain.com/somefile.html
>
>
> I've tried many different external and local web sites, and they all fail.
>
> 3. Some times the remote host does not allow you to connect to get the file
> contents.
>
>
> (Also not the cause -- as explained above.)
>
>
> 4. # 3 can be either way round from both the ends a) you host server does
> not allow external connections b) Remote host does not allow anonymous
> connection.
>
>
> Thanks for the options. I don't think they apply in this case. If you have
> any other suggestions on what to do, I would welcome them.
>
>
>
> Gaurav Kumar
> blog.oswebstudio.com
>
>
>
> On Thu, Dec 10, 2009 at 9:01 PM, René Fournier wrote:
>
>> I thought error_reporting would display them, but I guess php.ini had them
>> suppressed. Anyway, with:
>>
>> >
>> error_reporting(-1);
>> ini_set('display_errors', 1);
>> set_time_limit(0);
>> var_dump (file_get_contents ('http://www.google.com'));
>>
>> ?>
>>
>> I get:
>>
>> Warning: file_get_contents(http://www.google.com): failed to open stream:
>> Operation now in progress in //.php on line 7 bool(false)
>>
>> Does that help with the diagnosis?
>>
>>
>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>
>> > 2009/12/9 René Fournier :
>> >> It is, and I use curl elsewhere in the same script to fetch remote
>> content.
>> >> This exact same function works fine on my MacBook Pro (10.6 client, PHP
>> 5.3), and *was* previously working fine under Server 10.4.11 and PHP 5.3,
>> >>
>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>> >>
>> >>> try
>> >>> wget http://www.google.com in your command line to see whether the
>> network is reachable
>> >>>
>> >>> LinuxManMikeC wrote:
>> 
>>  On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC <
>> linuxmanmi...@gmail.com> wrote:
>> 
>> > On Wed, Dec 9, 2009 at 6:45 AM, René Fournier 
>> wrote:
>> >
>> >> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3.
>> Any call of file_get_contents() on a local file works fine -- the file is
>> read and returned. But any call of file_get_contents on a url -- any url,
>> local or remote -- always returns false.
>> >>
>> >> var_dump (file_get_contents 
>> >> ('http://www.google.com/')
>> );
>> >>
>> >> bool(false)
>> >>
>> >> I've checked php.ini, and the obvious seems okay:
>> >>
>> >>allow_url_fopen => On => On
>> >>
>> >> Any ideas?
>> >>
>> >> ...Rene
>> >>
>> >
>> http://us2.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
>> >
>> >
>> 
>>  "I've checked php.ini"
>>  Right, must remember not to reply to stuff till I'm awake. :-D
>> 
>>  --
>>  PHP General Mailing List (http://www.php.net/)
>>  To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
>> >>>
>> >>> --
>> >>> <2866791487_dbbbdddf9e.jpg>惠 新宸 xinchen.hui | 商务搜索部 |
>> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
>> >>
>> >>
>> >
>> > Do you have ANY errors/warning/notices?
>> >
>> >
>> >
>> > --
>> > -
>> > Richard Quadling
>> > "Standing on the shoulders of some very clever giants!"
>> > EE : http://www.experts-exchange.com/M_248814.html
>> > Zend Certified Engineer :
>> http://zend.com/zce.php?c=ZEND002498&r=213474731
>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>
>>
>
>


Re: [PHP] Learning PHP

2009-12-12 Thread Phpster

Programming php from Eric

Bastien

Sent from my iPod

On Dec 12, 2009, at 12:27 PM, Robert H  wrote:

What is a good beginners programming book for PHP? I like "dead  
trees" more than reading stuff on my screen, so I am looking for a  
book.


Thanks!

Bob


--
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] Learning PHP

2009-12-12 Thread Andrew Brookins
On Sat, Dec 12, 2009 at 9:27 AM, Robert H  wrote:
> What is a good beginners programming book for PHP? I like "dead trees" more
> than reading stuff on my screen, so I am looking for a book.

O'Reilly is good for getting the facts.  You could start with Programming PHP:

   http://oreilly.com/catalog/9781565926103/

Check the O'Reilly PHP page for more resources, some printed:

   http://oreilly.com/php/

If you're looking for books that specifically cover PHP's OO features,
there are lots of older books on pre-5.3 features, like Zandstra's PHP
5 Objects, Patterns, and Practice (2004):

   
http://www.amazon.com/PHP-5-Objects-Patterns-Practice/dp/1590593804/ref=sr_1_3?ie=UTF8&s=books&qid=1260652305&sr=8-3

Although if you're new to OOP you may want to read more general books
on the subject and then work your way back to the features available
in the version of PHP that you need to use.

In general, the best publishers I've found are O'Reilly, The Pragmatic
Programmers, Apress and Packt.

Best,

-- 
Andrew Brookins
a.m.brook...@gmail.com

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



Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-12 Thread René Fournier
The thing is, the file_get_contents() fails the same way on local URLs -- that 
is, web sites hosted on the same machine. Or even using the machine's own IP 
address.

On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:

> Hi Rene,
> 
> The only thing which is a hurdle is that your system/computer is not allowing 
> external connections. There seems to be nothing else wrong.
> 
> I strongly suggest check your system firewall, any central server settings 
> through which your system gets internet access, any antivirus s/w installed 
> etc.. this can be the only reason. Something is stopping you to access 
> external connection.
> 
> Let me know when your problem is fixed.
> Also I tried the below code and it works fine-
> 
>  $str =  file_get_contents ('http://www.google.com');
> echo $str;
> ?>
> 
> Thanks,
> 
> Gaurav Kumar
> 
> 
> 
> 2009/12/11 René Fournier 
> Hi Gaurav,
> 
> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
> 
>> A very typical problem. Good you sent the error message.
>> 
>> This problem can be caused due to one of the following-
>> 
>> 1. I have faced similar problem due to local firewall settings.
> 
> Don't think this is it, since (1) the firewall settings haven't changed, and 
> (2) other machines on the same network can execute this same code and 
> function (but they aren't running OS X Server 10.6.
> 
>> 2. Try some other domain; i.e. other than google com. Try some of the local 
>> area website with a particular page like www.somedomain.com/somefile.html
> 
> I've tried many different external and local web sites, and they all fail.
> 
>> 3. Some times the remote host does not allow you to connect to get the file 
>> contents.
> 
> (Also not the cause -- as explained above.)
> 
> 
>> 4. # 3 can be either way round from both the ends a) you host server does 
>> not allow external connections b) Remote host does not allow anonymous 
>> connection.
> 
> Thanks for the options. I don't think they apply in this case. If you have 
> any other suggestions on what to do, I would welcome them.
> 
> 
> 
>> Gaurav Kumar
>> blog.oswebstudio.com
>> 
>> 
>> 
>> On Thu, Dec 10, 2009 at 9:01 PM, René Fournier  wrote:
>> I thought error_reporting would display them, but I guess php.ini had them 
>> suppressed. Anyway, with:
>> 
>> > 
>> error_reporting(-1);
>> ini_set('display_errors', 1);
>> set_time_limit(0);
>> var_dump (file_get_contents ('http://www.google.com'));
>> 
>> ?>
>> 
>> I get:
>> 
>> Warning: file_get_contents(http://www.google.com): failed to open stream: 
>> Operation now in progress in //.php on line 7 bool(false)
>> 
>> Does that help with the diagnosis?
>> 
>> 
>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>> 
>> > 2009/12/9 René Fournier :
>> >> It is, and I use curl elsewhere in the same script to fetch remote 
>> >> content.
>> >> This exact same function works fine on my MacBook Pro (10.6 client, PHP 
>> >> 5.3), and *was* previously working fine under Server 10.4.11 and PHP 5.3,
>> >>
>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>> >>
>> >>> try
>> >>> wget http://www.google.com in your command line to see whether the 
>> >>> network is reachable
>> >>>
>> >>> LinuxManMikeC wrote:
>> 
>>  On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC  
>>  wrote:
>> 
>> > On Wed, Dec 9, 2009 at 6:45 AM, René Fournier  
>> > wrote:
>> >
>> >> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3. 
>> >> Any call of file_get_contents() on a local file works fine -- the 
>> >> file is read and returned. But any call of file_get_contents on a url 
>> >> -- any url, local or remote -- always returns false.
>> >>
>> >> var_dump (file_get_contents ('http://www.google.com/'));
>> >>
>> >> bool(false)
>> >>
>> >> I've checked php.ini, and the obvious seems okay:
>> >>
>> >>allow_url_fopen => On => On
>> >>
>> >> Any ideas?
>> >>
>> >> ...Rene
>> >>
>> > http://us2.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
>> >
>> >
>> 
>>  "I've checked php.ini"
>>  Right, must remember not to reply to stuff till I'm awake. :-D
>> 
>>  --
>>  PHP General Mailing List (http://www.php.net/)
>>  To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
>> >>>
>> >>> --
>> >>> <2866791487_dbbbdddf9e.jpg>惠 新宸 xinchen.hui | 商务搜索部 | 
>> >>> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
>> >>
>> >>
>> >
>> > Do you have ANY errors/warning/notices?
>> >
>> >
>> >
>> > --
>> > -
>> > Richard Quadling
>> > "Standing on the shoulders of some very clever giants!"
>> > EE : http://www.experts-exchange.com/M_248814.html
>> > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
>> > ZOPA : http://uk.zopa.com/member/RQuadling
>> 
>> 
> 
> 



Re: [PHP] Best ajax library

2009-12-12 Thread Raymond Irving
Well I would recommend jQuery for client-side ajax.

But if you're looking for an integrated solution for php on the server-side, 
then you might  want to check out Raxan for PHP - http://raxanpdi.com

Best regards,
__
Raymond Irving
Raxan for PHP - PHP/Ajax made simple






From: Ali Asghar Toraby Parizy 
To: php-general@lists.php.net
Sent: Sat, December 12, 2009 7:00:53 AM
Subject: [PHP] Best ajax library

Hi friends.
What ajax library do you suggest for php developers?
Can i use gwt with php, or It is compatible only with java web applications?

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