Re: [PHP] Odd strtotime behavior

2004-01-09 Thread hitek
Sorry, had my return address set up wrong, apparently the list doesn't like 
that.

Actually, it appears to be caused by Daylight Savings time.
Leap years yield 143.95833
Other years yield 142.95833
At 10:07 PM 1/9/2004, Chris W wrote:
The following code doesn't do what I expect and I was wondering if someone 
could tell me why and how to make it do what I want.

$NowT = strtotime("January 9 2004");
$EventT = strtotime("June 1 2004");
print ($EventT - $NowT)/86400;
I get 143.95833

Why don't I get 144?

Chris W

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


[PHP] Odd strtotime behavior

2004-01-09 Thread Chris W
The following code doesn't do what I expect and I was wondering if 
someone could tell me why and how to make it do what I want.

$NowT = strtotime("January 9 2004");
$EventT = strtotime("June 1 2004");
print ($EventT - $NowT)/86400;
I get 143.95833

Why don't I get 144?

Chris W

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


[PHP] Total NewB Q

2004-01-09 Thread Russell Shaw
Hi,
I'm using debian-unstable.
I just installed apache-1.3 and php4.

I don't know where else to ask. I made a php test file (phpinfo.php),
containing: , and put it in ~/public_html.
When i try to see it by putting: http://127.0.0.1/phpinfo.php into
mozilla 1.2.1, mozilla changes it to http://211.27.78.162/.
Is this a mozilla config problem or apache problem? I have my dialup isp
nameservers in /etc/resolv.conf.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] [Newbie Guide] For the benefit of new members

2004-01-09 Thread Ma Siva Kumar
===
This message is for the benefit of new subscribers 
and those new to PHP.  Please feel free to add 
more points and send to the list.
===
1. If you have any queries/problems about PHP try 
http://www.php.net/manual/en first. You can 
download a copy and use it offline also. 

Please also try http://www.php.net/manual/faq.php 
to get answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching for 
"php YOUR QUERY" may fetch you relevant results 
within the first 10 results, if you are lucky.

3. There is a searchable archive of the mailing 
list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and you 
may get answer to your query from the earlier 
discussions. 

For example: One of the repeatedly discussed 
question in the list is "Best PHP editor". 
Everyone has his/her favourite editor. 
You can get all the opinions by going through the 
list archives. If you want a chosen list try this 
link : http://phpeditors.linuxbackup.co.uk/ 
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want find out 
what extensions are available to you?

Just put the following code into a file with a 
.php extension and access it through your 
webserver:

 

If PHP is installed you will see a page with a lot 
of information on it. If PHP is not installed (or 
not working correctly) your browser will try
to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead 
of posting the whole script, try doing some 
research yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the details of 
your efforts (following steps 1, 2 & 3) and ask 
for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes 
place BEFORE the output reaches the client. 
Therefore, it is not possible to access the 
users'  computer related information (OS, screen 
size etc) using PHP. You need to go for 
JavaScript and ask the question in a JavaScript 
list.

On the other hand you can access the information 
that is SENT by the user's browser when a client 
requests a page from your server. You can
find details about browser, OS etc as reported by 
this request. - contributed by Wouter van Vliet 
and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. Avoid 
general subjects like "Help!!", "A Question" etc.  
Especially avoid blank subjects. 

8. When you want to start a new topic, open a new 
mail composer and enter the mailing list address 
[EMAIL PROTECTED] instead of replying to 
an existing thread and replacing the subject and 
body with your message.

9. It's always a good idea to post back to the 
list once you've solved your problem. People 
usually add [SOLVED] to the subject line of their
email when posting solutions. By posting your 
solution you're helping the next person with the 
same question. [contribued by Chris W Parker]

10. Ask smart questions  
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

Hope you have a good time programming with PHP.

Best regards,
-- 
Integrated Management Tools for leather industry
--
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

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



Re: [PHP] limit mysql connections

2004-01-09 Thread John W. Holmes
Diana Castillo wrote:

Is there any way to limit the connections so that this error never happens?
Warning: mysql_connect(): Too many connections at
/home/local/global/php/libraries/dblayer_mysql.php line 14.
The connections are already limited, that's why you get this warning. 
You need to handle this from the MySQL side and increase the number of 
connections allowed either when you start MySQL or in a config file. 
Directions are in the manual, of course. :)

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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


RE: [PHP] Sorting data into columns vertically

2004-01-09 Thread Ralph Guzman
DISREGARD THIS ONE

-Original Message-
From: Ralph Guzman [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 4:35 PM
To: 'Raditha Dissanayake'; 'dareal hamsta'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Sorting data into columns vertically


Here is a function that will do this, assuming $items is an array you would
do the following:


// $size INTEGER 
// $width INTEGER 
// border INTEGER 
// $cpadding INTEGER 
// $cspacing INTEGER 
// $data ARRAY 

function horizontalTable($size, $width, $border, $cpadding, $cspacing,
$data)
{

$table_width = $width;
$width = intval($table_width / $size);

$tr = '';
$td = "%s";

$table = "" . $tr;

$i = 0;
foreach($data as $value)
{
$table .= sprintf($td, $value);
$i++;

if(!($i % $size)) {
$table .= '' . $tr;
}
}

while($i % $size)
{
$table .= sprintf($td, ' ');
$i++;
}

$end_tr = strlen($tr) * -1;
if(substr($table, $end_tr) != $tr){
$table .= '';
} else {
$table = substr($table, 0, $end_tr);
}

$table .= '';

return $table;

}


-Oiginal Message-
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 5:30 AM
To: dareal hamsta
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sorting data into columns vertically

Where is your data stored? if you are using a DB surely using order by 
would less painfull?

all the best

dareal hamsta wrote:

> [ Please copy me off list. ]
>
> Say I have 7 items of data and I wish to sort them into 3 columns in a 
> HTML table. The items are unevenly sized, so rather than print them 
> out in rows - resulting in lots of wasteful whitespace - I would like 
> to output them in vertical order. However if I use the modulus 
> operator to check for when to break into a new column...
>
> foreach ($items as $item) {
> $counter++;
> if ( ($counter % $columns) == 0) {
> print "";
> }
> }
>
> ...the output will be something like this...
>
>  +---+---+---+
>  | Item1 | Item4 | Item7 |
>  | Item2 | Item5 |   |
>  | Item3 | Item6 |   |
>  +---+
>
> ...when what I'm really looking for is this...
>
>  +---+---+---+
>  | Item1 | Item4 | Item6 |
>  | Item2 | Item5 | Item7 |
>  | Item3 |   |   |
>  +---+
>
> Obviously if the number of items and columns are static, I have no 
> problem, but how do I get a layout that appeals to people and not 
> computers if they're dynamic? This has me befuddled, I'm wondering is 
> there an algorithm for doing it or is it effectively a Turing Test.
>
> Thanks,
> adam
>
>
>  $s=array(74,65,112,104,112,72,32,59,45,41);
> for($i=0;$i ?>
>
> _
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
>


-- 
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

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

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

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



RE: [PHP] Sorting data into columns vertically

2004-01-09 Thread Ralph Guzman
Here is a function I use. Assuming data is stored in an array called $items
you will call out horizontalTable() like this:

horizontalTable(3,600,1,3,3, $items);

Here is the horizontalTable() function code:

// $size: number of columns 
// $width: table width
// $border: table border
// $cpadding: table cellpadding
// $cspacing: table cellspacing
// $data: array with data you want to display

function horizontalTable($size, $width, $border, $cpadding, $cspacing,
$data)
{

$table_width = $width;
$width = intval($table_width / $size);

$tr = '';
$td = "%s";

$table = "" . $tr;

$i = 0;
foreach($data as $value)
{
$table .= sprintf($td, $value);
$i++;

if(!($i % $size)) {
$table .= '' . $tr;
}
}

while($i % $size)
{
$table .= sprintf($td, ' ');
$i++;
}

$end_tr = strlen($tr) * -1;
if(substr($table, $end_tr) != $tr){
$table .= '';
} else {
$table = substr($table, 0, $end_tr);
}

$table .= '';

return $table;

}

-Original Message-
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 5:30 AM
To: dareal hamsta
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sorting data into columns vertically

Where is your data stored? if you are using a DB surely using order by 
would less painfull?

all the best

dareal hamsta wrote:

> [ Please copy me off list. ]
>
> Say I have 7 items of data and I wish to sort them into 3 columns in a 
> HTML table. The items are unevenly sized, so rather than print them 
> out in rows - resulting in lots of wasteful whitespace - I would like 
> to output them in vertical order. However if I use the modulus 
> operator to check for when to break into a new column...
>
> foreach ($items as $item) {
> $counter++;
> if ( ($counter % $columns) == 0) {
> print "";
> }
> }
>
> ...the output will be something like this...
>
>  +---+---+---+
>  | Item1 | Item4 | Item7 |
>  | Item2 | Item5 |   |
>  | Item3 | Item6 |   |
>  +---+
>
> ...when what I'm really looking for is this...
>
>  +---+---+---+
>  | Item1 | Item4 | Item6 |
>  | Item2 | Item5 | Item7 |
>  | Item3 |   |   |
>  +---+
>
> Obviously if the number of items and columns are static, I have no 
> problem, but how do I get a layout that appeals to people and not 
> computers if they're dynamic? This has me befuddled, I'm wondering is 
> there an algorithm for doing it or is it effectively a Turing Test.
>
> Thanks,
> adam
>
>
>  $s=array(74,65,112,104,112,72,32,59,45,41);
> for($i=0;$i ?>
>
> _
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
>


-- 
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

-- 
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] Sorting data into columns vertically

2004-01-09 Thread Ralph Guzman

Here is a function that will do this, assuming $items is an array you would
do the following:


// $size INTEGER 
// $width INTEGER 
// border INTEGER 
// $cpadding INTEGER 
// $cspacing INTEGER 
// $data ARRAY 

function horizontalTable($size, $width, $border, $cpadding, $cspacing,
$data)
{

$table_width = $width;
$width = intval($table_width / $size);

$tr = '';
$td = "%s";

$table = "" . $tr;

$i = 0;
foreach($data as $value)
{
$table .= sprintf($td, $value);
$i++;

if(!($i % $size)) {
$table .= '' . $tr;
}
}

while($i % $size)
{
$table .= sprintf($td, ' ');
$i++;
}

$end_tr = strlen($tr) * -1;
if(substr($table, $end_tr) != $tr){
$table .= '';
} else {
$table = substr($table, 0, $end_tr);
}

$table .= '';

return $table;

}


-Oiginal Message-
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 5:30 AM
To: dareal hamsta
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sorting data into columns vertically

Where is your data stored? if you are using a DB surely using order by 
would less painfull?

all the best

dareal hamsta wrote:

> [ Please copy me off list. ]
>
> Say I have 7 items of data and I wish to sort them into 3 columns in a 
> HTML table. The items are unevenly sized, so rather than print them 
> out in rows - resulting in lots of wasteful whitespace - I would like 
> to output them in vertical order. However if I use the modulus 
> operator to check for when to break into a new column...
>
> foreach ($items as $item) {
> $counter++;
> if ( ($counter % $columns) == 0) {
> print "";
> }
> }
>
> ...the output will be something like this...
>
>  +---+---+---+
>  | Item1 | Item4 | Item7 |
>  | Item2 | Item5 |   |
>  | Item3 | Item6 |   |
>  +---+
>
> ...when what I'm really looking for is this...
>
>  +---+---+---+
>  | Item1 | Item4 | Item6 |
>  | Item2 | Item5 | Item7 |
>  | Item3 |   |   |
>  +---+
>
> Obviously if the number of items and columns are static, I have no 
> problem, but how do I get a layout that appeals to people and not 
> computers if they're dynamic? This has me befuddled, I'm wondering is 
> there an algorithm for doing it or is it effectively a Turing Test.
>
> Thanks,
> adam
>
>
>  $s=array(74,65,112,104,112,72,32,59,45,41);
> for($i=0;$i ?>
>
> _
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
>


-- 
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

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

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



RE: [PHP] Re: Not working?

2004-01-09 Thread Ralph Guzman
Or this:

system("rename('/path/to/new.sh', '/path/to/old' . $today)");

-Original Message-
From: Matt Grimm [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 10:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Not working?

You can't use variables inside single quotes, either.

This:
'/path/to/old.$today'
ought to be:
"/path/to/old.$today"

--
Matt Grimm


"Jas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I think I must be missing something but this command isn't renaming the
> file specified...  Pointers, tips appreciated!
>
> system("rename('/path/to/new.sh', '/path/to/old.$today')");
>
> /to directory has permissions set to current user and is also owned by
> the current user (test_user)... I can write files into the directory and
> delete files form the directory using the 'unlink()' command but the
> rename function I am having problems with.
> Jas

-- 
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] post vars not by form

2004-01-09 Thread Ralph Guzman
Use socket connection:

http://www.php.net/fsockopen

read the "User Contributed Notes" where you will find functions and
examples.

-Original Message-
From: Nabil [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 2:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] post vars not by form

HI,
Anyone can help , how to post variables from server side .. as from php page
to other without HTML form and submistion ???

i want post method , to post my vars to another php on another server , then
i have to read the body that will be printed by fopen ... so i can not use
Location:
example :
i wwant to post to www.example.com?var=1&var2=2
and then read the the body from that link .. as 1 or 0   ..

Regards

-- 
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] Hiding files away from /public_html/

2004-01-09 Thread Ralph Guzman
Put them in a folder with .htaccess:

RewriteEngine onRewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$ [NC]
ReWriteRule .*\.(gif|jpg)$  -   [N,F,L]



-Original Message-
From: Philip J. Newman [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 3:42 PM
To: 'Php-general'
Subject: [PHP] Hiding files away from /public_html/

Hi, just wanted to pick someones brain.

I want to store some images outside the /public_html/ how ever my isp has
decided that i'm not aloud
to write files in that area.  Would the next best solution that wold be as
secure to maybe put them
in a folder with a .htaccess file in it?

---
Philip J. Newman
Master Developer
PhilipNZ.com [NZ] Ltd.
[EMAIL PROTECTED]

-- 
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] Buffalo'ed, stumped, confused...

2004-01-09 Thread Ralph Guzman
For debugging purposes, if you want to see all values in $_POST use this
code:

print '';
print_r($_POST);
print '';

or this:

print '';
var_dump($_POST);
print '';

-Original Message-
From: Robin Kopetzky [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 4:31 PM
To: PHP General
Subject: [PHP] Buffalo'ed, stumped, confused...

Good evening.

I'm trying to read using $_POST, 4 radio buttons named "miles". I tried
reading the selected value with $_POST['miles[0]'], etc. with no success.
I've even tried using foreach to read the selected radio button with no
success.

Help!! I'm totally stumped with this one. I thought the value was passed
back as an array but maybe I'm wrong...

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

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

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



[PHP] Hiding files away from /public_html/

2004-01-09 Thread Philip J. Newman
Hi, just wanted to pick someones brain.

I want to store some images outside the /public_html/ how ever my isp has decided that 
i'm not aloud
to write files in that area.  Would the next best solution that wold be as secure to 
maybe put them
in a folder with a .htaccess file in it?

---
Philip J. Newman
Master Developer
PhilipNZ.com [NZ] Ltd.
[EMAIL PROTECTED]

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



[PHP] Re: XML/HTML encoding?

2004-01-09 Thread memoimyself
Hello Vincent,

On 9 Jan 2004 at 16:23, Vincent Jansen wrote:

> After xslt I end up with a html document with a souce that looks
> something like
> 
>   
>  "http://www.w3.org/TR/REC-html40/loose.dtd";>
>   
>   
>   dotted e (ë) works
>   
>   
>   Etc.
> 
> This is what I want
> But my browser displays "dotted e () works"
> 
> Because I don't want yes or no: Please tell me what (maybe obvious
> thing) I'm doing wrong

I don't think you're doing anything wrong, except perhaps for using an outdated 
browser. 
The "ë" (e-umlaut, which you called a "dotted e") displays just fine in both IE 6 and 
Netscape 7.1 on my computer.

Make sure your browser is configured to use Western European (ISO-8859-1) encoding, 
because even latest-generation browsers have poor support for UTF-8. To change your 
browser's encoding settings, do:

In IE 6: View > Encoding

In Netscape: View > Character Coding

Any other browser: figure it out yourself ;-)

Take care,

Erik

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



Re: [PHP] Display syslog file?

2004-01-09 Thread Steve Edberg
I don't know if the same syntax is available on Linux, but on Solaris 
I can use the 'tail -f' command to watch lines being appended to a 
file from the commandline.. You might be able to do something via

	passthru("tail -f $PathToSyslog");

in a frame on your page...although there might be socket_blocking or 
page flush() issues to experiment with -

	steve

At 8:28 AM -0600 1/9/04, Carlton L. Whitmore wrote:
I didn't make my last request very clear. I used lastlog as an example,
but what I really want to do is open a syslog file (text file), that is
coming in from a VPN box.
I'd like to have it displayed live so I can scan it during the day.
What is the best way to do this? Someone had suggested using cron, but
I'm very new to Linux and PHP so I would need some help with that.
Any help is appreciated,
Carlton.


--
++
| Steve Edberg  [EMAIL PROTECTED] |
| University of California, Davis  (530)754-9127 |
| Programming/Database/SysAdmin   http://pgfsun.ucdavis.edu/ |
++
| [EMAIL PROTECTED]: 1001 Work units on 23 oct 2002  |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
++
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] jpeg Uploader issue

