Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Per Jessen
Merlin Morgenstern wrote:

> I use windows right click for this.
> 
> Actually I isolated the problem, but still I can't figure out how to
> solve it. The page is not utf-8, but ugb2312.
> 
> I am already sending the header through php:
> header("Content-Type: text/html; charset=ugb2312");
> 
> And with apache http.conf:
> AddDefaultCharset ugb2312

Shouldn't that be just gb2312 ?

> However firefox still claims that it is utf-8 which is causing the
> strange characters.

The encoding informnation is in the headers sent - try using e.g.
wget -S to see what your server is sending.  Or sent me a link
off-line, and I'll check for you.

/Per

-- 
Per Jessen, Zürich (10.0°C)


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



Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Per Jessen
Andrew Ballard wrote:

> A bit off topic, but Ctrl+I no longer brings up the Page Info in
> Firefox like it used to -- at least on my Windows computers. (It opens
> the bookmark list in the sidebar.) Does it do differently under Linux?

On FF 2.0.0.6 Ctrl-I brings up the info page - perhaps 3.0 changed that?


/Per

-- 
Per Jessen, Zürich (9.9°C)


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



Re: [PHP] convert video files to FLV

2009-04-08 Thread Tom Sparks

there are shared-host that have ffmpeg 
like http://www.cirtexhosting.com/shared.shtml

tom_a_sparks

Please avoid sending me Word or PowerPoint attachments.
but instead use OpenDocument File Formats or 
use OpenOffice
http://en.wikipedia.org/wiki/OpenDocument
http://en.wikipedia.org/wiki/OpenOffice.org
http://www.gnu.org/philosophy/no-word-attachments.html

--- On Thu, 9/4/09, Gevorg Harutyunyan  wrote:

From: Gevorg Harutyunyan 
Subject: Re: [PHP] convert video files to FLV
To: "Adrian" 
Cc: php-general@lists.php.net
Received: Thursday, 9 April, 2009, 3:45 PM

Thanks guys, but as I understood that extension also requires ffmpeg on
server, correct me if I am wrong.
So anyway I need ffmpeg on server. Some day, when I will have dedicated
server I will use ffmpeg for sure, but now
I need other solution.

On Thu, Apr 9, 2009 at 10:33 AM, Adrian  wrote:

> Don't waste CPU power of shared servers for video recoding.
> If you need that, get a dedicated server without other customers who
> would probably be affected by you using lots of cpu power.
>
> Besides that, if you cannot install own (compiled) software on it,
> you'd have to use a pure php solution which would be HORRIBLY slow.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Best Regards,
Gevorg Harutyunyan



  The new Internet Explorer 8 optimised for Yahoo!7: Faster, Safer, Easier.

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



Re: [PHP] Re: PHP and Send Mail

2009-04-08 Thread Michael A. Peters

9el wrote:

On Thu, Apr 9, 2009 at 7:19 AM, Shawn McKenzie  wrote:

Alejandro Esteban Galvez wrote:

Hi!, I am making a web system and i need known how send a mail using PHP

Hi,
Use PHPmailer or PEAR:mail()


I second PHPmailer.
It rocks!

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



Re: [PHP] codeigniter 'secure, non-secure content' pop up message in IE7

2009-04-08 Thread Chris



Hello Experts,

I badly need your help. My developed site's some pages are HTTPS, and
other parts are HTTP. When I try to access the HTTPS page in IE it
comes up with "secure & non-secure content " warning. I search on
google to find out the solution. but almost every site suggest to
change the IE setting. But, its not wish way to tell every visitor's
to change  the IE setting. So, I want to stop this message with some
coding. while searching, I found some advice to make all image to
HTTPS, for https pages, I followed that, but still i am getting this
same pop up warning. Is there any other way to solve my problem? Any
one can help me on it? Please do reply.


Make all images, javascript etc work with https.

That's the only IE will not complain about it.

--
Postgresql & php tutorials
http://www.designmagick.com/


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



Re: [PHP] convert video files to FLV

2009-04-08 Thread Michael Shadle
there's some third party encoding services out there, and if you host
with softlayer, they have media transcoding services they offer for
their hosting customers (not sure the cost, but it's pay for what you
use)

On Wed, Apr 8, 2009 at 10:45 PM, Gevorg Harutyunyan  wrote:
> Thanks guys, but as I understood that extension also requires ffmpeg on
> server, correct me if I am wrong.
> So anyway I need ffmpeg on server. Some day, when I will have dedicated
> server I will use ffmpeg for sure, but now
> I need other solution.
>
> On Thu, Apr 9, 2009 at 10:33 AM, Adrian  wrote:
>
>> Don't waste CPU power of shared servers for video recoding.
>> If you need that, get a dedicated server without other customers who
>> would probably be affected by you using lots of cpu power.
>>
>> Besides that, if you cannot install own (compiled) software on it,
>> you'd have to use a pure php solution which would be HORRIBLY slow.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Best Regards,
> Gevorg Harutyunyan
>

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



Re: [PHP] convert video files to FLV

2009-04-08 Thread Gevorg Harutyunyan
Thanks guys, but as I understood that extension also requires ffmpeg on
server, correct me if I am wrong.
So anyway I need ffmpeg on server. Some day, when I will have dedicated
server I will use ffmpeg for sure, but now
I need other solution.

On Thu, Apr 9, 2009 at 10:33 AM, Adrian  wrote:

> Don't waste CPU power of shared servers for video recoding.
> If you need that, get a dedicated server without other customers who
> would probably be affected by you using lots of cpu power.
>
> Besides that, if you cannot install own (compiled) software on it,
> you'd have to use a pure php solution which would be HORRIBLY slow.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Best Regards,
Gevorg Harutyunyan


Re: [PHP] convert video files to FLV

2009-04-08 Thread Michael Shadle
On Wed, Apr 8, 2009 at 10:33 PM, Adrian  wrote:
> Don't waste CPU power of shared servers for video recoding.
> If you need that, get a dedicated server without other customers who
> would probably be affected by you using lots of cpu power.
>
> Besides that, if you cannot install own (compiled) software on it,
> you'd have to use a pure php solution which would be HORRIBLY slow.

i use php-fpm + nginx + have one allowed job per server for each of my
webservers. dual core with 2 gigs of ram and normal sata disk. no real
problems to complain about sharing the two.

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



Re: [PHP] Re: PHP and Send Mail

2009-04-08 Thread 9el
On Thu, Apr 9, 2009 at 7:19 AM, Shawn McKenzie  wrote:
> Alejandro Esteban Galvez wrote:
>> Hi!, I am making a web system and i need known how send a mail using PHP
Hi,
Use PHPmailer or PEAR:mail()

And I'm Lenin

Bye :)

www.twitter.com/nine_L

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



[PHP] codeigniter 'secure, non-secure content' pop up message in IE7

2009-04-08 Thread 9el
-- Forwarded message --
From: Sabrina Akter 
Date: Thu, Apr 9, 2009 at 1:12 AM
Subject: codeigniter 'secure, non-secure content' pop up message in IE7
To: phpexpe...@yahoogroups.com


Hello Experts,

I badly need your help. My developed site's some pages are HTTPS, and
other parts are HTTP. When I try to access the HTTPS page in IE it
comes up with "secure & non-secure content " warning. I search on
google to find out the solution. but almost every site suggest to
change the IE setting. But, its not wish way to tell every visitor's
to change  the IE setting. So, I want to stop this message with some
coding. while searching, I found some advice to make all image to
HTTPS, for https pages, I followed that, but still i am getting this
same pop up warning. Is there any other way to solve my problem? Any
one can help me on it? Please do reply.

With Regards

Sabrina Akter
Web App. Developer
'IBACS' - www.ibacs.co.uk

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



Re: [PHP] convert video files to FLV

2009-04-08 Thread Michael Shadle
On Wed, Apr 8, 2009 at 10:30 PM, Gevorg Harutyunyan  wrote:
> Hi,
>
> I need to convert video files to FLV using php.
>
> The only solution that I found is to use ffmpeg, but because I am using
> shared hosting I am not allowed to install it on server.
> Do you know any other ways to convert any video file types to flv using PHP.

use ffmpeg.

there is an ffmpeg-php extension but it's kinda buggy and i am not
sure it supports enough for what you want. but using ffmpeg for it is
pretty simple. just system() the calls to it. google for it

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



Re: [PHP] convert video files to FLV

2009-04-08 Thread Adrian
Don't waste CPU power of shared servers for video recoding.
If you need that, get a dedicated server without other customers who
would probably be affected by you using lots of cpu power.

Besides that, if you cannot install own (compiled) software on it,
you'd have to use a pure php solution which would be HORRIBLY slow.


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



[PHP] convert video files to FLV

2009-04-08 Thread Gevorg Harutyunyan
Hi,

I need to convert video files to FLV using php.

The only solution that I found is to use ffmpeg, but because I am using
shared hosting I am not allowed to install it on server.
Do you know any other ways to convert any video file types to flv using PHP.

Thanks for help!

Best Regards,
Gevorg Harutyunyan


Re: [PHP] How about a saveXHTML for the DOM?

2009-04-08 Thread Michael Shadle
On Wed, Apr 8, 2009 at 8:58 PM, Michael A. Peters  wrote:

> Yes it should - I believe php 6 is suppose to be much better at native UTF8.
> At least according to some blog I read somewhere (IE don't believe me
> without reservation, it's third hand knowledge at best)

afaik you're right, it's supposed to be fully unicode. or at least -was-

however, how long until it is production stable... when i am sure
someone can hack together a patch to make saveHTML unicode capable :p

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



Re: [PHP] How about a saveXHTML for the DOM?

2009-04-08 Thread Michael A. Peters

Michael Shadle wrote:

i think it should also be fully utf-8 capable.

saveHTML is not for me right now, and i have to run some preg_replace
to remove the  etc chunks, and the output is not utf-8, even
though the input is. i got a workaround using html_decode_entities()
or something like that but i haven't ran it to see really how well
that works...

but i would expect if you give the dom functions utf-8, and even
specify utf-8, it should operate as utf-8 the entire time, including
during save() ...


Yes it should - I believe php 6 is suppose to be much better at native 
UTF8. At least according to some blog I read somewhere (IE don't believe 
me without reservation, it's third hand knowledge at best)


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



Re: [PHP] How about a saveXHTML for the DOM?

2009-04-08 Thread Michael A. Peters

Raymond Irving wrote:

Hello,

I'm thinking that it's about time a saveXHTML() method be added to the DOM 
objects.


Not necessary.

saveXML() already does what is needed to provide valid xhtml output.

See the php source of http://www.clfsrpm.net/xss/dom_script_test.phps

to see how one can server-side detect whether or not to use saveHTML() 
or saveXML()




XHTML is supported by all major browsers and libxml2


IE (still) does not properly support XHTML.
It will render an XHTML page sent with the text/html mime type - but 
that's actually a standards violation.



so I can't see why we should be stuck with saveHTML() and saveXML(). While it's 
true that some developers are using saveXML(), it does not always comply with 
the XHTML standards.


Where does it deviate from xhtml standard?
xhtml is a subset of xml - if your DOMDocument is valid xhtml then the 
output of saveXML() should be as well.



Another problem with saveXML() is the lack of support for HTML entities.


An xml document does not need HTML entities.
If the bro



There are many tricks out there to cleanup the output of saveXML()



What tricks are needed?


but I think having a native function would be much more efficient and faster.


What do you think?


I think it is not necessary.
There are some issues - IE



is valid xml and I believe validates as xhtml - but (at least with older 
versions of Mozilla) does not render correctly. Knowing that - I always do


$xmlAnchor = $myxhtml->createElement("a"," ");
$xmlAnchor->setAttribute("id","foo");

but that's a browser bug, not a saveXML() bug.

I'm really curious to know where saveXML() fails to produce valid XHTML 
when the DOM structure is valid XHTML.


Rememver, XHTML is extendable - there's MathML and SVG that many 
browsers already know what to do with, and I'm sure others will be 
added. Unless a saveXHTML() function can be told what to do in those 
cases, what's the point?


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



Re: [PHP] difficult select problem

2009-04-08 Thread Jim Lucas

PJ wrote:

Gentlemen,

First, let me thank you all for responding and offering suggestions. I
appreciate it and I am learning things.


How about telling us/me what it did or did not do for you?


However, it looks like my message is not getting across:
The problem is not to retrieve only the authors whose last names begin
with A:

1) which books have a second author?
2) who is the second author ?
This is determined by table book_author column ordinal (which can be 1
or 2) - if there is only 1 author for a book then there is no ordinal 2
linked to book_author bookID and authID.


