Re: [PHP] One-page password-protected file

2006-10-23 Thread Dotan Cohen

On 24/10/06, Richard Lynch <[EMAIL PROTECTED]> wrote:


Can't you just use $_SESSION ?

Or is that also out?

Once the user is authenticated, $_SESSION['username'] = $username; and
you're done.

No passing passwords, hashed or not, back and forth.

Somebody can still hijack the session, but you gain nothing by
exposing the password or the hash of the password in that regard.

If they are about to do something particularly sensitive, force them
to re-authenticate with the password.

And in your code, you only then need the HASH of the password, not the
password itself.


I'm not sure if I can use sesssions. The code needs to be as portable
as possible: that means that he will be moving it from server to
server very often. If I knew that 100% of the world's servers had
sessions support, I might go that way.

Dotan Cohen

http://fedorafaqs.org
http://what-is-what.com/what_is/ubuntu.html

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



Re: [PHP] Comment management

2006-10-23 Thread Paul Scott

On Mon, 2006-10-23 at 15:53 -0400, tedd wrote:
> Well... I was afraid that someone would say that (paint me into a 
> corner). I just wanted to check before launching my own home-grown 
> solution and then having everyone say "Why didn't you use so-and-so's 
> 'comment manager' "?
> 
> I'm sure word-press would do, but it's probably an overkill for my needs.

Well, within our framework(s) we have a comment module that can be
attached onto any other module (like a blog, a content area, a
workgroup, a document repository etc), but I didn't mention it because
its in our framework. The module code is really quite simple (written in
a day) so you may find it useful for looking at, if you are not using
our system...

http://avoir.uwc.ac.za for downloads or http://fsiu.uwc.ac.za/ and check
out the wiki, where we use the comments module for wiki comments.

--Paul 

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] pagination code not incrementing page numbers.

2006-10-23 Thread Chris

Mark wrote:

I am using the following code for pagination with php5 and mysql 4.1.x
The pages advance by clicking on the "Next" or "Last" link

However the url does not advance past this in the url field
http://localhost/page.php?pagenum=2

Also the page count does not increase past
"--Page 1 of 50--" at the bottom of the page regardless of how many 
pages forward I have clicked.


If anyone could point me in the right direction to fix this, it would be 
much appreciated.


Code:

// Connects to your Database
mysql_connect("dev", localhost", "user", "password") or die(mysql_error());
mysql_select_db("mydatabase") or die(mysql_error());

//This checks to see if there is a page number. If not, it will set it 
to page 1

if (!(isset($pagenum)))
{
$pagenum = 1;
}


if (!isset($_GET['pagenum'])) {
  $pagenum = 1;
} else {
  $pagenum = (int)$_GET['pagenum'];
}

You have register_globals off (good thing) so you need to change how you 
fetch the information.


If it's in the url, it'll be in $_GET somewhere.

This:
$pagenum = (int)$_GET['pagenum'];

Will make sure that $pagenum is a number so I can't change it:

...?pagenum=alert('xyz');


--
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] pagination code not incrementing page numbers.

2006-10-23 Thread Mark

I am using the following code for pagination with php5 and mysql 4.1.x
The pages advance by clicking on the "Next" or "Last" link

However the url does not advance past this in the url field
http://localhost/page.php?pagenum=2

Also the page count does not increase past
"--Page 1 of 50--" at the bottom of the page regardless of how many 
pages forward I have clicked.


If anyone could point me in the right direction to fix this, it would be 
much appreciated.


Code:

// Connects to your Database
mysql_connect("dev", localhost", "user", "password") or die(mysql_error());
mysql_select_db("mydatabase") or die(mysql_error());

//This checks to see if there is a page number. If not, it will set it 
to page 1

if (!(isset($pagenum)))
{
$pagenum = 1;
}

//Here we count the number of results
//Edit $data to be your query
$data = mysql_query("SELECT * FROM main") or die(mysql_error());
$rows = mysql_num_rows($data);

//This is the number of results displayed per page
$page_rows = 8;

//This tells us the page number of our last page
$last = ceil($rows/$page_rows);

//this makes sure the page number isn't below one, or more than our 
maximum pages

if ($pagenum < 1)
{
$pagenum = 1;
}
elseif ($pagenum > $last)
{
$pagenum = $last;
}

//This sets range that we will display in our query
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;

//This is your query again, the same one... the only difference is we 
add $max into it

$data_p = mysql_query("SELECT * from main $max") or die(mysql_error());

//This is where you display your query results
while($info = mysql_fetch_array( $data_p ))
{

Print $info['id'];
echo "";
Print $info['bio'];
echo "";
}

echo "";

// This shows the user what page they are on, and the total number of pages
echo " --Page $pagenum of $last-- ";

// First we check if we are on page one. If we are then we don't need a 
link to the previous page or the first page so we do nothing. If we 
aren't then we generate links to the first page, and to the previous page.

if ($pagenum == 1)
{
}
else
{
echo "  <<-First ";
echo " ";
$previous = $pagenum-1;
echo "  <-Previous ";
}

//just a spacer
echo "  ";


//This does the same as above, only checking if we are on the last page, 
and then generating the Next and Last links

if ($pagenum == $last)
{
}
else {
$next = $pagenum+1;
echo " Next -> ";
echo " ";
echo " Last ->> ";
}
?>

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



Re: [PHP] Mapped Drive issue

2006-10-23 Thread Ed Lazor
If you're running Apache as an XP service, go to the services control  
panel, open the apache config, and you can change the user there.   
Otherwise, you'll have to edit the apache config and change the user  
there.


On Oct 23, 2006, at 7:21 PM, Rob Kritzer wrote:


For now I am on a PC XP Pro, wish they would give me back my Mac.


On 10/23/06, Ed Lazor <[EMAIL PROTECTED]> wrote:


Depends on your operating system.


On Oct 23, 2006, at 6:31 PM, Rob Kritzer wrote:

> Yes, the directory on mapped drive Y does exist.
>
> I do think that it might have something with how PHP and Apache is
> running.
>
> How do I chanage how PHP is running under an account? Where do I
> tell PHP or
> Apache to run under a different accunt?
>
>
>
> On 10/23/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
>>
>>
>> Y: doesn't exist.
>>
>> It may not exist because you haven't opened it lately and
>> authenticated it as valid.
>>
>> Or it might not exist because PHP is not running as you, and  
PHP has

>> no access to it.
>>
>> Or it might not exist because it's Windows, and you need to re- 
boot.

>>
>>
>>
>> On Wed, October 18, 2006 2:14 pm, Rob Kritzer wrote:
>> > I have a script the use to work:
>> >
>> > $date = date("mdy");
>> >
>> > mkdir("Y:/Daily_DisplayAds/todays_ads-$date");
>> >
>> > But now I get this error:
>> >
>> > Warning: mkdir() [function.mkdir]: No such file or directory in
>> > C:\wamp\www\scripts\ad_finder\display_class.php on line 10
>> >
>> > If I change "Y" to "C" it works, can anyone please help me  
thanks.

>> >
>>
>>
>> --
>> Some people have a "gift" link here.
>> Know what I want?
>> I want you to buy a CD from some starving artist.
>> http://cdbaby.com/browse/from/lynch
>> Yeah, I get a buck. So?
>>
>>




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



Re: [PHP] Mapped Drive issue

2006-10-23 Thread Rob Kritzer

For now I am on a PC XP Pro, wish they would give me back my Mac.


On 10/23/06, Ed Lazor <[EMAIL PROTECTED]> wrote:


Depends on your operating system.


On Oct 23, 2006, at 6:31 PM, Rob Kritzer wrote:

> Yes, the directory on mapped drive Y does exist.
>
> I do think that it might have something with how PHP and Apache is
> running.
>
> How do I chanage how PHP is running under an account? Where do I
> tell PHP or
> Apache to run under a different accunt?
>
>
>
> On 10/23/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
>>
>>
>> Y: doesn't exist.
>>
>> It may not exist because you haven't opened it lately and
>> authenticated it as valid.
>>
>> Or it might not exist because PHP is not running as you, and PHP has
>> no access to it.
>>
>> Or it might not exist because it's Windows, and you need to re-boot.
>>
>>
>>
>> On Wed, October 18, 2006 2:14 pm, Rob Kritzer wrote:
>> > I have a script the use to work:
>> >
>> > $date = date("mdy");
>> >
>> > mkdir("Y:/Daily_DisplayAds/todays_ads-$date");
>> >
>> > But now I get this error:
>> >
>> > Warning: mkdir() [function.mkdir]: No such file or directory in
>> > C:\wamp\www\scripts\ad_finder\display_class.php on line 10
>> >
>> > If I change "Y" to "C" it works, can anyone please help me thanks.
>> >
>>
>>
>> --
>> Some people have a "gift" link here.
>> Know what I want?
>> I want you to buy a CD from some starving artist.
>> http://cdbaby.com/browse/from/lynch
>> Yeah, I get a buck. So?
>>
>>




Re: [PHP] Mapped Drive issue

2006-10-23 Thread Ed Lazor

Depends on your operating system.


On Oct 23, 2006, at 6:31 PM, Rob Kritzer wrote:


Yes, the directory on mapped drive Y does exist.

I do think that it might have something with how PHP and Apache is  
running.


How do I chanage how PHP is running under an account? Where do I  
tell PHP or

Apache to run under a different accunt?



On 10/23/06, Richard Lynch <[EMAIL PROTECTED]> wrote:



Y: doesn't exist.

It may not exist because you haven't opened it lately and
authenticated it as valid.

Or it might not exist because PHP is not running as you, and PHP has
no access to it.

Or it might not exist because it's Windows, and you need to re-boot.



On Wed, October 18, 2006 2:14 pm, Rob Kritzer wrote:
> I have a script the use to work:
>
> $date = date("mdy");
>
> mkdir("Y:/Daily_DisplayAds/todays_ads-$date");
>
> But now I get this error:
>
> Warning: mkdir() [function.mkdir]: No such file or directory in
> C:\wamp\www\scripts\ad_finder\display_class.php on line 10
>
> If I change "Y" to "C" it works, can anyone please help me thanks.
>


--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




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



Re: [PHP] Paginating searchs = performance problem

2006-10-23 Thread Chris

Richard Lynch wrote:

On Fri, October 20, 2006 10:04 am, Fourat Zouari wrote:

I have PHP/PostgreSQL application were i got a search page with some
items
to search, am building the search query on server side.

I need to display a paginated search and for this i need to get the
total
count of lines matching the search before OFFSET/LIMITing my page, am
i
obliged to repeat the query twice ??? first to get the total count,
second
to get my page.

it's very heavy

Any one's suggesting better doing ?


Use a cursor.


Cursors won't help - they don't store the info about how many results 
the query would fetch (I asked this question a few months ago on one of 
the postgres lists).


--
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 Search and Privacy...

2006-10-23 Thread Chris

Russell Jones wrote:

Does anyone know if any of the PHP Site-Search tools have implemented the
new #privacy search standard (http://www.poundprivacy.org). Looking to
install a new site-search and I would really like to install something that
is compliant...


Don't know of any off hand but that site looks like a campaign to make 
something happen, not a standard. Two completely different things.


"Pound Privacy" is a *campaign* to create the first standard for search 
engine query privacy.


--
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] FTP - folders

2006-10-23 Thread Rob Kritzer

Yes Tedd,

This is what I am having trouble with, I can see where you can upload each
file, but all I really need it to do is take the contents of a folder and
upload everything it finds in the directory.

Rob



On 10/23/06, tedd <[EMAIL PROTECTED]> wrote:


At 8:42 PM +0100 10/23/06, Stut wrote:
>Rob Kritzer wrote:
>>Is it possible to FTP a folder and all it's content? I can do a file at
a
>>time, but not a folder.
>>
>>Also there is times when I will not know the folder name, so I would
like it
>>to just upload everything it finds in the folder I set.
>>
>>Is this possilbe?
>
>Yes[1][2].
>
>-Stut
>
>[1] http://catb.org/~esr/faqs/smart-questions.html
>[2] There is no function to upload a folder, but it's quite easy to
>code. Check out http://php.net/glob and/or http://php.net/readdir

-Stut:

Perhaps I'm confused (certainly could be), but I think the OP is
asking for a way to upload multiple files from a desktop folder to a
server (client-side to sever-side) by just selecting the desktop
(client-side) folder.

Maybe I should read [1] a little closer, but I did read [2] and I
don't see where one can use php to open a folder on a desktop, read
its contents, and then upload the files therein. However, I do see a
way to upload individual files, but not multiple files _unless_ the
user selects them one at a time and then uploads them consecutively
via a loop. But, that still requires the user to select the files
individually and not the folder that contains them.