2004-01-09 Thread Mike R

I am having an issue where a user with a MAC can't see jpegs uploaded to a
web site I built.  They are getting some sort of corrupt file indicator.
All PC users are fine from what I gather.

I saw only one reference to this on the web in a forum, and it lead to no
particular answer; just a few people talking about how they were all having
the issue.

Anyone ever seen anything like this?

Thanks,

-Mike

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



Re: [PHP] Form validation: client- or server-side?

2004-01-09 Thread Peter Vertes




It makes perfect sense now.  Thanks for clearing it up for me Chris :)

-Peter

On Fri, 2004-01-09 at 15:29, Chris Shiflett wrote:

--- Peter Vertes <[EMAIL PROTECTED]> wrote:
> Just to play devil's advocate; why would you validate data on the
> server if you have a _javascript_ that checked the user's input before
> it gets submitted to the server? I mean the whole point of you having
> that _javascript_ is to make sure the the correct data gets entered so
> why bother checking it once again on the server-side with PHP?
> Wouldn't that be redundant and a waste of resources?

The redundancy is in performing client-side validation, because you should
never consider server-side validation as optional.

Aside from the obvious fact that people can (and should be able to) turn
off any client-side scripting, an attacker can do things far more
sophisticated, to the point of writing a specialized Web client
specifically to attack your site.

When you receive a POST request, it will look something similar to this:

POST /path/to/script.php HTTP/1.1
Host: example.org
Content-Type: application/x-www-form-urlencoded
Content-Length: 35
Connection: close

first_name=chris&last_name=shiflett

That's it. This may have resulted from the user submitting the following
HTML form:

http://example.org/path/to/script.php" method="post">