This is the first that I have heard about this 'ordinal'.  From your description above, I don't get 
what it does for you.  The book_author table should, basically, connect the books table to the 
authors table by a simple two column combination of ids.  So, I don't understand the significance of 
that field.  Could you explain it further please?




The structure of the db:

book
   id
   title
   sub_title
   descr
   comment
   bk_cover
   copyright
   ISBN
   language
   sellers

author
   id
   first_name
   last_name
  
book_author

   authID
   bookID
   ordinal



Thanks for the structure.  From this I can show you exactly what I would do to create the code. 
Minus the publishers information of course since you didn't supply the layout for those tables.


$SQL = "
SELECT  book.*
FROMbook
INNER JOIN  book_author ON (book.id = book_author.bookID)
INNER JOIN  author  ON (book_author.authID = author.id)
WHERE   author.last_name LIKE '{$Auth}%'
";

$books = array();
$bookIDs = array();
if ( ( $results = mysql_query($SQL, $db) ) !== false ) {
while ( $row = mysql_fetch_assoc($results) ) {
$books[$row['id']] = $row;
$bookIDs[] = $row['id'];
}
}

if ( count($bookIDs) > 0 ) {

print_r($bookIDs);
# above should result in a structure that shows an indexed array of book 
ids for their values.

$SQL = "
SELECT book.id AS book_id, author.id AS author_id, author.first_name, 
author.last_name
FROMbook
INNER JOIN  book_author ON (book.id = book_author.bookID)
INNER JOIN  author  ON (book_author.authID = author.id)
WHERE   book.id IN ( " . join(',', $bookIDs) . " )
";

$authors = array();
if ( ( $results = mysql_query($SQL, $db) ) !== false ) {
while ( $row = mysql_fetch_assoc($results) ) {
$authors[$row['book_id']][$row['author_id']] = $row;
}
}

print_r($authors);
# above should result in a multidimensional array of books/authors/(author 
data)
# Now, you should be able to have two nexted foreach loops.
# I will briefly give you an example.
foreach ( $books AS $bookID => $bookData ) {

# Display book information
echo '', $bookID, '';
print_r($bookData);

# Test to see if the book has any authors
if ( isset($authors[$bookID]) ) {

# Tell us how many authors we found
echo 'Found: ', count($author[$bookID]), ' authors';

# Loop through the authors
foreach ( $authors[$bookID] AS $authorID => $authorData ) {
# Display the
echo "{$authorData['last_name']}, 
{$authorData['first_name']}\n";
}
echo '';
} else {
echo 'No authors found';
}
echo '';
}
} else {
echo 'No books match your search pattern...';
}

?>

Ok, this is the second time I have written a script for you...  You owe me :)

This should return to you a header that includes the book ID and then print all the data for the 
book.  That will be followed by any and all authors for the book.


If it doesn't work...  well I don't know what to do then.

But, try it!!!  Report back to the list what it did for you or what it missed 
on.

Your responses have been very vague as to what an example did or didn't do for 
you.

Tell us everything that worked or didn't and we might be able to help you to tweak the code so it 
DOES do what your are looking to do.


Hope it works!

Jim

categories and publishers are not realy relevant here...

The code I have:

$SQL = "SELECT b.*, c.publisher, a.first_name, a.last_name
FROM book AS b
LEFT JOIN book_publisher as bp ON b.id = bp.bookID
LEFT JOIN publishers AS c ON bp.publishers_id = c.id
LEFT JOIN book_author AS ba ON b.id = ba.bookID
LEFT JOIN author AS a ON ba.authID = a.id
WHERE LEFT(last_name, 1 ) = '$Auth' ";

(PLEASE LET ME KNOW IF THERE IS SOMETHING WRONG WITH THE CODE)
It gives me these results:

*array*
6 =>
*array*
'id' => string '6' /(length=1)/
'title' => string 'Nubia.' /(length=6)/
'sub_title' => string 'Corridor to Africa' /(length=18)/
'descr' => string '' /(length=0)/
'comment' => string '' /(length=0)/
'bk_cover' => string '' /(length=

Re: [PHP] How about a saveXHTML for the DOM?

2009-04-08 Thread Michael Shadle
i think it should also be fully utf-8 capable.

saveHTML is not for me right now, and i have to run some preg_replace
to remove the  etc chunks, and the output is not utf-8, even
though the input is. i got a workaround using html_decode_entities()
or something like that but i haven't ran it to see really how well
that works...

but i would expect if you give the dom functions utf-8, and even
specify utf-8, it should operate as utf-8 the entire time, including
during save() ...



On Wed, Apr 8, 2009 at 7:01 PM, Raymond Irving  wrote:
>
> Hello,
>
> I'm thinking that it's about time a saveXHTML() method be added to the DOM 
> objects.
>
> XHTML is supported by all major browsers and libxml2 so I can't see why we 
> should be stuck with saveHTML() and saveXML(). While it's true that some 
> developers are using saveXML(), it does not always comply with the XHTML 
> standards. Another problem with saveXML() is the lack of support for HTML 
> entities.
>
> There are many tricks out there to cleanup the output of saveXML() but I 
> think having a native function would be much more efficient and faster.
>
>
> What do you think?
>
>
> __
> Raymond Irving
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] How about a saveXHTML for the DOM?

2009-04-08 Thread Raymond Irving

Hello,

I'm thinking that it's about time a saveXHTML() method be added to the DOM 
objects.

XHTML is supported by all major browsers and libxml2 so I can't see why we 
should be stuck with saveHTML() and saveXML(). While it's true that some 
developers are using saveXML(), it does not always comply with the XHTML 
standards. Another problem with saveXML() is the lack of support for HTML 
entities.

There are many tricks out there to cleanup the output of saveXML() but I think 
having a native function would be much more efficient and faster.


What do you think?


__
Raymond Irving

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



[PHP] Re: PHP and Send Mail

2009-04-08 Thread Shawn McKenzie
Alejandro Esteban Galvez wrote:
> Hi!, I am making a web system and i need known how send a mail using PHP 
> 
> Bye
> 
> 
> 
> ---
> Alejandro Esteban Galvez
> Administrador de Red IPICHMC Rimed,
> Radio-Aficionado CL2AEG
> Linux User #472120 - http://i18n.counter.li.org/
> Correo: alejan...@infomed.sld.cu
> Correo y Jabber: alejan...@ipichmc.rimed.cu
> www.ipichmc.rimed.cu
> ---
> 
> 
> 
> 
> 
> ---
> Red Telematica de Salud - Cuba
> CNICM - Infomed
> 
> 
Hi! I'm Shawn.

Bye

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] PHP and Send Mail

2009-04-08 Thread Phpster

And not one RTFM?

Bastien

Sent from my iPod

On Apr 8, 2009, at 20:58, Chris  wrote:


Alejandro Esteban Galvez wrote:
Hi!, I am making a web system and i need known how send a mail  
using PHP


http://www.php.net/manual/en/function.mail.php

--
Postgresql & php tutorials
http://www.designmagick.com/


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



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



Re: [PHP] difficult select problem

2009-04-08 Thread Jim Lucas

PJ wrote:

Hi Jim,
Sorry I could not gat back to you on your suggestion. I've been under
the weather for a couple of days but am almost over it.
Your suggestion does not work... yet.
I'll insert comments & questions below...

Jim Lucas wrote:

PJ wrote:

I've searched the web, the tutorials, etc. with no luck and have asked
on MySql list with no luck and have even posted here with no replies.
So, let's try again:

I am trying to limit the search for books to only those that start with
"A" (does not have to be case sensitive); but within that selection
there may be a second author whose name may start with any letter of the
alphabet.

So, the real problem is to find if there is a second author in the
selection of books and to display that name.
My query shows all the books that begin with A:

$SQL = "SELECT b.*, c.publisher, a.first_name, a.last_name
FROM book AS b
LEFT JOIN book_publisher as bp ON b.id = bp.bookID
LEFT JOIN publishers AS c ON bp.publishers_id = c.id
LEFT JOIN book_author AS ba ON b.id = ba.bookID
LEFT JOIN author AS a ON ba.authID = a.id WHERE
LEFT(last_name, 1 ) = '$Auth' ";

Within the results there are some books that have 2 authors and now I
have to find if
there is a second author in the results and then be able to echo the
second author.
So far, I have not been able to figure out how to go about that.
Do I need to do another query to find the second author or can it
somehow be incorporated into the original query? Or can it be done
with a UNION ?
Please help.

 


... and we begin ...

$SQL = "SELECT b.*, c.id AS publisher_id, c.publisher, a.id AS
author_id, a.first_name, a.last_name
FROM book AS b
INNER JOIN book_publisher as bp ON b.id = bp.bookID
INNER JOIN publishers AS c ON bp.publishers_id = c.id
INNER JOIN book_author AS ba ON b.id = ba.bookID
INNER JOIN author AS a ON ba.authID = a.id
WHERE b.id IN (
SELECT  b.id
FROMbook AS b
INNER JOIN book_author AS ba ON b.id = ba.bookID
INNER JOIN author AS a ON ba.authID = a.id
WHERE   a.last_name LIKE '{$Auth}%'
)";

A written, the code does not produce a result.
Questions:
1. why c.id AS publisher_id and a.id AS author_id? I do not see a
reference to these in the code
2. why "a.last_name LIKE '{$Auth}%'? What does that change from
LEFT(last_name, 1) = '$Auth'? the LEFT clause will give me all authors
whose names begin with A; I don't care what the rest of the string may
be - the authors' last names always starts with a capital letter.
3. What were you expecting to get as a result from the code? It looks to
me like the results will only give all authors whose names begin with A.
And that I am already getting with the code as I have written. Sorry for
my ignorance, but that is why I am asking for help.
4. So far, no one has used the book_author.ordinal to select the author
;  perhaps I have not been clear on that as that is what I use to
determine if there are more than 1 author. Ordinal 1 is for all authors
who are unique for a book; ordinal 2 is for authors who are the second
author for a book.