I certainly can read the contents of a folder on the server, but I
don't see how you can do it client-side.

Now, am I right, or do you have a way to do this?

Thanks.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com



Re: [PHP] Mapped Drive issue

2006-10-23 Thread Rob Kritzer

Yes, the directory on mapped drive Y does exist.

I do think that it might have something with how PHP and Apache is running.

How do I chanage how PHP is running under an account? Where do I tell PHP or
Apache to run under a different accunt?



On 10/23/06, Richard Lynch <[EMAIL PROTECTED]> wrote:



Y: doesn't exist.

It may not exist because you haven't opened it lately and
authenticated it as valid.

Or it might not exist because PHP is not running as you, and PHP has
no access to it.

Or it might not exist because it's Windows, and you need to re-boot.



On Wed, October 18, 2006 2:14 pm, Rob Kritzer wrote:
> I have a script the use to work:
>
> $date = date("mdy");
>
> mkdir("Y:/Daily_DisplayAds/todays_ads-$date");
>
> But now I get this error:
>
> Warning: mkdir() [function.mkdir]: No such file or directory in
> C:\wamp\www\scripts\ad_finder\display_class.php on line 10
>
> If I change "Y" to "C" it works, can anyone please help me thanks.
>


--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




Re: [PHP] Re: How to recognise url in a block of text

2006-10-23 Thread Richard Lynch


FTP your files up there again, but use TEXT instead of BINARY or vice
versa?

On Wed, October 18, 2006 3:55 pm, AYSERVE.NET wrote:
> Hello Guys,
> I thought I was home and dry when the program worked fine on my
> windows
> but when I ran from my Linus server, I keep getting a url like:
> http://www.website.com/pdf/ED1.pdf%A0 instead of
> http://www.website.com/pdf/ED1.pdf.
>
> As a result, the link is not working. Please help.
>
> Regards,
> Bunmi
> www.ayserve.net
> www.budelak.com
>
> AYSERVE.NET wrote:
>> Hello Robin,
>> I love you man. The solution you gave below just worked perfectly
>> fine.
>> Thanks to all who assisted me on this. I appreciate you all.
>> Regards,
>> Bunmi
>> www.ayserve.net
>> www.budelak.com
>>
>> Robin Vickery wrote:
>>> On 17/10/06, Al <[EMAIL PROTECTED]> wrote:
 AYSERVE.NET wrote:
 > Please, I need help on how to to recognise url in a block of
 text
 being
 > retrieved from a database and present it as a link within that
 text.
 >
 > I will appreciate any help.
 > Regards,
 > Bunmi
 Show us some examples of URL substrings, with any variations, you
 want to handle.

 Most likely a regex function will do the job.
>>>
>>> In 6 easy steps:
>>>
>>> Step 1: Pinch  a regexp from perl...
>>>
>>>  perl -e 'use Regexp::Common; print $RE{URI}{HTTP}, "\n";'
>>>
>>> Step 2: Double up all backslashes
>>>
>>>  M-x replace-string \ \\
>>>
>>> Step 3: Escape single quote-marks
>>>
>>>  M-x replace-string ' \'
>>>
>>> Step 4. modify slightly to cope with the https scheme by adding an
>>> optional 's' to the http scheme.
>>>
>>> Step 5. add angle-brackets as delimiters
>>>
>>> Step 6. use in a preg_replace()
>>>
>>> >>
>>> $textString = 'orem ipsum dolor sit amet, consectetuer adipiscing
>>> elit. Proin et urna. Duis quam. Suspendisse potenti. Etiam sem
>>> tortor,
>>> ultricies nec,  http://example.com  imperdiet nec, tempus ac,
>>> purus.
>>> Suspendisse id lectus. Nam vitae quam. Aliquam ligula nisl,
>>> vestibulum
>>> vulputate, tempor nec, https://www.example.com  tincidunt sit amet,
>>> libero. Suspendisse a justo. Cum sociis natoque penatibus et.';
>>>
>>> $url_regexp =
>>> '<(?:(?:https?)://(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))(?::(?:(?:[0-9]*)))?(?:/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))(?:[?](?:(?:(?:[;/?:@&=+$,a-zA-Z0-9\\-_.!~*\'()]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)))?))?)>';
>>>
>>>
>>> $output = preg_replace($url_regexp, '$0',
>>> $textString);
>>>
>>> print $output;
>>> ?>
>>>
>>> If http and https isn't enough for you, there's another more
>>> general
>>> regexp but... well, it's 8.5Kb long.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] regex

2006-10-23 Thread Richard Lynch




On Thu, October 19, 2006 9:42 am, Robin Vickery wrote:
> On 19/10/06, Bagus Nugroho <[EMAIL PROTECTED]> wrote:
>> Hi All,
>>
>> If we have variable like :
>>
>> $var1 = 'abcde 12';
>> $var2 = 'abcdefghi 34';
>> $var3 = 'abc 20 def';
>>
>> Then we want output like :
>> $var1 = 'abcde';
>> $var2 = 'abcdefghi';
>> $var3 = 'abc def';
>
>
> $re = '/^\s+|\d+\s*|\s*\d+\s*$/';
>
> $var1 = preg_replace($re, '', $var1);
>
> It may or may not be what you're after, but it handles all your
> examples.

$var = preg_replace('/[0-9]*/', '', $var);
$var = preg_replace('/\\s+/', ' ', $var);
$var = trim($var);

This also fits all the examples, and is comprehensible. :-)

Whether it's right or not still depends on a better question.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Creating thumbnails using Image Functions, then saving to folders

2006-10-23 Thread Richard Lynch
See how your network guys would feel about:

A directory OUTSIDE the webtree which is 777.

You can put the thumbnails in there.

Then, in a PHP script that you use in the IMG tags, you would double
check several things before you serve up that image:

Does it match a record in the database so you know it's supposed to be
there?  (a whitelist of known image files)

Does it "look" like an image to functions like
http://php.net/get_image_size (a modest validity check)

You could also consider doing a simple GD imagefromjpeg followed by
imagejpeg.  It's unlikely any malicious file could survive that and do
something Evil.

PS You probably CAN set up FTP access and use PHP FTP to shuffle files
around...  But you're then putting your FTP password into your script,
and your network guys shouldn't like that either...

On Wed, October 18, 2006 12:40 pm, Matthews, Chris wrote:
> Good Morning:
>
> I am looking to create a thumbnail from an uploaded image, and then
> save it to a directory.
>
> I don't have any problem with the image functions, and can
> successfully create the thumbnail and push it to the browser or, as is
> currently set up, store the data in a database.
>
> What I want to do instead, however, is take that dynamically created
> thumbnail and write it to a folder on the server.
>
> If I simply write the file, however, it appears I need to have a
> folder chmod'd world read/writable for the process to work.  My
> network guys do not want this.
>
> I tried the FTP functions, which work great for copying a file that
> already exists somewhere into another folder, but I can't seem to get
> it to recognize the buffer as a valid source file location...
>
> Is there a way to use a php FTP function to FTP the file out of the
> buffer to a directory on the server, or some other way to write a file
> to a folder without making that folder 0777?
>
> Chris Matthews
> eGovernment Information Officer
> Washoe County, Nevada
> 775.328.3719
> http://www.washoecounty.us
>
> Director, West Region
> National Association of Government Webmasters
> http://www.nagw.org
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Mapped Drive issue

2006-10-23 Thread Richard Lynch

Y: doesn't exist.

It may not exist because you haven't opened it lately and
authenticated it as valid.

Or it might not exist because PHP is not running as you, and PHP has
no access to it.

Or it might not exist because it's Windows, and you need to re-boot.



On Wed, October 18, 2006 2:14 pm, Rob Kritzer wrote:
> I have a script the use to work:
>
> $date = date("mdy");
>
> mkdir("Y:/Daily_DisplayAds/todays_ads-$date");
>
> But now I get this error:
>
> Warning: mkdir() [function.mkdir]: No such file or directory in
> C:\wamp\www\scripts\ad_finder\display_class.php on line 10
>
> If I change "Y" to "C" it works, can anyone please help me thanks.
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] IMAP extension causing delays

2006-10-23 Thread Richard Lynch

You may also want to read PHP IMAP source and see what it does in its
initializiation function.

That may reduce the category of "DNS Error" to something a lot more
specific...

http://lxr.php.net/


On Thu, October 19, 2006 8:52 am, Edward Kay wrote:
> Hello,
>
> I need PHP's IMAP extension for my web app but it is really slowing my
> server up.
>
> My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with
> suPHP),
> PHP IMAP extension - all standard FC5 RPMs. The test page is simple -
> just a
> call to phpinfo().
>
> Without the IMAP extension, the response time is almost immediate.
> With the
> IMAP extension it takes 2-3 seconds to respond - sometimes as much as
> 4
> secs.
>
> Watching with 'top', I can see php-cgi is called immediately when the
> request is received. With the IMAP extension installed, after php-cgi
> starts, it then drops to the end of the 'top' list, consuming 0% CPU
> and
> 2.0% memory. It remains there for the 2-3 second delay before coming
> into
> play again an running the script quickly. Without the IMAP extension,
> it
> just ends quickly having finished the request.
>
> From this, it is clear to me there is some major delay being
> introduced by
> the loading of the IMAP extension. Any ideas on how to resolve this?
>
> Thanks,
> Edward
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] User question for PHP

2006-10-23 Thread Richard Lynch
On Fri, October 20, 2006 8:24 am, chris smith wrote:
> php running through apache:
>
>  mkdir('/path/to/dir');
> ?>
>
> Making that in a "shared" location will allow *any* domain to write to
> it, read from it or delete it (forget about possible open_basedir
> restrictions).

If 'nobody' can  read/write to be able to do the mkdir() in the first
place, then whether you do the mkdir() or the other user does it is
irrelevant.  They ALREADY have the access to that dir through PHP.

> Running as cgi you don't get that problem.

Maybe, maybe not.

Depends on the chmod and umask settings of the directory and/or your
script.

> I could be completely misunderstanding what suPHP does.

Possibly.

Or simply under-estimating the bad practices in BOTH scenarios which
can lead to disaster.

It's a fork in the road.

Taking either fork involves risks, of a different nature.

Understand the Risks, and how they relate to what YOU are doing.

Taking either fork blindly because somebody told you it's "safer" is
the  BAD OPTION.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] User question for PHP

2006-10-23 Thread Richard Lynch
On Fri, October 20, 2006 12:49 am, Chris wrote:
> A shared user (like "www" or "nobody") is a *much* bigger risk than
> separate users.

*MUST* we go through all the permutations of "What if..." for these
two scenarios again?

The Risk cannot be evaluated outside the context of everything else
you do after that.

The Risk from your fellow users is reduced when you own the files.

The Risks of a malicious file being uploaded/written/included having
more power than it should is increased when you own the files.

Which Risk is bigger depends on what you use the server and PHP to
*do* and how you do those things.

What if Notre Dame plays in the Rose Bowl?...
:-)
[Note to non-sports-non-ND-people.  It's a stupid question, as ND is
not eligible, but generates endless mindless arguments for reasons
beyond my ken.]

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] User question for PHP

2006-10-23 Thread Richard Lynch
On Thu, October 19, 2006 1:49 pm, Tom Ray [Lists] wrote:
> Is it possible to have a PHP script execute as the user of the domain
> instead of the webserver? So when I upload files through a PHP script
> they are owned by me and not "wwwrun" or "nobody"?

On a dedicated server, it's trivial to do it.
Look in httpd.conf for "User"
Could also be dangerous, or a boon, depending on what you do with it
next, and what you do with it years down the road...

On a shared server, with VirtualHosts, it gets more complicated
You're looking at proxyservers, fastcgi with suexec or similar stuff.
This also brings some potential dangers etc.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Ensuring all links go to index.php

2006-10-23 Thread Richard Lynch
The way you do or don't tear apart the original URL to get user and
login, as well as the URL you send out will affect this.

If your URL starts with "/" then it is an "absolute" URL, and the
browser won't put the current "directory" (from its perspective) in
front of it.

It's also possible you just tore the URL apart wrong, and aren't
sending out what you think you are sending...  Use "View Source" in
your browser to see what you sent.