You really can't tell what form was used on the receiving site, right? In
fact, you can't even be sure that the user used a form at all. As an
example, people ask on this list about performing a POST with PHP at least
once a week. PHP doesn't need to use an HTML form for this; it just sends
a request similar to the above (see
http://shiflett.org/hacks/php/http_post for an example).

The point is that the client decides what it sends, not you. If you want
to think about security, you have to get rid of the assumption that your
users will all use your site exactly as you intend. As I mentioned before,
client-side checking is basically like saying, "User, can you please send
me a username only if it is less than 10 characters in length and
alphanumeric only?" Someone attacking your site is not going to abide by
your requests.

Hope that helps.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/




-- 
perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")'








signature.asc
Description: This is a digitally signed message part


RE: [PHP] picturing webpage

2004-01-09 Thread Ryan A
Hey,
if they are paying for this service of getting thumbnails.maybe I can
write a script that keeps on hitting their site with different random
URLs
Would be a good way to make them pay for spamming me anyway.

Whos with me?


Cheers,
-Ryan

*
Getting closer.. Did a little digging.. The script goes to alexa.com,
from what I see, alexa is doing the work then sending the pics out.

http://pages.alexa.com/prod_serv/xml_feed.html

Does this help with anyone explaining how this works?

Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com
*

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



RE: [PHP] picturing webpage

2004-01-09 Thread Ryan A
Yep,
They might be spammers and lowlifes but they have a pretty nice program
running there.
I wrote to them twice but didnt get a replyI wonder if its because I
"kind of " said a few
bad words directed at them, their mothers, fathers and family.???
Cheers,
-Ryan



On 1/9/2004 7:10:35 PM, Jake McHenry ([EMAIL PROTECTED]) wrote:
> > -Original Message-
> > From: Ryan A [mailto:[EMAIL PROTECTED]
> > Sent: Friday, January 09, 2004 12:55 PM
> > To: David T-G
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] picturing webpage
> >
> >
> > Hey,
> > These sons of bitches at top--sites have done this, I call
> > them that coz I regularly get spam from them.
> >
> > Try this URL: http://top--sites.com/update.htm?d=spamcop.com&e=p
> >
> > change spamcop to any other url...
> >
> > Cheers,
> > -Ryan
> >
> >
> >
> > On 1/9/2004 4:28:33 PM, David T-G ([EMAIL PROTECTED])
> wrote:
> > > Eli --
> > >
> > > ...and then Eli Hen said...
> > > %
> > > % Hello All,
> > >
> > > Hi!
> > >
> > >
> > > %
> > > % I wanted to know if it is possible to picture a webpage
> > via PHP. %
> > > By "picturing" I mean that the program can generate a
> > picture, a view,
> > > out
> > >
> > > Hmmm...  An interesting concept.
> > >
> > >
> > > % of the page URL given. (Like sometimes you have in search
> > engines,
> > > that you

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



Re: [PHP] Form validation: client- or server-side?

2004-01-09 Thread Chris Shiflett
--- Peter Vertes <[EMAIL PROTECTED]> wrote:
> Just to play devil's advocate; why would you validate data on the
> server if you have a JavaScript that checked the user's input before
> it gets submitted to the server? I mean the whole point of you having
> that JavaScript is to make sure the the correct data gets entered so
> why bother checking it once again on the server-side with PHP?
> Wouldn't that be redundant and a waste of resources?

The redundancy is in performing client-side validation, because you should
never consider server-side validation as optional.

Aside from the obvious fact that people can (and should be able to) turn
off any client-side scripting, an attacker can do things far more
sophisticated, to the point of writing a specialized Web client
specifically to attack your site.

When you receive a POST request, it will look something similar to this:

POST /path/to/script.php HTTP/1.1
Host: example.org
Content-Type: application/x-www-form-urlencoded
Content-Length: 35
Connection: close

first_name=chris&last_name=shiflett

That's it. This may have resulted from the user submitting the following
HTML form:

http://example.org/path/to/script.php"; method="post">





You really can't tell what form was used on the receiving site, right? In
fact, you can't even be sure that the user used a form at all. As an
example, people ask on this list about performing a POST with PHP at least
once a week. PHP doesn't need to use an HTML form for this; it just sends
a request similar to the above (see
http://shiflett.org/hacks/php/http_post for an example).

The point is that the client decides what it sends, not you. If you want
to think about security, you have to get rid of the assumption that your
users will all use your site exactly as you intend. As I mentioned before,
client-side checking is basically like saying, "User, can you please send
me a username only if it is less than 10 characters in length and
alphanumeric only?" Someone attacking your site is not going to abide by
your requests.

Hope that helps.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] Spell checker in PHP

2004-01-09 Thread David O'Brien
I used system call to a dos spell checker program from here
http://fmg-www.cs.ucla.edu/fmg-members/geoff/ispell.html#ftp-sites
using the places2k.txt file from the US census as the dictionary

http://www.census.gov/geo/www/gazetteer/places2k.html

-Dave



At 02:57 PM 1/9/2004, Robin Kopetzky wrote:
Good afternoon!

I know aspell and pspell are available but pspell won't work in my Windows
environment. Does anyone know how to tie into Word's spell checker using php
or another spell check option? What I need is a way to check spelling on
city/state names and select the most appropriate if the user mangles the
words.
Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


David G. O'Brien
Web Services Coordinator / Systems Administrator
NACCRRA
The Nation's Network of Child Care Resource & Referral
1319 F Street NW, Suite 500
Washington, DC 20004
(202) 393-5501 ext. 113
(202) 393-1109 fax


RE: [PHP] Spell checker in PHP

2004-01-09 Thread Vail, Warren
Haven't heard of anyone doing this, and it's got to be slow but you could
consider creating a word document, invoking word, and saving/retrieving the
results.  I would start with

http://www.php.net/manual/en/ref.com.php

this should show you how to invoke word from your php script since you are
on windows.

good luck,

Warren Vail

-Original Message-
From: Robin Kopetzky [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 11:58 AM
To: PHP General
Subject: [PHP] Spell checker in PHP


Good afternoon!

I know aspell and pspell are available but pspell won't work in my Windows
environment. Does anyone know how to tie into Word's spell checker using php
or another spell check option? What I need is a way to check spelling on
city/state names and select the most appropriate if the user mangles the
words.

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

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

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



[PHP] Fw: Intermitent problems retreiving PDF's from a MySQL database.

2004-01-09 Thread Donald Tyler
Hi,

I have a website where the admin can create entries in a news list and
upload an associated PDF document.

I am storing the document in a MySQL database on another machine on the same
network.

For some reason, occasionaly when loading a PDF document, internet explorer
will "lock up", the Windows flag will continue to wave as if it is loading
the document, but it will never load. Once this happens, all of the other
PDF documents wont load until you restart internet explorer. Then it all
works fine until you click that one PDF again.

I thought that maybe the PDF had been corrupted somehow, but the problem
miraculously fixed itself so I didnt have a change to check that out.

Now I got a call from one of my users complaining of the exact same problem,
which once again miraculously fixed itself after reloading internet
explorer.

There are no error messages in the apache log or the mysql log.

Does anyone have any idea what is going on?!?

Thanks

Donald Tyler

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



[PHP] Spell checker in PHP

2004-01-09 Thread Robin Kopetzky
Good afternoon!

I know aspell and pspell are available but pspell won't work in my Windows
environment. Does anyone know how to tie into Word's spell checker using php
or another spell check option? What I need is a way to check spelling on
city/state names and select the most appropriate if the user mangles the
words.

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

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



[PHP] Intermitent problems retreiving PDF's from a MySQL database.

2004-01-09 Thread Donald Tyler
Hi,

I have a website where the admin can create entries in a news list and
upload an associated PDF document.

I am storing the document in a MySQL database on another machine on the same
network.

For some reason, occasionaly when loading a PDF document, internet explorer
will "lock up", the Windows flag will continue to wave as if it is loading
the document, but it will never load. Once this happens, all of the other
PDF documents wont load until you restart internet explorer. Then it all
works fine until you click that one PDF again.

I thought that maybe the PDF had been corrupted somehow, but the problem
miraculously fixed itself so I didnt have a change to check that out.

Now I got a call from one of my users complaining of the exact same problem,
which once again miraculously fixed itself after reloading internet
explorer.

There are no error messages in the apache log or the mysql log.

Does anyone have any idea what is going on?!?

Thanks

Donald Tyler

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



Re: [PHP] Form validation: client- or server-side?

2004-01-09 Thread Matt Matijevich
[snip]
why would you validate data on the server
if you have a JavaScript that checked the user's input before it gets
submitted to the server ?  I mean the whole point of you having that
JavaScript is to make sure the the correct data gets entered so why
bother checking it once again on the server-side with PHP ?  Wouldn't
that be redundant and a waste of resources ?
[/snip]

Javascript can be turned off.  Never trust the data you get from forms
or query strings, they can easily be tampered with.

Client side validation is just a convenience, save the users a round
trip to the server and back to display input errors.

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



Re: [PHP] Form validation: client- or server-side?

2004-01-09 Thread Peter Vertes




On Fri, 2004-01-09 at 14:22, Chris Shiflett wrote:

But, no matter what, always validate data on the server. Otherwise, it's
like being a teacher and having your students grade their own work; it
only works when everyone is honest (and I can guarantee you that won't be
the case on a public Web site).


Just to play devil's advocate; why would you validate data on the server if you have a _javascript_ that checked the user's input before it gets submitted to the server ?  I mean the whole point of you having that _javascript_ is to make sure the the correct data gets entered so why bother checking it once again on the server-side with PHP ?  Wouldn't that be redundant and a waste of resources ?

-Pete




-- 
perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")'








signature.asc
Description: This is a digitally signed message part


Re: [PHP] Form validation: client- or server-side?

2004-01-09 Thread Chris Shiflett
--- Matt Grimm <[EMAIL PROTECTED]> wrote:
> Is there a distinct advantage to doing form validation / error checking
> on the server side using PHP?

Yes, security.

Basically, I never think of it as client-side *versus* server-side. I
think of it more like this:

1. Server-side data validation? YES
2. Client-side data validation? Maybe

Client-side validation can save people from having to submit their data
before realizing a problem. This does nothing for security, but it can be
convenient for your users. Of course, this can be more annoying if there
are several errors. In addition, I think it's very unprofessional to have
a popup appear to display the errors. If you're going to do any
client-side validation, you should do something more sophisticated than
popping up a JavaScript error message. :-)

But, no matter what, always validate data on the server. Otherwise, it's
like being a teacher and having your students grade their own work; it
only works when everyone is honest (and I can guarantee you that won't be
the case on a public Web site).

That's my opinion...

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



[PHP] Re: not sure why regex is doing this

2004-01-09 Thread Justin Patrin
while (eregi(',\s*,',$query)):
 $query = preg_replace('/,\s*,/',',NULL,', $query, -1);
endwhile;
Please don't mix the regex engines like that...it could lead to much 
suffering.
instead of eregi, use preg_match.

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


RE: [PHP] not sure why regex is doing this

2004-01-09 Thread craig
Thanks Kelly.

That works just like I wanted, only starting the regex engine
once. Guess I'll have to figure out lookahead.

-Craig

> -Original Message-
> From: Kelly Hallman [mailto:[EMAIL PROTECTED]
> Sent: January 9, 2004 11:24 AM
> To: craig
> Cc: Php
> Subject: Re: [PHP] not sure why regex is doing this
>
>
> On Fri, 9 Jan 2004, craig wrote:
> > (4536,'golf tournament management',430,0,0),
> > (1434,'Premium golf balls',,,0),
> >
> > I have to replace the blank entries (,,) with NULLs, using
> this regex:
> > $query = preg_replace('/,\s*,/',',NULL,', $query, -1);
> > after this line, only ONE of the ,, sets is replaced by ,NULL, like:
> > (1434,'Premium golf balls',NULL,,0)
>
> The regex does continue trying to make matches, but the point
> at which it
> continues is just past your replacement. In other words, the trailing
> comma in ,NULL, is not considered part of the string to match/replace.
>
> This should do the trick:
> preg_replace('/,\s*(?=[,\)])/', ',NULL', $input);
>
> (?=pattern) is a positive lookahead. It evaluates true if the next
> characters match the pattern, but those characters are not consumed.
>
> So that regex is equivalent to "match a pattern starting with a comma
> followed by any existing spaces, ONLY IF the next character is , or )"
>
> The most robust way you could write this regex is:
> preg_replace('/([,\(])\s*(?=[,\)])/', '\1NULL', $input);
>
> I know you'll probably never have input like (),
> but it would work as expected.
>
> Many tricky regex problems can be solved by lookaheads. There
> is also a
> negative lookahead (?!pattern) ... also note that this is an advanced
> regex feature and won't it work on many regex engines not
> based on PCRE.
>
> --
> Kelly Hallman
> // Ultrafancy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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



[PHP] Re: XML/HTML encoding?

2004-01-09 Thread Manuel Lemos
Hello,

On 01/09/2004 01:23 PM, Vincent Jansen wrote:
I'm doing some XML processing with PHP5
I'm using UTF-8 encoding
When I look at my xml doc it looks something like


dotted e (ë) works

(I hope you see a dotted e)
After xslt I end up with a html document with a souce that looks
something like

http://www.w3.org/TR/REC-html40/loose.dtd";>


dotted e (ë) works


Etc.
This is what I want
But my browser displays "dotted e () works"
Because I don't want yes or no: Please tell me what (maybe obvious
thing) I'm doing wrong
To use it as you have you need to specify ISO-8859-1 as encoding in the 
XML input document.

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: XML?

2004-01-09 Thread Manuel Lemos
Hello,

On 01/09/2004 05:30 AM, Jake McHenry wrote:
Hi everyone,

Can someone point me in the right direction towards creating and
implementing XML with php? I've heard it can make things much easier
on me, and would like more info on it. Also, if anyone has any storys
from using it, might give me an idea of what I'm getting into. Is it
easy to implement? Does it make things easier on me in the future?
Etc.etc.
It depends on what you want to do. XML can be a means of many thing, not 
an end in itself. Once you realize what XML can be good for you, you may 
want to try this XML generation class that can make your life much easier:

http://www.phpclasses.org/xmlwriter

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Form validation: client- or server-side?

2004-01-09 Thread Matt Grimm
Thanks for the great input guys.  Sounds like I'm using a sound method now
with full server-side validation.  Perhaps to make the most user- and
server-friendly forms, one could use JavaScript as a guide to the user,
alerting them to erroneous input and suggesting alternatives rather than
being relied upon for more serious validation.

--
Matt Grimm


"Matt Grimm" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there a distinct advantage to doing form validation / error checking on
> the server side using PHP?  That's how I've always done it because I know
> PHP better than JavaScript, but wouldn't it make sense to validate as much
> of your form as possible using JavaScript before the form was ever posted?
> I'm just talking about the basics, like empty required fields, illegal
> characters, string lengths, etc.
>
> What are your preferred methods?  I do an awful lot of content management
> with HTML forms, so it's not an entirely spurious question.
>
> --
> Matt Grimm
> Web Developer
> The Health TV Channel, Inc.
> (a non - profit organization)
> 3820 Lake Otis Parkway
> Anchorage, AK 99508
> 907.770.6200 ext. 686
> 907.336.6205 (fax)
> E-mail: [EMAIL PROTECTED]
> Web: www.healthtvchannel.org

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



Re: [PHP] Form validation: client- or server-side?

2004-01-09 Thread Peter Vertes




On Fri, 2004-01-09 at 13:07, Matt Grimm wrote:

Is there a distinct advantage to doing form validation / error checking on
the server side using PHP?  That's how I've always done it because I know
PHP better than _javascript_, but wouldn't it make sense to validate as much
of your form as possible using _javascript_ before the form was ever posted?
I'm just talking about the basics, like empty required fields, illegal
characters, string lengths, etc.


    I would shove off as much work as possible for the client to do on his/her machine and not bog down my server which could be busy serving pages/processing bigger and better things.  Plus it also cuts down on bandwidth because you only send the form to the server if the _javascript_ checked everything and didn't find any errors.  The downside is that you have to make sure the client has _javascript_ turned on otherwise your form authentication will not work and the code for your _javascript_ is available to the user to see and if you have any bugs in it then they can see and work around it.
    I guess it would depend on the site you are planning to do the authentication on.  If the site is not super busy, bandwidth is not an issue and your server is not pegged at 100% most of the time then I would suggest using PHP to validate your forms because it's "safer" since the client can not see your code and it doesn't matter if the user has _javascript_ turned on of off.  Just my $0.02...

-Pete




-- 
perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")'








signature.asc
Description: This is a digitally signed message part


Re: [PHP] not sure why regex is doing this

2004-01-09 Thread Kelly Hallman
On Fri, 9 Jan 2004, craig wrote:
> (4536,'golf tournament management',430,0,0),
> (1434,'Premium golf balls',,,0),
> 
> I have to replace the blank entries (,,) with NULLs, using this regex:
> $query = preg_replace('/,\s*,/',',NULL,', $query, -1);
> after this line, only ONE of the ,, sets is replaced by ,NULL, like:
> (1434,'Premium golf balls',NULL,,0)

The regex does continue trying to make matches, but the point at which it
continues is just past your replacement. In other words, the trailing
comma in ,NULL, is not considered part of the string to match/replace.

This should do the trick:
preg_replace('/,\s*(?=[,\)])/', ',NULL', $input);

(?=pattern) is a positive lookahead. It evaluates true if the next 
characters match the pattern, but those characters are not consumed.

So that regex is equivalent to "match a pattern starting with a comma 
followed by any existing spaces, ONLY IF the next character is , or )"

The most robust way you could write this regex is:
preg_replace('/([,\(])\s*(?=[,\)])/', '\1NULL', $input);

I know you'll probably never have input like (),
but it would work as expected.

Many tricky regex problems can be solved by lookaheads. There is also a
negative lookahead (?!pattern) ... also note that this is an advanced
regex feature and won't it work on many regex engines not based on PCRE.