Thanks for explaining the ordinal significance.  Does it really make a difference if the ordinal is 
1 or 2?  Does 1 indicate the primary author and the 2 indicate supporting authors???


If a book has three authors and all three had an ordinal of 2, would it make any difference then if 
one was 1 and the remaining two were marked 2?


If it makes no difference, the the column is pointless.

If it does make a difference (identifying one as 1 and the remaining as 2), then keep it and we will 
deal with that later.


But, all this can be done without that column.

Read my other email that I about to send, responding to a different part of 
this thread.


Now, if my code is not too messy or cumbersome (I refer to your e-mail
of March 15) then what I really need is a way to save the book.id from
my query to a $tring and then use that to select the book in another
query that will give me the second author. I am wondering how that is
done; I have already used this in retrieving arrays but the id is
changed in a simple $bk_id = $result - damn, I forget where I found that
in the manuals. I used it in another situation like this:
$catvar = array_values($category[$categoryID]);
$cat = $catvar[1];

$catvar was ids like 9, 6, 17, etc. and assigning it to $cat ranged them
as 1, 2, 3, 4, etc. (which is what I want to avoid)

Then I should be able to do a
"SELECT CONCAT_WS(" ", first_name, last_name) as Author2
FROM author a, book b, book_author ba
WHERE $bk_id = ba.bookID && ba.authID = a.id"

or

"SELECT CONCAT(first_name, " ", last_name, book_author.ordinal) as Author2
FROM author a, book b, book_author ba
WHERE $bk_id = ba.bookID && ba.authID = a.id"

I probably have something wrong in the code; I haven't tried it as I am
not sure how to retrieve the $bk_id.
And the CONCAT w

Re: [PHP] PHP and Send Mail

2009-04-08 Thread Chris

Alejandro Esteban Galvez wrote:
Hi!, I am making a web system and i need known how send a mail using PHP 


http://www.php.net/manual/en/function.mail.php

--
Postgresql & php tutorials
http://www.designmagick.com/


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



Re: [PHP] PHP and Send Mail

2009-04-08 Thread Jason Pruim



Alejandro Esteban Galvez wrote:
Hi!, I am making a web system and i need known how send a mail using PHP 


Bye


  

HTTP://www.php.net/mail

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



[PHP] PHP and Send Mail

2009-04-08 Thread Alejandro Esteban Galvez
Hi!, I am making a web system and i need known how send a mail using PHP 

Bye



---
Alejandro Esteban Galvez
Administrador de Red IPICHMC Rimed,
Radio-Aficionado CL2AEG
Linux User #472120 - http://i18n.counter.li.org/
Correo: alejan...@infomed.sld.cu
Correo y Jabber: alejan...@ipichmc.rimed.cu
www.ipichmc.rimed.cu
---





---
Red Telematica de Salud - Cuba

  CNICM - Infomed




Re: [PHP] How can I echo a javascript var in an email subject line? Possible? (Yes!)

2009-04-08 Thread Raymond Irving

For me its very easy to pass php values to the client:

echo _var($value,'name');

But the best part is taking control of what your client sees from the 
server-side:

C('#info')->show(); // now you see it
...
C('#info')->hide(); // now you don't!

Take control and start building powerful web apps with Raxan PDI - 
http://raxanpdi.com

__
Raymond Irving
Create Rich Ajax/PHP Web Apps today!
Raxan PDI - http://raxanpdi


--- On Wed, 4/8/09, Michael A. Peters  wrote:

> From: Michael A. Peters 
> Subject: Re: [PHP] How can I echo a javascript var in an email subject line? 
> Possible?
> To: "Terion Miller" 
> Cc: "PHP General" 
> Date: Wednesday, April 8, 2009, 2:34 PM
> Terion Miller wrote:
> > 
> > 
> > 
> > 
> > On Wed, Apr 8, 2009 at 12:50 PM, Michael A. Peters
>  >
> wrote:
> > 
> >     Terion Miller wrote:
> > 
> > 
> > 
> >            javascript is
> client side.
> >            php is server
> side.
> >            To use
> something client side in a server side script, the web
> >         page
> >            has to send
> it to the server from the client.
> > 
> >            The best way
> to do what you want to do is probably to do the work
> >            count server
> side, but if you really want to use what javascript
> >            produced you
> can create a hidden input with a specified id,
> >         and use
> >            dhtml via
> javascript to modify the input and insert the value
> >         into
> >            the value
> field of the hidden input. Then it will get sent to the
> >            server when
> the user hits the post button.
> > 
> >            However,
> since you should be validating any user input server
> >         side,
> >            you'll need
> to validate that the variable is accurate - might as
> >            well just do
> the count with php server side.
> > 
> > 
> > 
> >         Thanks Michael I
> was kind of moving in the right direction as
> >         far as the
> hidden input goes, going to have to google on how to
> >         do it with the
> dhtml and all like you suggested.
> > 
> > 
> >     Look at the various DOM
> functions - IE for
> > 
> >      name="wordcount" id="hiddenStudd" value="">
> > 
> >     you coud do in your js:
> > 
> >     var myHidden =
> document.getElementById('hiddenStuff');
> > 
>    myHidden.setAttribute('value',$yourvalue);
> > 
> > 
> > Thought I would go ahead and post a bit more on this,
> so here is my wordcount little function on the textarea of
> the form:
> > 
> >      cols="55" rows="5" wrap="hard"
> onKeyDown="wordCounter(this.form.Comments,this.form.remLen,
> 300);"
> onKeyUp="wordCounter(this.form.Comments,this.form.remLen,
> 300);"> $_SESSION['Comments'];}
> ?>Letters to the Editor are
> limited to 300 words or less.Words remaining:
>  value=300>
> > 
> > So I was thinking I should be able to pass that again
> to the next page which is the emailform.php page that is
> taking all the id= and printing them to an email 
> > should be able to reuse that function right?
> > 
> >  onSubmit="return
> wordCounter(this.form.Comments,this.form.remLen);" >
> > 
> > or do I need to define the variable? think I'm
> starting to confuse myself lol
> 
> You don't want the onSubmit in the the hidden input.
> 
> I'm not a javascript guru - but I believe you can have the
> form onSubmit do the word count and insert it into the input
> field before the actual submit happens, I've never tried
> having an onsubmit function alter a value field though.
> 
> I would change the textarea to have an id="Comments" field
> and the remLen input to have an id="remLen" field to make it
> easy to find via getElementById (as id attributes have to be
> unique), count the words and set them to a variable that
> then gets put into the hidden input before whatever function
> you run on the submit type onSubmit returns true.
> 
> not tested - but something like this:
> 
> function countTheWords() {
>    var comment =
> $document.getElementById('Comments');
>    var remLen  =
> $document.getElementById('remLen').value;
>    var count =
> wordCounter($comment,$remLen);
>    var myHidden =
> document.getElementById('words');
>    myHidden.setAttribute('value',$count);
>    }
> 
> Then in whatever function you run in the form onSumbit have
> it run the countTheWords() function before it exits.
> 
> -- 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] Re: problems with loaded extensions

2009-04-08 Thread Edgar da Silva (Fly2k)
Did you check the apache error log?

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



Re: [PHP] difficult select problem

2009-04-08 Thread Jan G.B.
2009/4/7 Bastien Koert :
> On Tue, Apr 7, 2009 at 1:10 PM, Michael A. Peters  wrote:
>
>> PJ wrote:
>>
>>> Bob McConnell wrote:
>>>
 From: PJ

> First, let me thank you all for responding and offering suggestions. I
> appreciate it and I am learning things.
> However, it looks like my message is not getting across:
> The problem is not to retrieve only the authors whose last names begin
> with A:
>
 Actually, it appears you simply don't like the accurate answers you have
 been given.

>>> First, let me say that I am pretty fresh to all this.
>>> Second, I believe I can get the authors with several more queries as I
>>> have done for listings of all the books and by categories, but I am
>>> trying to limit the queries thinking that that will speed up the data
>>> retrieval.
>>>
>>
>> A friend of mine who manages many large scale websites with massive
>> databases says that isn't always the case, especially if you don't have a
>> dedicated SQL server with very fast disks and lots of memory.
>>
>> He's found that in many situations it is faster to do several sql queries
>> and let php sort it out then to use a bunch of joins, subselects, etc. in
>> order to reduce the number of sql queries.
>>
>> Has to do with how sql works on the filesystem, and the IO that can result
>> from sql needing to do a more complex query, and what is fastest varies upon
>> your setup. I think he said sub-selects are the worst because sql has to
>> create a virtual table for the subselect and that can really slow the query
>> down, but I might be mistaken about that.
>>
>> Thus unless he has a problem application that is way too slow on hardware
>> he can't upgrade, he opts for what is easier code to read and maintain.
>> Sometimes that's faster than hard to read queries anyway.
>>
>
> Simple queries will almost alwasy be faster than a large join. Join query
> response times can be affected by the order of the join if  the primary
> table is not the largest one amoung other factors.

Well .. this really depends and - if speaking of large scale sites
with a lot of traffic - you must recognize that you just move the
payload to another server. in that case this would be the webserver.
I give the example of Apache: one process takes up as much RAM as the
"biggest" page it serves. so if a few pageviews require the
application to parse a lot of data, all apache processes will use a
large amount of ram (I've seen systems with 120mb per process!).
High traffic requires a lot of processes and when as your webserver
starts to swap because the RAM is filled up, you're in deep shit. And
you'd  wish to have a normalized DB layout and effective queries.
Setting up a DB-Slave might be better than buying a lot of webservers. ;)

Also, the DB server is build for what you're trying to accomplish, the
webserver running php and serving pages.. well, maybe the server would
spend his CPU time in another way if he'd had the chance... whatever.
;)


byebye