On Fri, October 20, 2006 3:00 am, Dave M G wrote:
> PHP List,
>
> This problem is a little hard to describe. Please forgive me in
> advance
> if it's not clear.
>
> I have set up my .htaccess file to work with my PHP script to create
> "friendly URLs".
>
> For example, the URL mysite.com/user/login will take the user to a
> page
> where a user logs in.
>
> It does this by stripping everything out except "user" and "login". It
> takes "user" and creates a "user" object, and then passes a "login"
> method to that class to take the user to the login page.
>
> Somehow, in this process, the local URL is becoming "mysite/user",
> even
> though I'm just using that "user" designation to drive the creation of
> objects from classes.
>
> So, for example, I have a link to logout which is simply
> href="user/logout".
>
> But when I mouse over it, and look at the status bar at the bottom of
> my
> FireFox browser window, it says that the link points to:
> mysite.com/user/user/logout
>
> That URL, obviously, doesn't work for my system. It tries to make a
> "User" object and call a "user" method which doesn't exist.
>
> So... my question is, why is the /user portion of my URL being
> retained
> as a directory?
>
> I thought it had something to do with setting headers. I want
> everything
> to operate through the index.php file in my root directory, so I
> thought
> I could do that by putting this at the top of the index.php page:
>
> header("Location: /");
>
> Or:
>
> header("/local/server/www/directory/");
>
> Bottom line is, how do I ensure that all links and user requests
> through
> the URL end up going to the index.php in my web site's root directory?
>
> I hope this question is clear enough, and thank you for any and all
> advice.
>
> --
> Dave M G
> Ubuntu 6.06 LTS
> Kernel 2.6.17.7
> Pentium D Dual Core Processor
> PHP 5, MySQL 5, Apache 2
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Check HTML style sheet?

2006-10-23 Thread Richard Lynch
On Fri, October 20, 2006 3:20 am, Marc Roberts wrote:
> Is it possible to use php to check that the .css file in the html of a
> web page is the correct one e.g. check if the file included in the
> html
> is new.css.
>
> I think I will have to write a regex but if anyone has any ideas (or
> already has a regex to do this), it would be much appreciated.

Depends how fancy you want to get...

$html = file_get_contents('http://php.net/');
if (strstr($html, ' 
  @import url("http://static.php.net/www.php.net/styles/site.css";);
  @import url("http://static.php.net/www.php.net/styles/phpnet.css";);
 ')) echo "Yup, it's got that CSS in there\n";
else echo "Nope, they changed their CSS\n";

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] session - cookie issues

2006-10-23 Thread Richard Lynch
On Fri, October 20, 2006 5:20 am, Dave Goodchild wrote:
> Hi all, I am having issues with users not being able to post their
> details
> to my site. The system uses sessions, so when they hit the index page
> a test
> cookie is set thus:
>
> setcookie('djst', 'test');

You should *NOT* set the timeout to an hour!

If their clock is "off" by an hour (or worse, your server clock is off
by an hour) the cookie will expire immediately.

Trusting the "time" of a Cookie clock is silly for anything less than
the scale of years, maybe months.

Even then, a user intent on causing trouble will reset their clock to
wild values to play with you, and then you're in trouble.

> and then I test whether that cookie is set on the next page. If not, I
> direct the users to an informational page. This works my end in FF and
> IE6
> (sec settings tested at low, medium and medium high) but appox 1 in 20
> users
> cannot get past the cookie warning, even if they set their security
> settings
> to low in IE.

I've had major problems with IE on one site like this as well, and
suspect it's that goofy "short privacy policy" thing...

Never have time to check it out, as the answer "Use Firefox" always
works out better. :-)

> I am also setting PHPSESSID to something of my own, as I hear that IE
> does
> not like PHPSESSID (correct?).

Ar?

References, please?

Not that it would surprise me...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Fwd: Parsing and using URL variables

2006-10-23 Thread Richard Lynch
Your PHP is fine.

Your URL sucks. :-)

You can't have spaces in the data, nor / nor all kinds of stuff.

Which is why you should ALWAYS call:
http://php.net/urlencode
on data before you cram it into a URL.

*then*, if you are putting that URL into HTML for a person to click
on, you need to make it kosher for HTML browser output, which means
you need:
http://php.net/htmlentities

Sample usage:

$ph = 'My Website';
$cf = 'home.htm';

$url = 'www.mywebsite.com';
$url .= '?ph=' . urlencode($ph);
$url .= '&cf=' . urlencode($cf);

echo 'click me';



On Fri, October 20, 2006 8:35 am, andrew newman wrote:
> -- Forwarded message --
> From: andrew newman <[EMAIL PROTECTED]>
> Date: Oct 20, 2006 2:30 PM
> Subject: Parsing and using URL variables
> To: php-general-digest@lists.php.net
>
>
> Hello
>
> I am very new to PHP and I am trying to parse the values of variables
> from a URL into a web page. to build a very simple CMS!
>
> For example if the url is
>
> www.mywebsite.com?ph=My Website&pt=Welcome Page&cf=home.htm
>
> I then have a php file that is something like this:
>
> 
> 
> 
> 
> 
>  
> 
> 
> 
> 
> 
>
> Any advice would be most welcome!
>
> Thanks Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] handling multipart form-data

2006-10-23 Thread Richard Lynch
On Fri, October 20, 2006 9:28 am, Anton Statutov wrote:
> DOCUMENTATION> php://input is not available with
> enctype="multipart/form-data".
>
> What I should do if I really need to get multipart data? I want to
> implement my own form-data parser with PHP5. Can I at least turn off
> the
> PHP's one to be able to use php://input with multipart?

I think you want that HTTP_RAW_POST_DATA setting thingie that's in the
manual...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?


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



Re: [PHP] One-page password-protected file

2006-10-23 Thread Richard Lynch
On Mon, October 23, 2006 2:41 am, Dotan Cohen wrote:
> On 23/10/06, David Tulloh <[EMAIL PROTECTED]> wrote:
>> Breaking this down you have a hardcoded password.
>> In the script you store a hash of the password rather than the
>> actual
>> password.
>
> Yes, no choice but to have the password in the file. I can't include()
> anything, and no mysql. So, only hashed would I dare keep it.

Can't you just use $_SESSION ?

Or is that also out?

Once the user is authenticated, $_SESSION['username'] = $username; and
you're done.

No passing passwords, hashed or not, back and forth.

Somebody can still hijack the session, but you gain nothing by
exposing the password or the hash of the password in that regard.

If they are about to do something particularly sensitive, force them
to re-authenticate with the password.

And in your code, you only then need the HASH of the password, not the
password itself.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] FTP - folders

2006-10-23 Thread Richard Lynch
On Mon, October 23, 2006 5:07 pm, tedd wrote:
> Interesting.
>
> So a php server-side php script can establish a two-way communication
> with a client-side php script -- do you have an example?

http://php.net/sockets
should have an example...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Active Connections

2006-10-23 Thread tedd

At 4:21 AM +0600 10/24/06, Prathaban Mookiah wrote:

Hello List,

I am trying to develop a web based controller for a robot. The robot has an
embedded telnet deamon and it is controlled primarily through issuing
commands on this port. I am planning to implement this system with PHP on the
server side.


-snip-


Please let me know your ideas and inputs.


Prathap:

In 1995, Garnet Hertz and I did just that. We had a RC-10 guided by a 
web interface such that the web user could guide a robot around his 
laboratory view stuff in real time. It was exceedingly cool. I wrote 
the interface and he did the electronics.


You might review his site for more current projects, namely:

http://www.conceptlab.com/

I can't speak for him, but you might make contact -- perhaps he might 
provide help.


As for my code, it's been long lost -- I believe it was in C, but 
might have been in something else.


tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] FTP - folders

2006-10-23 Thread Stut

tedd wrote:

Interesting.

So a php server-side php script can establish a two-way communication 
with a client-side php script -- do you have an example?


http://php.net/sockets

-Stut

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



Re: [PHP] Active Connections

2006-10-23 Thread Richard Lynch
On Mon, October 23, 2006 5:21 pm, Prathaban Mookiah wrote:
> I am trying to develop a web based controller for a robot. The robot
> has an
> embedded telnet deamon and it is controlled primarily through issuing
> commands on this port. I am planning to implement this system with PHP
> on the
> server side.

Cool!

> Ideally what I would like to do is have two persistent active
> connections:
> one between the browser and the webserver, and the other between the
> webserver and the robot controller. When the user opens the interface
> for the
> first time in his browser, the 2 connections are initiated and they
> have to
> remain active till the session is closed. In the simplest case, a
> single
> servers side PHP script would manage both these connections. I know
> there is
> no way I can keep an active connection between the browser and server
> using
> HTTP. I guess I will have to go for something like applets.

You could consider using PHP to run Java to run the connection part,
just so it can be a "bridge" to keep that connection open... Always
wanted to try this, but never got around to it...
[keep reading]

> My question is, is there any other way this can be done in PHP. At
> least is
> there a way I can keep the web server - controller connection alive
> even
> after the script finishes executing and then use that connection the
> next
> time the user tries to access the controller through the webserver.

You can't force the web server to keep its connection open, but you
could write your own custom "robot server" with http://php.net/sockets

This is the way I personally would go, as I'd waste about a thousand
hours fighting with Java and never would get it to work.

> Plus the controller outputs have to be automatically updated in the
> browser
> window. Is an Applet-PHP Script combination a good choice for this
> system. Or
> are MS activex controls good choice in the browser side?

On the "browser" side you've got choices like PHP-GTK and Ming that
might work out well for this kind of thing.

Ming/Flash won't keep the connection open reliably, but you at least
have Good Odds it will stick around, so you can program for it to be
"mostly there, except when it's not" which you have to do any way for
dropped connections and other problems.

MS ActiveX avoid like the plague, personally, as they don't work on my
boxes, and aren't installed on the boxes where they would work if I
was willing to install them, but I'm not.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: Paginating searchs = performance problem

2006-10-23 Thread Richard Lynch
On Mon, October 23, 2006 4:55 am, Ivo F.A.C. Fokkema wrote:
> For my projects I use MySQL anyway, and this one even bypasses the
> LIMIT
> clause, according to the MySQL manual. All I have to do is check if my
> users are using MySQL >= 4.0... That's been released for a while, but
> you
> never know... :)

You also may not have the number defined as a constant in MySQL, so
you have to know that it's, er, 2, I think...

I remember having to do a define() in PHP and splicing it into the
query on some box...

Or maybe I was just being particularly stupid that day...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] FTP - folders

2006-10-23 Thread tedd

At 2:56 PM -0700 10/23/06, Ed Lazor wrote:

On Oct 23, 2006, at 2:27 PM, Richard Lynch wrote:


On the Mac, I always dug "Fetch" personally.


Nice... I've been looking for something like Fetch.


Yeah, Fetch is super cool, but it's been around as long as I have -- 
I'm surprised you haven't heard of it before.


The name came about while we were trying to program with sticks 
(upgrade from rocks) and our dog kept running away with memory. 
Incidentally, the dog also demonstrated the first memory leak by 
raising his leg, but that's another story.


Sorry, too long at the keyboard today.  :-)

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Screen Shots

2006-10-23 Thread Dotan Cohen

On 23/10/06, Stut <[EMAIL PROTECTED]> wrote:

Mark wrote:
> It is just my friends kids on this site so do you know how i could do
> the active x thing please help thanks

I don't care if it's on your Intranet! Spying on visitors to a website
is not good on several levels. If you really want to do it put in the
research - everything you need can be found with your favourite search
engine, you just need to put the effort in to pull it all together.



Come on, show him how to access the user's webcam and actually see his
friends' kids!

Dotan Cohen

http://essentialinux.com/basics.php
http://what-is-what.com/what_is/ubuntu.html

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



Re: [PHP] FTP - folders

2006-10-23 Thread tedd

At 4:27 PM -0500 10/23/06, Richard Lynch wrote:

On Mon, October 23, 2006 4:18 pm, tedd wrote:

 I certainly can read the contents of a folder on the server, but I
 don't see how you can do it client-side.


E.

You could install PHP on the client and do it with PHP.


Interesting.

So a php server-side php script can establish a two-way communication 
with a client-side php script -- do you have an example?




Or it could be TOTALLY OFF-TOPIC


I didn't assume that it was -- too many considerations. I have enough 
problems understanding what's on my plate as it is.


tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Active Connections

2006-10-23 Thread Prathaban Mookiah
Hello List,

I am trying to develop a web based controller for a robot. The robot has an 
embedded telnet deamon and it is controlled primarily through issuing 
commands on this port. I am planning to implement this system with PHP on the 
server side.