-- 
Kelly Hallman
// Ultrafancy

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



Re: [PHP] md5() and string-length?

2004-01-09 Thread Peter Vertes




Sorry my bad; I read your post but I didn't understand it fully.  I agree with the others; there is no theoretical limit (only physical like available memory, disk space, etc..) to the size of a string which you can pass to the md5() function.

-Pete

On Fri, 2004-01-09 at 12:29, Michael Müller wrote:

mhm, I think there was a missunderstanding ;)
I want to know, how long the input-string could be (so that the encoded
strings, that you get, are unique)

Michael




-- 
perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")'








signature.asc
Description: This is a digitally signed message part


RE: [PHP] Form validation: client- or server-side?

2004-01-09 Thread craig
> Is there a distinct advantage to doing form validation /
> error checking on
> the server side using PHP?
The actual code you use to validate remains hidden from a potential
malicious user, while javascript code can be seen, so if there is a
hole in your error checking, it can be found easier.

The big advantage to javascript is that it is fast, since a request
isn't sent back to the server, processed, and then sent back. It also
reduces network traffic, and reduces server load.

> That's how I've always done it
> because I know
> PHP better than JavaScript, but wouldn't it make sense to
> validate as much
> of your form as possible using JavaScript before the form was
> ever posted?
> I'm just talking about the basics, like empty required fields, illegal
> characters, string lengths, etc.
even if you partially validate on the client, you still have to validate
on the client side, which seems redundant to me.
>
> What are your preferred methods?  I do an awful lot of
> content management
> with HTML forms, so it's not an entirely spurious question.

I only use javascript for things that I can't do with php, and I can
validate with php.

that's my 2 cents worth,
Craig

>
> --
> Matt Grimm
> Web Developer
> The Health TV Channel, Inc.
> (a non - profit organization)
> 3820 Lake Otis Parkway
> Anchorage, AK 99508
> 907.770.6200 ext. 686
> 907.336.6205 (fax)
> E-mail: [EMAIL PROTECTED]
> Web: www.healthtvchannel.org
>
> --
> 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] picturing webpage

2004-01-09 Thread Jake McHenry
> -Original Message-
> From: Ryan A [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 09, 2004 12:55 PM
> To: David T-G
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] picturing webpage
> 
> 
> Hey,
> These sons of bitches at top--sites have done this, I call 
> them that coz I regularly get spam from them.
> 
> Try this URL: http://top--sites.com/update.htm?d=spamcop.com&e=p
> 
> change spamcop to any other url...
> 
> Cheers,
> -Ryan
> 
> 
> 
> On 1/9/2004 4:28:33 PM, David T-G ([EMAIL PROTECTED])
wrote:
> > Eli --
> >
> > ...and then Eli Hen said...
> > %
> > % Hello All,
> >
> > Hi!
> >
> >
> > %
> > % I wanted to know if it is possible to picture a webpage 
> via PHP. % 
> > By "picturing" I mean that the program can generate a 
> picture, a view, 
> > out
> >
> > Hmmm...  An interesting concept.
> >
> >
> > % of the page URL given. (Like sometimes you have in search 
> engines, 
> > that you % see the site URL and besides is the picture of the
first 
> > page of the site).
> >
> > Can you provide an example?  I know I've never seen this 
> feature, and 
> > I'm not sure I follow what you mean.
> >
> >
> > % What technologies I use for that? Is it possible with PHP?
> >
> > Dunno and dunno, but let's find out :-)
> >
> >
> > %
> > % -thanks, Eli
> >
> >
> > HTH & HAND & Happy New Year
> >
> > :-D
> > --
> > David T-G  * There is too much animal courage
in
> > (play) [EMAIL PROTECTED] * society and not sufficient moral 
> > courage.
> > (work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science
and
> Health"
> > http://justpickone.org/davidtg/  Shpx gur 
> Pbzzhavpngvbaf Qrprapl Npg!
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



Getting closer.. Did a little digging.. The script goes to alexa.com,
from what I see, alexa is doing the work then sending the pics out.

http://pages.alexa.com/prod_serv/xml_feed.html

Does this help with anyone explaining how this works?

Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com

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



RE: [PHP] picturing webpage

2004-01-09 Thread Mike Brum
I can tell you this much, .cfm is ColdFusion. And CF is somewhat similar to
PHP in it's embedded-in style of scripting. 

It could be similar to how you can build a PDF. They could just take your
HTML and then use that to build a .JPG. I'm sure it's a very *expensive*
process (server & CPU -wise) though.

-M 

-Original Message-
From: Jake McHenry [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 1:11 PM
To: 'Ryan A'
Cc: 'Php-general'
Subject: RE: [PHP] picturing webpage

> -Original Message-
> From: Ryan A [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 09, 2004 12:55 PM
> To: David T-G
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] picturing webpage
> 
> 
> Hey,
> These sons of bitches at top--sites have done this, I call them that 
> coz I regularly get spam from them.
> 
> Try this URL: http://top--sites.com/update.htm?d=spamcop.com&e=p
> 
> change spamcop to any other url...
> 
> Cheers,
> -Ryan
> 
> 
> 
> On 1/9/2004 4:28:33 PM, David T-G ([EMAIL PROTECTED])
wrote:
> > Eli --
> >
> > ...and then Eli Hen said...
> > %
> > % Hello All,
> >
> > Hi!
> >
> >
> > %
> > % I wanted to know if it is possible to picture a webpage
> via PHP. %
> > By "picturing" I mean that the program can generate a
> picture, a view,
> > out
> >
> > Hmmm...  An interesting concept.
> >
> >
> > % of the page URL given. (Like sometimes you have in search
> engines,
> > that you % see the site URL and besides is the picture of the
first 
> > page of the site).
> >
> > Can you provide an example?  I know I've never seen this
> feature, and
> > I'm not sure I follow what you mean.
> >
> >
> > % What technologies I use for that? Is it possible with PHP?
> >
> > Dunno and dunno, but let's find out :-)
> >
> >
> > %
> > % -thanks, Eli
> >
> >
> > HTH & HAND & Happy New Year
> >
> > :-D
> > --
> > David T-G  * There is too much animal courage
in
> > (play) [EMAIL PROTECTED] * society and not sufficient moral 
> > courage.
> > (work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science
and
> Health"
> > http://justpickone.org/davidtg/  Shpx gur 
> Pbzzhavpngvbaf Qrprapl Npg!
> 
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
> http://www.php.net/unsub.php
> 





This is where I saw it! They're using a script, pic.cfm on a windows box
which somehow grabs a screenshot of the url.

Any clues how this is done?



Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com

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

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



[PHP] Re: Form validation: client- or server-side?

2004-01-09 Thread Manuel Lemos
Hello,

On 01/09/2004 04:07 PM, Matt Grimm wrote:
Is there a distinct advantage to doing form validation / error checking on
the server side using PHP?  That's how I've always done it because I know
PHP better than JavaScript, but wouldn't it make sense to validate as much
of your form as possible using JavaScript before the form was ever posted?
I'm just talking about the basics, like empty required fields, illegal
characters, string lengths, etc.
What are your preferred methods?  I do an awful lot of content management
with HTML forms, so it's not an entirely spurious question.
Server side validation is mandatory. However, whenever possible you 
should perform client side validation to make your forms more usable as 
the users do not have to wait for the server to process the submitted 
form to tell the user about invalid fields, if with some client side 
validation that feedback can be antecipated.

You may want to take a look and this popular forms generation and 
validation class that not only can perform many built-in supported types 
both client side and server side validation, as it can preform some 
pre-processing of values like capitalization of text values, 
auto-completion or reformatting based on rules define with regular 
expressions also with support to perform that on client and server side. 
Take a look at the examples:

http://www.phpclasses.org/formsgeneration

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Form validation: client- or server-side?

2004-01-09 Thread Ray Hunter
On Fri, 2004-01-09 at 11:07, Matt Grimm wrote:
> Is there a distinct advantage to doing form validation / error checking on
> the server side using PHP?  That's how I've always done it because I know
> PHP better than JavaScript, but wouldn't it make sense to validate as much
> of your form as possible using JavaScript before the form was ever posted?
> I'm just talking about the basics, like empty required fields, illegal
> characters, string lengths, etc.
> 
> What are your preferred methods?  I do an awful lot of content management
> with HTML forms, so it's not an entirely spurious question.

I do both server and client side...javascript helps with the really
basic and server-side helps with the complicated stuff.

My theory is do as much on the client and then do server-side.

--
Ray

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



RE: [PHP] Form validation: client- or server-side?

2004-01-09 Thread Mike Brum
Yes, it's considered best practice to do as much client-side validation as
you can as to save your server time and load. 

This doesn't mean you still shouldn't do full validation on the server-side,
but the fewer times the form is posted to your site the better.

You might want to recheck what Javascript can do now - it's pretty extensive
for a client-side scripting language.

-M 

-Original Message-
From: Matt Grimm [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 1:08 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Form validation: client- or server-side?

Is there a distinct advantage to doing form validation / error checking on
the server side using PHP?  That's how I've always done it because I know
PHP better than JavaScript, but wouldn't it make sense to validate as much
of your form as possible using JavaScript before the form was ever posted?
I'm just talking about the basics, like empty required fields, illegal
characters, string lengths, etc.

What are your preferred methods?  I do an awful lot of content management
with HTML forms, so it's not an entirely spurious question.

--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org

--
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] Form validation: client- or server-side?

2004-01-09 Thread David T-G
Matt --

...and then Matt Grimm said...
% 
% Is there a distinct advantage to doing form validation / error checking on
% the server side using PHP?  That's how I've always done it because I know

1) I hate JavaScript.

2) Don't trust anything coming from a client.

You should be validating on the server anyway -- empty fields and all --
and so there's no need to do it twice especially when it eliminates
surfers who don't use JS.


HTH & HAND & Happy New Year

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


RE: [PHP] picturing webpage

2004-01-09 Thread Jake McHenry
> -Original Message-
> From: Ryan A [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 09, 2004 12:55 PM
> To: David T-G
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] picturing webpage
> 
> 
> Hey,
> These sons of bitches at top--sites have done this, I call 
> them that coz I regularly get spam from them.
> 
> Try this URL: http://top--sites.com/update.htm?d=spamcop.com&e=p
> 
> change spamcop to any other url...
> 
> Cheers,
> -Ryan
> 
> 
> 
> On 1/9/2004 4:28:33 PM, David T-G ([EMAIL PROTECTED])
wrote:
> > Eli --
> >
> > ...and then Eli Hen said...
> > %
> > % Hello All,
> >
> > Hi!
> >
> >
> > %
> > % I wanted to know if it is possible to picture a webpage 
> via PHP. % 
> > By "picturing" I mean that the program can generate a 
> picture, a view, 
> > out
> >
> > Hmmm...  An interesting concept.
> >
> >
> > % of the page URL given. (Like sometimes you have in search 
> engines, 
> > that you % see the site URL and besides is the picture of the
first 
> > page of the site).
> >
> > Can you provide an example?  I know I've never seen this 
> feature, and 
> > I'm not sure I follow what you mean.
> >
> >
> > % What technologies I use for that? Is it possible with PHP?
> >
> > Dunno and dunno, but let's find out :-)
> >
> >
> > %
> > % -thanks, Eli
> >
> >
> > HTH & HAND & Happy New Year
> >
> > :-D
> > --
> > David T-G  * There is too much animal courage
in
> > (play) [EMAIL PROTECTED] * society and not sufficient moral 
> > courage.
> > (work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science
and
> Health"
> > http://justpickone.org/davidtg/  Shpx gur 
> Pbzzhavpngvbaf Qrprapl Npg!
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 





This is where I saw it! They're using a script, pic.cfm on a windows
box which somehow grabs a screenshot of the url.

Any clues how this is done?



Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com

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



[PHP] Form validation: client- or server-side?

2004-01-09 Thread Matt Grimm
Is there a distinct advantage to doing form validation / error checking on
the server side using PHP?  That's how I've always done it because I know
PHP better than JavaScript, but wouldn't it make sense to validate as much
of your form as possible using JavaScript before the form was ever posted?
I'm just talking about the basics, like empty required fields, illegal
characters, string lengths, etc.

What are your preferred methods?  I do an awful lot of content management
with HTML forms, so it's not an entirely spurious question.

--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org

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



Re: [PHP] picturing webpage

2004-01-09 Thread Ryan A
Hey,
These sons of bitches at top--sites have done this, I call them that coz I
regularly get spam from them.

Try this URL: http://top--sites.com/update.htm?d=spamcop.com&e=p

change spamcop to any other url...

Cheers,
-Ryan



On 1/9/2004 4:28:33 PM, David T-G ([EMAIL PROTECTED]) wrote:
> Eli --
>
> ...and then Eli Hen said...
> %
> % Hello All,
>
> Hi!
>
>
> %
> % I wanted to know if it is possible to picture a webpage via PHP.
> % By "picturing" I mean that the program can generate a picture, a view,
> out
>
> Hmmm...  An interesting concept.
>
>
> % of the page URL given. (Like sometimes you have in search engines, that
> you
> % see the site URL and besides is the picture of the first page of the
> site).
>
> Can you provide an example?  I know I've never seen this feature, and I'm
> not sure I follow what you mean.
>
>
> % What technologies I use for that? Is it possible with PHP?
>
> Dunno and dunno, but let's find out :-)
>
>
> %
> % -thanks, Eli
>
>
> HTH & HAND & Happy New Year
>
> :-D
> --
> David T-G  * There is too much animal courage in
> (play) [EMAIL PROTECTED] * society and not sufficient moral courage.
> (work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and
Health"
> http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

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



[PHP] Re: not sure why regex is doing this

2004-01-09 Thread Pavel Janda
Hi again,

I am not sure, that it is the clearest way, how to do it, but I've tried
this:



As you can see, I've added more ","s to your string to try, if it works good
and it seems, that yes...

PJ


"Craig" <[EMAIL PROTECTED]> píse v diskusním príspevku
news:[EMAIL PROTECTED]
> Hi,
>
> I have a text file that I have to parse and insert into a db.
> these are a couple of sample lines (they are part of the
> variable $query)
>
> (4536,'golf tournament management',430,0,0),
> (1434,'Premium golf balls',,,0),
>
> I have to replace the blank entries (,,) with NULLs,
> and I am using this regex:
> $query = preg_replace('/,\s*,/',',NULL,', $query, -1);
>
> after this line, only ONE of the ,, sets is replaced
> by ,NULL, like this:
> (4536,'golf tournament management',430,0,0),
> (1434,'Premium golf balls',NULL,,0),
>
> So, my problem is that I have to run the regex twice to
> replace both sets of ,, with ,NULL, and I really don't
> want to do that. Why isn't it getting them both with the
> first regex, and how should I modify it to catch them
> both?
>
> TIA,
> Craig

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



Re: [PHP] md5() and string-length?

2004-01-09 Thread Mike Migurski
>mhm, I think there was a missunderstanding ;)
>I want to know, how long the input-string could be (so that the encoded
>strings, that you get, are unique)

In theory, you are limited by the fact that the MD5 message digest is 128
bits long, so collisions are /possible/, but not /probable/. In practice,
you should be able to throw any two large pieces of text at MD5 and wind
up with different hashes every time.

Which is to say...
[The MD5 algorithm] takes as input a message of arbitrary length
and produces as output a 128-bit "fingerprint" or "message digest"
of the input. It is conjectured that it is computationally
infeasible to produce two messages having the same message digest,
or to produce any message having a given prespecified target
message digest.

- http://userpages.umbc.edu/~mabzug1/cs/md5/md5.html

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



RE: [PHP] md5() and string-length?

2004-01-09 Thread Julien Wadin
No limit for the input string

-Message d'origine-
De : Michael Müller [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 9 janvier 2004 18:29
À : [EMAIL PROTECTED]
Objet : Re: [PHP] md5() and string-length?


mhm, I think there was a missunderstanding ;)
I want to know, how long the input-string could be (so that the encoded
strings, that you get, are unique)

Michael

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



Re: [PHP] md5() and string-length?

2004-01-09 Thread Jason Wong
On Saturday 10 January 2004 01:29, Michael Müller wrote:
> mhm, I think there was a missunderstanding ;)
> I want to know, how long the input-string could be (so that the encoded
> strings, that you get, are unique)

Basically, as long as you like (within memory constraints).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Win98 error 009: Erroneous error: Nothing is wrong.
*/

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



Re: [PHP] md5() and string-length?

2004-01-09 Thread Brad Pauly
On Fri, 2004-01-09 at 10:29, Michael MÃller wrote:
> mhm, I think there was a missunderstanding ;)
> I want to know, how long the input-string could be (so that the encoded
> strings, that you get, are unique)