>
> Another thing to consider here is that the data is relatively static.
> Perhaps you could build a xml representation on the first display of the
> book and pay the piper once in building the data. From there build an xml
> snippet ( and store it in the database perhaps in the main books table. Then
> on future calls to that book to display the same data, request the xml and
> use that to display all the data. That way you get the search functionality
> you are looking for and a one time hit to build that data into one common
> format. That would make the future reads of that data much quicker.
>
> --
>
> Bastien
>
> Cat, the other other white meat
>

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



Re: [PHP] difficult select problem

2009-04-08 Thread PJ
Hi Jim,
Sorry I could not gat back to you on your suggestion. I've been under
the weather for a couple of days but am almost over it.
Your suggestion does not work... yet.
I'll insert comments & questions below...

Jim Lucas wrote:
> PJ wrote:
>> I've searched the web, the tutorials, etc. with no luck and have asked
>> on MySql list with no luck and have even posted here with no replies.
>> So, let's try again:
>>
>> I am trying to limit the search for books to only those that start with
>> "A" (does not have to be case sensitive); but within that selection
>> there may be a second author whose name may start with any letter of the
>> alphabet.
>>
>> So, the real problem is to find if there is a second author in the
>> selection of books and to display that name.
>> My query shows all the books that begin with A:
>>
>> $SQL = "SELECT b.*, c.publisher, a.first_name, a.last_name
>> FROM book AS b
>> LEFT JOIN book_publisher as bp ON b.id = bp.bookID
>> LEFT JOIN publishers AS c ON bp.publishers_id = c.id
>> LEFT JOIN book_author AS ba ON b.id = ba.bookID
>> LEFT JOIN author AS a ON ba.authID = a.id WHERE
>> LEFT(last_name, 1 ) = '$Auth' ";
>>
>> Within the results there are some books that have 2 authors and now I
>> have to find if
>> there is a second author in the results and then be able to echo the
>> second author.
>> So far, I have not been able to figure out how to go about that.
>> Do I need to do another query to find the second author or can it
>> somehow be incorporated into the original query? Or can it be done
>> with a UNION ?
>> Please help.
>>
>>  
>>
>
> ... and we begin ...
>
> $SQL = "SELECT b.*, c.id AS publisher_id, c.publisher, a.id AS
> author_id, a.first_name, a.last_name
> FROM book AS b
> INNER JOIN book_publisher as bp ON b.id = bp.bookID
> INNER JOIN publishers AS c ON bp.publishers_id = c.id
> INNER JOIN book_author AS ba ON b.id = ba.bookID
> INNER JOIN author AS a ON ba.authID = a.id
> WHERE b.id IN (
> SELECT  b.id
> FROMbook AS b
> INNER JOIN book_author AS ba ON b.id = ba.bookID
> INNER JOIN author AS a ON ba.authID = a.id
> WHERE   a.last_name LIKE '{$Auth}%'
> )";
A written, the code does not produce a result.
Questions:
1. why c.id AS publisher_id and a.id AS author_id? I do not see a
reference to these in the code
2. why "a.last_name LIKE '{$Auth}%'? What does that change from
LEFT(last_name, 1) = '$Auth'? the LEFT clause will give me all authors
whose names begin with A; I don't care what the rest of the string may
be - the authors' last names always starts with a capital letter.
3. What were you expecting to get as a result from the code? It looks to
me like the results will only give all authors whose names begin with A.
And that I am already getting with the code as I have written. Sorry for
my ignorance, but that is why I am asking for help.
4. So far, no one has used the book_author.ordinal to select the author
;  perhaps I have not been clear on that as that is what I use to
determine if there are more than 1 author. Ordinal 1 is for all authors
who are unique for a book; ordinal 2 is for authors who are the second
author for a book.

Now, if my code is not too messy or cumbersome (I refer to your e-mail
of March 15) then what I really need is a way to save the book.id from
my query to a $tring and then use that to select the book in another
query that will give me the second author. I am wondering how that is
done; I have already used this in retrieving arrays but the id is
changed in a simple $bk_id = $result - damn, I forget where I found that
in the manuals. I used it in another situation like this:
$catvar = array_values($category[$categoryID]);
$cat = $catvar[1];

$catvar was ids like 9, 6, 17, etc. and assigning it to $cat ranged them
as 1, 2, 3, 4, etc. (which is what I want to avoid)

Then I should be able to do a
"SELECT CONCAT_WS(" ", first_name, last_name) as Author2
FROM author a, book b, book_author ba
WHERE $bk_id = ba.bookID && ba.authID = a.id"

or

"SELECT CONCAT(first_name, " ", last_name, book_author.ordinal) as Author2
FROM author a, book b, book_author ba
WHERE $bk_id = ba.bookID && ba.authID = a.id"

I probably have something wrong in the code; I haven't tried it as I am
not sure how to retrieve the $bk_id.
And the CONCAT with the ordinal, I can filter the 1 or the 2 when echoing.

I must be really long-winded but this is a long and complicated exercise
for my little brain. :'(  
>
> Ok, with those changes made, you will now see that your result set is
> going to have duplicate entries for each book. Well, almost duplicate...
>
> Basically what you need to realize is that you are talking about row
> counts compounding upon themselves...
>
> I will try and explain...
>
> if you had ten books with a total of 16 unique authors and 8 unique
> publishers, you would end

[PHP] About Login on PHP

2009-04-08 Thread Alejandro Esteban Galvez
Hi!, I am making a system in php for linux. This system take a control of my 
LDAP server, and login for the LDAP server too. How I can do that the login 
expires past two minutes, when the user part of the system, and when the user 
close your Internet Explorer???

Bye


---
Alejandro Esteban Galvez
Administrador de Red IPICHMC Rimed,
Radio-Aficionado CL2AEG
Linux User #472120 - http://i18n.counter.li.org/
Correo: alejan...@infomed.sld.cu
Correo y Jabber: alejan...@ipichmc.rimed.cu
www.ipichmc.rimed.cu
---





---
Red Telematica de Salud - Cuba

  CNICM - Infomed




[PHP] Re: problems with loaded extensions

2009-04-08 Thread Shawn McKenzie
Andres Gonzalez wrote:
> Hi,
> 
> I have got an extension loaded in all three of my php config files (in
> cli, in cgi, and in apache2 directories).  The functions in the
> extension are all accessible when running test scripts from the command
> line, like:
> 
> php init.php
> 
> for example, in the init.php file I have calls to several of the
> functions in my loaded extension. I also can print out the functions
> like this:
> 
> print_r(get_loaded_extensions());
> print_r(get_extension_funcs("vrad"));
> 
> However, when I run these thru apache, all calls to the functions in my
> loaded extension fail even though the extension is present. If I do
> 
> print_r(get_loaded_extensions());
> 
> I see my loaded extension "vrad" printed out as expected indicating it
> is loaded. If I run:
> 
> if (extension_loaded("vrad"))
> 
> it comes back true which further indicates that the extension is indeed
> loaded.
> 
> But if I call using apache any of the functions in the loaded extension,
> or if I call:
> print_r(get_extension_funcs("vrad"));
> 
> all I get is a blank white page with no errors.
> 
> I would think that as long as the extension is loaded in both the cli
> php.ini and the apache2 php.ini, I would get the same results from the
> loaded extension. Any idea why it work thru the cli and not apache?
> 
> Thanks,
> 
> -Andres

Does the extension rely on any external libraries?  It may be that
apache/the extension can't find it/them or apache doesn't have
permission to it/them.

Execute a shell as the apache user and try it from cli.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] problems with loaded extensions

2009-04-08 Thread Andres Gonzalez

Hi,

I have got an extension loaded in all three of my php config files (in 
cli, in cgi, and in apache2 directories).  The functions in the 
extension are all accessible when running test scripts from the command 
line, like:


php init.php

for example, in the init.php file I have calls to several of the 
functions in my loaded extension. I also can print out the functions 
like this:


print_r(get_loaded_extensions());
print_r(get_extension_funcs("vrad"));

However, when I run these thru apache, all calls to the functions in my 
loaded extension fail even though the extension is present. If I do


print_r(get_loaded_extensions());

I see my loaded extension "vrad" printed out as expected indicating it 
is loaded. If I run:


if (extension_loaded("vrad"))

it comes back true which further indicates that the extension is indeed 
loaded.


But if I call using apache any of the functions in the loaded extension, 
or if I call: 


print_r(get_extension_funcs("vrad"));

all I get is a blank white page with no errors.

I would think that as long as the extension is loaded in both the cli 
php.ini and the apache2 php.ini, I would get the same results from the 
loaded extension. Any idea why it work thru the cli and not apache?


Thanks,

-Andres

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



Re: [PHP] How can I echo a javascript var in an email subject line? Possible?

2009-04-08 Thread Michael A. Peters

Terion Miller wrote:





On Wed, Apr 8, 2009 at 12:50 PM, Michael A. Peters > wrote:


Terion Miller wrote:



   javascript is client side.
   php is server side.
   To use something client side in a server side script, the web
page
   has to send it to the server from the client.

   The best way to do what you want to do is probably to do the work
   count server side, but if you really want to use what javascript
   produced you can create a hidden input with a specified id,
and use
   dhtml via javascript to modify the input and insert the value
into
   the value field of the hidden input. Then it will get sent to the
   server when the user hits the post button.

   However, since you should be validating any user input server
side,
   you'll need to validate that the variable is accurate - might as
   well just do the count with php server side.



Thanks Michael I was kind of moving in the right direction as
far as the hidden input goes, going to have to google on how to
do it with the dhtml and all like you suggested.


Look at the various DOM functions - IE for



you coud do in your js:

var myHidden = document.getElementById('hiddenStuff');
myHidden.setAttribute('value',$yourvalue);


Thought I would go ahead and post a bit more on this, so here is my 
wordcount little function on the textarea of the form:


onKeyDown="wordCounter(this.form.Comments,this.form.remLen, 300);" 
onKeyUp="wordCounter(this.form.Comments,this.form.remLen, 300);">if (isset($_SESSION['Comments'])) {echo $_SESSION['Comments'];} 
?>Letters to the Editor are limited to 300 words or 
less.Words remaining: value=300>


So I was thinking I should be able to pass that again to the next page 
which is the emailform.php page that is taking all the id= and printing 
them to an email 

should be able to reuse that function right?




or do I need to define the variable? think I'm starting to confuse 
myself lol


You don't want the onSubmit in the the hidden input.

I'm not a javascript guru - but I believe you can have the form onSubmit 
do the word count and insert it into the input field before the actual 
submit happens, I've never tried having an onsubmit function alter a 
value field though.


I would change the textarea to have an id="Comments" field and the 
remLen input to have an id="remLen" field to make it easy to find via 
getElementById (as id attributes have to be unique), count the words and 
set them to a variable that then gets put into the hidden input before 
whatever function you run on the submit type onSubmit returns true.


not tested - but something like this:

function countTheWords() {
   var comment = $document.getElementById('Comments');
   var remLen  = $document.getElementById('remLen').value;
   var count = wordCounter($comment,$remLen);
   var myHidden = document.getElementById('words');
   myHidden.setAttribute('value',$count);
   }

Then in whatever function you run in the form onSumbit have it run the 
countTheWords() function before it exits.


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



Re: [PHP] PHP module ignores ldap.conf (SOLVED)

2009-04-08 Thread Keith Lawson


>>> On Mon, Apr 6, 2009 at  7:02 PM, in message <49da8a1b.5070...@gmail.com>, 
>>> Chris
 wrote: 
> Keith Lawson wrote:
>> Hello, 
>> 
>> I'm trying to connect to and LDAP server using PHP over SSL. I compiled 
> Openldap from source, installed it and then compiled PHP against that 
> install. I have a tiny PHP script for testing that I have been calling from 
> the command line (php scriptname). Before adding "TLS_REQCERT never" to 
> ldap.conf that script was failing. After I set that setting in ldap.conf 
> ldaps:// connections work from the command line but when I call the exact 
> same code in a browser it fails. 
> 
> (I assume ldap.conf refers to the config for openldap).
> 
> PHP doesn't know what ldap.conf is or what it does.
> 
> Are you sure you're connecting to the same ldap server? (Stupid question 
> but worth checking).
> 
> If you could run apache in standalone mode (see 
> http://bugs.php.net/bugs- generating- backtrace.php for some info about 
> that) you might be able to strace the process to see what's going on.

My problem was that I had compiled Apache against the Solaris 10 openSSL 
libraries version 0.9.7. When I installed OpenLDAP and recompiled PHP I 
manually build new openSSL libs that were version 0.9.8. Rebuilding apache and 
linking to the same openSSL libraries resolved this problem for me. That 
explains why I was seeing different behavior with command line PHP than when I 
called the same code through Apache. 
 
truss (Solaris strace) brought this to my attention, thanks for the suggestions 
Chris.


 