Ideally what I would like to do is have two persistent active connections: 
one between the browser and the webserver, and the other between the 
webserver and the robot controller. When the user opens the interface for the 
first time in his browser, the 2 connections are initiated and they have to 
remain active till the session is closed. In the simplest case, a single 
servers side PHP script would manage both these connections. I know there is 
no way I can keep an active connection between the browser and server using 
HTTP. I guess I will have to go for something like applets.

My question is, is there any other way this can be done in PHP. At least is 
there a way I can keep the web server - controller connection alive even 
after the script finishes executing and then use that connection the next 
time the user tries to access the controller through the webserver.

Plus the controller outputs have to be automatically updated in the browser 
window. Is an Applet-PHP Script combination a good choice for this system. Or 
are MS activex controls good choice in the browser side?

Please let me know your ideas and inputs.

Thanks in advance.

Prathap

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



Re: [PHP] FTP - folders

2006-10-23 Thread Ed Lazor


On Oct 23, 2006, at 2:27 PM, Richard Lynch wrote:


On the Mac, I always dug "Fetch" personally.


Nice... I've been looking for something like Fetch.


PC, you got your CuteFTP and all that ilk.


SecureFTP by VanDyke rocks.


Now, on *nix, SCP is nice for that, if you have SSH shell access.  If
not, I dunno...  Never have stumbled across a good utility for that.
Never looked super hard either, as glob usually works in FTP shell,
and when it doesn't, well, I can ususally find some way around that
too.


ncftp for general stuff on Unix has always been my favorite.  I  
default to things like scp when I need secure transfers of data.


-Ed

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



Re: [PHP] Paginating searchs = performance problem

2006-10-23 Thread Richard Lynch
On Fri, October 20, 2006 10:04 am, Fourat Zouari wrote:
> I have PHP/PostgreSQL application were i got a search page with some
> items
> to search, am building the search query on server side.
>
> I need to display a paginated search and for this i need to get the
> total
> count of lines matching the search before OFFSET/LIMITing my page, am
> i
> obliged to repeat the query twice ??? first to get the total count,
> second
> to get my page.
>
> it's very heavy
>
> Any one's suggesting better doing ?

Use a cursor.
http://postgresql.org/

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] connectivity weirdness

2006-10-23 Thread Richard Lynch
On Fri, October 20, 2006 11:40 am, Richard Lynch wrote:
> The canonical PHP example of web-scraping:
> http://php.net/');?>
> fails on a machine I'm using.
>
> I'm laying out here all the things I've done and eliminated, and it
> got awfully long...
>
> Short Version:
>
> FC4 + LAMPP on 2 different private IP boxes at day job
>
> file_get_contents('http://php.net') hangs and times out after 2
> minutes.
> telnet php.net 80 | GET / HTTP/1.0 hangs and times out after 2
> minutes.
> wget php.net WORKS
> links php.net WORKS

It turns out that there are two gateways here on the Intranet, and one
of them does NAT and one doesn't.

Changing the gateway to the one that NATs fixed things.

Don't ask me how wget and links made the allegedly non-NAT-ing gateway
"work" as I don't know and probably wouldn't understand the
explanation if somebody told me anyway :-)

It's probably some weird Windows thing anyway :-)

The NAT-ing boxen are most likely Windows, as the IT guy didn't even
know how to change the gateway on Un*x...

It only took me 5 tries and 10 re-reads of the man pages to get the
command right :-)

But I done fixed it, yup.

There's a reason I'm not a sysadmin... :-) :-) :-)

PS
On another fun job this weekend...
NOTE TO SELF:  Always check to make sure nobody kicked the wall wart
loose from the power strip before you waste an hour trying to fix your
boss' Win98 2Ed. computer after he claims that the whole Internet is
"down"
Every damn change to the IP/netconfig required re-inserting the damn
OS CD and re-booting!  What the hell is up with that?
No wonder I told him I was no longer supporting that box five years
ago...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Parsing serialized PHP arrays in "C"

2006-10-23 Thread Richard Lynch
On Sat, October 21, 2006 6:25 pm, Kevin Wilcox wrote:
> ext/standard/var_unserializer.c, and I don't think what will port to a

That's pretty much the code I would have pointed you to...

Unless you happen to KNOW that all the data inside the arrays is
ultimately scaler or something...

I suppose you've already ruled out just installing PHP and using
exec() in C to call it?

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] IP Address

2006-10-23 Thread Richard Lynch
On Sat, October 21, 2006 6:55 pm, Fred Moses wrote:
> Is there a function which returns the IP address of the requestor of
> the
> current page?

Any question like this:

"Is there a way to find out X that came in from the user"

is almost always answered by adding this to the top of your code:




Also, be aware that the IP is pretty useless for anything other than
entertainment value.  It's not unique, it's not stable, it's not
reliable, it's not useful for identification nor authentication [*],
it's pretty pointless bit of info.

[*] Obviously if you control the IP address and it is static, that is
a limited exception to this generalization, and you (hopefully)
already understood all the above *before* somebody granted you the
power to control a public static IP address... :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Comment management

2006-10-23 Thread Robert Cummings
On Mon, 2006-10-23 at 17:27 -0400, Chris Shiflett wrote:
> Robert Cummings wrote:
> > Well it's still trivial, just most of us who have frameworks
> > wouldn't be so wasteful of our time to remove the dependency
> > of our framework and code it from first principles.
> 
> If your framework is written in PHP and doesn't have any external
> dependencies, why are you bothering to make this point? You seem to be
> trying to debate something that's completely irrelevant.

Ah, I thought by external dependencies you meant other PHP libs (as in
not a standalone comment manager).

> > I still say trivial that may depend on what you expect of #2
> > and #3 which you've obviously left blank
> 
> They weren't obviously blank:

I didn't say they were blank, you've mentioned what you don't want, not
what you DO want.

> 2. Some content is removed

What kind of content removal bothers you? There are security
implications with leaving submitted data intact (you're well aware of
that I'm sure :)

> 3. Blacklist approaches to filtering

What would you prefer over blacklist approaches?

> I'm currently writing a test suite for this, and I'd be happy to test
> any solution you've written.
> 
> But, to be quite honest, if you think the problem is trivial, your
> solution isn't likely to be very useful to me.

It depends on the problem. Your criteria don't define it well yet. The
OP's criteria did define it as trivial.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Re: Screen Shots

2006-10-23 Thread Richard Lynch
On Sun, October 22, 2006 11:39 am, Dotan Cohen wrote:
> And how does that produce a screenshot?

You could re-render in smaller form the same page you sent to them,
since you have all the inputs it required to send it, since you sent
it from those inputs.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Screen Shots

2006-10-23 Thread Richard Lynch
On Sun, October 22, 2006 7:19 am, Mark McWhirter wrote:
> Is there any way that I can get a script to take a screen shot every
> minute
> of all the users using my php website?

You mean a literal screen shot of what's on my monitor?!

Uhhh, no.

That would be just a tiny bit of a security hole, don't you think?
Okay, more like a sucking chest wound of a security hole, actually...


If you just want to copy all the session files over somewhere to
examine their state later for forensics, I suppose that shouldn't be
too hard.
http://php.net/copy
http://php.net/glob
http://php.net/exec
would all be potentially useful.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Comment management

2006-10-23 Thread Chris Shiflett
Robert Cummings wrote:
> Well it's still trivial, just most of us who have frameworks
> wouldn't be so wasteful of our time to remove the dependency
> of our framework and code it from first principles.

If your framework is written in PHP and doesn't have any external
dependencies, why are you bothering to make this point? You seem to be
trying to debate something that's completely irrelevant.

> I still say trivial that may depend on what you expect of #2
> and #3 which you've obviously left blank

They weren't obviously blank:

2. Some content is removed
3. Blacklist approaches to filtering

> your request is sort of impossible since I'm not about to guess.

I'm currently writing a test suite for this, and I'd be happy to test
any solution you've written.

But, to be quite honest, if you think the problem is trivial, your
solution isn't likely to be very useful to me.

Chris

-- 
Chris Shiflett
http://shiflett.org/

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



Re: [PHP] FTP - folders

2006-10-23 Thread Richard Lynch
On Mon, October 23, 2006 4:18 pm, tedd wrote:
> I certainly can read the contents of a folder on the server, but I
> don't see how you can do it client-side.

E.

You could install PHP on the client and do it with PHP.

Or it could be TOTALLY OFF-TOPIC

> Now, am I right, or do you have a way to do this?

How many FTP tools are "out there" that let you specify a whole
directory, some portion thereof, or all kinds of ways to pick and
choose files to upload?

Dozens, nay, hundreds.

Some of them even work quite nicely.

On the Mac, I always dug "Fetch" personally.

PC, you got your CuteFTP and all that ilk.

Now, on *nix, SCP is nice for that, if you have SSH shell access.  If
not, I dunno...  Never have stumbled across a good utility for that. 
Never looked super hard either, as glob usually works in FTP shell,
and when it doesn't, well, I can ususally find some way around that
too.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] FTP - folders

2006-10-23 Thread tedd

At 8:42 PM +0100 10/23/06, Stut wrote:

Rob Kritzer wrote:

Is it possible to FTP a folder and all it's content? I can do a file at a
time, but not a folder.

Also there is times when I will not know the folder name, so I would like it
to just upload everything it finds in the folder I set.

Is this possilbe?


Yes[1][2].

-Stut

[1] http://catb.org/~esr/faqs/smart-questions.html
[2] There is no function to upload a folder, but it's quite easy to 
code. Check out http://php.net/glob and/or http://php.net/readdir


-Stut:

Perhaps I'm confused (certainly could be), but I think the OP is 
asking for a way to upload multiple files from a desktop folder to a 
server (client-side to sever-side) by just selecting the desktop 
(client-side) folder.


Maybe I should read [1] a little closer, but I did read [2] and I 
don't see where one can use php to open a folder on a desktop, read 
its contents, and then upload the files therein. However, I do see a 
way to upload individual files, but not multiple files _unless_ the 
user selects them one at a time and then uploads them consecutively 
via a loop. But, that still requires the user to select the files 
individually and not the folder that contains them.


I certainly can read the contents of a folder on the server, but I 
don't see how you can do it client-side.


Now, am I right, or do you have a way to do this?

Thanks.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Comment management

2006-10-23 Thread Robert Cummings
On Mon, 2006-10-23 at 16:54 -0400, Chris Shiflett wrote:
> Tedd wrote:
> > I just wanted to check before launching my own home-grown
> > solution and then having everyone say "Why didn't you use
> > so-and-so's 'comment manager'"?
> 
> For what it's worth, I'm interested in a good solution to this problem
> as well, and I don't think it's nearly as trivial as others seem to think.
> 
> Most existing solutions have one or more undesirable characteristics:
> 
> 1. Too many external dependencies
> 2. Some content is removed
> 3. Blacklist approaches to filtering
> 4. Yet another markup language
> 5. XHTML is required (or invalid XHTML is produced)
> 
> I'm sure I could come up with several more with a bit of thought. Of
> course, I'd love to be proven wrong and shown a really great solution.

Well it's still trivial, just most of us who have frameworks wouldn't be
so wasteful of our time to remove the dependency of our framework and
code it from first principles. We created frameworks for a reason. Also,
you've added a feature list not present in the OP, and while I still say
trivial that may depend on what you expect of #2 and #3 which you've
obviously left blank which means we don't even have your list of
"desirable" characteristics... so actually, your request is sort of
impossible since I'm not about to guess... and I'll sleep well tonight
whether I prove you wrong or not :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Screen Shots

2006-10-23 Thread Stut

Please don't reply directly to me - always include the list.

Mark wrote:
It is just my friends kids on this site so do you know how i could do 
the active x thing please help thanks


I don't care if it's on your Intranet! Spying on visitors to a website 
is not good on several levels. If you really want to do it put in the 
research - everything you need can be found with your favourite search 
engine, you just need to put the effort in to pull it all together.


-Stut


- Original Message - From: "Stut" <[EMAIL PROTECTED]>
To: "Mark McWhirter" <[EMAIL PROTECTED]>
Cc: 
Sent: Sunday, October 22, 2006 3:29 PM
Subject: Re: [PHP] Screen Shots



Mark McWhirter wrote:
Is there any way that I can get a script to take a screen shot every 
minute

of all the users using my php website?


Wow, does that ever have nothing to do with PHP!!

To answer the inappropriate question... No. Or rather, not without the
use of a client-side technology such as ActiveX and the ability to
bypass any active content security or convince your visitors to give you
permission to spy on them.

So, as I said previously, no.

-Stut





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



Re: [PHP] Class privacy and variable identifiers