I don't think there is a limit, theoretically. In practice you might
have other constraints that make very large input impractical.

- Brad

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



Re: [PHP] md5() and string-length?

2004-01-09 Thread Michael Müller
mhm, I think there was a missunderstanding ;)
I want to know, how long the input-string could be (so that the encoded
strings, that you get, are unique)

Michael


[PHP] Re: not sure why regex is doing this

2004-01-09 Thread Pavel Janda
Hi Craig,

the mistake is in regex, because you replace only the pair of "," with
",NULL,"... So in case, that there are tree "," in row, there is only one
pair and it means one replacing..
For example, when your string is like this: (12345)  //two pair of ",,"
the result is (12345,NULL,,NULL,)

But now - I don't know, how to change regex easily to help you... :o)) In
case, that I have any idea, I will write you again :o)

PJ

PS: I hope, that I am right :o)

"Craig" <[EMAIL PROTECTED]> píse v diskusním príspevku
news:[EMAIL PROTECTED]
> Hi,
>
> I have a text file that I have to parse and insert into a db.
> these are a couple of sample lines (they are part of the
> variable $query)
>
> (4536,'golf tournament management',430,0,0),
> (1434,'Premium golf balls',,,0),
>
> I have to replace the blank entries (,,) with NULLs,
> and I am using this regex:
> $query = preg_replace('/,\s*,/',',NULL,', $query, -1);
>
> after this line, only ONE of the ,, sets is replaced
> by ,NULL, like this:
> (4536,'golf tournament management',430,0,0),
> (1434,'Premium golf balls',NULL,,0),
>
> So, my problem is that I have to run the regex twice to
> replace both sets of ,, with ,NULL, and I really don't
> want to do that. Why isn't it getting them both with the
> first regex, and how should I modify it to catch them
> both?
>
> TIA,
> Craig

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



RE: [PHP] Dynamically Created Arrays

2004-01-09 Thread Cameron B. Prince
Hi Marek,

I came up with this hack, which seems to work:

$query = "SELECT name, value FROM config WHERE site = '$site' ORDER BY name,
seq";
$result = mysql_query($query)
   or die("Query failed : " . mysql_error());

$conf = array ();
$last = "";

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

   if ($line['name'] == $last) {

  array_push($conf[$last], $line['value']);

   } else {

  $last = $line['name'];
  $conf[$last] = array ($line['value']);


   }

}

mysql_free_result($result);


Your's seems more elegant, so I'll give it a try.

Thanks,
Cameron


-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 11:06 AM
To: Cameron B. Prince
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Dynamically Created Arrays


This should be what you need:

if(!is_array($conf[$name])) $conf[$name] = array($val);
else $conf[$name][] = $val;

Cameron B. Prince wrote:

> Hey guys,
>
> I'm making progress on my perl to PHP conversion project but I need some
> help...
>
> I have a configuration table in MySQL made up like this:
>
>
> CREATE TABLE config (
>   code mediumint(9) NOT NULL auto_increment,
>   site varchar(32) NOT NULL default '',
>   name varchar(64) NOT NULL default '',
>   value varchar(128) NOT NULL default '',
>   seq smallint(4) default NULL,
>   PRIMARY KEY  (code)
> ) TYPE=MyISAM;
>
>
> It has data like this:
>
> | 1  | site1 | homedir   | /var/www/htdocs/site1 | NULL |
> | 2  | site1 | groupname | Group1| 1|
> | 3  | site1 | groupname | Group2| 2|
>
>
> I use this query to get the configuration data:
>
> SELECT name, value
> FROM config
> WHERE site = '$site'
> ORDER BY name, seq
>
>
> What I want to create is an array of arrays like this:
>
> $conf[$name][] = $val;
>
> or
>
> array_push($conf[$name], $val);
>
>
> So I end up with something like:
>
> $conf[homedir][0] = /var/www/htdocs/site1
> $conf[groupname][0] = Group1
> $conf[groupname][1] = Group2
>
>
>
> If I were still in Perl-land, I'd use a hash of arrays and push things
into
> it, but I don't seem to have that option now and I keep getting "Use of
> undefined constant name" errors.
>
> Am I going about this in the right way? Any help would be greatly
> appreciated.
>
> Thanks,
> Cameron
>



!DSPAM:3ffede81271881305314632!

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



Re: [PHP] $_SERVER['PHP_AUTH_USER'] doesn't work with location header for Mozilla.

2004-01-09 Thread "Miguel J. Jiménez"
I think it's because all headers must be sent BEFORE doing anything else ...



Scott Fletcher wrote:

Hi!

  The login page where the HTTP Authentication would pop-up asking the web
user to enter the user id and password to log in.  I'm using the PHP's
$_SERVER['PHP_AUTH_USER'] and it work okay in both Internet Explorer and
Gecko browsers, like Mozilla for example.  What I had discovered is that
when using the PHP's header, 'header("Location: https://whatever";); to go to
the next webpage (with HTTP Authentication is successful), is that HTTP
Authentication cease to exist on the next webpage for the Gecko browsers.
It work fine with Internet Explorer.
   Anyone know why does the Gecko browser lose the HTTP Authentication data
once the PHP location redirect header is used?  I'll post the code below.
--snip--
 if (!isset($_SERVER['PHP_AUTH_USER'])) {
// If empty, send header causing dialog box to appear
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
   } else if (isset($_SERVER['PHP_AUTH_USER'])) {
// If non-empty, open file containing valid user info
$filename = "/usr/local/apache/conf/whatever";
$fp = fopen($filename, "r");
$file_contents = fread($fp, filesize($filename));
fclose($fp);
// Place each line in user info file into an array
$line = explode("\n", $file_contents);
// For as long as $i is <= the size of the $line array,
// explode each array element into a username and password pair
$i = 0;
while($i <= sizeof($line)) {
 $data_pair = explode(":", $line[$i]);
 if (($data_pair[0] == $_SERVER['PHP_AUTH_USER']) && ($data_pair[1] ==
MD5($_SERVER['PHP_AUTH_PW']))) {
  $auth = 1;
  break;
 } else {
  $auth = 0;
 }
 $i++;
}
if ($auth == 1) {
   session_id($salt);
   session_start();
   $_SESSION['SESSION_IDENTIFIER'] = $salt;

//echo $_SERVER['PHP_AUTH_USER']." ";
   header("Location:
https://".$_SERVER['HTTP_HOST']."/administration/main_menu.php?PHPSESSID=".$salt);
} else {
 header('WWW-Authenticate: Basic realm="My Private Stuff"');
 header('HTTP/1.0 401 Unauthorized');
}
   }
 



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

Re: [PHP] Dynamically Created Arrays

2004-01-09 Thread Marek Kilimajer
This should be what you need:

if(!is_array($conf[$name])) $conf[$name] = array($val);
else $conf[$name][] = $val;
Cameron B. Prince wrote:

Hey guys,

I'm making progress on my perl to PHP conversion project but I need some
help...
I have a configuration table in MySQL made up like this:

CREATE TABLE config (
  code mediumint(9) NOT NULL auto_increment,
  site varchar(32) NOT NULL default '',
  name varchar(64) NOT NULL default '',
  value varchar(128) NOT NULL default '',
  seq smallint(4) default NULL,
  PRIMARY KEY  (code)
) TYPE=MyISAM;
It has data like this:

| 1  | site1 | homedir   | /var/www/htdocs/site1 | NULL |
| 2  | site1 | groupname | Group1| 1|
| 3  | site1 | groupname | Group2| 2|
I use this query to get the configuration data:

SELECT name, value
FROM config
WHERE site = '$site'
ORDER BY name, seq
What I want to create is an array of arrays like this:

$conf[$name][] = $val;

or

array_push($conf[$name], $val);

So I end up with something like:

$conf[homedir][0] = /var/www/htdocs/site1
$conf[groupname][0] = Group1
$conf[groupname][1] = Group2


If I were still in Perl-land, I'd use a hash of arrays and push things into
it, but I don't seem to have that option now and I keep getting "Use of
undefined constant name" errors.
Am I going about this in the right way? Any help would be greatly
appreciated.
Thanks,
Cameron
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] not sure why regex is doing this