The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in  reliance upon, this information by persons or entities other  than the 
intended recipient is prohibited. If you received this  in error, please 
contact the sender and delete the material from any computer. 


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



Re: [PHP] How can I echo a javascript var in an email subject line? Possible?

2009-04-08 Thread Terion Miller
On Wed, Apr 8, 2009 at 12:50 PM, Michael A. Peters  wrote:

> Terion Miller wrote:
>
>>
>>
>>javascript is client side.
>>php is server side.
>>To use something client side in a server side script, the web page
>>has to send it to the server from the client.
>>
>>The best way to do what you want to do is probably to do the work
>>count server side, but if you really want to use what javascript
>>produced you can create a hidden input with a specified id, and use
>>dhtml via javascript to modify the input and insert the value into
>>the value field of the hidden input. Then it will get sent to the
>>server when the user hits the post button.
>>
>>However, since you should be validating any user input server side,
>>you'll need to validate that the variable is accurate - might as
>>well just do the count with php server side.
>>
>>
>>
>> Thanks Michael I was kind of moving in the right direction as far as the
>> hidden input goes, going to have to google on how to do it with the dhtml
>> and all like you suggested.
>>
>
> Look at the various DOM functions - IE for
>
> 
>
> you coud do in your js:
>
> var myHidden = document.getElementById('hiddenStuff');
> myHidden.setAttribute('value',$yourvalue);
>

Thought I would go ahead and post a bit more on this, so here is my
wordcount little function on the textarea of the form:

Letters to the Editor are limited to 300 words or
less.Words remaining: 

So I was thinking I should be able to pass that again to the next page which
is the emailform.php page that is taking all the id= and printing them to an
email 
should be able to reuse that function right?



or do I need to define the variable? think I'm starting to confuse myself
lol


Re: [PHP] PHP LDAP over SSL problems (SOLVED)

2009-04-08 Thread Keith Lawson


>>> On Fri, Apr 3, 2009 at 10:16 AM, in message
<49d5e20c.8302.00a...@sjhc.london.on.ca>, "Keith Lawson"
 wrote: 

> 
 On Thu, Apr 2, 2009 at  5:51 PM, in message <49d53344.7040...@gmail.com>, 
> Chris
>  wrote: 
>> Keith Lawson wrote:
>>> Hello, 
>>> 
>>> I have been working on this problem for some time now and I can't seem to 
>> resolve it. Everything I have found on google and php.net says I can connect 
> 
>> to an LDAP server with SSL by setting "TLS_REQCERT never" in ldap.conf. I 
>> want to eliminate certs from the picture for now just to confirm I can make 
>> the connection which is why I have "TLS_REQCERT never" set. 
>>> 
>>> I added that setting to my ldap.conf and my test code now works from the 
>> command line but it does not work when I call it from a browser. Here is my 
>> test: 
>>> 
>>> >> $ldaphost = "ldaps://my.ldap.server";
>>> 
>>> //ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
>>> // Connecting to LDAP
>>> $ldapconn = ldap_connect($ldaphost)
>>>   or die("Could not connect to {$ldaphost}");
>>> ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
>>> ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
>>> 
>>> echo var_dump(@ldap_bind($ldapconn, "cn=Keithl, ou=Users, o=LH"));
>> 
>> It's hard to know -   you're suppressing errors.
>> 
>> Add these 2 lines to your script:
>> error_reporting(E_ALL);
>> ini_set('display_errors', true);
> 
> I've done that and I get the following when I load the page in a browser: 
> Warning: ldap_bind() [function.ldap- bind]: Unable to bind to server: Can't 
> contact LDAP server in /www/doc/INTRA/ktlwiki/ldap- test.php on line 19
> bool(false)
> Can't contact LDAP server
> 
> From the command line still works: 
> 
> [www]/www/doc/> php ldap- test.php
> bool(true)
> Success
> 
> As I mentioned the command line call did not work until I added "TLS_REQCERT 
> never" to ldap.conf. I need to figure out why the apache loadable module is 
> behaving differently than the command line binary. I'm pretty sure the web 
> page is failing because it is still trying to verify the LDAP server's cert. 
> 
>

My problem was that I had compiled Apache against the Solaris 10 openSSL 
libraries version 0.9.7. When I installed OpenLDAP and recompiled PHP I 
manually build new openSSL libs that were version 0.9.8. Rebuilding apache and 
linking to the same openSSL libraries resolved this problem for me. That 
explains why I was seeing different behavior with command line PHP than when I 
called the same code through Apache. 
 
Thanks for the suggestions Chris.

>> 
>> Then get rid of the @ in front of ldap_bind.
>> 
>> Use http://www.php.net/manual/en/function.ldap-  error.php to capture the 
>> error message and search for it.
> 
> 
>  
> 
> 
> The information transmitted is intended only for the person or entity to 
> which it is addressed and may contain confidential and/or privileged 
> material. Any review, retransmission, dissemination or other use of, or 
> taking of any action in  reliance upon, this information by persons or 
> entities other  than the intended recipient is prohibited. If you received 
> this  in error, please contact the sender and delete the material from any 
> computer. 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


 


The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in  reliance upon, this information by persons or entities other  than the 
intended recipient is prohibited. If you received this  in error, please 
contact the sender and delete the material from any computer. 


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



Re: [PHP] How can I echo a javascript var in an email subject line? Possible?

2009-04-08 Thread Michael A. Peters

Terion Miller wrote:



javascript is client side.
php is server side.
To use something client side in a server side script, the web page
has to send it to the server from the client.

The best way to do what you want to do is probably to do the work
count server side, but if you really want to use what javascript
produced you can create a hidden input with a specified id, and use
dhtml via javascript to modify the input and insert the value into
the value field of the hidden input. Then it will get sent to the
server when the user hits the post button.

However, since you should be validating any user input server side,
you'll need to validate that the variable is accurate - might as
well just do the count with php server side.



Thanks Michael I was kind of moving in the right direction as far as the 
hidden input goes, going to have to google on how to do it with the 
dhtml and all like you suggested.


Look at the various DOM functions - IE for



you coud do in your js:

var myHidden = document.getElementById('hiddenStuff');
myHidden.setAttribute('value',$yourvalue);

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



Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Merlin Morgenstern


Merlin Morgenstern wrote:



Paul Gregg wrote:

In mail.php.general, Merlin Morgenstern  wrote:

Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes 
chinese characters and looks ok, when opened in a browser.


Now I want to extract some text from the file. In order to do this I do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as 
questinomarks or wired characters. To fix it I tried to add:


$contents = utf8_decode($contents);


You don't want this.


header("Content-Type: text/html; charset=utf-8");


You do want this.


But still... no luck :-(

Has somebody an idea why??


Try it with just the Content-Type: header addition.

header('Content-Type: text/html; charset=UTF-8');

Regards,
PG


Looks like this was a caching problem in firefox. The caracters show now 
in GB2312.


Next problem up... How to convert them into unicode :-)

I found the function to convert GB2312  into unicode from a member:
http://de.php.net/utf8_encode (gb2unicode in the lower bottom)

Unfortunatelly the required file is missing with the encoding. The post 
is also pretty old.


The question is how to get this chinese characters saved into a mysql db 
under utf-8 unicode?





got it:
$text = iconv("gb2312", "UTF-8", $text);

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



[PHP] stream_set_timeout issue with ssl connection

2009-04-08 Thread Sebastian Muszytowski

Hello everyone,

i have an issue with stream_set_timeout and ssl.
I've written a php irc newsbot and my code looks like this:

[...]