2006-10-23 Thread Richard Lynch
On Mon, October 23, 2006 3:07 pm, David Morse wrote:
> i) Does the language provide a way to generate a private or
> local class that is accessible only within another function
> or a parent class. In python, for example, if you declare a
> class or function within a function definition, I believe it
> is accessible only within the parent function. Does PHP 5
> supply a good way to generate a little utility class without
> polluting the public namespace? Or are local variables in
> functions, class methods and class properties the only
> entities that can be hidden from public access?

I believe a function defined in another function won't exist until the
outer function is called, but once it exists, it is in global
namespace.

If you want to do that, stick with Python.

> ii) Suppose I would like to be able generate any of several
> classes at runtime, for which constructor interfaces are the
> same. These might, for example, be specialized subclasses of
> a common parent. Based on the idea of a variable variable,
> I am tempted to try to replace the class name by a variable,
> as in
>
>  $object = new $class_name_variable($param1,$param2,)

I'm not sure if you can do that, but you could try it faster than I
could...

If you cannot do it, you could do several other things.

#1.
http://php.net/eval
Usually, if eval() is the answer, you've asked a bad question...

#2.
Have PHP write generate your class source code files before you
include them.

> Is this legal PHP 5? Put another way, are variable names the
> only identifiers that can be replaced by string values of
> other variables, or is the technique more general? For instance,
> how about accessing a property or method by a name that is
> specified by a variable, as in:
>
>  $object_instance->$property_name_variable

This works, but sometimes you need ( ) or { } to set order of
operations precedence so things happen in the right order.

>  $object_instance->$method_name_variable()

Ditto.

> The idea of a 'variable variable' name seems quite useful,

It SEEMS useful, but it usually means you should have architected an
array or class instance instead of a single variable. :-)

http://php.net
is the documentation, and I don't think any of the answers I've
provided are missing...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] different php configuration per .httaccess?

2006-10-23 Thread Stut

Zbigniew Szalbot wrote:

STFWNN!!


Ok, don't know what it means but will google, lesson learnt ;)


You could Google that too, but I don't believe the NN is very common. 
Stands for Search the Effing Web Numb Nuts.


Glad I could help.

-Stut

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



Re: [PHP] Comment management

2006-10-23 Thread Leif Gregory
Hello tedd,

Monday, October 23, 2006, 1:53:41 PM, you wrote:
> Well... I was afraid that someone would say that (paint me into a
> corner). I just wanted to check before launching my own home-grown
> solution and then having everyone say "Why didn't you use
> so-and-so's 'comment manager' "?

Sorry, wasn't paying attention earlier. I recently wrote a comment
manager that you include on the page you want to do comments. It uses
one MySQL table with an id that relates to the page the comments
pertain to. i.e. it uses the same code and DB table for multiple pages
where the comments may all be different.

It's cake easy to implement (one php file to display and save new
comments) and I'd be interested in any comments you might have about
it. PM me and I'll send it to you. 

If you want to see it in action, take a look at
http://trucks.pcwize.com/ubiquirack.php (at the bottom). I need to
setup a test page for this somewhere on my devtek.org site.


-- 
  TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x5D167202
 __       Geocaching:http://gps.PCWize.com
(  )  ( ___)(_  _)( ___)  TBUDP Wiki Site:  http://www.PCWize.com/thebat/tbudp
 )(__  )__)  _)(_  )__)   Roguemoticons & Smileys:http://PCWize.com/thebat
()()()(__)PHP Tutorials and snippets:http://www.DevTek.org

Stock news: Certs shareholders breathe easier.

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



Re: [PHP] Comment management

2006-10-23 Thread Chris Shiflett
Tedd wrote:
> I just wanted to check before launching my own home-grown
> solution and then having everyone say "Why didn't you use
> so-and-so's 'comment manager'"?

For what it's worth, I'm interested in a good solution to this problem
as well, and I don't think it's nearly as trivial as others seem to think.

Most existing solutions have one or more undesirable characteristics:

1. Too many external dependencies
2. Some content is removed
3. Blacklist approaches to filtering
4. Yet another markup language
5. XHTML is required (or invalid XHTML is produced)

I'm sure I could come up with several more with a bit of thought. Of
course, I'd love to be proven wrong and shown a really great solution.

Chris

-- 
Chris Shiflett
http://shiflett.org/

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



Re: [PHP] different php configuration per .httaccess?

2006-10-23 Thread Zbigniew Szalbot

Hi,


STFWNN!!


Ok, don't know what it means but will google, lesson learnt ;)



http://www.google.co.uk/search?q=change+php+configuration+htaccess


Sorry, I should have started from google. I had a brief look at php 
configuration but could not find a specific reference. Anyway, thanks.




--
Zbigniew Szalbot

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



Re: [PHP] different php configuration per .httaccess?

2006-10-23 Thread Stut

Zbigniew Szalbot wrote:
I would like to know if it is possible to change php configuration per 
.htaccess file? For example, to be able to switch register_globals 
on/off and the like (based on the main configuration file)?


If it is possible, could someone share what the general syntax for 
.htaccess file would look like?


For exmaple, would I need to put register_globals = on in .htaccess to 
make it work for a given directory?


STFWNN!!

http://www.google.co.uk/search?q=change+php+configuration+htaccess


Many thanks for your advice!


No problem.


Warm regards,


Same to you.

-Stut

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



[PHP] different php configuration per .httaccess?

2006-10-23 Thread Zbigniew Szalbot

Hello,

I would like to know if it is possible to change php configuration per 
.htaccess file? For example, to be able to switch register_globals on/off 
and the like (based on the main configuration file)?


If it is possible, could someone share what the general syntax for 
.htaccess file would look like?


For exmaple, would I need to put register_globals = on in .htaccess to 
make it work for a given directory?


Many thanks for your advice!

Warm regards,

--
Zbigniew Szalbot

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



Re: [PHP] Class privacy and variable identifiers

2006-10-23 Thread Jochem Maas
David Morse wrote:
> I have two somewhat general questions about the PHP 5
> language. These points remain unclear to me after reading
> the manual and working with the language for a few months:
> 
> i) Does the language provide a way to generate a private or
> local class that is accessible only within another function
> or a parent class.

no. classes are global. as an aside there *may* be namespaces in php
in the future.

 In python, for example, if you declare a
> class or function within a function definition, I believe it
> is accessible only within the parent function. Does PHP 5
> supply a good way to generate a little utility class without
> polluting the public namespace? Or are local variables in
> functions, class methods and class properties the only
> entities that can be hidden from public access?

no - may an assoc array would suffice your needs? many people
use static classes to contain sets of [utility] functions as a
sort of poormans namespacing ... helps to cut down pollution a little.

> 
> ii) Suppose I would like to be able generate any of several
> classes at runtime, for which constructor interfaces are the
> same. These might, for example, be specialized subclasses of
> a common parent. Based on the idea of a variable variable,
> I am tempted to try to replace the class name by a variable,
> as in
> 
> $object = new $class_name_variable($param1,$param2,)

works.

> 
> Is this legal PHP 5? Put another way, are variable names the
> only identifiers that can be replaced by string values of
> other variables, or is the technique more general? For instance,
> how about accessing a property or method by a name that is
> specified by a variable, as in:
> 
> $object_instance->$property_name_variable

works.

> 
> or
> 
> $object_instance->$method_name_variable()

works.
please get into the habit of testing stuff like this
(get yourself a linux shell and read up on using php on the cmdline :-):

php5 -r '
class myObject {
const MY_CNST = "a";
public $myProp = "b";
public function myMethod() { return "c1"; }
public static function myStaticMethod() { return "c2"; }
}

$f = "MY_CNST"; $c = "myObject"; $p = "myProp"; $m = "myMethod"; $s = "CNST"; 
$MY_CNST = "f";
print_r($o = new $c());
echo join(", ", array(
constant(get_class($o)."::${${"MY_$s"}}"),
$o->$p,
$o->$m(),
constant("$c::MY_CNST"),
$o->{"myProp"},
call_user_func(array($c, "myStaticMethod","\n";
'

> 
> The idea of a 'variable variable' name seems quite useful,

be careful with varvars ;-)
see also:

http://php.net/call_user_func
http://php.net/call_user_func_array

> but I'm not sure how general the concept is. Is there a
> well-defined rule for when the parser will accept a string
> value of a variable as a replacement for a literal
> identifier. If so, is the rule documented?

somewhere on php.net no doubt :-/

> 
> Thanks in advance for any insight.
> 
> -David Morse

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



Re: [PHP] Comment management

2006-10-23 Thread Robert Cummings
On Mon, 2006-10-23 at 15:53 -0400, tedd wrote:
> At 12:17 PM -0400 10/23/06, Robert Cummings wrote:
> >On Mon, 2006-10-23 at 11:12 -0400, tedd wrote:
> >  > Does anyone have any recommendations or can point me to a simple
> >  > content manager for such a purpose?
> >
> >If you just want something simple like what PHP uses, you're probably
> >going to spend more time looking for someone else's solution than it
> >would take to write it yourself :p It's quite trivial for any
> >half-seasoned coder.
> >
> >Cheers,
> >Rob.
> 
> Rob:
> 
> Well... I was afraid that someone would say that (paint me into a 
> corner). I just wanted to check before launching my own home-grown 
> solution and then having everyone say "Why didn't you use so-and-so's 
> 'comment manager' "?
> 
> I'm sure word-press would do, but it's probably an overkill for my needs.
> 
> Thanks guys.
> 
> tedd
> 
> PS: I've been called a "half-???" coder before, but the word usually 
> isn't "seasoned".  :-)

I was speaking general, so you can retain your claim to the other
word :B ;) :D

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Class privacy and variable identifiers

2006-10-23 Thread David Morse

I have two somewhat general questions about the PHP 5
language. These points remain unclear to me after reading
the manual and working with the language for a few months:

i) Does the language provide a way to generate a private or
local class that is accessible only within another function
or a parent class. In python, for example, if you declare a
class or function within a function definition, I believe it
is accessible only within the parent function. Does PHP 5
supply a good way to generate a little utility class without
polluting the public namespace? Or are local variables in
functions, class methods and class properties the only
entities that can be hidden from public access?

ii) Suppose I would like to be able generate any of several
classes at runtime, for which constructor interfaces are the
same. These might, for example, be specialized subclasses of
a common parent. Based on the idea of a variable variable,
I am tempted to try to replace the class name by a variable,
as in

$object = new $class_name_variable($param1,$param2,)

Is this legal PHP 5? Put another way, are variable names the
only identifiers that can be replaced by string values of
other variables, or is the technique more general? For instance,
how about accessing a property or method by a name that is
specified by a variable, as in:

$object_instance->$property_name_variable

or

$object_instance->$method_name_variable()

The idea of a 'variable variable' name seems quite useful,
but I'm not sure how general the concept is. Is there a
well-defined rule for when the parser will accept a string
value of a variable as a replacement for a literal
identifier. If so, is the rule documented?

Thanks in advance for any insight.

-David Morse
--
!---!   
!  David Morse  email: [EMAIL PROTECTED]   !
!  Dept of Chem Eng & Mat Sci   phone: (612)625-0167!
!  University of Minnesota  !
!  Minneapolis, MN 55455!
!---!

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



Re: [PHP] Comment management

2006-10-23 Thread tedd

At 12:17 PM -0400 10/23/06, Robert Cummings wrote:

On Mon, 2006-10-23 at 11:12 -0400, tedd wrote:
 > Does anyone have any recommendations or can point me to a simple
 > content manager for such a purpose?

If you just want something simple like what PHP uses, you're probably
going to spend more time looking for someone else's solution than it
would take to write it yourself :p It's quite trivial for any
half-seasoned coder.

Cheers,
Rob.


Rob:

Well... I was afraid that someone would say that (paint me into a 
corner). I just wanted to check before launching my own home-grown 
solution and then having everyone say "Why didn't you use so-and-so's 
'comment manager' "?


I'm sure word-press would do, but it's probably an overkill for my needs.

Thanks guys.

tedd

PS: I've been called a "half-???" coder before, but the word usually 
isn't "seasoned".  :-)

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] [ANNOUNCEMENT] Sparse 1.1b released - create Ajax forms!

2006-10-23 Thread Daniel Orner
   No, not yet. I admit to being something of a novice when it comes to 
Ajax, and as has been stated, this is still in beta and I have yet to 
get any significant beta testers (most of the new versions are mainly 
new functionality rather than bugfixes, all of which I somehow 
discovered myself).
   On the PHP side I've tried to shield against SQL/PHP injection as 