2004-01-09 Thread craig
Hi,

I have a text file that I have to parse and insert into a db.
these are a couple of sample lines (they are part of the 
variable $query)

(4536,'golf tournament management',430,0,0),
(1434,'Premium golf balls',,,0),

I have to replace the blank entries (,,) with NULLs,
and I am using this regex:
$query = preg_replace('/,\s*,/',',NULL,', $query, -1);

after this line, only ONE of the ,, sets is replaced
by ,NULL, like this:
(4536,'golf tournament management',430,0,0),
(1434,'Premium golf balls',NULL,,0),

So, my problem is that I have to run the regex twice to
replace both sets of ,, with ,NULL, and I really don't 
want to do that. Why isn't it getting them both with the 
first regex, and how should I modify it to catch them 
both?

TIA,
Craig

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



Re: [PHP] md5() and string-length?

2004-01-09 Thread Peter Vertes




It's always a 32 character string.

http://us4.php.net/manual/en/function.md5.php

-Peter

On Fri, 2004-01-09 at 11:30, Michael Müller wrote:

Hi,
is anybody here who knows the max_length of a string which is encoded by
md5()?

thx, Michael
Berlin, Germany




-- 
perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")'








signature.asc
Description: This is a digitally signed message part


[PHP] md5() and string-length?

2004-01-09 Thread Michael Müller
Hi,
is anybody here who knows the max_length of a string which is encoded by
md5()?

thx, Michael
Berlin, Germany

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



[PHP] $_SERVER['PHP_AUTH_USER'] doesn't work with location header for Mozilla.

2004-01-09 Thread Scott Fletcher
Hi!

   The login page where the HTTP Authentication would pop-up asking the web
user to enter the user id and password to log in.  I'm using the PHP's
$_SERVER['PHP_AUTH_USER'] and it work okay in both Internet Explorer and
Gecko browsers, like Mozilla for example.  What I had discovered is that
when using the PHP's header, 'header("Location: https://whatever";); to go to
the next webpage (with HTTP Authentication is successful), is that HTTP
Authentication cease to exist on the next webpage for the Gecko browsers.
It work fine with Internet Explorer.

Anyone know why does the Gecko browser lose the HTTP Authentication data
once the PHP location redirect header is used?  I'll post the code below.