while (!feof($con['socket']))
   {
   stream_set_timeout($con['socket'], 
$CONFIG['qtime']);


[...]

I need this timeout because i want to read the news every X seconds from 
the Database.

I use

$con['buffer'] = trim(fgets($con['socket'], 4096));

to get the data. If i don't use the stream_set_timeout the bot would 
wait until it recieves data.


In fact this solution works, but only if i connect with fsockopen to a 
non ssl connection.


If i use a ssl connection steam_set_timeout seems to be ignored.

Any clues or workarounds?

Sebastian

PS: You can download the whole code on 
http://muzybot.de/phpircbot.tar.gz or http://muzybot.de/phpircbot.zip


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



Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Merlin Morgenstern



Paul Gregg wrote:

In mail.php.general, Merlin Morgenstern  wrote:

Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes 
chinese characters and looks ok, when opened in a browser.


Now I want to extract some text from the file. In order to do this I do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as questinomarks 
or wired characters. To fix it I tried to add:


$contents = utf8_decode($contents);


You don't want this.


header("Content-Type: text/html; charset=utf-8");


You do want this.


But still... no luck :-(

Has somebody an idea why??


Try it with just the Content-Type: header addition.

header('Content-Type: text/html; charset=UTF-8');

Regards,
PG


Looks like this was a caching problem in firefox. The caracters show now 
in GB2312.


Next problem up... How to convert them into unicode :-)

I found the function to convert GB2312  into unicode from a member:
http://de.php.net/utf8_encode (gb2unicode in the lower bottom)

Unfortunatelly the required file is missing with the encoding. The post 
is also pretty old.


The question is how to get this chinese characters saved into a mysql db 
under utf-8 unicode?





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



Re: [PHP] How can I echo a javascript var in an email subject line? Possible?

2009-04-08 Thread Terion Miller
javascript is client side.
> php is server side.
> To use something client side in a server side script, the web page has to
> send it to the server from the client.
>
> The best way to do what you want to do is probably to do the work count
> server side, but if you really want to use what javascript produced you can
> create a hidden input with a specified id, and use dhtml via javascript to
> modify the input and insert the value into the value field of the hidden
> input. Then it will get sent to the server when the user hits the post
> button.
>
> However, since you should be validating any user input server side, you'll
> need to validate that the variable is accurate - might as well just do the
> count with php server side.
>


Thanks Michael I was kind of moving in the right direction as far as the
hidden input goes, going to have to google on how to do it with the dhtml
and all like you suggested.

Thanks


Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Paul Gregg
In mail.php.general, Merlin Morgenstern  wrote:
> Hello everybody,
> 
> I am having some trouble with utf-8 encoding. The html file containes 
> chinese characters and looks ok, when opened in a browser.
> 
> Now I want to extract some text from the file. In order to do this I do:
> 
> $handle = fopen($file, "r");
> $contents = fread($handle, filesize($file));
> 
> echo $contents;
> 
> The chinese characters are gone by then. They show up as questinomarks 
> or wired characters. To fix it I tried to add:
> 
> $contents = utf8_decode($contents);

You don't want this.

> header("Content-Type: text/html; charset=utf-8");

You do want this.

> But still... no luck :-(
> 
> Has somebody an idea why??

Try it with just the Content-Type: header addition.

header('Content-Type: text/html; charset=UTF-8');

Regards,
PG

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



Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Merlin Morgenstern



Andrew Ballard wrote:

On Wed, Apr 8, 2009 at 11:38 AM, Per Jessen  wrote:

Merlin Morgenstern wrote:


Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes
chinese characters and looks ok, when opened in a browser.

Now I want to extract some text from the file. In order to do this I
do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as questinomarks
or wired characters. To fix it I tried to add:

$contents = utf8_decode($contents);
header("Content-Type: text/html; charset=utf-8");

But still... no luck :-(

Has somebody an idea why??

Check that the page really is displayed with the right encoding - in FF,
Ctrl-I.

/Per


--
Per Jessen, Zürich (16.6°C)


A bit off topic, but Ctrl+I no longer brings up the Page Info in
Firefox like it used to -- at least on my Windows computers. (It opens
the bookmark list in the sidebar.) Does it do differently under Linux?

Andrew


I use windows right click for this.

Actually I isolated the problem, but still I can't figure out how to 
solve it. The page is not utf-8, but ugb2312.


I am already sending the header through php:
header("Content-Type: text/html; charset=ugb2312");

And with apache http.conf:
AddDefaultCharset ugb2312

However firefox still claims that it is utf-8 which is causing the 
strange characters.


What a night mare! Does anybody have an idea on how to get closer to 
solving this?


Regards, Merlin

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



Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Andrew Ballard
On Wed, Apr 8, 2009 at 11:38 AM, Per Jessen  wrote:
> Merlin Morgenstern wrote:
>
>> Hello everybody,
>>
>> I am having some trouble with utf-8 encoding. The html file containes
>> chinese characters and looks ok, when opened in a browser.
>>
>> Now I want to extract some text from the file. In order to do this I
>> do:
>>
>> $handle = fopen($file, "r");
>> $contents = fread($handle, filesize($file));
>>
>> echo $contents;
>>
>> The chinese characters are gone by then. They show up as questinomarks
>> or wired characters. To fix it I tried to add:
>>
>> $contents = utf8_decode($contents);
>> header("Content-Type: text/html; charset=utf-8");
>>
>> But still... no luck :-(
>>
>> Has somebody an idea why??
>
> Check that the page really is displayed with the right encoding - in FF,
> Ctrl-I.
>
> /Per
>
>
> --
> Per Jessen, Zürich (16.6°C)

A bit off topic, but Ctrl+I no longer brings up the Page Info in
Firefox like it used to -- at least on my Windows computers. (It opens
the bookmark list in the sidebar.) Does it do differently under Linux?

Andrew

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



Re: [PHP] How can I echo a javascript var in an email subject line? Possible?

2009-04-08 Thread Michael A. Peters

Terion Miller wrote:

I have a php form, that uses a javascript word counter to make sure
submissions are a certain number of words, I have now been tasked with
taking that word count and having it pass in the email that gets sent when
someone submits a form ..in the subject line.
Here is the code I'm using so far.  Is it possible to just echo a
javascript  variable on a page like you can a php var?


javascript is client side.
php is server side.
To use something client side in a server side script, the web page has 
to send it to the server from the client.


The best way to do what you want to do is probably to do the work count 
server side, but if you really want to use what javascript produced you 
can create a hidden input with a specified id, and use dhtml via 
javascript to modify the input and insert the value into the value field 
of the hidden input. Then it will get sent to the server when the user 
hits the post button.


However, since you should be validating any user input server side, 
you'll need to validate that the variable is accurate - might as well 
just do the count with php server side.


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



Re: [PHP] Am I being hacked?

2009-04-08 Thread Andrew Ballard
On Wed, Apr 8, 2009 at 12:05 PM, Michael A. Peters  wrote:
> Andrew Ballard wrote:
>
>>>
>>
>> You don't need a disassembler; I already said what that string is
>> intended to do. If it is allowed to run on Microsoft's SQL Server, the
>> hex value is implicitly converted to the string "WAITFOR DELAY
>> '00:00:10'", which is then executed. It doesn't require semi-colons,
>> as SQL Server doesn't need them between statements. This particular
>> command is relatively harmless by itself. Its value lies in the fact
>> that if it causes the resulting page to take more than 10 seconds to
>> load, the attacker knows that your page is wide open to SQL injection
>> as well as knowing that he can execute anything he wants. If you're
>> running MySQL, this won't work so you should be unaffected. Just make
>> sure your code is written to prevent SQL injection and you should be
>> fine.
>
> Would doing all SQL queries via pear mdb2 prepare() and execute() prevent
> sql injection, or do other sql injection stepps need to take when using pear
> mdb2?
>

I'm not very familiar with the Pear libraries, but the approach is a
good one. A good library will either pass the query off as a prepared
statement with parameters to the database (if supported) or else will
perform parameter substitution that should use
mysql_real_escape_string() or similar functions to build a statement
that should be safe to execute.

The fact that you see these strings in the correct database field is a
good sign, because they were correctly interpreted as string input and
inserted rather than being interpreted as statements and executed.
Just don't use this as a litmus test for your site's overall security.

Andrew

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



[PHP] How can I echo a javascript var in an email subject line? Possible?

2009-04-08 Thread Terion Miller
I have a php form, that uses a javascript word counter to make sure
submissions are a certain number of words, I have now been tasked with
taking that word count and having it pass in the email that gets sent when
someone submits a form ..in the subject line.
Here is the code I'm using so far.  Is it possible to just echo a
javascript  variable on a page like you can a php var?
CODE=

// Enter in a subject line for the email.
$_SESSION['EmailSubject'] = "Letter to the Editor  echo('submitcount')";
< I want to just echo it..possible??

//Thank you text
$_SESSION['ThankYou'] = "Thank you for participating\\n\\nYour comments have
been sent to our newsroom. \\nIf our writers or editors have any questions
about your letter, you will receive a reply via phone or e-mail. ";

?>



  var submitcount=0;
   function checkSubmit() {

  if (submitcount == 0)
  {
  submitcount++;
  document.Surv.submit();
  }
   }


function wordCounter(field, countfield, maxlimit) {
wordcounter=0;
for (x=0;x 300) {field.value = field.value.substring(0, x);}
  else {countfield.value = maxlimit - wordcounter;}
  }
   }

function textCounter(field, countfield, maxlimit) {
  if (field.value.length > maxlimit)
  {field.value = field.value.substring(0, maxlimit);}
  else
  {countfield.value = maxlimit - field.value.length;}
  }


===END CODE==
Thanks
Terion

Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.
Report Moderator Abuse Here:
http://www.freecycle.org/faq/faq/contact-info
Or Email Your Complaint to:
f...@freecycle.org or i...@freecycle.org

Twitter?
http://twitter.com/terionmiller

Facebook:
http://www.facebook.com/people/Terion-Miller/1542024891";
title="Terion Miller's Facebook profile" target=_TOP>http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0
alt="Terion Miller's Facebook profile">


Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Merlin Morgenstern



Per Jessen wrote:

Merlin Morgenstern wrote:


Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes
chinese characters and looks ok, when opened in a browser.

Now I want to extract some text from the file. In order to do this I
do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as questinomarks
or wired characters. To fix it I tried to add:

$contents = utf8_decode($contents);
header("Content-Type: text/html; charset=utf-8");

But still... no luck :-(

Has somebody an idea why??


Check that the page really is displayed with the right encoding - in FF,
Ctrl-I. 


/Per




yes it is. I checked it. UTF-8.

It looks like it has to do something with wget, the programm I used to 
retrieve the file. Or Linux itself. The language-pack for china is not 
on the suse box, and I can't even find the chinese language through yast 
"languages". This might explain, why I can open it from a mounted samba 
share directly, but not through the apache webserver who reads it from 
the linux system.


Did somebody else have such a probl. before?

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



Re: [PHP] Am I being hacked?

2009-04-08 Thread Michael A. Peters

Andrew Ballard wrote:





You don't need a disassembler; I already said what that string is
intended to do. If it is allowed to run on Microsoft's SQL Server, the
hex value is implicitly converted to the string "WAITFOR DELAY
'00:00:10'", which is then executed. It doesn't require semi-colons,
as SQL Server doesn't need them between statements. This particular
command is relatively harmless by itself. Its value lies in the fact
that if it causes the resulting page to take more than 10 seconds to
load, the attacker knows that your page is wide open to SQL injection
as well as knowing that he can execute anything he wants. If you're
running MySQL, this won't work so you should be unaffected. Just make
sure your code is written to prevent SQL injection and you should be
fine.


Would doing all SQL queries via pear mdb2 prepare() and execute() 
prevent sql injection, or do other sql injection stepps need to take 
when using pear mdb2?


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



RE: [PHP] Am I being hacked?

2009-04-08 Thread Warren Vail
Looks like an attempt to get your SQL server to execute a command, Microsoft
SQL server will do that(among others), and if not properly set up can do it
with root access.  If you don't properly escape and store this comment in a
database, it could execute (called SQL injection, no?).

Warren Vail

> -Original Message-
> From: Yannick Mortier [mailto:mvmort...@googlemail.com] 
> Sent: Wednesday, April 08, 2009 8:07 AM
> To: 9el
> Cc: Bob McConnell; Richard Heyes; julian haffegee; PHP Mailing List
> Subject: Re: [PHP] Am I being hacked?
> 
> 2009/4/8 9el :
> > On Wed, Apr 8, 2009 at 8:04 PM, Bob McConnell  wrote:
> >
> >> On Behalf Of Richard Heyes
> >> >> I set up a simple form to save comments on my webpage, 
> and after 
> >> >> just
> >> one
> >> >> day of going live, i'm getting weird comments up like this
> >> >>
> >> >> declare @q varchar(8000) select @q =
> >> >> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
> >> >>
> >> >>
> >> >> I don't recognise this code - is this an attempt to do something
> >> nefarious,
> >> >> or nothing I should worry about?
> >> >
> >> > Looks like it may be. As long as you escape you SQL 
> correctly using
> >> > mysql_real_escape_string() or the equivalent, you should be OK.
> >>
> >> Let me see if I got this right. The data you got from the 
> form tries 
> >> to set up a local variable, assigns it a hex string as a 
> value, then 
> >> tries to execute it. That definitely looks like an attempt 
> to crack 
> >> your server. It looks like the semi-colons were removed 
> somewhere, so 
> >> none of it actually runs. But you would probably need a set of 
> >> dis-assemblers to find out what CPU that code was written 
> for and what it actually does.
> >>
> >> Next question: You said there are multiple comments like 
> this. How do 
> >> they differ, if they do? Possibly they are trying code for 
> different 
> >> CPUs.
> >>
> >> Did you trace these back to the logs to see if they all 
> come from one 
> >> IP or subnet? Is there anywhere to report these attempts 
> that would 
> >> actually do any good, or should you just ban that IP.
> >>
> >> But this one goes into my journal as something to be prepared for.
> >>
> >> I think the danger these codes have should be discussed 
> well. And how 
> >> to
> > resist such attacks in your server and apps should also be 
> discussed 
> > in greater depth.
> >
> > regards
> >
> > Lenin
> >
> > www.twitter.com/nine_L
> >
> 
> 
> I just googled for that string. Seems like you are not the 
> only victim. Sadly, I can't give you any more advice.
> 
> 
> --
> Currently developing a browsergame...
> http://www.p-game.de
> Trade - Expand - Fight
> 
> Follow me on twitter!
> http://twitter.com/moortier
> 
> --
> 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] Am I being hacked?

2009-04-08 Thread Andrew Ballard
On Wed, Apr 8, 2009 at 10:04 AM, Bob McConnell  wrote:
> On Behalf Of Richard Heyes
>>> I set up a simple form to save comments on my webpage, and after just
> one
>>> day of going live, i'm getting weird comments up like this
>>>
>>> declare @q varchar(8000) select @q =
>>> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>>>
>>>
>>> I don't recognise this code - is this an attempt to do something
> nefarious,
>>> or nothing I should worry about?
>>
>> Looks like it may be. As long as you escape you SQL correctly using
>> mysql_real_escape_string() or the equivalent, you should be OK.
>
> Let me see if I got this right. The data you got from the form tries to
> set up a local variable, assigns it a hex string as a value, then tries
> to execute it. That definitely looks like an attempt to crack your
> server. It looks like the semi-colons were removed somewhere, so none of
> it actually runs. But you would probably need a set of dis-assemblers to
> find out what CPU that code was written for and what it actually does.
>
> Next question: You said there are multiple comments like this. How do
> they differ, if they do? Possibly they are trying code for different
> CPUs.
>
> Did you trace these back to the logs to see if they all come from one IP
> or subnet? Is there anywhere to report these attempts that would
> actually do any good, or should you just ban that IP.
>
> But this one goes into my journal as something to be prepared for.
>
> Bob McConnell
>

You don't need a disassembler; I already said what that string is
intended to do. If it is allowed to run on Microsoft's SQL Server, the
hex value is implicitly converted to the string "WAITFOR DELAY
'00:00:10'", which is then executed. It doesn't require semi-colons,
as SQL Server doesn't need them between statements. This particular
command is relatively harmless by itself. Its value lies in the fact
that if it causes the resulting page to take more than 10 seconds to
load, the attacker knows that your page is wide open to SQL injection
as well as knowing that he can execute anything he wants. If you're
running MySQL, this won't work so you should be unaffected. Just make
sure your code is written to prevent SQL injection and you should be
fine.

I suppose if you get a lot of these requests from the same IP address
you could have the web server block requests from that IP.

Andrew

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



Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Per Jessen
Merlin Morgenstern wrote:

> Hello everybody,
> 
> I am having some trouble with utf-8 encoding. The html file containes
> chinese characters and looks ok, when opened in a browser.
> 
> Now I want to extract some text from the file. In order to do this I
> do:
> 
> $handle = fopen($file, "r");
> $contents = fread($handle, filesize($file));
> 
> echo $contents;
> 
> The chinese characters are gone by then. They show up as questinomarks
> or wired characters. To fix it I tried to add:
> 
> $contents = utf8_decode($contents);
> header("Content-Type: text/html; charset=utf-8");
> 
> But still... no luck :-(
> 
> Has somebody an idea why??

Check that the page really is displayed with the right encoding - in FF,
Ctrl-I. 

/Per


-- 
Per Jessen, Zürich (16.6°C)


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



[PHP] Re: opening utf-8 files - chinese mb characters

2009-04-08 Thread Merlin Morgenstern



Merlin Morgenstern wrote:

Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes 
chinese characters and looks ok, when opened in a browser.


Now I want to extract some text from the file. In order to do this I do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as questinomarks 
or wired characters. To fix it I tried to add:


$contents = utf8_decode($contents);
header("Content-Type: text/html; charset=utf-8");

But still... no luck :-(

Has somebody an idea why??

Regards, Merlin


Something really strange: If I open the file directly from the hard 
drive inside the browser, the chinese characters show OK. If I open the 
file through the webserver the characters do not show OK. File encoding 
is set to utf-8.


Isn't this strange?°?!?

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



[PHP] opening utf-8 files - chinese mb characters

2009-04-08 Thread Merlin Morgenstern

Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes 
chinese characters and looks ok, when opened in a browser.


Now I want to extract some text from the file. In order to do this I do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as questinomarks 
or wired characters. To fix it I tried to add:


$contents = utf8_decode($contents);
header("Content-Type: text/html; charset=utf-8");

But still... no luck :-(

Has somebody an idea why??

Regards, Merlin

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



Re: [PHP] extracting text - regex

2009-04-08 Thread Merlin Morgenstern



George Larson wrote:

On Wed, Apr 8, 2009 at 9:13 AM, George Larson wrote:


I'm what you might consider rather green, myself.
I certainly wouldn't use this code for production but if you're just
debugging or something then how about something like this:

") !== FALSE) { $echo_output = TRUE; }
if (strpos($eos,"<\div>") !== FALSE) { $echo_output = FALSE; }
if ($echo_output == TRUE) { echo $eos; }
}
fclose($handle);
}
?>




On Wed, Apr 8, 2009 at 8:30 AM, Per Jessen  wrote:


Merlin Morgenstern wrote:


Hello,

I am trying read text out of a text that is inbetween two divs.
Somehow this should be possible with regex, I just can't figure out
how.

Example:


bla blub


I would like to extract the text "bla blub" out of this example.


This might do the trick (not tested):

preg_match( "/]*>([^<]*)<\/div>", $yourtext, $match );
print $match[1];


/Per


--
Per Jessen, Zürich (16.8°C)


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



Sorry about the top-post.  I forgot. :)




Thank you everbody. I figured it out without regex. It's not for 
production, just testing:

$pos_1 = strpos($contents, $word1);
$pos_2 = strpos($contents, $word2, $pos_1);
$text = strip_tags(substr($contents, $pos_1, $pos_2 - $pos_1));

That works as well.



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



Re: [PHP] Am I being hacked?

2009-04-08 Thread Yannick Mortier
2009/4/8 9el :
> On Wed, Apr 8, 2009 at 8:04 PM, Bob McConnell  wrote:
>
>> On Behalf Of Richard Heyes
>> >> I set up a simple form to save comments on my webpage, and after just
>> one
>> >> day of going live, i'm getting weird comments up like this
>> >>
>> >> declare @q varchar(8000) select @q =
>> >> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>> >>
>> >>
>> >> I don't recognise this code - is this an attempt to do something
>> nefarious,
>> >> or nothing I should worry about?
>> >
>> > Looks like it may be. As long as you escape you SQL correctly using
>> > mysql_real_escape_string() or the equivalent, you should be OK.
>>
>> Let me see if I got this right. The data you got from the form tries to
>> set up a local variable, assigns it a hex string as a value, then tries
>> to execute it. That definitely looks like an attempt to crack your
>> server. It looks like the semi-colons were removed somewhere, so none of
>> it actually runs. But you would probably need a set of dis-assemblers to
>> find out what CPU that code was written for and what it actually does.
>>
>> Next question: You said there are multiple comments like this. How do
>> they differ, if they do? Possibly they are trying code for different
>> CPUs.
>>
>> Did you trace these back to the logs to see if they all come from one IP
>> or subnet? Is there anywhere to report these attempts that would
>> actually do any good, or should you just ban that IP.
>>
>> But this one goes into my journal as something to be prepared for.
>>
>> I think the danger these codes have should be discussed well. And how to
> resist such attacks in your server and apps should also be discussed in
> greater depth.
>
> regards
>
> Lenin
>
> www.twitter.com/nine_L
>


I just googled for that string. Seems like you are not the only
victim. Sadly, I can't give you any more advice.


-- 
Currently developing a browsergame...
http://www.p-game.de
Trade - Expand - Fight

Follow me on twitter!
http://twitter.com/moortier

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



Re: [PHP] Am I being hacked?

2009-04-08 Thread 9el
On Wed, Apr 8, 2009 at 8:04 PM, Bob McConnell  wrote:

> On Behalf Of Richard Heyes
> >> I set up a simple form to save comments on my webpage, and after just
> one
> >> day of going live, i'm getting weird comments up like this
> >>
> >> declare @q varchar(8000) select @q =
> >> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
> >>
> >>
> >> I don't recognise this code - is this an attempt to do something
> nefarious,
> >> or nothing I should worry about?
> >
> > Looks like it may be. As long as you escape you SQL correctly using
> > mysql_real_escape_string() or the equivalent, you should be OK.
>
> Let me see if I got this right. The data you got from the form tries to
> set up a local variable, assigns it a hex string as a value, then tries
> to execute it. That definitely looks like an attempt to crack your
> server. It looks like the semi-colons were removed somewhere, so none of
> it actually runs. But you would probably need a set of dis-assemblers to
> find out what CPU that code was written for and what it actually does.
>
> Next question: You said there are multiple comments like this. How do
> they differ, if they do? Possibly they are trying code for different
> CPUs.
>
> Did you trace these back to the logs to see if they all come from one IP
> or subnet? Is there anywhere to report these attempts that would
> actually do any good, or should you just ban that IP.
>
> But this one goes into my journal as something to be prepared for.
>
> I think the danger these codes have should be discussed well. And how to
resist such attacks in your server and apps should also be discussed in
greater depth.

regards

Lenin

www.twitter.com/nine_L


Re: [PHP] integrating perl and PHP problem

2009-04-08 Thread Thijs Lensselink
Moses wrote:
> Hi Everyone,
> 
> I have a perl program which I would like to display its
> results in PHP. I have read PHP book and the solution
> is to convert the perl program which is not easy. I have
> tried a simple example but it is not working. The perl script
> is
> 
> #! /usr/bin/perl -w
> print "hello world"
> 
> and the Php script is
> 
>  $result = exec("/var/www/hello.pl",$dirout);
> foreach($dirout as $line)
> {
>echo "$line\n";
> }
> ?>
> 
> Thanks.
> 

I don't think PHP / Apache have the rights to execute a perl script like
this.

Either give hello.pl execute rights. Or change the line in exec to
"/usr/bin/perl /var/www/hello.pl"

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



[PHP] integrating perl and PHP problem

2009-04-08 Thread Moses
Hi Everyone,

I have a perl program which I would like to display its
results in PHP. I have read PHP book and the solution
is to convert the perl program which is not easy. I have
tried a simple example but it is not working. The perl script
is

#! /usr/bin/perl -w
print "hello world"

and the Php script is



Thanks.


RE: [PHP] Am I being hacked?

2009-04-08 Thread Bob McConnell
On Behalf Of Richard Heyes
>> I set up a simple form to save comments on my webpage, and after just
one
>> day of going live, i'm getting weird comments up like this
>>
>> declare @q varchar(8000) select @q =
>> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>>
>>
>> I don't recognise this code - is this an attempt to do something
nefarious,
>> or nothing I should worry about?
> 
> Looks like it may be. As long as you escape you SQL correctly using
> mysql_real_escape_string() or the equivalent, you should be OK.

Let me see if I got this right. The data you got from the form tries to
set up a local variable, assigns it a hex string as a value, then tries
to execute it. That definitely looks like an attempt to crack your
server. It looks like the semi-colons were removed somewhere, so none of
it actually runs. But you would probably need a set of dis-assemblers to
find out what CPU that code was written for and what it actually does.

Next question: You said there are multiple comments like this. How do
they differ, if they do? Possibly they are trying code for different
CPUs.

Did you trace these back to the logs to see if they all come from one IP
or subnet? Is there anywhere to report these attempts that would
actually do any good, or should you just ban that IP.

But this one goes into my journal as something to be prepared for.

Bob McConnell

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



Re: [PHP] Am I being hacked?

2009-04-08 Thread Andrew Ballard
On Wed, Apr 8, 2009 at 9:23 AM, Richard Heyes  wrote:
>> I set up a simple form to save comments on my webpage, and after just one
>> day of going live, i'm getting weird comments up like this
>>
>> declare @q varchar(8000) select @q =
>> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>>
>>
>> I don't recognise this code - is this an attempt to do something nefarious,
>> or nothing I should worry about?
>
> Looks like it may be. As long as you escape you SQL correctly using
> mysql_real_escape_string() or the equivalent, you should be OK.
>
> --
> Richard Heyes
>
> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
> http://www.rgraph.net (Updated March 28th)
>

It's probably someone testing to see if your site is running SQL
Server and is vulnerable to SQL injection. Effectively all it does is
issue the command WAITFOR DELAY '00:00:10', telling the server to wait
for 10 seconds before allowing the connection to continue.

Andrew

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



Re: [PHP] Am I being hacked?

2009-04-08 Thread Richard Heyes
> I set up a simple form to save comments on my webpage, and after just one
> day of going live, i'm getting weird comments up like this
>
> declare @q varchar(8000) select @q =
> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>
>
> I don't recognise this code - is this an attempt to do something nefarious,
> or nothing I should worry about?

Looks like it may be. As long as you escape you SQL correctly using
mysql_real_escape_string() or the equivalent, you should be OK.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] extracting text - regex

2009-04-08 Thread George Larson
On Wed, Apr 8, 2009 at 9:13 AM, George Larson wrote:

> I'm what you might consider rather green, myself.
> I certainly wouldn't use this code for production but if you're just
> debugging or something then how about something like this:
>
>  $handle = @fopen('page.htm', 'r');
> if ($handle) {
> while (!feof($handle)) {
> $eos = trim(fgets($handle, 4096));
> if (strpos($eos,"") !== FALSE) { $echo_output = TRUE; }
> if (strpos($eos,"<\div>") !== FALSE) { $echo_output = FALSE; }
> if ($echo_output == TRUE) { echo $eos; }
> }
> fclose($handle);
> }
> ?>
>
>
>
>
> On Wed, Apr 8, 2009 at 8:30 AM, Per Jessen  wrote:
>
>> Merlin Morgenstern wrote:
>>
>> > Hello,
>> >
>> > I am trying read text out of a text that is inbetween two divs.
>> > Somehow this should be possible with regex, I just can't figure out
>> > how.
>> >
>> > Example:
>> >
>> > 
>> > bla blub
>> > 
>> >
>> > I would like to extract the text "bla blub" out of this example.
>> >
>>
>> This might do the trick (not tested):
>>
>> preg_match( "/]*>([^<]*)<\/div>", $yourtext, $match );
>> print $match[1];
>>
>>
>> /Per
>>
>>
>> --
>> Per Jessen, Zürich (16.8°C)
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
Sorry about the top-post.  I forgot. :)


[PHP] Am I being hacked?

2009-04-08 Thread julian haffegee
I set up a simple form to save comments on my webpage, and after just one 
day of going live, i'm getting weird comments up like this


declare @q varchar(8000) select @q = 
0x57414954464F522044454C4159202730303A30303A313027 exec(@q)



I don't recognise this code - is this an attempt to do something nefarious, 
or nothing I should worry about?


Anybody know what this means?

Thanks so much for reading
Jules 



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



Re: [PHP] extracting text - regex

2009-04-08 Thread George Larson
I'm what you might consider rather green, myself.
I certainly wouldn't use this code for production but if you're just
debugging or something then how about something like this:

") !== FALSE) { $echo_output = TRUE; }
if (strpos($eos,"<\div>") !== FALSE) { $echo_output = FALSE; }
if ($echo_output == TRUE) { echo $eos; }
}
fclose($handle);
}
?>