best I could, but of course no one's perfect. It does still need to be 
destruct-tested.


--Daniel

Ed Lazor wrote:

Has anyone checked this for security?


On Oct 23, 2006, at 11:26 AM, Daniel Orner wrote:

A big new update for Sparse, the HTML-based framework for writing 
MySQL-backed CGI applications easily and quickly. Now, the generated 
forms output in fully degradable Ajax, meaning that if a user doesn't 
have Javascript available or if an error occurs, the regular 
functionality will still work. Documentation has also had a 
significant overhaul. If you haven't tried Sparse yet, now's the time!


--Daniel

--Sparse - a new way to write MySQL-based programs with little to no 
actual programming. Save yourself time and effort!

http://sparse-php.sourceforge.net/

--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] FTP - folders

2006-10-23 Thread Stut

Rob Kritzer wrote:

Is it possible to FTP a folder and all it's content? I can do a file at a
time, but not a folder.

Also there is times when I will not know the folder name, so I would 
like it

to just upload everything it finds in the folder I set.

Is this possilbe?


Yes[1][2].

-Stut

[1] http://catb.org/~esr/faqs/smart-questions.html
[2] There is no function to upload a folder, but it's quite easy to 
code. Check out http://php.net/glob and/or http://php.net/readdir


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



[PHP] FTP - folders

2006-10-23 Thread Rob Kritzer

Is it possible to FTP a folder and all it's content? I can do a file at a
time, but not a folder.

Also there is times when I will not know the folder name, so I would like it
to just upload everything it finds in the folder I set.

Is this possilbe?

Thanks


Re: [PHP] [ANNOUNCEMENT] Sparse 1.1b released - create Ajax forms!

2006-10-23 Thread Ed Lazor

Has anyone checked this for security?


On Oct 23, 2006, at 11:26 AM, Daniel Orner wrote:

	A big new update for Sparse, the HTML-based framework for writing  
MySQL-backed CGI applications easily and quickly. Now, the  
generated forms output in fully degradable Ajax, meaning that if a  
user doesn't have Javascript available or if an error occurs, the  
regular functionality will still work. Documentation has also had a  
significant overhaul. If you haven't tried Sparse yet, now's the time!


--Daniel

--
Sparse - a new way to write MySQL-based programs with little to no  
actual programming. Save yourself time and effort!

http://sparse-php.sourceforge.net/

--
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] Screen Shots

2006-10-23 Thread Google Kreme

On 23 Oct 2006, at 08:32 , Dotan Cohen wrote:
I give this information to spread awareness, not to spread  
malicious code, FUD, exploits, or anything else.


On he other hand, IE related malicious code and exploits should be  
distributed as widely as possible as it is the only way MSFT will fix  
anything.


I love how the new improved windows vista already has viruses and  
exploits.  Tee Hee.



--
"Real stupidity beats artificial intelligence every time."

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



[PHP] PHP Search and Privacy...

2006-10-23 Thread Russell Jones

Does anyone know if any of the PHP Site-Search tools have implemented the
new #privacy search standard (http://www.poundprivacy.org). Looking to
install a new site-search and I would really like to install something that
is compliant...


[PHP] [ANNOUNCEMENT] Sparse 1.1b released - create Ajax forms!

2006-10-23 Thread Daniel Orner
	A big new update for Sparse, the HTML-based framework for writing 
MySQL-backed CGI applications easily and quickly. Now, the generated 
forms output in fully degradable Ajax, meaning that if a user doesn't 
have Javascript available or if an error occurs, the regular 
functionality will still work. Documentation has also had a significant 
overhaul. If you haven't tried Sparse yet, now's the time!


--Daniel

--
Sparse - a new way to write MySQL-based programs with little to no 
actual programming. Save yourself time and effort!

http://sparse-php.sourceforge.net/

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



Re: [PHP] Screen Shots

2006-10-23 Thread Dotan Cohen

On 23/10/06, Jochem Maas <[EMAIL PROTECTED]> wrote:

it's a Pretty Damning Format ;-)



I'd always thought of it as the Potty-Diaper Format. I stand corrected.

Dotan Cohen

http://faq-google.com
http://what-is-what.com/what_is/spam.html

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



Re: [PHP] Comment management

2006-10-23 Thread Google Kreme

On 23 Oct 2006, at 09:12 , tedd wrote:
Does anyone have any recommendations or can point me to a simple  
content manager for such a purpose?


Do you need a content manager?  Sounds like you want a blog like  
setup where you post a entry (code) and people can comment.   
Wordpress is nice.


Or am I missing something?


--
"But you read a lot of books, I'm thinking. Hard to have faith, ain't  
it, when you've read too many books?"


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



Re: [PHP] Comment management

2006-10-23 Thread Robert Cummings
On Mon, 2006-10-23 at 18:16 +0200, Rocco Di Leo wrote:
> Hi Tedd,
> 
> you may want to check out a Blog-Software like Wordpress if it fulfills your
> requirements and relaunch your website using it. From what i see on your
> page, it could pretty much replace the functionality and add the benefits of
> comments, nice urls, etc

If he goes that far, he could just use Drupal and get all the other
content management "features" and of course "headaches" *hehe*.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] [OFF] A note on replying to this list

2006-10-23 Thread Ed Lazor
You're asking everyone else to change their email client when the  
quickest solution would be for you to change yours.


On Oct 22, 2006, at 10:59 PM, theIggs wrote:


Hello all!

Sorry for the offtopic.
Please, when you reply to PHP mailing lists, put the Re: element right
in front of the subject:
Re: [PHP] Screen shots
not
[PHP] Re: Screen shots
When there are two different styles used simultaneously it's merely
impossible to sort messages in chains. At least my email client (The
Bat!) can't sort messages in chains with [PHP] Re-like subject. So I
believe for most of us two different styles at a time are not
convenient.

Thanks.
Please correct me if I'm wrong.

---
Regards,
theIggs.

--
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] Comment management

2006-10-23 Thread Robert Cummings
On Mon, 2006-10-23 at 11:12 -0400, tedd wrote:
> Hi:
> 
> I posted this on the web-design list, but didn't receive any leads.
> 
> I want to continue what I've been doing, which is to offer various 
> code solutions for people via my web site, but I would like to add a 
> feature where people can comment on the code. Such as if they found 
> it useful, or found an error, or general comment -- you know, you've 
> seen this before. Also, I want the code to be secure and allow me to 
> edit users comments.
> 
> Does anyone have any recommendations or can point me to a simple 
> content manager for such a purpose?
> 
> I know I could write it myself, but I would rather not reinvent the 
> wheel, if possible.

If you just want something simple like what PHP uses, you're probably
going to spend more time looking for someone else's solution than it
would take to write it yourself :p It's quite trivial for any
half-seasoned coder.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Comment management

2006-10-23 Thread Rocco Di Leo

Hi Tedd,

you may want to check out a Blog-Software like Wordpress if it fulfills your
requirements and relaunch your website using it. From what i see on your
page, it could pretty much replace the functionality and add the benefits of
comments, nice urls, etc

Greets
Rocco

--
New Identity AG



On 10/23/06, tedd <[EMAIL PROTECTED]> wrote:


Hi:

I posted this on the web-design list, but didn't receive any leads.

I want to continue what I've been doing, which is to offer various
code solutions for people via my web site, but I would like to add a
feature where people can comment on the code. Such as if they found
it useful, or found an error, or general comment -- you know, you've
seen this before. Also, I want the code to be secure and allow me to
edit users comments.

Does anyone have any recommendations or can point me to a simple
content manager for such a purpose?

I know I could write it myself, but I would rather not reinvent the
wheel, if possible.

Thanks.

tedd

--
---
http://sperling.com   http://ancientstones.com  http://earthstones.com

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




Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread David Giragosian

Angelo, as Brad says, you can pass user and password args to mysqldump from
an include file.

I run a php backup script via cron every night, then tar and compress and
store in various dirs out of the web tree.

I have the script if you'd like. It came from someone on the php-db list
years ago, and I'm not in any way claiming credit for it.

David


On 10/23/06, Brad Bonkoski <[EMAIL PROTECTED]> wrote:


Edward Kay wrote:
> hi all,
>
> Im doing the following dump through PHP:
>
> $output = shell_exec('mysqldump '. $db_database .' > '.
> $backup_path.$filename);
>
> It doesnt seem to work but when I run the exact same command (with
> appropriate values) in the command line it creates the dump file.
What
> could be the reason for this?
>
> Thanks in advance.
>
> regards
>
>
>
>
 It appears that it could be because the user that runs the scripts is
 not allowed to. When I run them on the commandline, I run them as the
 root user. Is this a common problem? What would the best way be to
sort
 this out keeping in mind security on the server?



>>> If you are trying to automate backups of you database, set up a
>>>
>> cron job. I
>>
>>> have a shell script that dumps my databases, zips them and then
>>>
>> sends them
>>
>>> via FTP to a remote server. This is automatically run every 12 hours
by
>>> cron.
>>>
>>> See http://en.wikipedia.org/wiki/Crontab for more info.
>>>
>>> Edward
>>>
>>>
>>>
>>>
>>>
>> hi Edward,
>> yes I know of CRONtabs but wont this still leave us with the user
>> permission of running mysqldump? because essentially it will still be a
>> PHP file to run the shell command to create the dump file?
>>
>> thanks
>>
>>
> No, cron will typically run as root. You don't need to involve PHP.
>
> It looks to me as if you are trying to use web scripting (PHP) to do the
> sysadmin on your server, for which other methods are more suitable.
>
> Edward
>
>
#1. You can run mysqldump with the same flags a the mysql command
line... i.e. -u= --password=
#2. Crons run as the user that owns the crontab, not always root.
#3. Edward is right, PHP is a wonderful tool, not sure the tool was
meant to do the types of things you are trying to do...unless you could
fill us in with more details of what the purpose is, then we might be
able to give more insight into how.

-B

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




Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread Angelo Zanetti



Edward Kay wrote:


Angelo Zanetti wrote:

   


hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .' > '.
$backup_path.$filename);

It doesnt seem to work but when I run the exact same command (with
appropriate values) in the command line it creates the dump file. What
could be the reason for this?

Thanks in advance.

regards

 


It appears that it could be because the user that runs the scripts is
not allowed to. When I run them on the commandline, I run them as the
root user. Is this a common problem? What would the best way be to sort
this out keeping in mind security on the server?
   



If you are trying to automate backups of you database, set up a cron job. I
have a shell script that dumps my databases, zips them and then sends them
via FTP to a remote server. This is automatically run every 12 hours by
cron.

See http://en.wikipedia.org/wiki/Crontab for more info.

Edward


 



hi Edward,
yes I know of CRONtabs but wont this still leave us with the user 
permission of running mysqldump? because essentially it will still be a 
PHP file to run the shell command to create the dump file?


thanks

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



Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread Brad Bonkoski

Edward Kay wrote:

hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .' > '.
$backup_path.$filename);

It doesnt seem to work but when I run the exact same command (with
appropriate values) in the command line it creates the dump file. What
could be the reason for this?

Thanks in advance.

regards



  

It appears that it could be because the user that runs the scripts is
not allowed to. When I run them on the commandline, I run them as the
root user. Is this a common problem? What would the best way be to sort
this out keeping in mind security on the server?




If you are trying to automate backups of you database, set up a
  

cron job. I


have a shell script that dumps my databases, zips them and then
  

sends them


via FTP to a remote server. This is automatically run every 12 hours by
cron.

See http://en.wikipedia.org/wiki/Crontab for more info.

Edward




  

hi Edward,
yes I know of CRONtabs but wont this still leave us with the user
permission of running mysqldump? because essentially it will still be a
PHP file to run the shell command to create the dump file?

thanks



No, cron will typically run as root. You don't need to involve PHP.

It looks to me as if you are trying to use web scripting (PHP) to do the
sysadmin on your server, for which other methods are more suitable.

Edward

  
#1. You can run mysqldump with the same flags a the mysql command 
line... i.e. -u= --password=

#2. Crons run as the user that owns the crontab, not always root.
#3. Edward is right, PHP is a wonderful tool, not sure the tool was 
meant to do the types of things you are trying to do...unless you could 
fill us in with more details of what the purpose is, then we might be 
able to give more insight into how.


-B

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



RE: [PHP] mysqldump problem from PHP