--snip--
  if (!isset($_SERVER['PHP_AUTH_USER'])) {
 // If empty, send header causing dialog box to appear
 header('WWW-Authenticate: Basic realm="My Private Stuff"');
 header('HTTP/1.0 401 Unauthorized');
} else if (isset($_SERVER['PHP_AUTH_USER'])) {
 // If non-empty, open file containing valid user info
 $filename = "/usr/local/apache/conf/whatever";
 $fp = fopen($filename, "r");
 $file_contents = fread($fp, filesize($filename));
 fclose($fp);

 // Place each line in user info file into an array
 $line = explode("\n", $file_contents);

 // For as long as $i is <= the size of the $line array,
 // explode each array element into a username and password pair
 $i = 0;

 while($i <= sizeof($line)) {
  $data_pair = explode(":", $line[$i]);

  if (($data_pair[0] == $_SERVER['PHP_AUTH_USER']) && ($data_pair[1] ==
MD5($_SERVER['PHP_AUTH_PW']))) {
   $auth = 1;
   break;
  } else {
   $auth = 0;
  }
  $i++;
 }

 if ($auth == 1) {
session_id($salt);
session_start();

$_SESSION['SESSION_IDENTIFIER'] = $salt;

//echo $_SERVER['PHP_AUTH_USER']." ";
header("Location:
https://".$_SERVER['HTTP_HOST']."/administration/main_menu.php?PHPSESSID=".$salt);

 } else {
  header('WWW-Authenticate: Basic realm="My Private Stuff"');
  header('HTTP/1.0 401 Unauthorized');
 }
}

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



[PHP] Re: XML?

2004-01-09 Thread memoimyself
Hi there, Jake,

On 9 Jan 2004 at 2:30, Jake McHenry wrote:

> Can someone point me in the right direction towards creating and
> implementing XML with php? I've heard it can make things much easier on
> me, and would like more info on it. Also, if anyone has any storys
> from using it, might give me an idea of what I'm getting into. Is it
> easy to implement? Does it make things easier on me in the future?
> Etc.etc. 

First of all, please tell us what use you think you might have for XML. XML can be 
used 
in several different ways for several different things, but of course it's completely 
useless for several other things.

Your question about whether or not XML is easy to implement cannot be answered if 
we don't know what you might be trying to implement. XML is a fairly complex 
technology that takes some studying; that much I can tell you right now.

Cheers,

Erik

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



[PHP] Re: Please check this program (its working)

2004-01-09 Thread memoimyself
On 9 Jan 2004 at 8:20, Ryan A wrote:

> I dont know if this is the right way to do this, so please have a looksee
> and tell me. Its working perfectly well...but will I have problems if I
> try it on a large email list or will it hog resourcesetc? ANY advice
> appreciated.

One step at a time, Ryan. You can't get any serious or useful advice if you don't 
explain 
what it is that you're trying to accomplish with your script, i.e., what purpose(s) it 
serves.

One thing I can tell you right now is that "SELECT *" is rarely a good idea, unless 
you 
really are going to use every column in the table you're querying. Consider using 
"SELECT column1, columnx" instead.

Cheers,

Erik

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



[PHP] Re: Please help with mail function

2004-01-09 Thread memoimyself
Hello Rolf,

On 9 Jan 2004 at 0:51, Rolf Berkenbosch wrote:

> I have a big problem with the mail function in a php script.
> If I run this script with root access, the mail function is working.
> If I try to run it like http://www.i-s-u.nl/test.php it won't work.
> What is happening, what can I do???

The link you supplied is useless, because of course all PHP code is processed at the 
server and nothing reachers the browser.

It's difficult to say what could be going wrong without knowing more about your server 
setup. My suggestion is that you try using a good socket-based mailing script to 
circumvent your web server's sendmail shortcomings. You'll find an excellent (free) 
socket-based mailing script at http://www.phpguru.org/mime.mail.html .

Good luck,

Erik

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



[PHP] Dynamically Created Arrays

2004-01-09 Thread Cameron B. Prince
Hey guys,

I'm making progress on my perl to PHP conversion project but I need some
help...

I have a configuration table in MySQL made up like this:


CREATE TABLE config (
  code mediumint(9) NOT NULL auto_increment,
  site varchar(32) NOT NULL default '',
  name varchar(64) NOT NULL default '',
  value varchar(128) NOT NULL default '',
  seq smallint(4) default NULL,
  PRIMARY KEY  (code)
) TYPE=MyISAM;


It has data like this:

| 1  | site1 | homedir   | /var/www/htdocs/site1 | NULL |
| 2  | site1 | groupname | Group1| 1|
| 3  | site1 | groupname | Group2| 2|


I use this query to get the configuration data:

SELECT name, value
FROM config
WHERE site = '$site'
ORDER BY name, seq


What I want to create is an array of arrays like this:

$conf[$name][] = $val;

or

array_push($conf[$name], $val);


So I end up with something like:

$conf[homedir][0] = /var/www/htdocs/site1
$conf[groupname][0] = Group1
$conf[groupname][1] = Group2



If I were still in Perl-land, I'd use a hash of arrays and push things into
it, but I don't seem to have that option now and I keep getting "Use of
undefined constant name" errors.

Am I going about this in the right way? Any help would be greatly
appreciated.

Thanks,
Cameron

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



RE: [PHP] picturing webpage

2004-01-09 Thread Ed Curtis

> > Hi!
> >
> >
> > %
> > % I wanted to know if it is possible to picture a webpage via
> > PHP. % By "picturing" I mean that the program can generate a
> > picture, a view, out


 Don't know if this is exactly what you're looking for but this might be
what you're after. It was posted on Freshmeat just this week.

http://www.babysimon.co.uk/khtml2png/

Ed Curtis

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



RE: [PHP] XML/HTML encoding?

2004-01-09 Thread Ray Hunter
On Fri, 2004-01-09 at 08:44, Vincent Jansen wrote:
> I see this using MSIE 6
> But in Mozilla 1.5 I get ë for ë
> 
> I'm hoping this is fixable without changing browser settings

Do you have this page accessible via the web that i can take a look at
it.

--
Ray

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



RE: [PHP] Display syslog file?

2004-01-09 Thread Peter Vertes




On Fri, 2004-01-09 at 10:05, Carlton L. Whitmore wrote:


I'm using the root user to access the file so rights aren't an issue. 


    Actually it is an issue because PHP is not running with root privileges (at least I hope you haven't changed it and made it run with root privileges; that would be a _bad_ thing).  The reason why only root can access your syslog file is because it contains very specific information about what is running on your machine.  If the syslog file would be readable by all users on your machine then a clever user could gain root access by exploiting something that he/she found in the syslogfile.  It's usually not a good idea to publish the contents of your syslog file to the world accessable via HTTP either.  However if you want to throw caution to the wind keep reading...


I want to display the file thru a webserver. I'd like the page to
refresh so I can watch the activity coming in from my SonicWall router.
I don't mind watching all the activity coming in on that syslog file,
maybe later I can limit what is displayed.


    Ok, so we know that the PHP process does not have access to your syslog file because the file is read-only/write-only by root _and_ read-only by users who are in the root group:

-rw-r-    1 root adm  1285 Jan  9 06:00 /var/log/syslog

    I assume you are running PHP as an apache module and apache is running as user "apache" on your system.  So check to see if the apache user is in the root group (the command is "group apache").  If the command only returns "apache" (which it should) then it means that the apache user is only part of the "apache" group on your system.  What you could do is add the apache user to the root group but please understand you are creating a big security hole here.  When joe hacker comes along and notices this he can trick your apache server to run command on your machine with root privileges.  Not a good thing...
    Another, less intrusive, way to do this is to create a cron job (as root) that executes every minutes and copies the contents of the syslog file into another file, readable by the apache user, and displaying the contents of that file on your webpage.  The downside to this is that you will have a 1 minute delay in the information you see on the webpage.
    Hope this helped...

-Pete




-- 
perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")'








signature.asc
Description: This is a digitally signed message part


RE: [PHP] XML/HTML encoding?

2004-01-09 Thread Vincent Jansen
I see this using MSIE 6
But in Mozilla 1.5 I get ë for ë

I'm hoping this is fixable without changing browser settings

-Original Message-
From: Ray Hunter [mailto:[EMAIL PROTECTED] 
Sent: vrijdag 9 januari 2004 16:34
To: 'Php-general'
Subject: Re: [PHP] XML/HTML encoding?


On Fri, 2004-01-09 at 08:23, Vincent Jansen wrote:
> I'm doing some XML processing with PHP5
> I'm using UTF-8 encoding
> When I look at my xml doc it looks something like
> 
>   
>   
>   dotted e (ë) works
>   
> 
> (I hope you see a dotted e)
> After xslt I end up with a html document with a souce that looks 
> something like
> 
>   
>  "http://www.w3.org/TR/REC-html40/loose.dtd";>
>   
>   
>   dotted e (ë) works
>   
>   
>   Etc.
> 
> This is what I want
> But my browser displays "dotted e () works"
> 
> Because I don't want yes or no: Please tell me what (maybe obvious
> thing) I'm doing wrong

What browser and version are you using?

--
Ray

-- 
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] picturing webpage

2004-01-09 Thread Jake McHenry
> -Original Message-
> From: David T-G [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 09, 2004 10:29 AM
> To: PHP General list
> Cc: Eli Hen
> Subject: Re: [PHP] picturing webpage
> 
> 
> Eli --
> 
> ...and then Eli Hen said...
> % 
> % Hello All,
> 
> Hi!
> 
> 
> % 
> % I wanted to know if it is possible to picture a webpage via 
> PHP. % By "picturing" I mean that the program can generate a 
> picture, a view, out
> 
> Hmmm...  An interesting concept.
> 
> 
> % of the page URL given. (Like sometimes you have in search 
> engines, that you % see the site URL and besides is the 
> picture of the first page of the site).
> 
> Can you provide an example?  I know I've never seen this 
> feature, and I'm not sure I follow what you mean.
> 
> 
> % What technologies I use for that? Is it possible with PHP?
> 
> Dunno and dunno, but let's find out :-)
> 
> 
> % 
> % -thanks, Eli
> 
> 
> HTH & HAND & Happy New Year
> 
> :-D
> -- 
> David T-G  * There is too much animal courage in

> (play) [EMAIL PROTECTED] * society and not sufficient 
> moral courage.
> (work) [EMAIL PROTECTED]  -- Mary Baker Eddy, 
> "Science and Health"
> http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf 
> Qrprapl Npg!
> 
> 




I've seen this many times, in spam emails sent to me, and in search
engines. It takes a dynamic screen shot of the url and shows you the
image. It's dynamic, I was playing with one I found, which I can't
now, but I made changes to the site and it showed up on that page. I
also thought it was very cool. I'll try to find the page, this was
about a year ago when I found it before.

Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com



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



Re: [PHP] XML/HTML encoding?

2004-01-09 Thread Ray Hunter
On Fri, 2004-01-09 at 08:23, Vincent Jansen wrote:
> I'm doing some XML processing with PHP5
> I'm using UTF-8 encoding
> When I look at my xml doc it looks something like
> 
>   
>   
>   dotted e (ë) works
>   
> 
> (I hope you see a dotted e)
> After xslt I end up with a html document with a souce that looks
> something like
> 
>   
>  "http://www.w3.org/TR/REC-html40/loose.dtd";>
>   
>   
>   dotted e (ë) works
>   
>   
>   Etc.
> 
> This is what I want
> But my browser displays "dotted e () works"
> 
> Because I don't want yes or no: Please tell me what (maybe obvious
> thing) I'm doing wrong

What browser and version are you using?

--
Ray

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



RE: [PHP] XML?

2004-01-09 Thread Ray Hunter
On Fri, 2004-01-09 at 08:22, Jake McHenry wrote:
> It's pretty much for data organization, right?

yes, it is a method for organizing data into a standard format that is
platform independent.

> I do a lot of importing and exporting to/from excel. I belive it could
> help me out here.

Perhaps. 

> How does php get the data from the xml docs?

Loads up and parses the document.

> I guess I'm just looking for info on how to use it with php.

XML: http://us2.php.net/manual/en/ref.xml.php
DOM XML: http://us2.php.net/manual/en/ref.domxml.php

That should get you started. There are many uses for xml documents.
Mainly it is a way to describe and organize your data into a logical
representation.

--
Ray

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



Re: [PHP] picturing webpage

2004-01-09 Thread David T-G
Eli --

...and then Eli Hen said...
% 
% Hello All,

Hi!


% 
% I wanted to know if it is possible to picture a webpage via PHP.
% By "picturing" I mean that the program can generate a picture, a view, out

Hmmm...  An interesting concept.


% of the page URL given. (Like sometimes you have in search engines, that you
% see the site URL and besides is the picture of the first page of the site).

Can you provide an example?  I know I've never seen this feature, and I'm
not sure I follow what you mean.


% What technologies I use for that? Is it possible with PHP?

Dunno and dunno, but let's find out :-)


% 
% -thanks, Eli


HTH & HAND & Happy New Year

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


RE: [PHP] Display syslog file?

2004-01-09 Thread Ray Hunter
On Fri, 2004-01-09 at 08:05, Carlton L. Whitmore wrote:
> Ray,
> I'm using the root user to access the file so rights aren't an issue. 
> I want to display the file thru a webserver. I'd like the page to
> refresh so I can watch the activity coming in from my SonicWall router.
> I don't mind watching all the activity coming in on that syslog file,
> maybe later I can limit what is displayed.

Some how you want to get the permissions of the syslog file to those of
your webserver so that you can display the file properly. You dont want
you webserver having root access at all.

I dont know off hand how to have syslog log to a file and change the
permissions of that file. You might have to have cron running and
copying that file to apaches doc_root and running that every 5 minutes
or less.

You would have a little php [perl,bash] run from root's crontab that
would copy the file and change the permissions for you.

That might be the easiest way to do it.

--
Ray


> 
> 
> 
> -Original Message-
> From: Ray Hunter [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 09, 2004 8:46 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Display syslog file?
> 
> 
> 
> On Fri, 2004-01-09 at 07:28, Carlton L. Whitmore wrote:
> > I didn't make my last request very clear. I used lastlog as an 
> > example, but what I really want to do is open a syslog file (text 
> > file), that is coming in from a VPN box.
> 
> That is easy enough to do if you have access to the syslog file. Most
> syslog files are written by root so you need to have privileges to read
> the file. You might want to check to see if syslogd will write and
> change the file permissions.
> 
> > I'd like to have it displayed live so I can scan it during the day. 
> > What is the best way to do this? Someone had suggested using cron, but
> 
> > I'm very new to Linux and PHP so I would need some help with that. Any
> 
> > help is appreciated,
> 
> How do you want to display it? through a webserver or some other method?
> 
> Do you want specific info from the syslog file(s). There are many syslog
> files that you can look at. Be more specific.
> 
> --
> Ray

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



[PHP] XML/HTML encoding?

2004-01-09 Thread Vincent Jansen
I'm doing some XML processing with PHP5
I'm using UTF-8 encoding
When I look at my xml doc it looks something like



dotted e (ë) works


(I hope you see a dotted e)
After xslt I end up with a html document with a souce that looks
something like


http://www.w3.org/TR/REC-html40/loose.dtd";>


dotted e (ë) works


Etc.

This is what I want
But my browser displays "dotted e () works"

Because I don't want yes or no: Please tell me what (maybe obvious
thing) I'm doing wrong

Thanks

---
Vincent Jansen

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



RE: [PHP] XML?

2004-01-09 Thread Jake McHenry
Not sure. Just asking. I haven't used it before and don't really know
what it's about. I've read about it on xml.com. Either nothing sank
in, or I'm just confused.

It's pretty much for data organization, right?

Almost all of the documentation I've read on it deals with asp. I know
it is used with php as well.

Guess I'm just curious what it can do, and how I could put it to use.

I do a lot of importing and exporting to/from excel. I belive it could
help me out here.

How does php get the data from the xml docs?

I guess I'm just looking for info on how to use it with php.

Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com




> -Original Message-
> From: Ray Hunter [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 09, 2004 9:48 AM
> To: 'Php-general'
> Subject: Re: [PHP] XML?
> 
> 
> On Fri, 2004-01-09 at 00:30, Jake McHenry wrote:
> > Can someone point me in the right direction towards creating and 
> > implementing XML with php? I've heard it can make things 
> much easier 
> > on me, and would like more info on it. Also, if anyone has 
> any storys 
> > from using it, might give me an idea of what I'm getting 
> into. Is it 
> > easy to implement? Does it make things easier on me in the future?

> > Etc.etc.
> 
> What do you want to do with xml? There is expat and DOM that 
> you can use to parse and create xml docs. What are you 
> looking to achieve?
> 
> --
> Ray
> 
> -- 
> 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] Display syslog file?

2004-01-09 Thread Carlton L. Whitmore
Ray,
I'm using the root user to access the file so rights aren't an issue. 
I want to display the file thru a webserver. I'd like the page to
refresh so I can watch the activity coming in from my SonicWall router.
I don't mind watching all the activity coming in on that syslog file,
maybe later I can limit what is displayed.
Thanks,
Carlton.




-Original Message-
From: Ray Hunter [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 8:46 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Display syslog file?



On Fri, 2004-01-09 at 07:28, Carlton L. Whitmore wrote:
> I didn't make my last request very clear. I used lastlog as an 
> example, but what I really want to do is open a syslog file (text 
> file), that is coming in from a VPN box.

That is easy enough to do if you have access to the syslog file. Most
syslog files are written by root so you need to have privileges to read
the file. You might want to check to see if syslogd will write and
change the file permissions.

> I'd like to have it displayed live so I can scan it during the day. 
> What is the best way to do this? Someone had suggested using cron, but

> I'm very new to Linux and PHP so I would need some help with that. Any

> help is appreciated,

How do you want to display it? through a webserver or some other method?

Do you want specific info from the syslog file(s). There are many syslog
files that you can look at. Be more specific.

--
Ray

-- 
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] XML?

2004-01-09 Thread Ray Hunter
On Fri, 2004-01-09 at 00:30, Jake McHenry wrote:
> Can someone point me in the right direction towards creating and
> implementing XML with php? I've heard it can make things much easier
> on me, and would like more info on it. Also, if anyone has any storys
> from using it, might give me an idea of what I'm getting into. Is it
> easy to implement? Does it make things easier on me in the future?
> Etc.etc.

What do you want to do with xml? There is expat and DOM that you can use
to parse and create xml docs. What are you looking to achieve?

--
Ray

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



Re: [PHP] Display syslog file?

2004-01-09 Thread Ray Hunter

On Fri, 2004-01-09 at 07:28, Carlton L. Whitmore wrote:
> I didn't make my last request very clear. I used lastlog as an example,
> but what I really want to do is open a syslog file (text file), that is
> coming in from a VPN box.

That is easy enough to do if you have access to the syslog file. Most
syslog files are written by root so you need to have privileges to read
the file. You might want to check to see if syslogd will write and
change the file permissions.

> I'd like to have it displayed live so I can scan it during the day.
> What is the best way to do this? Someone had suggested using cron, but
> I'm very new to Linux and PHP so I would need some help with that.
> Any help is appreciated,

How do you want to display it? through a webserver or some other method?

Do you want specific info from the syslog file(s). There are many syslog
files that you can look at. Be more specific.

--
Ray

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



[PHP] Display syslog file?

2004-01-09 Thread Carlton L. Whitmore
I didn't make my last request very clear. I used lastlog as an example,
but what I really want to do is open a syslog file (text file), that is
coming in from a VPN box.
I'd like to have it displayed live so I can scan it during the day.
What is the best way to do this? Someone had suggested using cron, but
I'm very new to Linux and PHP so I would need some help with that.
Any help is appreciated,
Carlton.
 


Re: [PHP] critical case, please read and comment !!

2004-01-09 Thread Christophe Chisogne
Nabil wrote:
for ($i=0 ; $iwith n records you send n http GET requets, which take a long time,
using bandwith, and needs n executions of php script on webserver2.
Why not simply creating a csv file on the fly, with all your
3fields data, and send it to the php script on the other webserver?
You can do it via the POST method of HTTP, like the way it's done
with an HTML form containing a type=file input tag. You just need
a web client written in PHP (equivalent of Perl's LWP, libwww-perl).
I think curl can do it.
Just my 2 eurocents ;-)

Christophe

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


Re: [PHP] open_basedir clarification

2004-01-09 Thread Tom Dangler
Matt,

>From the php manual:

The restriction specified with open_basedir is actually a prefix, not a directory 
name. This means that "open_basedir = /dir/incl" also allows access to "/dir/include" 
and "/dir/incls" if they exist. When you want to restrict access to only the specified 
directory, end with a slash. For example: "open_basedir = /dir/incl/" 

php manual link:

http://www.zend.com/manual/features.safe-mode.php


Tom Dangler

>>> "Matt Grimm" <[EMAIL PROTECTED]> 01/08/04 07:16PM >>>
Can anyone clarify this for me?  Is open_basedir recursive or restricted to
the exact paths specified?

--
Matt Grimm


"Matt Grimm" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If my server has an open_basedir restriction in place for my home
directory,
> I understand that to mean I can only open files in the same directory as
> whatever script is currently running.  Is that correct?
>
> --
> Matt Grimm
> Web Developer
> The Health TV Channel, Inc.
> (a non - profit organization)
> 3820 Lake Otis Parkway
> Anchorage, AK 99508
> 907.770.6200 ext. 686
> 907.336.6205 (fax)
> E-mail: [EMAIL PROTECTED] 
> Web: www.healthtvchannel.org

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



[PHP] Re: limit mysql connections

2004-01-09 Thread pete M
check out the mssql.max_links setting in php.ini
There's a dew other settings in there 200
pete

Diana Castillo wrote:

Is there any way to limit the connections so that this error never happens?
Warning: mysql_connect(): Too many connections at
/home/local/global/php/libraries/dblayer_mysql.php line 14.
--
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: deamon / server

2004-01-09 Thread pete M
What you trying to achieve...



Decapode Azur wrote:
hello,

Is it possible to make php scripts working like deamons
and build something like a server?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] deamon / server

2004-01-09 Thread Stuart
Decapode Azur wrote:
Is it possible to make php scripts working like deamons
and build something like a server?
Yes.

http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html

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


RE: [PHP] deamon / server

2004-01-09 Thread Jay Blanchard
[snip]
Is it possible to make php scripts working like deamons
and build something like a server?
[/snip]

*scratching chin* Anything is possible.

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



[PHP] deamon / server

2004-01-09 Thread Decapode Azur
hello,

Is it possible to make php scripts working like deamons
and build something like a server?

-- 
thanks

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



Re: [PHP] Please check this program (its working)

2004-01-09 Thread Richard Davey
Hello Ryan,

Friday, January 9, 2004, 7:20:09 AM, you wrote:

RA> Its working perfectly well...but will I have problems if I try it on a large
RA> email list or
RA> will it hog resourcesetc? ANY advice appreciated.

Stick this at the bottom of your loop (INSIDE the loop!):

set_time_limit(30);

The problem with your script is that if it takes a long time to run,
i.e. there are lots of email addresses then it'll probably time out on
you. The above command will reset the time-out limit after each email
is sent, preventing this problem.. so you can leave the script running
until it completes with no "Execution time" error.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP] Time Limit in save-mode