On Wed, Apr 8, 2009 at 8:30 AM, Per Jessen  wrote:

> Merlin Morgenstern wrote:
>
> > Hello,
> >
> > I am trying read text out of a text that is inbetween two divs.
> > Somehow this should be possible with regex, I just can't figure out
> > how.
> >
> > Example:
> >
> > 
> > bla blub
> > 
> >
> > I would like to extract the text "bla blub" out of this example.
> >
>
> This might do the trick (not tested):
>
> preg_match( "/]*>([^<]*)<\/div>", $yourtext, $match );
> print $match[1];
>
>
> /Per
>
>
> --
> Per Jessen, Zürich (16.8°C)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] extracting text - regex

2009-04-08 Thread Per Jessen
Merlin Morgenstern wrote:

> Hello,
> 
> I am trying read text out of a text that is inbetween two divs.
> Somehow this should be possible with regex, I just can't figure out
> how.
> 
> Example:
> 
> 
> bla blub
> 
> 
> I would like to extract the text "bla blub" out of this example.
> 

This might do the trick (not tested):

preg_match( "/]*>([^<]*)<\/div>", $yourtext, $match );
print $match[1];


/Per


-- 
Per Jessen, Zürich (16.8°C)


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



[PHP] extracting text - regex

2009-04-08 Thread Merlin Morgenstern