2006-10-23 Thread Edward Kay
> >>>hi all,
> >>>
> >>>Im doing the following dump through PHP:
> >>>
> >>>$output = shell_exec('mysqldump '. $db_database .' > '.
> >>>$backup_path.$filename);
> >>>
> >>>It doesnt seem to work but when I run the exact same command (with
> >>>appropriate values) in the command line it creates the dump file. What
> >>>could be the reason for this?
> >>>
> >>>Thanks in advance.
> >>>
> >>>regards
> >>>
> >>>
> >>>
> >>It appears that it could be because the user that runs the scripts is
> >>not allowed to. When I run them on the commandline, I run them as the
> >>root user. Is this a common problem? What would the best way be to sort
> >>this out keeping in mind security on the server?
> >>
> >>
> >
> >If you are trying to automate backups of you database, set up a
> cron job. I
> >have a shell script that dumps my databases, zips them and then
> sends them
> >via FTP to a remote server. This is automatically run every 12 hours by
> >cron.
> >
> >See http://en.wikipedia.org/wiki/Crontab for more info.
> >
> >Edward
> >
> >
> >
> >
>
> hi Edward,
> yes I know of CRONtabs but wont this still leave us with the user
> permission of running mysqldump? because essentially it will still be a
> PHP file to run the shell command to create the dump file?
>
> thanks
>
No, cron will typically run as root. You don't need to involve PHP.

It looks to me as if you are trying to use web scripting (PHP) to do the
sysadmin on your server, for which other methods are more suitable.

Edward

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



Re: [PHP] Comment management

2006-10-23 Thread tg-php
Think he's looking for something that'll manage comments.. not bugs.  As he 
says, so people can post comments (like in the online PHP docs where there are 
user comments for differnent entries with their own code samples and notes).

-TG

= = = Original message = = =

Maybe you mean a bug tracker?

checkout

http://flyspray.rocks.cc/


on Monday 23 October 2006 17:12, tedd wrote:
> Hi:
>
> I posted this on the web-design list, but didn't receive any leads.
>
> I want to continue what I've been doing, which is to offer various
> code solutions for people via my web site, but I would like to add a
> feature where people can comment on the code. Such as if they found
> it useful, or found an error, or general comment -- you know, you've
> seen this before. Also, I want the code to be secure and allow me to
> edit users comments.
>
> Does anyone have any recommendations or can point me to a simple
> content manager for such a purpose?
>
> I know I could write it myself, but I would rather not reinvent the
> wheel, if possible.
>
> Thanks.
>
> tedd



___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] Re: Finding a visitor's location

2006-10-23 Thread Colin Guthrie
John Messam wrote:
> Hello, I am trying to find out the country and possibly the city where the
> visitors to my site are coming from.   I can capture the IP address but how
> do I translate that to a specific locale.   Is there a way to do it or do I
> have to ask them and map the info myself.  Thank you for you help.  This list
> is a very useful tool.

There are webservice based solutions for this.

Look around for the GeoIP firefox extension and I think there is a
Joomla extension that would probably give some PHP examples.

Col.

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



Re: [PHP] Comment management

2006-10-23 Thread Thomas Munz
Maybe you mean a bug tracker?

checkout

http://flyspray.rocks.cc/


on Monday 23 October 2006 17:12, tedd wrote:
> Hi:
>
> I posted this on the web-design list, but didn't receive any leads.
>
> I want to continue what I've been doing, which is to offer various
> code solutions for people via my web site, but I would like to add a
> feature where people can comment on the code. Such as if they found
> it useful, or found an error, or general comment -- you know, you've
> seen this before. Also, I want the code to be secure and allow me to
> edit users comments.
>
> Does anyone have any recommendations or can point me to a simple
> content manager for such a purpose?
>
> I know I could write it myself, but I would rather not reinvent the
> wheel, if possible.
>
> Thanks.
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Comment management

2006-10-23 Thread tedd

Hi:

I posted this on the web-design list, but didn't receive any leads.

I want to continue what I've been doing, which is to offer various 
code solutions for people via my web site, but I would like to add a 
feature where people can comment on the code. Such as if they found 
it useful, or found an error, or general comment -- you know, you've 
seen this before. Also, I want the code to be secure and allow me to 
edit users comments.


Does anyone have any recommendations or can point me to a simple 
content manager for such a purpose?


I know I could write it myself, but I would rather not reinvent the 
wheel, if possible.


Thanks.

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread Angelo Zanetti



Angelo Zanetti wrote:


hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .' > '. 
$backup_path.$filename);


It doesnt seem to work but when I run the exact same command (with 
appropriate values) in the command line it creates the dump file. What 
could be the reason for this?


Thanks in advance.

regards

It appears that it could be because the user that runs the scripts is 
not allowed to. When I run them on the commandline, I run them as the 
root user. Is this a common problem? What would the best way be to sort 
this out keeping in mind security on the server?


Thanks in advance.
angelo

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



Re: [PHP] Screen Shots

2006-10-23 Thread Dotan Cohen

On 23/10/06, Jim Moseby <[EMAIL PROTECTED]> wrote:

>
> Is there any way that I can get a script to take a screen
> shot every minute
> of all the users using my php website?
>

This is not a PHP question, but here's an answer anyway:

With your users conscent, yes.  There is a tiny utility that will take a
screenshot at set intervals using the VNC protocol.   This would require
that your users have VNC server loaded and configured to allow it.

If your goal is to spy on users of your website without their knowledge,
then there is (thank $diety) no practical way to do it.


I wish that this was true. If your users use Internet Explorer <=6 (I
don't know about the new v7) then there actually is a way to get them
to authorize a VNC session without their knowledge (assuming that a
VNC server is already installed on the machine). I'll leave it as an
excersize to the reader, but I'll give this hint: it is possible to
disguise the pop up as something else.

Please don't email me asking how. I give this information to spread
awareness, not to spread malicious code, FUD, exploits, or anything
else. I myself don't possess the skills to do it, but I have
personally seen an example of it on a fully patched (at the time- a
few months ago) Windows XP machine. I don't know if it was Home or
Professional.

Dotan Cohen

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



Re: [PHP] Screen Shots

2006-10-23 Thread Jochem Maas
Jim Moseby wrote:
>> Is there any way that I can get a script to take a screen 
>> shot every minute 
>> of all the users using my php website? 
>>
> 
> This is not a PHP question, but here's an answer anyway: 
> 
> With your users conscent, yes.  There is a tiny utility that will take a
> screenshot at set intervals using the VNC protocol.   This would require
> that your users have VNC server loaded and configured to allow it.
> 
> If your goal is to spy on users of your website without their knowledge,
> then there is (thank $diety) no practical way to do it.

with the exception of the proud owners of 'Windows Genuine "Advantage" Tool' ;-)

> 
> JM
> 

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



Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread clive

write rights for apache/php user to the $backup_path?

also is apache/php user allowed to run mysqldump?

hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .' > '. 
$backup_path.$filename);


It doesnt seem to work but when I run the exact same command (with 
appropriate values) in the command line it creates the dump file. What 
could be the reason for this?


Thanks in advance.

regards



Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] 




--
Regards,

Clive

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



[PHP] mysqldump problem from PHP

2006-10-23 Thread Angelo Zanetti

hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .' > '. 
$backup_path.$filename);


It doesnt seem to work but when I run the exact same command (with 
appropriate values) in the command line it creates the dump file. What 
could be the reason for this?


Thanks in advance.

regards



Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] 

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



RE: [PHP] Screen Shots

2006-10-23 Thread Jim Moseby
> 
> Is there any way that I can get a script to take a screen 
> shot every minute 
> of all the users using my php website? 
> 

This is not a PHP question, but here's an answer anyway: 

With your users conscent, yes.  There is a tiny utility that will take a
screenshot at set intervals using the VNC protocol.   This would require
that your users have VNC server loaded and configured to allow it.

If your goal is to spy on users of your website without their knowledge,
then there is (thank $diety) no practical way to do it.

JM

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



Re: [PHP] One-page password-protected file

2006-10-23 Thread Dotan Cohen

On 23/10/06, Jochem Maas <[EMAIL PROTECTED]> wrote:

Dotan Cohen wrote:

...

> Thanks for any and all input.

// here is a completely different way of doing it:

function setSimplePageProtectionDetails($login, $pwd, $makeSha1Hash = false)
{

if (!defined('SIMPLE_AUTH_PW') && !defined('SIMPLE_AUTH_USER')) {
if (!$login || !$pwd) {
return 0;
}

define('SIMPLE_AUTH_USER',$login);
define('SIMPLE_AUTH_PW',  ($makeSha1Hash ? sha1($pwd) : $pwd));
}

return -1;
}

function simplePageProtection($token = null, $realm = null)
{
if (!defined('SIMPLE_AUTH_PW') || !defined('SIMPLE_AUTH_USER')) {
die('required authentication details are not configured - unable to 
grant access to anyone.');
}

if (($token === null) || !$bla = strval($token)) $bla = 'micrositedefault';
$token = 'access_to_'.$bla.'_granted';

if (! ($realm = strval($realm))) $realm = "Please login";

if (!isset($_SESSION[ $token ]) || !$_SESSION[ $token ]) {
$_SESSION[ $token ] = false;

$login = isset($_SERVER[ 'PHP_AUTH_USER' ]) ? $_SERVER[ 'PHP_AUTH_USER' 
]: false;
$pass  = isset($_SERVER[ 'PHP_AUTH_PW' ])   ? $_SERVER[ 'PHP_AUTH_PW' 
]: false;

if (strtolower(trim($login)) == strtolower(trim(SIMPLE_AUTH_USER)) && 
sha1($pass) === SIMPLE_AUTH_PW) {
$_SESSION[ $token ] = true;
} else {
header('WWW-Authenticate: Basic realm="'.$realm.'."');
header('HTTP/1.0 401 Unauthorized');
exit;
}
}
}

// configure page protection
setSimplePageProtectionDetails('your_login', 'your_pwd', true);
// alternative page protection (using literal sha1 hash of the string 
'your_pwd')
// setSimplePageProtectionDetails('your_login', 
'0eb9a6a3306220b901c7b4920cd9896899f219be');


// activate page protection
simplePageProtection('your_token', 'your_realm');



Thanks, I had considered http authentication and decided against it as
I am not familiar with it. By your example, I learn. Thank you.

Dotan Cohen

http://what-is-what.com/what_is/linux.html
http://technology-sleuth.com/question/what_is_a_router.html

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



Re: [PHP] Screen Shots

2006-10-23 Thread tedd

At 12:00 PM +0200 10/23/06, Jochem Maas wrote:

Dotan Cohen wrote:
 > Has anybody read the original post? The OP wants a screenshot of his

 users' desktops. He does not want stats.


the way I read it he's looking for something akin to a group photo.
given that his users could be anywhere on the planet that's quite a challenge.

;-)


Yes, and I am surprised at the amount of posting over this. 
Considering that this would most certainly be a client-side 
operation, what does this have to do with php?


If the OP wants to see what his site looks like on other desk-tops, 
then he might try BrowserCam.


tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Finding a visitor's location

2006-10-23 Thread tedd

At 3:35 AM -0500 10/23/06, John Messam wrote:

Hello, I am trying to find out the country and possibly the city where the
visitors to my site are coming from.   I can capture the IP address but how
do I translate that to a specific locale.   Is there a way to do it or do I
have to ask them and map the info myself.  Thank you for you help.  This list
is a very useful tool.

John


John:

I've done the country thing, namely:

http://xn--ovg.com/location

It depends upon a somewhat large IP to Country database stored in 
mysql. The user's reported IP is simply looked up in the dB and the 
country is returned. You might find something more specific (i.e., 
city) and if you do, please share.


I've had the above page working for several months and have received 
hundreds of reports with less than two percent saying it was the 
wrong country -- so, it seems to work. If you want the dB, reply off 
list.


tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Ensuring all links go to index.php [SOLVED]

2006-10-23 Thread Dave M G

Edward, Roman, Jochem, Lowell, Kreme,

Thank you for your explanations.

Based on what was said here, I understand that the issue was setting up 
my local computer's Apache server to treat my directory hierarchies as 
they would behave on my hosting service.


With the help of my local Linux user's group, I was able to edit my 
local Apache configuration files to get the right setup.


As was mentioned here, it's not a PHP issue per se, but now I can, in 
PHP, get to my root web directory by simply preceeding any relative link 
with a forward slash.


Thanks for your time and advice.

--
Dave M G
Ubuntu 6.06 LTS
Kernel 2.6.17.7
Pentium D Dual Core Processor
PHP 5, MySQL 5, Apache 2

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



Re: [PHP] Screen Shots