2004-01-09 Thread Pavel Janda
Hello,

a have this problem. I am reading some data from another server via
http-conection for which I have used fsock_open. But sometimes, it is
possible, that reading is longer, than for example 5 seconds, and I want to
stop this reading a return false...

I found function set_time_limit, which is working only if server is not in
safe-mode... But server, where is my script have to be in safe-mode...

I have tried socket_set_timeout() too, but it seems, that it doesn't work
(I've used a example from php.net)...

Does anybody have any idea, how to solve this? I have PHP 4.1.0 (and because
I am not the admin, I cannot change it...)
Thank you!

PJ

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



RE: [PHP] open_basedir clarification

2004-01-09 Thread Ford, Mike [LSS]
On 09 January 2004 01:16, Matt Grimm wrote:

> Can anyone clarify this for me?  Is open_basedir recursive or
> restricted to the exact paths specified?

This is a bit hard to find in the manual, but everything you need to know
should be at
http://www.php.net/manual/en/features.safe-mode.php#ini.open-basedir.

(Why it's on the Safe Mode page, when it's not affected by safe_mode, I
really don't know!)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] critical case, please read and comment !!

2004-01-09 Thread Jay Blanchard
[snip]
1-the problem is that the 30 second of execution time expired before i
can
send even 200 records.
[/snip]

Use set_time_limit() in the page itself, requires no mod to php.ini
http://www.php.net/set_time_limit

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



[PHP] limit mysql connections

2004-01-09 Thread Diana Castillo
Is there any way to limit the connections so that this error never happens?
Warning: mysql_connect(): Too many connections at
/home/local/global/php/libraries/dblayer_mysql.php line 14.

--
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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



Re: [PHP] _ENV

2004-01-09 Thread Stuart
Diana Castillo wrote:
Can someone tell me the name of the environmental variable that tells you
the path that you are in?
http://php.net/getcwd

or for the virtual path to the script...

dirname($_SERVER['SCRIPT_NAME']);

or for the document root of the current site...

$_SERVER['DOCUMENT_ROOT']

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


Re: [PHP] Content-type vs session_start()

2004-01-09 Thread Børge Strand

Cheers Chris
 
> I will try to explain using your code:
> 
> > Here's test3.cgi:
> > ==
> > #! /usr/local/bin/php
> >  > print 'Content-type: text/html' . "\n\n";
> 
> When you are running as a CGI, you can set the Content-Type header in this
> way. However, as soon as you send two sequential newlines, you are
> indicating the end of the headers and the beginning of the content.

What should be there instead of \n\n? I tried without any newlines
with the error "Cannot send session cache limiter - headers already
sent..."

One newline gives "Cannot send session cookie - headers already
sent..." and then the same error as above.

Do you know of a site where I can find "headers001" and what headers
are sent by session_start()?

Actually, my program worked just fine before my ISP upgraded to 4.3.4.


> > session_start();
> 
> So, when you have this on the next line, PHP cannot set the Set-Cookie
> header that it is likely trying to set (in addition to whatever
> cache-related headers it may be setting, depending on your configuration).
> This is because you have already indicated the end of the headers in your
> previous line. This is the danger in writing your own headers in this way;
> you become responsible for adhering to the proper format of things.
> 
> > And test3.php:
> > ==
> >  > session_start();
> > //  print 'Content-type: text/html' . "\n\n"; // only in .cgi version!
> 
> While it's not necessary to specify Conetnt-Type here, you can do so using
> the header() function:
> 
> header('Content-Type: text/html');

Aha! That explains it a bit. Without me having to print Content-type...,
(i.e. in a .php file), sessions seem to be working just fine. 

-- 
Børge

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



[PHP] _ENV

2004-01-09 Thread Diana Castillo
Can someone tell me the name of the environmental variable that tells you
the path that you are in?

--
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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



Re: [PHP] Content-type vs session_start()

2004-01-09 Thread Børge Strand

> > Do you have any ideas what I should do to make both .php and .cgi
> > versions work?
> 
> > Here's test3.cgi:
> > ==
> > #! /usr/local/bin/php
> >  > print 'Content-type: text/html' . "\n\n";
> > session_start();
> 
> Have you tried putting session_start() before the first print?

Yes. Then I get "Internal Server Error". 

--
Børge

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




[PHP] [problem solved] -> Is it possible to see if a jpeg is RGB or CMYK via PHP GD2?

2004-01-09 Thread SED
I was to fast on this list...  I found the solution reading the manual
better ;)

...
With JPG images, two extra indexes are returned: channels and bits. channels
will be 3 for RGB pictures and 4 for CMYK pictures. bits is the number of
bits for each color. 

Beginning with PHP 4.3, bits and channels are present for other image types,
too. However, the presence of these values can be a bit confusing. As an
example, GIF always uses 3 channels per pixel, but the number of bits per
pixel cannot be calculated for an animated GIF with a global color table. 
...



-Original Message-
From: SED [mailto:[EMAIL PROTECTED]
Sent: 9. janúar 2004 09:51
To: [EMAIL PROTECTED]
Subject: [PHP] Is it possible to see if a jpeg is RGB or CMYK via PHP GD2?

I'm allowing user to upload images to a gallery. However, some user seem to
have both RGB and CMYK jpeg images. I get an error from ImageCreateFromJPEG
when the script is creating thumbnails from a CMYK jpeg. Can I somehow see
if the image is RGB or CMYK, so I know when to skip the automatic thumbnail
creation?
 
Regards,
SED

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



RE: [PHP] detecting flash in php

2004-01-09 Thread Julien Wadin
php is server side
try in javascript

-Message d'origine-
De : Louie Miranda [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 9 janvier 2004 6:12
À : [EMAIL PROTECTED]
Objet : [PHP] detecting flash in php


is there anyway of detecting flash? in php


-- -
Louie Miranda
http://www.axishift.com

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

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



[PHP] Is it possible to see if a jpeg is RGB or CMYK via PHP GD2?

2004-01-09 Thread SED
I'm allowing user to upload images to a gallery. However, some user seem to
have both RGB and CMYK jpeg images. I get an error from ImageCreateFromJPEG
when the script is creating thumbnails from a CMYK jpeg. Can I somehow see
if the image is RGB or CMYK, so I know when to skip the automatic thumbnail
creation?
 
Regards,
SED


php-general Digest 9 Jan 2004 09:50:14 -0000 Issue 2520

2004-01-09 Thread php-general-digest-help

php-general Digest 9 Jan 2004 09:50:14 - Issue 2520

Topics (messages 174065 through 174095):

open_basedir clarification
174065 by: Matt Grimm
174082 by: Matt Grimm

Re: php on linux..
174066 by: memoimyself.yahoo.com.br

Content-type vs session_start()
174067 by: Børge Strand
174068 by: Brad Pauly
174069 by: Chris Shiflett

post vars not by form
174070 by: Nabil
174073 by: Matt Matijevich
174074 by: Chris Shiflett
174078 by: Justin Patrin

upload and RENAME picture
174071 by: Matt Hedges
174072 by: Matt Matijevich
174084 by: Bossek

Help parsing text file?
174075 by: Carlton L. Whitmore
174077 by: Brad Pauly
174088 by: David Robley

Please help with mail function
174076 by: Rolf Berkenbosch

Buffalo'ed, stumped, confused...
174079 by: Robin Kopetzky
174080 by: Richard Davey
174081 by: John W. Holmes

Re: php5 overload()
174083 by: Marek Kilimajer

php_hostconnect()
174085 by: Anthony Ritter

php.ini config on 4.3.4
174086 by: Turbo
174087 by: John W. Holmes

detecting flash in php
174089 by: Louie Miranda
174090 by: Leif K-Brooks
174091 by: Paul Chvostek

Please check this program (its working)
174092 by: Ryan A

XML?
174093 by: Jake McHenry

Rsvp/invite script?
174094 by: Dustin Choe

critical case, please read and comment !!
174095 by: Nabil

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
--- Begin Message ---
If my server has an open_basedir restriction in place for my home directory,
I understand that to mean I can only open files in the same directory as
whatever script is currently running.  Is that correct?

--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org
--- End Message ---
--- Begin Message ---
Can anyone clarify this for me?  Is open_basedir recursive or restricted to
the exact paths specified?

--
Matt Grimm


"Matt Grimm" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If my server has an open_basedir restriction in place for my home
directory,
> I understand that to mean I can only open files in the same directory as
> whatever script is currently running.  Is that correct?
>
> --
> Matt Grimm
> Web Developer
> The Health TV Channel, Inc.
> (a non - profit organization)
> 3820 Lake Otis Parkway
> Anchorage, AK 99508
> 907.770.6200 ext. 686
> 907.336.6205 (fax)
> E-mail: [EMAIL PROTECTED]
> Web: www.healthtvchannel.org
--- End Message ---
--- Begin Message ---
Hello Khoa,

On 8 Jan 2004 at 0:13, khoa vo wrote:

> 
> 
>   Your name: 
> 
> 

That's fine, but that's not what you have up on your web space. Your form is pointing 
to 
action.html, not action.php.
 
> 
> #!/lusr/bin/php
> Hi .

Ok, you don't need the first line (#!/lusr/bin/php), because this is a script for the 
web and 
will be processed by the web server. But you do need to save the file action.php with 
the 
".php" suffix. I've just checked your online pages and your form is being sent to 
"action.html", not "action.php", so the PHP code is not being processed, because your 
web server doesn't look for PHP code in HTML files.

I had a look at the source of your action.html file and it's like this:


Hi. Your name is .


The phpinfo() function is going to print a long list of information about PHP on the 
server, so you might want to remove that.

So, to recap, you need to change the action attribute in your index.html file to 
"action.php", and then rename the file action.html to action.php (and maybe remove the 
phpinfo() function while you're at it). That should do the trick.

Good luck,

Erik
--- End Message ---
--- Begin Message ---

I have a problem with html headers using sessions. I guess it has to
do with the Content-type line. My ISP uses PHP 4.3.4 with
register_globals = On (although I want this to work with Off too).

My program (test3.cgi, test3.php) simply logs the number of times I
have accessed a web site. As a php file it works as supposed to only
that there's no Content-type line.

As a .cgi file the script has to have the Content-type line in order
to be executed. With Content-type BEFORE session_start(), $_SESSION
doesn't seem to be set. Alternatively, with Content-type AFTER
session_start(), I get "Warning: session_start(): Cannot send session
cookie - headers already sent by..."

Do you have any ideas what I should do to make both .php and .cgi
versions work?

--
Børge

Here's test3.cgi:
===

[PHP] critical case, please read and comment !!

2004-01-09 Thread Nabil
I have the following example case:
1- More than 1000 record in my MySQL database.
2- I have to submit those record via HTTP GET or POST method.
3- I  have to read the confirmation message that will be printed on the
remote page showing me that the vars have been inserted in the remote
database.
4- of course, I have a limitation of executing time of 30 seconds and i
should not modify the php.ini

i did the following scenario :

http://anotherwebserver/url2.php?var1=$var1$var2=$var2&var3=$var3";,
"r") ;
$data = fread($handle, 11);
fclose($handle);
if ($data == $var1) return true; else return false;
}
for ($i=0 ; $i

1-the problem is that the 30 second of execution time expired before i can
send even 200 records.
2- in case of not connection of the remote page, and i did not get the $var1
printed  ($data == $var1) then i have to re submit this record.

Regards

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



  1   2   >