Hello,

I am trying read text out of a text that is inbetween two divs. Somehow 
this should be possible with regex, I just can't figure out how.


Example:


bla blub


I would like to extract the text "bla blub" out of this example.

Has anybody an idea on how to do that? Is there a special php function 
available for this?


Thank you for any hint,

Merlin

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



Re: [PHP] how to get the filesize of an online document?

2009-04-08 Thread Sebastian Muszytowski

Hi,

thanks for the hint, but how can i get the size when the header isn't 
specified?


is there the possibility to "count the bits and bytes" when i get the file?


Sebastian

Gevorg Harutyunyan schrieb:

Hi,

You must get content-length http header value, but sometimes header is 
not set and you don't have any chance to

get size.

For more info see **get_headers** function description.

On Wed, Apr 8, 2009 at 12:31 PM, Sebastian Muszytowski 
mailto:s.muszytow...@googlemail.com>> 
wrote:


Hello everyone,

i have a little problem. I want to get the filesize of an online
document (for example an rss or atom feed).
I tried the filesize() function, but this doesn't work. I also
search for options with cUrl but i didn't found any solution.

Hope you can give me some hints or code snipplets so that i can
work for an solution.

Thanks in advance

Sebastian

-- 
PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php




--
Best Regards,
Gevorg Harutyunyan

www.soongy.com 



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



Re: [PHP] Larger fonts...

2009-04-08 Thread Peter Ford
Tom,

You're right - I tried to catch it before it went, but just too late!

To the list - please ignore the message Tom refers to  - it's not too
commercially sensitive, at least.

I probably need more coffee before fielding bug reports in the morning.


Cheers
Pete

Tom Chubb wrote:
> Pete,
> Before you get slated by the list, I'm guessing you meant to send this
> to someone else?
> (It came to me via the PHP-General Mailing List.
>  
> Tom
> 
> 2009/4/8 Peter Ford mailto:p...@justcroft.com>>
> 
> Patrick,
> 
> The reason you think the fonts are too small is that you have
> (un)zoomed the
> screen at some point. The proportions of the centre white panel to
> the side bars
> is wrong.
> Measuring your screenshots, and assuming you had a full-screen
> browser window at
> 1680x1050 resolution (what your monitor does), I work out that the
> white section
> of the screen is only around 800 pixels wide - it is defined to be
> 1000 pixels
> wide at normal magnification. Measuring the icons suggests that your
> screen is
> showing them at 42 pixels, while they are supposed to be 56 pixels.
> Overall,
> your seeing the whole thing at 80% full size - no wonder the fonts
> look small!
> 
> The fonts and icon sizes haven't changed for about a year, and you
> haven't
> really complained before.
> 
> In addition, you are using a pretty large screen - the pages are
> designed to
> work on a 1024x768 screen as a minimum. Making the fonts larger would
> drastically reduce the amount of information displayed vertically -
> it's already
> pretty tight on some of the design screens.
> 
> So, I'll ignore the calls for bigger fonts and icons.
> 
> The button icons may also look better at full size, but the main
> problem is that
> they need to be properly designed. Replacing them with just words is
> not very
> good - it makes them all different sizes, which messes up the layout.
> I could remove the shaded background and see if that helps.
> 
> Other points I will work on.
> 
> Cheers
> 
> --
> Peter Ford  phone: 01580 89
> Developer   fax:   01580 893399
> Justcroft International Ltd., Staplehurst, Kent
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> -- 
> Tom Chubb
> t...@tomchubb.com  | tomch...@gmail.com
> 
> 07912 202846


-- 
Peter Ford, Developer phone: 01580 89 fax: 01580 893399
Justcroft International Ltd.  www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent   TN12 0AH   United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS

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



[PHP] Larger fonts...

2009-04-08 Thread Peter Ford
Patrick,

The reason you think the fonts are too small is that you have (un)zoomed the
screen at some point. The proportions of the centre white panel to the side bars
is wrong.
Measuring your screenshots, and assuming you had a full-screen browser window at
1680x1050 resolution (what your monitor does), I work out that the white section
of the screen is only around 800 pixels wide - it is defined to be 1000 pixels
wide at normal magnification. Measuring the icons suggests that your screen is
showing them at 42 pixels, while they are supposed to be 56 pixels. Overall,
your seeing the whole thing at 80% full size - no wonder the fonts look small!

The fonts and icon sizes haven't changed for about a year, and you haven't
really complained before.

In addition, you are using a pretty large screen - the pages are designed to
work on a 1024x768 screen as a minimum. Making the fonts larger would
drastically reduce the amount of information displayed vertically - it's already
pretty tight on some of the design screens.

So, I'll ignore the calls for bigger fonts and icons.

The button icons may also look better at full size, but the main problem is that
they need to be properly designed. Replacing them with just words is not very
good - it makes them all different sizes, which messes up the layout.
I could remove the shaded background and see if that helps.

Other points I will work on.

Cheers

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



Re: [PHP] Best Practices for Hiding Errors

2009-04-08 Thread George Langley
	Thanks for all the info, everyone! Seems like the @ trick is nice  
for individual lines, but turning off/on every time may be bit much  
on a complicated page. The ini_set('display_errors', false); also has  
a hit, as it turns back on after the entire script has run, but seems  
the easier way and just the one time may not be too bad. So maybe is  
best to turn it off in the actual ini, and turn on only for me, based  
on my IP or some other flag.

Thanks again!


George Langley
Multimedia Developer, Audio/Video Editor, Musician, Arranger, Composer

http://www.georgelangley.ca


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



Re: [PHP] how to get the filesize of an online document?

2009-04-08 Thread Gevorg Harutyunyan
Hi,

You must get content-length http header value, but sometimes header is not
set and you don't have any chance to
get size.

For more info see *get_headers* function description.

On Wed, Apr 8, 2009 at 12:31 PM, Sebastian Muszytowski <
s.muszytow...@googlemail.com> wrote:

> Hello everyone,
>
> i have a little problem. I want to get the filesize of an online document
> (for example an rss or atom feed).
> I tried the filesize() function, but this doesn't work. I also search for
> options with cUrl but i didn't found any solution.
>
> Hope you can give me some hints or code snipplets so that i can work for an
> solution.
>
> Thanks in advance
>
> Sebastian
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Best Regards,
Gevorg Harutyunyan

www.soongy.com


[PHP] how to get the filesize of an online document?

2009-04-08 Thread Sebastian Muszytowski

Hello everyone,

i have a little problem. I want to get the filesize of an online 
document (for example an rss or atom feed).
I tried the filesize() function, but this doesn't work. I also search 
for options with cUrl but i didn't found any solution.


Hope you can give me some hints or code snipplets so that i can work for 
an solution.


Thanks in advance

Sebastian

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