2006-10-23 Thread Jochem Maas
Stut wrote:
> Sancar Saran wrote:
>> Do you want take screen shot of webpage from server? Convert your web
>> page into pdf.
>>
>> Do you want take screen shot of your online user count. Collect user
>> data into sql. generate web page from sql data and convert to pdf.
>>
>> Do you want take screen shot of your online users locations. Do
>> someting with ip to location databases put into sql, generate a web
>> page from that data then convert to pdf.
> 
> Somebody needs weeding off their PDF habit. I mean, seriously, why the
> obsession?

it's a Pretty Damning Format ;-)

> 
> -Stut
> 

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



[PHP] Hotel Reservations

2006-10-23 Thread Chris
Greetings all,

I`ve searched Google and come up with a couple of links to PHP/MySQL
open source based hotel reservation systems, does anyone have any
advice/opinions on what you are using and how its worked for you.

I`m just checking at various options at this stage before embarking on
writing one from scratch...

Regards

--
Chris Blake 
Cell: 082 775 1492
Work: +27 11 880 2825
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

You are here: *** *** * *** * *** * But you're not all
there.

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



Re: [PHP] Screen Shots

2006-10-23 Thread Stut

Sancar Saran wrote:
Do you want take screen shot of webpage from server? Convert your web page 
into pdf.


Do you want take screen shot of your online user count. Collect user data into 
sql. generate web page from sql data and convert to pdf.


Do you want take screen shot of your online users locations. Do someting with 
ip to location databases put into sql, generate a web page from that data 
then convert to pdf.


Somebody needs weeding off their PDF habit. I mean, seriously, why the 
obsession?


-Stut

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



Re: [PHP] Finding a visitor's location

2006-10-23 Thread Ivo F.A.C. Fokkema
On Mon, 23 Oct 2006 19:00:08 +1000, Chris wrote:

> John Messam wrote:
>> Hello, I am trying to find out the country and possibly the city where the
>> visitors to my site are coming from.   I can capture the IP address but how
>> do I translate that to a specific locale.   Is there a way to do it or do I
>> have to ask them and map the info myself.  Thank you for you help.  This list
>> is a very useful tool.
> 
> Search for "geo-ip database" or "ip to country" or some such variant in 
> a search engine.

To quickly do a relatively simple check (do not expect high success rate,
but it doesn't require you to download/purchase databases) is do a
reverse-DNS lookup (gethostbyaddr) on $_SERVER['REMOTE_ADDR'], check if
it's the same IP address (failed), if not you've got yourself a hostname.
Grab the last piece after the dot (strrchr), and you've got the TLD...
Although it includes TLD's like com, net, org, edu and such it also
includes countries.

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



Re: [PHP] Screen Shots

2006-10-23 Thread Sancar Saran
On Monday 23 October 2006 13:00, Jochem Maas wrote:
> Dotan Cohen wrote:
> > On 23/10/06, Ed Lazor <[EMAIL PROTECTED]> wrote:
> >> On Oct 22, 2006, at 5:29 PM, Sancar Saran wrote:
> >> > Convert to pdf.
> >>
> >> Are you logging the stats?  That would allow you to graph the usage
> >> whenever you want.
> >> -Ed
> >
> > Has anybody read the original post? The OP wants a screenshot of his
> > users' desktops. He does not want stats.
>
> the way I read it he's looking for something akin to a group photo.
> given that his users could be anywhere on the planet that's quite a
> challenge.
>
> ;-)
>
> > Dotan Cohen
> >
> > http://what-is-what.com/what_is/ubuntu.html
> > http://technology-sleuth.com/question/what_is_a_cellphone.html
Do you want take screen shot of webpage from server? Convert your web page 
into pdf.

Do you want take screen shot of your online user count. Collect user data into 
sql. generate web page from sql data and convert to pdf.

Do you want take screen shot of your online users locations. Do someting with 
ip to location databases put into sql, generate a web page from that data 
then convert to pdf.

Regards 

Sancar Saran

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



Re: [PHP] Screen Shots

2006-10-23 Thread Jochem Maas
Dotan Cohen wrote:
> On 23/10/06, Ed Lazor <[EMAIL PROTECTED]> wrote:
>> On Oct 22, 2006, at 5:29 PM, Sancar Saran wrote:
>> > Convert to pdf.
>>
>> Are you logging the stats?  That would allow you to graph the usage
>> whenever you want.
>> -Ed
>>
> 
> Has anybody read the original post? The OP wants a screenshot of his
> users' desktops. He does not want stats.

the way I read it he's looking for something akin to a group photo.
given that his users could be anywhere on the planet that's quite a challenge.

;-)

> 
> Dotan Cohen
> 
> http://what-is-what.com/what_is/ubuntu.html
> http://technology-sleuth.com/question/what_is_a_cellphone.html
> 

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



Re: [PHP] Re: Paginating searchs = performance problem

2006-10-23 Thread Ivo F.A.C. Fokkema
On Mon, 23 Oct 2006 04:33:52 -0400, Robert Cummings wrote:

> On Mon, 2006-10-23 at 10:13 +0200, Ivo F.A.C. Fokkema wrote:
>> On Fri, 20 Oct 2006 12:06:26 -0400, Robert Cummings wrote:
>> 
>> > On Fri, 2006-10-20 at 17:22 +0200, Ivo F.A.C. Fokkema wrote:
>> >> On Fri, 20 Oct 2006 17:04:35 +0200, Fourat Zouari wrote:
>> >> 
>> >> > I have PHP/PostgreSQL application were i got a search page with some 
>> >> > items
>> >> > to search, am building the search query on server side.
>> >> > 
>> >> > I need to display a paginated search and for this i need to get the 
>> >> > total
>> >> > count of lines matching the search before OFFSET/LIMITing my page, am i
>> >> > obliged to repeat the query twice ??? first to get the total count, 
>> >> > second
>> >> > to get my page.
>> >> > 
>> >> > it's very heavy
>> >> > 
>> >> > Any one's suggesting better doing ?
>> >> 
>> >> As far as I know, this is the only way. The first query, you don't need to
>> >> sort your data though, and you might be able to drop a join, depending on
>> >> whether or not you use the joined table in your WHERE clause.
>> >> 
>> >> But I think due to caching the database will not take a long time for the
>> >> second query, since it just recently had (almost) the same query - YMMV.
>> > 
>> > Hell no, don't use the same query twice. Use a count in the first query
>> > that only returns 1 row... the count. The second query can return the
>> > records (which may be less than the count returns since you're paging).
>> 
>> There must have been a reason why I started doing this... I used to use
>> COUNT(*) first too, then run the full query but somehow this must have not
>> worked for me when searching though a complex set of JOIN'ed tables or
>> so... after which I have my query builder run the query first without
>> the order clause. I'm going to look into this, see if I can track that
>> down.
>> 
>> But you're right, I should've mentioned that in his case a COUNT(*)
>> could've been possible, since I didn't know his table structure or query.
> 
> You can also use this dirty little sucker that's specific to MySQL
> (AFAIK):
> 
> SQL_CALC_FOUND_ROWS
> 
> Just add it right after the SELECT keyword:
> 
> SELECT SQL_CALC_FOUND_ROWS ...
> 
> Then afterwards you issue another query:
> 
> SELECT FOUND_ROWS() AS YeeHaw
> 
> And you're all set. it works regardless of the complexity of joins and
> other stuff.
> 
> Cheers,
> Rob.

Supa-kewl! You da man!

For my projects I use MySQL anyway, and this one even bypasses the LIMIT
clause, according to the MySQL manual. All I have to do is check if my
users are using MySQL >= 4.0... That's been released for a while, but you
never know... :)

Thanks,

Ivo

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



Re: [PHP] One-page password-protected file

2006-10-23 Thread Jochem Maas
Dotan Cohen wrote:

...

> Thanks for any and all input.

// here is a completely different way of doing it:

function setSimplePageProtectionDetails($login, $pwd, $makeSha1Hash = false)
{

if (!defined('SIMPLE_AUTH_PW') && !defined('SIMPLE_AUTH_USER')) {
if (!$login || !$pwd) {
return 0;
}

define('SIMPLE_AUTH_USER',$login);
define('SIMPLE_AUTH_PW',  ($makeSha1Hash ? sha1($pwd) : $pwd));
}

return -1;
}

function simplePageProtection($token = null, $realm = null)
{
if (!defined('SIMPLE_AUTH_PW') || !defined('SIMPLE_AUTH_USER')) {
die('required authentication details are not configured - unable to 
grant access to anyone.');
}

if (($token === null) || !$bla = strval($token)) $bla = 'micrositedefault';
$token = 'access_to_'.$bla.'_granted';

if (! ($realm = strval($realm))) $realm = "Please login";

if (!isset($_SESSION[ $token ]) || !$_SESSION[ $token ]) {
$_SESSION[ $token ] = false;

$login = isset($_SERVER[ 'PHP_AUTH_USER' ]) ? $_SERVER[ 'PHP_AUTH_USER' 
]: false;
$pass  = isset($_SERVER[ 'PHP_AUTH_PW' ])   ? $_SERVER[ 'PHP_AUTH_PW' 
]: false;

if (strtolower(trim($login)) == strtolower(trim(SIMPLE_AUTH_USER)) && 
sha1($pass) === SIMPLE_AUTH_PW) {
$_SESSION[ $token ] = true;
} else {
header('WWW-Authenticate: Basic realm="'.$realm.'."');
header('HTTP/1.0 401 Unauthorized');
exit;
}
}
}

// configure page protection
setSimplePageProtectionDetails('your_login', 'your_pwd', true);
// alternative page protection (using literal sha1 hash of the string 
'your_pwd')
// setSimplePageProtectionDetails('your_login', 
'0eb9a6a3306220b901c7b4920cd9896899f219be');


// activate page protection
simplePageProtection('your_token', 'your_realm');

> 
> Dotan Cohen
> 
> http://nanir.com
> http://what-is-what.com/what_is/html.html
> 

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



Re: [PHP] Finding a visitor's location

2006-10-23 Thread Chris

John Messam wrote:

Hello, I am trying to find out the country and possibly the city where the
visitors to my site are coming from.   I can capture the IP address but how
do I translate that to a specific locale.   Is there a way to do it or do I
have to ask them and map the info myself.  Thank you for you help.  This list
is a very useful tool.


Search for "geo-ip database" or "ip to country" or some such variant in 
a search engine.


--
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] Re: Paginating searchs = performance problem

2006-10-23 Thread Chris

Robert Cummings wrote:

On Mon, 2006-10-23 at 10:13 +0200, Ivo F.A.C. Fokkema wrote:

On Fri, 20 Oct 2006 12:06:26 -0400, Robert Cummings wrote:


On Fri, 2006-10-20 at 17:22 +0200, Ivo F.A.C. Fokkema wrote:

On Fri, 20 Oct 2006 17:04:35 +0200, Fourat Zouari wrote:


I have PHP/PostgreSQL application were i got a search page with some items
to search, am building the search query on server side.

I need to display a paginated search and for this i need to get the total
count of lines matching the search before OFFSET/LIMITing my page, am i
obliged to repeat the query twice ??? first to get the total count, second
to get my page.

it's very heavy

Any one's suggesting better doing ?

As far as I know, this is the only way. The first query, you don't need to
sort your data though, and you might be able to drop a join, depending on
whether or not you use the joined table in your WHERE clause.

But I think due to caching the database will not take a long time for the
second query, since it just recently had (almost) the same query - YMMV.

Hell no, don't use the same query twice. Use a count in the first query
that only returns 1 row... the count. The second query can return the
records (which may be less than the count returns since you're paging).

There must have been a reason why I started doing this... I used to use
COUNT(*) first too, then run the full query but somehow this must have not
worked for me when searching though a complex set of JOIN'ed tables or
so... after which I have my query builder run the query first without
the order clause. I'm going to look into this, see if I can track that
down.

But you're right, I should've mentioned that in his case a COUNT(*)
could've been possible, since I didn't know his table structure or query.


You can also use this dirty little sucker that's specific to MySQL
(AFAIK):

SQL_CALC_FOUND_ROWS


Yep mysql specific.

Postgres you have to do it the old fashioned way:

$count_query = "SELECT COUNT(...)";

$fetch_query = "SELECT " .

--
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] Finding a visitor's location

2006-10-23 Thread John Messam
Hello, I am trying to find out the country and possibly the city where the
visitors to my site are coming from.   I can capture the IP address but how
do I translate that to a specific locale.   Is there a way to do it or do I
have to ask them and map the info myself.  Thank you for you help.  This list
is a very useful tool.

 

John



  1   2   >