Re: [PHP] Big table dump stopping in between

2004-11-05 Thread Ritesh Nadhani
Hello,
I wont be doing it everytime. Just need to strees test something. Just 
wanted to know how my app behaves when 80K+ rows are dumped.

I will look into the options you have given and let you know the result.
Regards,
Ritesh
- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 06, 2004 11:41 AM
Subject: RE: [PHP] Big table dump stopping in between


Why on earth would you want to echo 80k rows?? :)
Anyways...
1) If you have safe mode on, set_time_limit doesn't work.
2) You might check your max_execution_time value defined in the php.ini
Nate
-Original Message-
From: Ritesh Nadhani [mailto:[EMAIL PROTECTED]
Sent: Friday, November 05, 2004 9:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Big table dump stopping in between
Hello,
I have a PHP page.
In the script I connect to one our tables having more then 80K rows and 
dump

the data using echo command.
When I run this page from my browser, the process always stops half way 
thru

and only half the data is dumped. I can reproduce this problem everytime. 
I
am on a 512Kbps DSL line.

By stopping i mean from IE, about 50K rows are dumped and then the process
stops.
I have even tried: set_time_limit (0) so that we have unlimited timeout 
but
its still giving the same error.

Do I need to configure something in the server so that complete data is
dumped?
Ritesh
--
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] Big table dump stopping in between

2004-11-05 Thread nate
Why on earth would you want to echo 80k rows?? :)

Anyways...

1) If you have safe mode on, set_time_limit doesn't work.
2) You might check your max_execution_time value defined in the php.ini

Nate

-Original Message-
From: Ritesh Nadhani [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 05, 2004 9:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Big table dump stopping in between

Hello,

I have a PHP page.

In the script I connect to one our tables having more then 80K rows and dump

the data using echo command.

When I run this page from my browser, the process always stops half way thru

and only half the data is dumped. I can reproduce this problem everytime. I 
am on a 512Kbps DSL line.

By stopping i mean from IE, about 50K rows are dumped and then the process 
stops.

I have even tried: set_time_limit (0) so that we have unlimited timeout but 
its still giving the same error.

Do I need to configure something in the server so that complete data is 
dumped?

Ritesh 

-- 
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] CONGRATULATION (YOU JUST WON LOTTERY)

2004-11-05 Thread -{ Rene Brehmer }-
Spam message reported, original sender added to permanent blacklist
Have a nice day
Rene
At 02:56 06-11-2004, floydjeffers wrote:
[skip spam]
--
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] Big table dump stopping in between

2004-11-05 Thread Ritesh Nadhani
Hello,
I have a PHP page.
In the script I connect to one our tables having more then 80K rows and dump 
the data using echo command.

When I run this page from my browser, the process always stops half way thru 
and only half the data is dumped. I can reproduce this problem everytime. I 
am on a 512Kbps DSL line.

By stopping i mean from IE, about 50K rows are dumped and then the process 
stops.

I have even tried: set_time_limit (0) so that we have unlimited timeout but 
its still giving the same error.

Do I need to configure something in the server so that complete data is 
dumped?

Ritesh 

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


[PHP] best way to store images

2004-11-05 Thread nate
I'm trying to plan out the best way to develop an image hosting script for
my client.



I'd like to use the least CPU intensive way assuming 10's of thousands of
images in this system. Disk space is less important, as that seems to be a
cheaper upgrade than memory/CPU would be.


There are basically 2 scenarios I've come up with but I'm open to other
ideas:

1)   Store images on the file system - and the image information (file
name, timestamp, size, dimensions, type, etc) in MySQL.

2)   Store images in MySQL table 1 and their corresponding information
in table 2.

 

Also for each image request I'd like to record bandwidth usage and probably
other statistics in MySQL so assume at least this one query on MySQL for
each image request (if not 2 queries if I store the image itself in MySQL).

 

Lastly, I will use mod_rewrite so clients can access images by their name
rather than a php page.

So I guess my questions are which scenario do you think is best and would
because mod_rewrite uses a little more overhead would that be a major issue
assuming a busy site?

Thanks for your help!

Nate



[PHP] Re: Initializing variables

2004-11-05 Thread Jason Barnett
What I want to know is if the variable assignment is
unknown, as in a user form.
Would I then just initialize the variables to 0 ?
Stuart
// I assign null to the variable if I'm not sure what type it's going to have. 
$var = null;

// 0 and FALSE are also ok choices, I try to use them for integers or booleans
// If you're talking about I think you're talking about (register_globals) then 
// isset() won't suffice because the $_POST and $_GET indices get registered as 
// global variables automatically.

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


Re: [PHP] 4.3.9 slower then 4.3.8 ... ?

2004-11-05 Thread Marc G. Fournier
yOn Wed, 3 Nov 2004, James Kaufman wrote:
On Wed, Nov 03, 2004 at 08:43:52PM -0400, Marc G. Fournier wrote:
I'm not sure how to debug this further ... on the 27th, I upgraded our
server(s) to 4.3.9, and since then, the sites just aren't performing very
well ... I've tried adding mmcache, and it makes no improvement ... I've
tried halving the # of processes running on the server, no improvement ...
the only thing I haven't tried yet is downgrading back to 4.3.8, which I'm
going to try next ...
But, if anyone has any ideas ... ?  Something that I can look at, or use
to debug?

Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]   Yahoo!: yscrappy  ICQ: 7615664
How about going back to 4.3.8 and seeing if that truly makes a difference.
After alot of frustrating debugging, we finally tried removin the 
--enable-versioning from the FreeBSD port makefile ... that make a 
*massive* difference in start times, and return of php pages ... :(


Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]   Yahoo!: yscrappy  ICQ: 7615664
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: keywords generation (ANOTHER)

2004-11-05 Thread Bruno B B Magalhães
Hi,
I am trying to categorize the keywords... for example, if a word shows  
at the begin probably it´s more important, but how many occurrences is  
also important...
Does someone knows Google´s formula? hehe

This code is working more or less as expected!
Many Thanks,
Bruno
===EXAMPLE== 
=
$submited_text = 'Polones e atracao no Match Race Brasil
Karol Jablonski, segundo colocado no ranking mundial, tentara acabar  
com o domínio de Torben Grael na competicao
 Sao Paulo – O polones Karol Jablonski, de 38 anos, sera uma das  
atracoes da terceira e ultima etapa do Match Race Brasil, competicao  
barco contra barco que sera disputada de 18 a 21 de novembro, no Rio de  
Janeiro. Segundo colocado no ranking mundial de match race da Federacao  
Internacional de Vela (Isaf), o velejador tentara acabar com o domínio  
de Torben Grael, bicampeao invicto da competicao.
 Radicado na Alemanha, Jablonski e comandante do sindicato italiano  
Toscana Challenge, que se prepara para a America´s Cup de 2007.  
Experiente, ele tem entre os seus maiores títulos o da Admiral´s Cup de  
1993. No ranking mundial de match race, ele soma 10.060 pontos, contra  
10.468 do norte-americano Ed Baiard, líder da lista da Isaf.
 A tripulacao de Jablonski na etapa carioca do Match Race Brasil  
contara ainda com os poloneses Piotr Przybylski, Dominik Zycki e Jacek  
Wysocki, todos velejadores experientes em competicoes barco contra  
barco.
 Torben Grael, bicampeao olímpico da classe Star, venceu as cinco  
etapas disputadas do Match Race Brasil – tres da edicao do ano passado  
e duas em 2004. Comandante do barco Brasil 1, que disputara a Volvo  
Ocean Race, a mais importante regata de volta ao mundo, Torben teve  
100% de aproveitamento, por exemplo, na etapa de Ilhabela, vencendo as  
11 regatas disputadas.
 “A participacao de Jablonski e muito importante. Nossa prioridade  
sempre foi trazer atletas de classes olímpicas, mas dessa vez  
resolvemos convidar um especialista em match race para desafiar o  
Torben”, comentou Enio Ribeiro, diretor da Vela Brasil, organizadora da  
competicao. “Teremos certamente uma etapa de alto nível tecnico no Rio  
de Janeiro.”
 O Match Race Brasil e disputado em veleiros Beneteau 40.7  
rigorosamente iguais. Os quatro barcos sao escolhidos pela organizacao  
e sorteados para os participantes.
';
===FUNCTION  
CODE===
echo generate_keywords($submited_text,23);

function generate_keywords($text,$number=10)
{
$iwords = array(' muito ');

if(isset($text) && $text != '' && $text=strtolower($text))
{
foreach($iwords as $var=>$val)
{
$text = str_replace($val,' ',$text);
}
		foreach(str_word_count($text,1) as $var=>$val)
		{
			if(strlen($val) >= 5)
			{
$total[$val] =  
((strpos($text,$val)+2)*(strpos($text,$val)+2))*((substr_count($text,$va 
l)+2)*0.75);
			}
		}
		
		asort($total,SORT_NUMERIC);

		return implode(',',array_keys(array_slice($total, 0, $number)));
	}
}
 
===

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


Re: [PHP] SQL-Injection, XSS and Hijacking

2004-11-05 Thread Chris Shiflett
--- Jordi Canals <[EMAIL PROTECTED]> wrote:
> > I highlight some of the things I think are of principal concern
> > for PHP developers in something I call the PHP Security Workbook:
> > 
> > http://shiflett.org/php-security.pdf
> > 
> > That doesn't cover everything, of course, but it covers those
> > things I have chosen as most important when I only have three
> > hours to talk about security concerns. :-)
>
> Chris,
> 
> Many thanks for this link to your workbook. Really is a valuable
> read as it puts together the main security concerns.

Thanks. :-)

> Which method for data filtering you think is best for a modular
> site? the dispatch method (page 8) or the include method (page
> 10)?

First, let me point out that those aren't the only two choices. A lot of
people avoid discussing software design with strangers, because many
people are very passionate about their like or dislike of a particular
approach. However, I "risk" it in my talks, because I think it's helpful
for people to at least see a couple of brief overviews of some popular
methods, in case there are characteristics that they like from either one.
I think it's similar to how no one thinks XP is all great, but most people
who study XP end up finding a few characteristics that they like
(test-driven design perhaps).

Personally, of those two that I mention in the PHP Security Workbook, I
prefer the Dispatch Method. It does two things I like:

1. Completely removes the possibility of data being exposed via URL. The
"entry point" to your application is very defined, and there is no other
way in.
2. Makes it very easy for a developer to see the control flow of the
entire application. You can't do this when looking through hundreds of
lines of code. On the largest applications I have created (which consist
of hundreds of thousands of lines of code), the dispatch.php script (or
whatever you call it) is still rarely more than a hundred lines long. It
is the overview - the blueprint.

I think these characteristics help me as a developer to be mindful of
security (it's easy to keep up with data flow as well), and I think these
characteristics help me as a manager to be sure that my developers'
mistakes are limited in the damage they can do.

> I specially like the dispatch method as I use my own private server
> (VPS) and have all modules outside the document root. This way, all
> scripts must be called by the dispatcher wich provides al security
> checks. As scripts are outside the document root, you cannot run them
> directly bypassing the dispatcher, and the security checks ... In my
> document root, the dispatcher is the only available script.

Yeah, that's basically the first reason I mentioned. :-) I think the other
reason is equally as strong.

Hope that helps. Thanks for appreciating my work.

Chris

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

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming February 2005http://httphandbook.org/

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



Re: [PHP] SQL-Injection, XSS and Hijacking

2004-11-05 Thread Jordi Canals
On Wed, 3 Nov 2004 19:02:22 -0800 (PST), Chris Shiflett
<[EMAIL PROTECTED]> wrote:

> There is a lot more. I highlight some of the things I think are of
> principal concern for PHP developers in something I call the PHP Security
> Workbook:
> 
> http://shiflett.org/php-security.pdf
> 
> That doesn't cover everything, of course, but it covers those things I
> have chosen as most important when I only have three hours to talk about
> security concerns. :-)
> 
Chris,

Many thanks for this link to your workbook. Really is a valuable read
as it puts together the main security concerns. It helped me to see
another point of view in some things.

Just have to ask:

Which method for data filtering you think is best for a modular site?
the dispatch method (page 8) or the include method (page 10)?

I specially like the dispatch method as I use my own private server
(VPS) and have all modules outside the document root. This way, all
scripts must be called by the dispatcher wich provides al security
checks. As scripts are outside the document root, you cannot run them
directly bypassing the dispatcher, and the security checks ... In my
document root, the dispatcher is the only available script.

Regards,
Jordi.

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



Re: [PHP] Re: keywords generation

2004-11-05 Thread Bruno B B Magalhães
Finally a solution for those who needs! :)
==FUNCTION== 

function generate_keywords($text,$number=10)
{
	$iwords = array('a',
	'to',
	'of',
	't',
	'e'
	);

	if(isset($text) && $text != '' && $text=strtolower($text))
	{
		foreach($iwords as $var=>$val)
		{
			$text = str_replace($val,'',$text);
		}
		
		foreach(str_word_count($text,2) as $var=>$val)
		{
			$total[$val] = substr_count($text,$val);
		}
		
		arsort($total,SORT_NUMERIC);
		
		return implode(',',array_keys(array_slice($total, 0, $number)));
	}
}
==EXAMPLE=== 
===
$submited_text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing  
elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna  
aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud  
exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea  
commodo consequat. Duis autem vel eum iriure dolor in hendrerit in  
vulputate velit esse molestie consequat, vel illum dolore eu feugiat  
nulla facilisis at vero eros et accumsan et iusto odio dignissim qui  
blandit praesent luptatum zzril delenit augue duis dolore te feugait  
nulla facilisi. ';

echo generate_keywords($submited_text);
 


Thanks to Tularis and Sokolewicz .
Regards,
Bruno B B Magalhães
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Passing values from a new window

2004-11-05 Thread Greg Donald
On Fri, 05 Nov 2004 13:17:29 -0800, Todd Cary <[EMAIL PROTECTED]> wrote:
> Is there a place where I can view some examples of using JavaScript?

http://google.com/search?q=javascript


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Re: keywords generation

2004-11-05 Thread M. Sokolewicz
use a simple:
asort($total, SORT_NUMERIC);
$total will hold the correct array with the most common word at the top, 
and the least common at the bottom. (just a quick question, why're you 
using latin? :P)

> Hi,
>
> no problem at all...
>
> well, the script is incomplete cause I don´t know how to sort the
> $total array by value... for example:
> Array
> (
>  [Lorem] => 1
>  [ipsum] => 1
>  [dolor] => 5
>  [sit] => 1
>  [met] => 1
>  [consectetuer] => 1
>  [dipiscing] => 1
>  [elit] => 2
>  [sed] => 1
>  [dim] => 0
>  [nonummy] => 1
>  [nibh] => 1
>  [euismod] => 1
>  [tincidunt] => 1
>  [ut] => 5
>  [loreet] => 0
>  [dolore] => 3
>  [mgn] => 0
>  [liqum] => 0
>  [ert] => 0
>  [volutpt] => 0
>  [Ut] => 1
>  [wisi] => 1
>  [enim] => 1
>  [d] => 19
>  [minim] => 1
>  [venim] => 0
>  [quis] => 1
>  [nostrud] => 1
>  [exerci] => 1
>  [ttion] => 0
>  [ullmcorper] => 0
>  [suscipit] => 1
>  [lobortis] => 1
>  [nisl] => 1
>  [liquip] => 1
>  [ex] => 2
>  [e] => 49
>  [commodo] => 1
>  [consequt] => 0
>  [Duis] => 1
>  [utem] => 1
>  [vel] => 3
>  [eum] => 1
>  [iriure] => 1
>  [in] => 5
>  [hendrerit] => 1
>  [vulputte] => 0
>  [velit] => 1
>  [esse] => 1
>  [molestie] => 1
>  [illum] => 1
>  [eu] => 5
>  [feugit] => 0
>  [null] => 2
>  [fcilisis] => 0
>  [t] => 39
>  [vero] => 1
>  [eros] => 1
>  [et] => 5
>  [ccumsn] => 0
>  [ius] => 1
>  [odio] => 1
>  [dignissim] => 1
>  [qui] => 3
>  [blndit] => 0
>  [present] => 0
>  [lupttum] => 0
>  [zzril] => 1
>  [delenit] => 1
>  [ugue] => 1
>  [duis] => 1
>  [te] => 4
>  [fcilisi] => 0
> )
>
> Which is the word and it total occurrence in the text... Now I want to
> sort it from the highest values to the lowest... and then return a
> keyword string as:
>
> $keywords = 'dolor,t,eu,te,in';
>
> Got it?
>
> Thanks,
> Bruno B B Magalhaes
>
> On Nov 5, 2004, at 7:42 PM, M. Sokolewicz wrote:
>
>> Bruno b b magalhães wrote:
>>
>>> Hi People,
>>> well, I am building a very sophisticated(?) CMS, and I am thinking to
>>> implement a keyword automatically generation function... I thought on
>>> the following structure:
>>> ==
>>> $submited_text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing
>>> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
>>> aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud
>>> exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea
>>> commodo consequat. Duis autem vel eum iriure dolor in hendrerit in
>>> vulputate velit esse molestie consequat, vel illum dolore eu feugiat
>>> nulla facilisis at vero eros et accumsan et iusto odio dignissim qui
>>> blandit praesent luptatum zzril delenit augue duis dolore te feugait
>>> nulla facilisi. ';
>>> generate_keywords($submited_text);
>>> function generate_keywords($text)
>>> {
>>> if(isset($text) && $text != '')
>>> {
>>> $words_to_ignore = array('/a/',
>>> '/to/',
>>> '/of/',
>>> '/from/'
>>> );
>>> $words =
>>> str_word_count(preg_replace($words_to_ignore,'',$text),1);
>>> foreach($words as $var=>$val)
>>> {
>>> $total[$val] = substr_count($text,$val);
>>> }
>>>}
>>> }
>>> =
>>> How can I sort the resulting array by value, without loosing its
>>> relations.
>>> Is there a faster way of doing this?
>>> Regards,
>>> Bruno B B Magalhaes
>> Yes!!! DO NOT USE REGEXPS WHEN YOU DON'T NEED THEM! :) (not to be
>> rude, but you *really* don't need them. You're doing SIMPLE
>> str-replacements, which goes at LEAST a factor 20 faster using
>> str_replace thant using *any* regexp function.)
>>
>> Just remember the following:
>> from fastest to slowest:
>> str_replace
>> str_ireplace
>> preg_replace
>> ereg_replace
>> eregi_replace
>>
>> If you're not doing any regexp magic, use str_replace (or str_ireplace
>> as of PHP 5). As quotes from the str_replace section of the PHP
>> manual:
>> [snip]If you don't need fancy replacing rules (like regular
>> expressions), you should always use this function instead of
>> ereg_replace() or preg_replace().[/snip].
>>
>> Also, what does:
>> [snip]$words =
>> str_word_count(preg_replace($words_to_ignore,'',$text),1);[/snip] do.
>> The result is not used after storing it, nor is it returned in any
>> way...?
>>
>> Now, at the end you have the $total array, and you discard it at the
>> end... how... useful? (void return)
>>
>> hope those remarks help you, and if you consider me rude, just blame
>> it on a very early shift I had today
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit

RE: [PHP] Re: Passing values from a new window

2004-11-05 Thread Vail, Warren
That foot sticking out of his monitor was his choice

Warren Vail


> -Original Message-
> From: Matthew Sims [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 05, 2004 2:08 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Re: Passing values from a new window
> 
> 
> > [snip]
> > Is there a place where I can view some examples of using 
> JavaScript? 
> > [/snip]
> >
> > A. Type http://www.google.com in your browser's address bar 
> or click 
> > on the handy link provided. If push comes to shove, cut and 
> paste the 
> > address into your browser's address bar. 2. Carefully and 
> thoughtfully 
> > type "JavaScript examples" in the text box that appears. If 
> push comes 
> > to shove, cut and paste the text into the text box that appears.
> > III. Click on the button that reads "Google Search"
> >
> > Thousands of examples will be yours to behold.
> >
> > :7)
> 
> >
> 
> Can you pick one for me?
> 
> ;)
> 
> -- 
> --Matthew Sims
> --
> 
> -- 
> 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: keywords generation

2004-11-05 Thread Bruno B B Magalhães
Hi,
no problem at all...
well, the script is incomplete cause I don´t know how to sort the 
$total array by value... for example:
Array
(
[Lorem] => 1
[ipsum] => 1
[dolor] => 5
[sit] => 1
[met] => 1
[consectetuer] => 1
[dipiscing] => 1
[elit] => 2
[sed] => 1
[dim] => 0
[nonummy] => 1
[nibh] => 1
[euismod] => 1
[tincidunt] => 1
[ut] => 5
[loreet] => 0
[dolore] => 3
[mgn] => 0
[liqum] => 0
[ert] => 0
[volutpt] => 0
[Ut] => 1
[wisi] => 1
[enim] => 1
[d] => 19
[minim] => 1
[venim] => 0
[quis] => 1
[nostrud] => 1
[exerci] => 1
[ttion] => 0
[ullmcorper] => 0
[suscipit] => 1
[lobortis] => 1
[nisl] => 1
[liquip] => 1
[ex] => 2
[e] => 49
[commodo] => 1
[consequt] => 0
[Duis] => 1
[utem] => 1
[vel] => 3
[eum] => 1
[iriure] => 1
[in] => 5
[hendrerit] => 1
[vulputte] => 0
[velit] => 1
[esse] => 1
[molestie] => 1
[illum] => 1
[eu] => 5
[feugit] => 0
[null] => 2
[fcilisis] => 0
[t] => 39
[vero] => 1
[eros] => 1
[et] => 5
[ccumsn] => 0
[ius] => 1
[odio] => 1
[dignissim] => 1
[qui] => 3
[blndit] => 0
[present] => 0
[lupttum] => 0
[zzril] => 1
[delenit] => 1
[ugue] => 1
[duis] => 1
[te] => 4
[fcilisi] => 0
)

Which is the word and it total occurrence in the text... Now I want to 
sort it from the highest values to the lowest... and then return a 
keyword string as:

$keywords = 'dolor,t,eu,te,in';
Got it?
Thanks,
Bruno B B Magalhaes
On Nov 5, 2004, at 7:42 PM, M. Sokolewicz wrote:
Bruno b b magalhães wrote:
Hi People,
well, I am building a very sophisticated(?) CMS, and I am thinking to 
implement a keyword automatically generation function... I thought on 
the following structure:
==
$submited_text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing 
elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna 
aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud 
exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea 
commodo consequat. Duis autem vel eum iriure dolor in hendrerit in 
vulputate velit esse molestie consequat, vel illum dolore eu feugiat 
nulla facilisis at vero eros et accumsan et iusto odio dignissim qui 
blandit praesent luptatum zzril delenit augue duis dolore te feugait 
nulla facilisi. ';
generate_keywords($submited_text);
function generate_keywords($text)
{
if(isset($text) && $text != '')
{
$words_to_ignore = array('/a/',
'/to/',
'/of/',
'/from/'
);
$words = 
str_word_count(preg_replace($words_to_ignore,'',$text),1);
foreach($words as $var=>$val)
{
$total[$val] = substr_count($text,$val);
}
   }
}
=
How can I sort the resulting array by value, without loosing its 
relations.
Is there a faster way of doing this?
Regards,
Bruno B B Magalhaes
Yes!!! DO NOT USE REGEXPS WHEN YOU DON'T NEED THEM! :) (not to be 
rude, but you *really* don't need them. You're doing SIMPLE 
str-replacements, which goes at LEAST a factor 20 faster using 
str_replace thant using *any* regexp function.)

Just remember the following:
from fastest to slowest:
str_replace
str_ireplace
preg_replace
ereg_replace
eregi_replace
If you're not doing any regexp magic, use str_replace (or str_ireplace 
as of PHP 5). As quotes from the str_replace section of the PHP 
manual:
[snip]If you don't need fancy replacing rules (like regular 
expressions), you should always use this function instead of 
ereg_replace() or preg_replace().[/snip].

Also, what does:
[snip]$words = 
str_word_count(preg_replace($words_to_ignore,'',$text),1);[/snip] do. 
The result is not used after storing it, nor is it returned in any 
way...?

Now, at the end you have the $total array, and you discard it at the 
end... how... useful? (void return)

hope those remarks help you, and if you consider me rude, just blame 
it on a very early shift I had today

--
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: Passing values from a new window

2004-11-05 Thread Greg Donald
On Fri, 5 Nov 2004 13:36:08 -0800, Vail, Warren <[EMAIL PROTECTED]> wrote:
> I can recommend http://www.hotscripts.com (the javascript section).

I forgot about my handy dandy google search script:

> ./google.pl javascript 10
Result:
http://javascript.internet.com/
http://www.javascript.com/
http://javascriptkit.com/
http://www.webreference.com/js/
http://www.w3schools.com/js/default.asp
http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/
http://www.geocities.com/SiliconValley/7116/
http://www.dynamicdrive.com/
http://webdeveloper.earthweb.com/webjs/
http://www.javascriptsearch.com/


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Problem with fopen(...) - "No error"??

2004-11-05 Thread Pankaj Kafley
Can you be more specific ? I actually had the same sort of problem
once but maybe it is not the same. But anyways I was getting null
everytime until I change $_FILES variable to $HTTP_POST_FILES. As by
suggested by someone else here.

Regards 


On Fri, 5 Nov 2004 21:08:17 +0100, Arty <[EMAIL PROTECTED]> wrote:
> I'm working against a table without problems, that is, as long as I insert and 
> retrieve texts and numerical values from various fields. However, I'm also using a 
> table for images, but I can't upload files correctly. This is the error I get :
> 
> Warning: fopen("", "r") - No error in c:\code\wengine\aey.php on line 130
> 
> Warning: fread(): supplied argument is not a valid File-Handle resource in 
> c:\code\wengine\aey.php on line 131
> 
> I have no clue what's the problem. I checked register_globals (on) but then again, 
> that shouldn't matter 'cause I'm using the $_FILES variable to access the file 
> information. Obviously, PHP thinks otherwise. It seems (from the warning "fopen("", 
> "r")" above), that even so, $_FILES[userfile][tmp_name] is not recognized and just 
> interpretated as null. I've tried $_FILES[userfile][name] also, but the same error 
> occurs. The second error is obviously just an effect from the first, so what am I 
> doing wrong here?? Any tips appreciated!
> 
> Thanks,
> Arty
> 
>

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



[PHP] Re: Initializing variables

2004-11-05 Thread M. Sokolewicz
Stuart Felenstein wrote:
I'm reading PHP security paper by Chris Shiflett. 
Trying to figure out what is meant by first
initializing a variable.  
Now, just for the record, I'm not completely dumb.
I know you can start with a 
$var = 2

What I want to know is if the variable assignment is
unknown, as in a user form.
Would I then just initialize the variables to 0 ?
Stuart
test it using at least isset(), and after that do some sanity checks to 
make sure the user didn't input some bogus data

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


Re: [PHP] Re: Passing values from a new window

2004-11-05 Thread Greg Donald
On Fri, 5 Nov 2004 15:30:43 -0600, Jay Blanchard
<[EMAIL PROTECTED]> wrote:
> Thousands of examples will be yours to behold.

14.8 million from where I sit.

I'm tired of all your inaccurate answers Jay.  :)


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] Re: Passing values from a new window

2004-11-05 Thread Matthew Sims
> [snip]
> Is there a place where I can view some examples of using JavaScript?
> [/snip]
>
> A. Type http://www.google.com in your browser's address bar or click on
> the handy link provided. If push comes to shove, cut and paste the
> address into your browser's address bar.
> 2. Carefully and thoughtfully type "JavaScript examples" in the text box
> that appears. If push comes to shove, cut and paste the text into the
> text box that appears.
> III. Click on the button that reads "Google Search"
>
> Thousands of examples will be yours to behold.
>
> :7)

>

Can you pick one for me?

;)

-- 
--Matthew Sims
--

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



[PHP] Initializing variables

2004-11-05 Thread Stuart Felenstein
I'm reading PHP security paper by Chris Shiflett. 
Trying to figure out what is meant by first
initializing a variable.  
Now, just for the record, I'm not completely dumb.
I know you can start with a 
$var = 2

What I want to know is if the variable assignment is
unknown, as in a user form.
Would I then just initialize the variables to 0 ?

Stuart

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



[PHP] Re: keywords generation

2004-11-05 Thread M. Sokolewicz
Bruno b b magalhães wrote:
Hi People,
well, I am building a very sophisticated(?) CMS, and I am thinking to 
implement a keyword automatically generation function... I thought on 
the following structure:

==
$submited_text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing 
elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna 
aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci 
tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo 
consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate 
velit esse molestie consequat, vel illum dolore eu feugiat nulla 
facilisis at vero eros et accumsan et iusto odio dignissim qui blandit 
praesent luptatum zzril delenit augue duis dolore te feugait nulla 
facilisi. ';

generate_keywords($submited_text);
function generate_keywords($text)
{
if(isset($text) && $text != '')
{
$words_to_ignore = array('/a/',
'/to/',
'/of/',
'/from/'
);
$words = str_word_count(preg_replace($words_to_ignore,'',$text),1);
foreach($words as $var=>$val)
{
$total[$val] = substr_count($text,$val);

}
   
}
}
=

How can I sort the resulting array by value, without loosing its relations.
Is there a faster way of doing this?
Regards,
Bruno B B Magalhaes
Yes!!! DO NOT USE REGEXPS WHEN YOU DON'T NEED THEM! :) (not to be rude, 
but you *really* don't need them. You're doing SIMPLE str-replacements, 
which goes at LEAST a factor 20 faster using str_replace thant using 
*any* regexp function.)

Just remember the following:
from fastest to slowest:
str_replace
str_ireplace
preg_replace
ereg_replace
eregi_replace
If you're not doing any regexp magic, use str_replace (or str_ireplace 
as of PHP 5). As quotes from the str_replace section of the PHP manual:
[snip]If you don't need fancy replacing rules (like regular 
expressions), you should always use this function instead of 
ereg_replace() or preg_replace().[/snip].

Also, what does:
[snip]$words = 
str_word_count(preg_replace($words_to_ignore,'',$text),1);[/snip] do. 
The result is not used after storing it, nor is it returned in any way...?

Now, at the end you have the $total array, and you discard it at the 
end... how... useful? (void return)

hope those remarks help you, and if you consider me rude, just blame it 
on a very early shift I had today

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


RE: [PHP] Re: Passing values from a new window

2004-11-05 Thread Vail, Warren
I can recommend http://www.hotscripts.com (the javascript section).

Warren Vail


> -Original Message-
> From: Todd Cary [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 05, 2004 1:17 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Passing values from a new window
> 
> 
> Is there a place where I can view some examples of using JavaScript?
> 
> Todd
> 
> Todd Cary wrote:
> 
> > I have a button that creates a new window.  The surfer may 
> enter data 
> > in
> > the new window, and if he does, when the window is closed 
> by the surfer, 
> > can the information update fields on the original page - 
> the page/window 
> > from which the new window was created?
> > 
> > I have seen instances where the surfer can open a new window to get
> > email addresses and these addresses appear in the first window.
> > 
> > Todd
> 
> -- 
> 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] How to display a 'please wait' message whilst processing?

2004-11-05 Thread Brent Clements
I would suggest using the PEAR Package html_progress available at your
friendly neighborhood pear repository mirror.

You can extend the class to work as needed and it uses the observer pattern
to do it's magic.

There are other ways to do this but html_progress is the simplest way to get
you up and going.

Brent Clements
Innovative PHP Development Company
::a division of Im-Online, LLC


- Original Message - 
From: "Brent Baisley" <[EMAIL PROTECTED]>
To: "Graham Cossey" <[EMAIL PROTECTED]>
Cc: "Php-General" <[EMAIL PROTECTED]>
Sent: Friday, November 05, 2004 2:03 PM
Subject: Re: [PHP] How to display a 'please wait' message whilst processing?


> I've read of solutions on how to do this, but can't remember where. You
> will probably need to search the message archives. You can pretty much
> forget about the flush() command though, browsers don't handle it the
> same way. For instance, Internet Explorer won't display anything until
> it has either the whole page or a certain amount of data (something
> like 24K). Also, I don't think any browser will display anything unless
> all the html tags are closed (i.e. ...).
>
> I think one solution was to use CSS and DHTML to display the wait
> message as a separate page in a  on the current page. Once the
> processing is done, the page will finished loading and the wait message
> will be hidden. Unfortunately, I don't think you can use this technique
> without javascript. But, I think it will work if javascript is not
> enabled, the user just won't see the wait message.
>
>
> On Nov 5, 2004, at 11:50 AM, Graham Cossey wrote:
>
> >
> > [snip]
> >> On a number of sites a message and/or graphic is displayed asking you
> >> to
> >> wait or be patient whilst some processing is being performed to
> >> compose the
> >> next page.
> >>
> >> How are these done within PHP scripts?
> >> Could output buffering be used for this purpose?
> >> For example is it possible to do something like:
> >>
> > [snip]
> >
> > Does anyone have any ideas on this?
> >
> > I do not really want to use META refresh as my understanding is that
> > this
> > either reloads the same page (loop?) or a new page, which I don't see
> > working as I want the "Please wait.." to remain until the processing
> > has
> > finished, not for a fixed period of time as the report may take 10
> > seconds
> > or one minute to complete running.
> >
> > I want to avoid Javascript if at all possible, as I cannot guarantee it
> > being available on the client.
> >
> > I have managed to use flush() to display some text, but after
> > processing (or
> > sleep) I cannot 'overwrite' this only add to it.
> >
> > Any help much appreciated...
> >
> > Graham
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> -- 
> Brent Baisley
> Systems Architect
> Landover Associates, Inc.
> Search & Advisory Services for Advanced Technology Environments
> p: 212.759.6400/800.759.0577
>
> -- 
> 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] Syntax highlighting of odd language

2004-11-05 Thread M. Sokolewicz
Aaron Gould wrote:
Bruno B B Magalhães wrote:
$code = 'function what() { do oddname; %oddsyntax }';
function highlight_code($code)
{
$oddsyntax = array('oddsyntax','oddsyntax2','oddsyntax3');
for($i = 0; $i <= count($oddsyntax)-1; $i++)
{
$highlighted_code = eregi_replace($oddsyntax[$i],''.$oddsyntax[$i].'',$code);
}
return $code;
}

Hi Bruno...
I tried your sample, but it doesn't seem to work.  I do however see what 
you're getting at.

Perhaps I need to experiment with the eregi_replace commands (or other 
regex commands) a bit.

Thanks,
for what Bruno showed you, you definitly don't need regexps. That 
example doesn't use regular expressions in case you didn't notice, so 
would work just as well with a simple str_replace.

Now, the problem with such a "solution" is the following. Imagine you 
have the following keywords:
include
require
in
of
typof

now, when you replace include with include, it'll go on, and also replace all 
instances of in, so you'll end up with things like include 
(very ugly).

*a* way to get around that is by using word boundries around the keyword 
to be replaced (eg. preg_replace('\(\W|^)+('.$highlight[$i].')(\W|$)\i', 
'$1$2$3') )

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


RE: [PHP] Re: Passing values from a new window

2004-11-05 Thread Jay Blanchard
[snip]
Is there a place where I can view some examples of using JavaScript?
[/snip]

A. Type http://www.google.com in your browser's address bar or click on
the handy link provided. If push comes to shove, cut and paste the
address into your browser's address bar. 
2. Carefully and thoughtfully type "JavaScript examples" in the text box
that appears. If push comes to shove, cut and paste the text into the
text box that appears.
III. Click on the button that reads "Google Search"

Thousands of examples will be yours to behold.

:7)

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



Re: [PHP] Syntax highlighting of odd language

2004-11-05 Thread Aaron Gould
Bruno B B Magalhães wrote:
$code = 'function what() { do oddname; %oddsyntax }';
function highlight_code($code)
{
$oddsyntax = array('oddsyntax','oddsyntax2','oddsyntax3');

for($i = 0; $i <= count($oddsyntax)-1; $i++)
{
$highlighted_code = eregi_replace($oddsyntax[$i],''.$oddsyntax[$i].'',$code);
}
return $code;
}
Hi Bruno...
I tried your sample, but it doesn't seem to work.  I do however see what 
you're getting at.

Perhaps I need to experiment with the eregi_replace commands (or other 
regex commands) a bit.

Thanks,
--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Passing values from a new window

2004-11-05 Thread Todd Cary
Is there a place where I can view some examples of using JavaScript?
Todd
Todd Cary wrote:
I have a button that creates a new window.  The surfer may enter data in 
the new window, and if he does, when the window is closed by the surfer, 
can the information update fields on the original page - the page/window 
from which the new window was created?

I have seen instances where the surfer can open a new window to get 
email addresses and these addresses appear in the first window.

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


Re: [PHP] Passing values from a new window

2004-11-05 Thread Greg Donald
On Fri, 05 Nov 2004 13:03:31 -0800, Todd Cary <[EMAIL PROTECTED]> wrote:
> I have seen instances where the surfer can open a new window to get
> email addresses and these addresses appear in the first window.


Javascript.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Passing values from a new window

2004-11-05 Thread Chris
That is usually done with Javascript, though if you've got a session 
running, you can update session variables, then use Javascript to 
refresh the source page.

For the most part I'd recommend a purely Javascript solution, but in 
some cases Using session variables/cookies/database might make more sense.

Chris
Todd Cary wrote:
I have a button that creates a new window.  The surfer may enter data 
in the new window, and if he does, when the window is closed by the 
surfer, can the information update fields on the original page - the 
page/window from which the new window was created?

I have seen instances where the surfer can open a new window to get 
email addresses and these addresses appear in the first window.

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


[PHP] keywords generation

2004-11-05 Thread Bruno B B Magalhães
Hi People,
well, I am building a very sophisticated(?) CMS, and I am thinking to 
implement a keyword automatically generation function... I thought on 
the following structure:

==
$submited_text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing 
elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna 
aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud 
exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea 
commodo consequat. Duis autem vel eum iriure dolor in hendrerit in 
vulputate velit esse molestie consequat, vel illum dolore eu feugiat 
nulla facilisis at vero eros et accumsan et iusto odio dignissim qui 
blandit praesent luptatum zzril delenit augue duis dolore te feugait 
nulla facilisi. ';

generate_keywords($submited_text);
function generate_keywords($text)
{
if(isset($text) && $text != '')
{
$words_to_ignore = array('/a/',
'/to/',
'/of/',
'/from/'
);
$words = str_word_count(preg_replace($words_to_ignore,'',$text),1);
foreach($words as $var=>$val)
{
$total[$val] = substr_count($text,$val);

}

}
}
=
How can I sort the resulting array by value, without loosing its 
relations.

Is there a faster way of doing this?
Regards,
Bruno B B Magalhaes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Syntax highlighting of odd language

2004-11-05 Thread Bruno B B Magalhães
Aaron,
why don't you use a very simle sintax like this one:
$code = 'function what() { do oddname; %oddsyntax }';
function highlight_code($code)
{
	$oddsyntax = array('oddsyntax','oddsyntax2','oddsyntax3');
	
	for($i = 0; $i <= count($oddsyntax)-1; $i++)
	{
		$highlighted_code = eregi_replace($oddsyntax[$i],''.$oddsyntax[$i].'',$code);
	}
	return $code;
}

echo highlight_code($code);
Regards,
Bruno B B Magalhães
On Nov 5, 2004, at 6:39 PM, Aaron Gould wrote:
Could any of you privide some leads in regard to highlighting syntax 
of an odd language?  I have a large amount of snippits of legacy code 
from our company's primary application. The code used is "BBx" (a 
variant of Basic).

I'm attempting to show this code on a web page, but with highlighting 
of keywords and variables/numbers.  I've already got a list of the 
language's 250-odd keywords in a file.

I saw a "Text_Highlighter" PEAR class, but that seems to only do a 
bunch of predefined popular languages (ie. SQL, PHP, C).

Please don't ruin my Friday afternoon and tell me I'll need to dig 
into regular expressions.  :)

--
Aaron Gould
Parts Canada - Web Developer
--
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] Passing values from a new window

2004-11-05 Thread Todd Cary
I have a button that creates a new window.  The surfer may enter data in 
the new window, and if he does, when the window is closed by the surfer, 
can the information update fields on the original page - the page/window 
from which the new window was created?

I have seen instances where the surfer can open a new window to get 
email addresses and these addresses appear in the first window.

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


[PHP] Re: Syntax highlighting of odd language

2004-11-05 Thread M. Sokolewicz
Aaron Gould wrote:
Could any of you privide some leads in regard to highlighting syntax of 
an odd language?  I have a large amount of snippits of legacy code from 
our company's primary application. The code used is "BBx" (a variant of 
Basic).

I'm attempting to show this code on a web page, but with highlighting of 
keywords and variables/numbers.  I've already got a list of the 
language's 250-odd keywords in a file.

I saw a "Text_Highlighter" PEAR class, but that seems to only do a bunch 
of predefined popular languages (ie. SQL, PHP, C).

Please don't ruin my Friday afternoon and tell me I'll need to dig into 
regular expressions.  :)
regexps are a minimum... What I'd suggest it so find a correctly working 
parser, which basically feeds your script with the info about what it 
encounters where. Eg using m4. (gnu.org/software/m4) But that's just my 
point of view :)

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


RE: [PHP] Multiple checkboxes and multiple textboxes [SOLVED]

2004-11-05 Thread Ryan A
Hey guys,
Thank you everyone who replied.

The below solution from Warren worked out great for me with a little
modification for my specific needs.

Cheers,
Ryan

> Hard code the array occurrence number in the checkbox and textbox names;
>  checked> somesite
> 

> The form will only return the checkboxes that are checked and the
> textboxes
>
> will return all textboxes (that is the nature of these input controls
> with
>
> most browsers);
>
>
>
> $urls = $_POST["url"];
>
> $temptexts = $_POST["txt"];
>
> Foreach($urls as $no => $val) {
>
> $txt[$no] = $temptxts[$no];
>
> }
>
>
>
> Now $txt contains only matching text fields.
>
>
>
> Hope this helps,
>
>
>
> Warren Vail
>
>
>
>
>
> > -Original Message-
>
> > From: Ryan A [mailto:[EMAIL PROTECTED]
>
> > Sent: Friday, November 05, 2004 11:28 AM
>
> > To: [EMAIL PROTECTED]
>
> > Subject: [PHP] Multiple checkboxes and multiple textboxes
>
> >
>
> >
>
> > Hi,
>

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



[PHP] Syntax highlighting of odd language

2004-11-05 Thread Aaron Gould
Could any of you privide some leads in regard to highlighting syntax of 
an odd language?  I have a large amount of snippits of legacy code from 
our company's primary application. The code used is "BBx" (a variant of 
Basic).

I'm attempting to show this code on a web page, but with highlighting of 
keywords and variables/numbers.  I've already got a list of the 
language's 250-odd keywords in a file.

I saw a "Text_Highlighter" PEAR class, but that seems to only do a bunch 
of predefined popular languages (ie. SQL, PHP, C).

Please don't ruin my Friday afternoon and tell me I'll need to dig into 
regular expressions.  :)

--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Multiple checkboxes and multiple textboxes

2004-11-05 Thread Ryan A
Hi Jay,
I modified your code slightly because I am working with 152 rows and the
output would be a _lot_

This is how i modified it:

 $url=$_POST['url'];
 $txt=$_POST['txt'];

for($i = 0; $i < count($txt); $i++){
if(("" != $url[$i]) && ("" != $txt[$i])){
//echo $url[$i] . " ". $txt[$i] . "\n";
echo $i . " ". $txt[$i] . "\n";
} else {
echo "".$i . " ". $txt[$i] . "\n";
}
}


I unchecked rows: 122,148,149,150

output I got:
0 0's text
1 1's text
.etc
149 149's text
150 150's text
151 151's text
152 152's text

ideas?

Thanks,
Ryan

On 11/5/2004 9:13:43 PM, Jay Blanchard ([EMAIL PROTECTED])
wrote:
> [snip]
>
> This didnt work, it just chops off the last x depending on how many were
>
> selected.
>
> [/snip]
>
>
>
> Hmreally? I was just able to do this with nary a problem. Chops
>
> off? Can you just echo out the results?
>
>
>
> for($i = 0; $i < count($url); $i++){
>
> if(("" != $url[$i]) && ("" != $txt[$i])){
>
> echo $url[$i] . " " $txt[$i] . "\n";
>
> } else {
>
> //it ain't OK
> }
> }
>
> --
> 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: Re: VOTE TODAY

2004-11-05 Thread -{ Rene Brehmer }-
Well, I definitely don't enjoy the 45 euro I have to pay for my 512 kbit 
SDSL ... the prices have halfed over the past 2 years, but it's still above 
and beyond what the quality of service deserves  but this is as cheap 
as it gets for SDSL here ... the ADSL is cheaper, but I need the high upload...

Rene
At 12:34 05-11-2004, Francisco M. Marzoa Alonso wrote:
That's true for Germany and France and probably another european 
countries, but in Spain by example we've just 512/128kbps paying the same 
that a french by 6Mbps/512kbps. Never mind, this dammed country continues 
being more the North of Africa than the South of Europe...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Multiple checkboxes and multiple textboxes

2004-11-05 Thread Jay Blanchard
[snip]
This didnt work, it just chops off the last x depending on how many were
selected.
[/snip]

Hmreally? I was just able to do this with nary a problem. Chops
off? Can you just echo out the results?

for($i = 0; $i < count($url); $i++){
if(("" != $url[$i]) && ("" != $txt[$i])){
echo $url[$i] . " " $txt[$i] . "\n";
} else {
//it ain't OK
}
}

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



Re: [PHP] How to display a 'please wait' message whilst processing?

2004-11-05 Thread Brent Baisley
I've read of solutions on how to do this, but can't remember where. You 
will probably need to search the message archives. You can pretty much 
forget about the flush() command though, browsers don't handle it the 
same way. For instance, Internet Explorer won't display anything until 
it has either the whole page or a certain amount of data (something 
like 24K). Also, I don't think any browser will display anything unless 
all the html tags are closed (i.e. ...).

I think one solution was to use CSS and DHTML to display the wait 
message as a separate page in a  on the current page. Once the 
processing is done, the page will finished loading and the wait message 
will be hidden. Unfortunately, I don't think you can use this technique 
without javascript. But, I think it will work if javascript is not 
enabled, the user just won't see the wait message.

On Nov 5, 2004, at 11:50 AM, Graham Cossey wrote:
[snip]
On a number of sites a message and/or graphic is displayed asking you 
to
wait or be patient whilst some processing is being performed to
compose the
next page.

How are these done within PHP scripts?
Could output buffering be used for this purpose?
For example is it possible to do something like:
[snip]
Does anyone have any ideas on this?
I do not really want to use META refresh as my understanding is that 
this
either reloads the same page (loop?) or a new page, which I don't see
working as I want the "Please wait.." to remain until the processing 
has
finished, not for a fixed period of time as the report may take 10 
seconds
or one minute to complete running.

I want to avoid Javascript if at all possible, as I cannot guarantee it
being available on the client.
I have managed to use flush() to display some text, but after 
processing (or
sleep) I cannot 'overwrite' this only add to it.

Any help much appreciated...
Graham
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Multiple checkboxes and multiple textboxes

2004-11-05 Thread Ryan A

Nope,
This didnt work, it just chops off the last x depending on how many were
selected.

Thanks,
Ryan

On 11/5/2004 8:46:27 PM, Jay Blanchard ([EMAIL PROTECTED])
wrote:
> [snip]
>
> These values will be entered into the database so I need proper
>
> "matching
> pairs" of URL and TXT
>
> [/snip]
>
>
>
> for($i = 0; $i < count($url); $i++){
>
> if(("" != $url[$i]) && ("" != $txt[$i])){
>
> //it is OK to put into database
>
> } else {
>
> //it ain't OK
> }
> }

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



[PHP] Problem with fopen(...) - "No error"??

2004-11-05 Thread Arty
I'm working against a table without problems, that is, as long as I insert and 
retrieve texts and numerical values from various fields. However, I'm also using a 
table for images, but I can't upload files correctly. This is the error I get :

Warning: fopen("", "r") - No error in c:\code\wengine\aey.php on line 130

Warning: fread(): supplied argument is not a valid File-Handle resource in 
c:\code\wengine\aey.php on line 131

I have no clue what's the problem. I checked register_globals (on) but then again, 
that shouldn't matter 'cause I'm using the $_FILES variable to access the file 
information. Obviously, PHP thinks otherwise. It seems (from the warning "fopen("", 
"r")" above), that even so, $_FILES[userfile][tmp_name] is not recognized and just 
interpretated as null. I've tried $_FILES[userfile][name] also, but the same error 
occurs. The second error is obviously just an effect from the first, so what am I 
doing wrong here?? Any tips appreciated!

Thanks,
Arty


RE: [PHP] Multiple checkboxes and multiple textboxes

2004-11-05 Thread Vail, Warren
Hard code the array occurrence number in the checkbox and textbox names;

 somesite 


The form will only return the checkboxes that are checked and the textboxes
will return all textboxes (that is the nature of these input controls with
most browsers);

$urls = $_POST["url"];
$temptexts = $_POST["txt"];
Foreach($urls as $no => $val) {
   $txt[$no] = $temptxts[$no];
}

Now $txt contains only matching text fields.

Hope this helps,

Warren Vail


> -Original Message-
> From: Ryan A [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 05, 2004 11:28 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Multiple checkboxes and multiple textboxes
> 
> 
> Hi,
> I have a form that has something like this:
> 
>  checked> somesite 
> 
> 
>  checked> somesite1 
> 
> 
>  checked> somesite2 
> 
> 
> As you can see from the above, theses a checkbox (url[]) 
> which holds the value of the URL and a textbox (txt[]) which 
> holds some description text, in the above there are only 3 
> rows but actually there are 200 per page. When the form is 
> submitted how do I make sure that if url[] is unchecked even 
> txt[] should not be taken?
> 
> These values will be entered into the database so I need 
> proper "matching pairs" of URL and TXT
> 
> Thanks,
> Ryan
> 
> -- 
> 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] Multiple checkboxes and multiple textboxes

2004-11-05 Thread Brent Baisley
You're close, but you want to use multidimensional arrays. So something 
like:






...

Obviously you can put that into a loop to generate how many you want 
instead of typing each one individually. It will then be simple to 
match your array items since your array  will have x rows and two 
columns: url, txt. Just keep in mind that some rows rows will have two 
columns and some one, depending on if they filled out both fields.

On Nov 5, 2004, at 2:28 PM, Ryan A wrote:
Hi,
I have a form that has something like this:

somesite


somesite1


somesite2

As you can see from the above, theses a checkbox (url[]) which holds 
the
value of the URL and a textbox (txt[]) which holds some description 
text, in
the above there are only 3 rows but actually there are 200 per page. 
When
the form is submitted how do I make sure that if url[] is unchecked 
even
txt[] should not be taken?

These values will be entered into the database so I need proper 
"matching
pairs" of URL and TXT

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Multiple checkboxes and multiple textboxes

2004-11-05 Thread Jay Blanchard
[snip]
These values will be entered into the database so I need proper
"matching
pairs" of URL and TXT
[/snip]

for($i = 0; $i < count($url); $i++){
if(("" != $url[$i]) && ("" != $txt[$i])){
//it is OK to put into database
} else {
//it ain't OK
}
}

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



[PHP] Multiple checkboxes and multiple textboxes

2004-11-05 Thread Ryan A
Hi,
I have a form that has something like this:


somesite



somesite1



somesite2


As you can see from the above, theses a checkbox (url[]) which holds the
value of the URL and a textbox (txt[]) which holds some description text, in
the above there are only 3 rows but actually there are 200 per page. When
the form is submitted how do I make sure that if url[] is unchecked even
txt[] should not be taken?

These values will be entered into the database so I need proper "matching
pairs" of URL and TXT

Thanks,
Ryan

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



Re: [PHP] Re: PHP - MCRYPT - CBC - IDEA

2004-11-05 Thread Ben Ramsey
Frantzcy Paisible wrote:
  But I've been thru this one, in and out, and it's exactly one of those that say 
"MCRYPT_IDEA (non-free)"  but not more.
Have you used mcrypt ? with cbc and IDEA ?
Sorry about that. I must have read your message wrong. I have used 
mcrypt, but not with IDEA or cbc. Are you locked into that particular 
cipher? Can you not use a different one? (I suppose you can't since all 
your existing passwords would use the old cipher.)

You could continue to use your old Perl script by using exec() or 
passthru() from PHP to call it, but, then again, your code could end up 
on thephpwtf.com, opening you to scorn and ridicule from the few who 
deem themselves worthy enough to criticize everyone's code.

Have you checked out libmcrypt, installed it, and tried it? It looks 
like they've implemented the IDEA algorithm in libmcrypt. I could be 
wrong, since I've never used it. 

--
Ben Ramsey
Zend Certified Engineer
http://benramsey.com
---
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie pattern question

2004-11-05 Thread -{ Rene Brehmer }-
At 19:59 05-11-2004, Greg Donald wrote:
On Fri, 5 Nov 2004 20:55:00 +0200, Phpu <[EMAIL PROTECTED]> wrote:
>   if(ereg("^[a-zA-Z0-9_]{2,30}$", $name)) {
if(ereg("^[a-zA-Z0-9_\ ]{2,30}$", $name)) {
If you use ereg, use [[:blank:]] instead of an actual space, that allows 
for tabs and other variants too

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


Re: [PHP] Newbie pattern question

2004-11-05 Thread Frantzcy Paisible
Hi,

  Try adding a space([a-zA-Z0-9_] => [a-zA-Z0-9_ ]), John Doe is false but JohnDoe 
would be true in the case below

Frantzcy

On Fri, 5 Nov 2004 20:55:00 +0200,"Phpu" <[EMAIL PROTECTED]> wrote:

> Hi,
> I have this function
> 
>  function validate_name($name) {
> 
>   if(ereg("^[a-zA-Z0-9_]{2,30}$", $name)) {
> 
>return true;
> 
>   } else {
> 
>return false;
> 
>   }
> 
>  }
> 
> If i enter a name like John for exemple everything is ok but if i
> enter John Doe the function return false.
> 
> Where is the problem?
> 
> Thanks
> 


-- 

Unreachability is bliss
-- 

Sleep, sometime in MAY... if lucky

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



Re: [PHP] PHP - MCRYPT - CBC - IDEA

2004-11-05 Thread Greg Donald
On Fri, 5 Nov 2004 13:10:43 -0500, Frantzcy Paisible
<[EMAIL PROTECTED]> wrote:
> I need to recreate this perl script in php :

I'm not sure if you realize it, but you can call the Perl script from
PHP using system().


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



[PHP] Re: Newbie pattern question

2004-11-05 Thread Matthew Weier O'Phinney
* Phpu <[EMAIL PROTECTED]>:
> I have this function
>
>  function validate_name($name) {
>
>   if(ereg("^[a-zA-Z0-9_]{2,30}$", $name)) {
>
>return true;
>
>   } else {
>
>return false;
>
>   }
>
>  }
>
> If i enter a name like John for exemple everything is ok but if i enter =
> John Doe the function return false.

You need to add a space to your character class:

if (ereg("^[a-zA-Z0-9_ ]{2,30}$", $name)) {
return true;
}

However, note also: pattern matching such as this is faster and more
flexible if you use the preg_* functions instead of the ereg_*
functions:

if (preg_match('/^[a-z0-9_ ]{2,30}$/i', $name)) {
return true;
}

will perform faster, and gives you case insensitivity with the 'i'
switch following the regexp.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Newbie pattern question

2004-11-05 Thread Greg Donald
On Fri, 5 Nov 2004 20:55:00 +0200, Phpu <[EMAIL PROTECTED]> wrote:
>   if(ereg("^[a-zA-Z0-9_]{2,30}$", $name)) {

if(ereg("^[a-zA-Z0-9_\ ]{2,30}$", $name)) {

Need to allow spaces in the regular expression.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Re: PHP - MCRYPT - CBC - IDEA

2004-11-05 Thread Frantzcy Paisible

Thanx Ben,

  But I've been thru this one, in and out, and it's exactly one of those that say 
"MCRYPT_IDEA (non-free)"  but not more.

Have you used mcrypt ? with cbc and IDEA ?

Frantzcy


On Fri, 05 Nov 2004 13:30:04 -0500,Ben Ramsey <[EMAIL PROTECTED]>
wrote:

> Frantzcy Paisible wrote:
> >I'm looking for some information, rearging mcrypt.
> > Now, I've been through the normal channels, I've been going in in
> > cercles.
> 
> > even a simple "Look this way" would help.
> 
> Look this way: 
> :-)
> 
> -- 
> Ben Ramsey
> Zend Certified Engineer
> http://benramsey.com
> 
> ---
> Atlanta PHP - http://www.atlphp.org/
> The Southeast's premier PHP community.
> ---
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 

Sleep, sometime in MAY... if lucky

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



[PHP] Newbie pattern question

2004-11-05 Thread Phpu
Hi,
I have this function

 function validate_name($name) {

  if(ereg("^[a-zA-Z0-9_]{2,30}$", $name)) {

   return true;

  } else {

   return false;

  }

 }

If i enter a name like John for exemple everything is ok but if i enter John Doe the 
function return false.

Where is the problem?

Thanks


[PHP] troubleshooting bulk email script

2004-11-05 Thread Redmond Militante
hi

i have a script that loops through a mysql database, and extracts usernames and email 
addresses, then uses this information to send emails

the code for the (i think) relevant part of the script is below.  i'm having a couple 
of problems with this script -

the main one being that bulk email messages seem to get 'cut off' at a certain point 
in the message.  for ex., a message that is 3 paragraphs long arrives at the recipient 
with the last paragraph cut off.  the problem seems to be random, and doesn't seem to 
have a relation to how many email addresses you happen to be sending to at a 
particular time.  it does, i think have something to do with cutting and pasting text 
into my email sender form from microsoft word.  the problem also seems to be sporadic 
- i.e., i have a hard time reproducing it, but my users don't seem to have any trouble.

another problem i have is weird characters showing up like '\222' or '\224' in the 
body of the email when text is cut and pasted from microsoft word.  this is not as big 
of a problem as the emails getting cut off.  i'm pasting the mail() loop from the 
script below, if anyone has any suggestions.  it's really hard to troubleshoot this 
one since i'm not sure if it has to do with the number of emails that are being sent 
out at once.  i only have a limited number of test email recipient accounts, the rest 
in the database are all real emails that i wouldn't want to send test emails to.

thanks for any suggestions, code is below:

$sql = "select * from table where name=... order by id";
//Query for the total number of rows
$getTotalRows = mysql_query($sql, $conn);
$totalRowsNum = mysql_num_rows($getTotalRows);
//Append the limit and offset to the sql
$sql.=" Limit ".$_GET['thisOffset'].",$recordLimit";
//Query and fetch array with the limit and offset
$query = mysql_query($sql, $conn);
while ($result=mysql_fetch_array($query)){
//Increment the line index by 1
$_GET['lineIndex']++;
if (floor($_GET['lineIndex']/2) == ($_GET['lineIndex']/2)) 
{ 
echo "";
$userid=$result['userid'];
$firstname=$result['firstname'];
$middlename=$result['middlename'];
$lastname=$result['lastname'];
$address1=$result['address1'];
$address2=$result['address2'];
$address3=$result['address3'];
$city=$result['city'];
$state=$result['state'];
$zip=$result['zip'];
$country=$result['country'];
$phone1=$result['phone1'];
$phone2=$result['phone2'];
$email=$result['email'];
$dateregistered=$result['dateregistered'];
$letters_sent=$result['letters_sent'];
$status=$result['status'];
   
 
   
 
$to = "\"$lastname, $firstname $middlename\" <$email>";
$from = "\"".$_REQUEST['str_from_name']."\" <".$_REQUEST['str_from_email'].">";
$to = str_replace("\\'", "'", $to);
$from = str_replace("\\'", "'", $from);
$_REQUEST['str_subject'] = str_replace("\\'", "'", $_REQUEST['str_subject']);
//$message = str_replace("\'", "'", $_REQUEST['str_message']);
$message =  $str_message;
mail($to, $_REQUEST['str_subject'], $message, "From: $from\nX-Mailer: System33r");



-- 
Redmond Militante
Software Engineer / Medill School of Journalism
FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386
12:15PM  up 2 days, 21:22, 1 user, load averages: 0.02, 0.05, 0.02


pgpes0I3Gh5yI.pgp
Description: PGP signature


[PHP] Re: PHP - MCRYPT - CBC - IDEA

2004-11-05 Thread Ben Ramsey
Frantzcy Paisible wrote:
   I'm looking for some information, rearging mcrypt.
Now, I've been through the normal channels, I've been going in in cercles.

even a simple "Look this way" would help.
Look this way: 
:-)
--
Ben Ramsey
Zend Certified Engineer
http://benramsey.com
---
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP - MCRYPT - CBC - IDEA

2004-11-05 Thread Frantzcy Paisible
Hi all,

   I'm looking for some information, rearging mcrypt.
Now, I've been through the normal channels, I've been going in in cercles.


I need to recreate this perl script in php :

sub cryptage
{
  use Crypt::CBC; 
  $key = "SuperFreak"; 
  my $action = shift; 
  my $string = shift; 

  my $c = new Crypt::CBC($key,"IDEA"); 
  if ($action == 1) { #- crypt 
return $c->encrypt_hex($string); 
  } else { #- decrypt 
return $c->decrypt_hex($string   ); 
}


As you can notice it uses CBC, and IDEA.

MCRYPT_IDEA (non-free) is all I get from the net, where can I purchase it ?
Or better yet, how can I recreate this function in PHP ?

even a simple "Look this way" would help.

Thanx

Frantzcy


-- 

Sleep, sometime in MAY... if lucky

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



RE: [PHP] SQL-Injection, XSS and Hijacking

2004-11-05 Thread Pedro Iran Mendez Perez
Hello Mark, Where can I find these articles that you talk? do you have a URL
for those articles?

Thank you :)

 =
"?Acaso se olvidara la mujer de su bebe, y dejara de compadecerse del hijo
de su vientre? Aunque ellas se olviden, yo no me olvidare de ti"

Isa 40:27
 =

Atte   Pedro Iran Mendez Perez


-Mensaje original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Enviado el: Miercoles, 03 de Noviembre de 2004 04:25 p.m.
Para: [EMAIL PROTECTED]
Asunto: [PHP] SQL-Injection, XSS and Hijacking


Hi,

I read now quite a lot of articles about SQL-Injection,
XSS and session hijacking in a hopefully appropriate way.

As I understand the function addslashes(),quote_meta()
and mysql_real_escape_string() are to avoid SQL Injection
e.g. in order to use page_sliding with entered POST data
over forms with $_REQUEST parameters, while strip_tags(),
htmlentities() and utf8_decode() is useful to have a
clean output within the browser by not having arbitrary
code within.

For a session authentication PEAR::Auth is used.

I just wanted to ask if there's more to take care of.

--
Best Regards,

Mark

--
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] getting a number range from user input.. (weight)

2004-11-05 Thread Murray @ PlanetThoughtful
[snippage]

> In theory perhaps, the "better" approach kind of depends on if he is
> looking
> up the cost of one shipment or many.  Databases, like you indicated, are
> optimized for looking up this kind of information from large record sets
> on
> a hard drive and a good database will try to cache as much of their last
> result as possible for use in the next query, but once cache cannot be
> used,
> performance drops dramatically.  For one lookup on an single order, the
> direct DB approach probably would produce faster results, but I doubt the
> user would be able to see the performance difference on one order (can you
> see a savings of 200 milliseconds), and for processing multiple shipments,
> avoiding multiple db lookups would produce faster results.

[snippage]

All valid observations. My point, if I have one, is that many people
overlook the fact that database servers are not just a convenient place to
store data, but also usually the best tool for criteria-based data
selection; best summed up by the phrase: "Why return unnecessary rows when
you can return the right row(s)?" This implies sensible table design, and
for large recordsets, heavily relies on appropriate indexing, but the truism
remains: any work you can get your db server to do prior to working on the
recordset in your scripting language is usually A Good Thing. Note the use
of the conditional term 'usually'.

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

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



Re: [PHP] images doesn't seem to cache

2004-11-05 Thread Marek Kilimajer
anders thoresson wrote:
Hi,
I put all my images outside the web root, the prevent direct access, and 
then access them with a -tag like this:


where fnc_get_image.php is:
// Check if user is logged in
require_once 'global_includes.php';
$user =& new User();
// Get path to image for display
$path = $_GET['path'];
// Prepend path - prevents misuse
$pPath = "/home/username/albums/" . $path;
header("Cache-Control: private");
$extention = substr($path, -3);
if ($extention == "jpg")
header("Content-type: image/jpeg");
if ($extention == "gif")
header("Content-type: image/gif");
if ($extention == "bmp")
header("Content-type: image/bmp");
if ($extention == "png")
header("Content-type: image/png");
readfile("$pPath");
There is one slight problem though: To my eyes, it looks like the images
are downloaded from the server every time. Is this a side effect of this
method or is it just a optical illusion? Is there a way to tell for sure
if the image is downloaded or displayed from the browser cache?
I've tried with and without a Cache-Control header. It doesn't seem to 
do any difference at all.
Your eyes are fine. You need to check for If-Modified-Since header, if 
the time is older than file modification time (filemtime()) send 
Last-Modified header and the image, else send 304 Not Modified response.

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


Re: [PHP] Configure help / advise

2004-11-05 Thread Greg Donald
On Fri, 5 Nov 2004 15:53:16 -, Dave Carrera <[EMAIL PROTECTED]> wrote:
> My mysql server is on another box so what file is needed for the php
> configure ?

I think the MySQL libs and dev files needed to add MySQL support to
PHP are in the MySQL 'server' port under FreeBSD.

For example: /usr/ports/databases/mysql41-server

> Using FreeBSD 4.7 stable if that help (don't want to use the port)

To each his own, but it seems the easiest way to me.

cd /usr/ports/databases/mysql41-server
make install clean


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Send XHTML emails with images

2004-11-05 Thread Manuel Lemos
Hello,
On 11/05/2004 12:02 PM, Gery Duyck wrote:
I've made an XHTML page to be send as a rich e-mail so I can do more as just
tekst.
Everything is fine, except for the images.
In the source code I say the images are like http://www.domain.com/pic.jpg"; alt="" />
but wen I send the email, I can't see the images in Outlook Express or
Hotmail (in browser).
The problem is that you can't send messages with only an HTML part. You 
are required to send both the HTML part and an alternative plain text 
part for mail programs that do not support HTML messages. If you send 
HTML only messages, some systems classify your message as spam and 
refuse to show any images that it references.

What you need to do is to compose multipart/alternative messages. If you 
do not know how to do that, you may want to try this class that comes 
with an example of sending HTML messages with an alternative text part. 
It may also embed the images in the message, which is a safer solution 
if you want your messages to reach the recipients and show the images.

http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Configure help / advise

2004-11-05 Thread Dave Carrera

Hi List,

I want to configure a new php4 (latest stable) but include some extra
modules

Currently I have the standard mods plus GD using this for configure

'./configure --with-apxs=/usr/local/apache/bin/apxs --with-gd=/usr/local
--prefix=/usr/local' 

I want to add SSL, and all other mods that might be useful and I note that
mysql is not bundled.

My mysql server is on another box so what file is needed for the php
configure ?

Any help / advise is welcome

Using FreeBSD 4.7 stable if that help (don’t want to use the port)

Thank you in advance

Dave C

-- 
UK Web Hosting @ http://www.ephgroup.com  

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004
 

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



RE: [PHP] How to display a 'please wait' message whilst processing?

2004-11-05 Thread Graham Cossey

[snip]
> On a number of sites a message and/or graphic is displayed asking you to
> wait or be patient whilst some processing is being performed to
> compose the
> next page.
>
> How are these done within PHP scripts?
> Could output buffering be used for this purpose?
> For example is it possible to do something like:
>
[snip]

Does anyone have any ideas on this?

I do not really want to use META refresh as my understanding is that this
either reloads the same page (loop?) or a new page, which I don't see
working as I want the "Please wait.." to remain until the processing has
finished, not for a fixed period of time as the report may take 10 seconds
or one minute to complete running.

I want to avoid Javascript if at all possible, as I cannot guarantee it
being available on the client.

I have managed to use flush() to display some text, but after processing (or
sleep) I cannot 'overwrite' this only add to it.

Any help much appreciated...

Graham

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



Re: [PHP] Re: $_SERVER['HTTP_REFERER'] does not work

2004-11-05 Thread Jason Wong
On Friday 05 November 2004 11:14, Michelle Konzack wrote:

> I do not like to have linked my PHP Scripts/Pages from outside like
> from GOOGLE. I do not know how GOOGLE know about my "onlinestore"
> because it exist since one week... But gotten around 3700 hits from
> "googlebot". 3700 Hits for nothing...

If it's only googlebot you're trying to keep out then create an appropriate 
robots.txt, googlebot should respect it as would most legitimate 
crawlers/spiders.

-- 
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
--
/*
Men have as exaggerated an idea of their rights as women have of their wrongs.
  -- E.W. Howe
*/

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



Re: [PHP] Re: Problems with MySql

2004-11-05 Thread - Edwin -
Hi,

On Fri, 05 Nov 2004 12:55:17 -0200
Oliver <[EMAIL PROTECTED]> wrote:

> Today I installed EasyPHP without any problems, but when
> I updated the version of php, Mysql stoped.*

Okay. So, how did you update it?

Assuming you're on linux and using RPMs,

[...]
> / To connect to a MySQL server, PHP needs a set of MySQL
> functions called "MySQL extension". This extension may be
> part of the PHP distribution (compiled-in), otherwise it
> needs to be loaded dynamically.  Its name is probably
> //mysql.so or //php_mysql.dll. phpMyAdmin tried to load
> the extension but failed.

Here's the hint on how to solve it:
> Usually, the problem is solved by installing a software
> package called "PHP-MySQL" or something similar."
> /

HTH,

-- 
- E - copperwalls was here ;)
"Look! I am making all things new."
 - Revelation 21:5

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



RE: [PHP] getting a number range from user input.. (weight)

2004-11-05 Thread Warren Vail

> > You can probably figure ways to streamline this, but I think it
> may answer
> > your basic question.  The best solution is one that works for you
> > reliably,
> > and there have to be at least 50 ways to do this.  This is just one.
>
> Hmm. Personally I would have thought the best way to do this is to get the
> db server to perform as much of the selection work as possible, thus the
> suggestion of using a BETWEEN operation in a WHERE clause of an SQL
> statement.

In theory perhaps, the "better" approach kind of depends on if he is looking
up the cost of one shipment or many.  Databases, like you indicated, are
optimized for looking up this kind of information from large record sets on
a hard drive and a good database will try to cache as much of their last
result as possible for use in the next query, but once cache cannot be used,
performance drops dramatically.  For one lookup on an single order, the
direct DB approach probably would produce faster results, but I doubt the
user would be able to see the performance difference on one order (can you
see a savings of 200 milliseconds), and for processing multiple shipments,
avoiding multiple db lookups would produce faster results.

I did forget to include an "order by weight" clause in the query which would
be required for my solution (and would add an overhead), and probably not
required for the DB solution, hopefully he figured that out.  Bottom line
the real "best" solution is the one that works for him, that he understands
and can change if needed.  He probably would have a tough time measuring
things that could cause the DB approach to suddenly not be able to use
cached contents, like DB server load from other applications, etc., and if
he is processing multiple shipments factors outside his control, like
other apps, could impact his applications performance.

Warren Vail

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



Re: [PHP] This is weird..whts the prob???

2004-11-05 Thread dgobrien
Add a 
phpinfo(); 
to the script and see what is getting passed to the page. That has worked wonders for 
me.
-Dave


> 
> From: "Aalee" <[EMAIL PROTECTED]>
> Date: 2004/11/05 Fri AM 07:25:20 EST
> To: [EMAIL PROTECTED]
> Subject: [PHP] This is weird..whts the prob???
> 
> Hi guys,
> Working on PHP ver 4.3.8 with register_globals turned OFF and Apache 1.3.31.
> MySQL ver 4.0.20a on winXP pro SP1. This script does not seems to work with
> the method of POST. When I change it to GET method the data is entered into
> the database, but with POST it does not. I have another script with the POST
> method, but that script works with POST. What is wrong with this script.
> Here goes the script. What am I doing wrong.
> 
>  if (isset($_GET['addjoke'])){
> ?>
> 
> 
>   Type your joke :
>   
>
>   
> 
> 
> 
>   }
> else { // start main else statement
> if(isset ($_POST['insert'])) {
>  $db = mysql_connect("localhost","homesite","ju4754") ;
>  mysql_select_db("jokes",$db);
>  $query = mysql_query("INSERT INTO jokes SET
>  JokeText = '".$_POST['jokeText']."' ,
>  JokeDate = CURDATE() ");
>  echo $query;
>  echo " Joke inserted, Thank you ";
>  echo mysql_error();
> }
> $color1 = "#66CCFF";
> $color2 = "#66CC99";
> $row_count = 1;
> 
> // -- Following lines list the jokes in the
> database 
> echo " These are the jokes we have got so far";
> $db = mysql_connect("localhost","homesite","ju4754")  or die(mysql_error());
> mysql_select_db("jokes",$db);
> $sql = "SELECT id, JokeText, JokeDate from jokes";
> $query = mysql_query($sql);
> echo "
>
> ID
>   Joke Text
>   Joke Date";
> while ($myrow = mysql_fetch_array($query))
>  {
>  $row_color = ($row_count % 2) ? $color1 : $color2;
>   echo"".
>   "". $myrow["id"]."".
>   "". $myrow["JokeText"]. "".
>   "". $myrow["JokeDate"]."";
>   $row_count++;
>  }
> echo "";
> 
> $current_url = $_SERVER['PHP_SELF'];
> echo("" ."Add a Joke!");
> 
> 
> } // end main else statement
> ?>
> 
> -- 
> 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: Problems with MySql

2004-11-05 Thread Oliver
I have sent am mail to [EMAIL PROTECTED] and the sad to me send the 
error for this e-mail.
--- Begin Message ---
Hi Oliver,
Please ask support questions at [EMAIL PROTECTED]
Regards,
Gabor Hojtsy
Oliver írta:
*Hello. My name is Oliver. I am from Brazil and I have had some problems.
Today I installed EasyPHP without any problems, but when I updated the 
version of php, Mysql stoped.*

*The error is: *
/Fatal error: Call to undefined function mysql_connect() in c:\arquivos 
de programas\easyphp1-7\www\WallWeb\config.php on line 16/*/./

The phpMyAdmin Documentations says:*
/"[1.20] I receive the error "cannot load MySQL extension, please check 
PHP Configuration". /

/ To connect to a MySQL server, PHP needs a set of MySQL functions 
called "MySQL extension". This extension may be part of the PHP 
distribution (compiled-in), otherwise it needs to be loaded dynamically. 
Its name is probably //mysql.so or //php_mysql.dll. phpMyAdmin tried to 
load the extension but failed.

Usually, the problem is solved by installing a software package called 
"PHP-MySQL" or something similar."
/

What can I do to solve it?
*
Oliver Bellaver Longhi.
Thank you very much.*
*
*


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

Re: [PHP] Send XHTML emails with images

2004-11-05 Thread Marek Kilimajer
Gery Duyck wrote:
Hi,
I've made an XHTML page to be send as a rich e-mail so I can do more as just
tekst.
Everything is fine, except for the images.
In the source code I say the images are like http://www.domain.com/pic.jpg"; alt="" />
but wen I send the email, I can't see the images in Outlook Express or
Hotmail (in browser).
Because loading of remote content is usualy forbiden in the mail readers 
for security and privacy reasons. You need to embed the images into the 
email, there are classes that will help you:

http://pear.php.net/package/Mail_Mime
http://www.phpclasses.org/mimemessage
and others
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] This is weird..whts the prob???

2004-11-05 Thread - Edwin -
Hi,

On Fri, 5 Nov 2004 22:55:20 +1030
"Aalee" <[EMAIL PROTECTED]> wrote:

> Hi guys,
> Working on PHP ver 4.3.8 with register_globals turned OFF
> and Apache 1.3.31. MySQL ver 4.0.20a on winXP pro SP1. This
> script does not seems to work with the method of POST. When
> I change it to GET method the data is entered into the
> database, but with POST it does not. I have another script
> with the POST method, but that script works with POST. What
> is wrong with this script. Here goes the script. What am I
> doing wrong.
> 
>  if (isset($_GET['addjoke'])){
> ?>
[...]

Try changing that $_GET to $_POST ...

-- 
- E - copperwalls was here ;)

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



Re: [PHP] This is weird..whts the prob???

2004-11-05 Thread Brent Baisley
The code looks fine to me. You may want to look at the Apache access 
logs to see what is getting submitted to the server when you submit the 
form. Or you can use a network monitoring tool to see what the client 
is submitting.

But, if you can't figure out what is causing the problem, just use 
$_REQUEST instead of $_POST or $_GET. $_REQUEST doesn't care if the 
form was submitted via post or get, it holds the values of either type 
of submission.

Personally, I always like to fix the cause rather than treat the 
symptom. But there isn't always time in the short term.

On Nov 5, 2004, at 7:25 AM, Aalee wrote:
Hi guys,
Working on PHP ver 4.3.8 with register_globals turned OFF and Apache 
1.3.31.
MySQL ver 4.0.20a on winXP pro SP1. This script does not seems to work 
with
the method of POST. When I change it to GET method the data is entered 
into
the database, but with POST it does not. I have another script with 
the POST
method, but that script works with POST. What is wrong with this 
script.
Here goes the script. What am I doing wrong.



  Type your joke :
  
   
  


";
 echo mysql_error();
}
$color1 = "#66CCFF";
$color2 = "#66CC99";
$row_count = 1;
// -- Following lines list the jokes in the
database 
echo " These are the jokes we have got so far";
$db = mysql_connect("localhost","homesite","ju4754")  or 
die(mysql_error());
mysql_select_db("jokes",$db);
$sql = "SELECT id, JokeText, JokeDate from jokes";
$query = mysql_query($sql);
echo "
   
ID
  Joke Text
  Joke Date";
while ($myrow = mysql_fetch_array($query))
 {
 $row_color = ($row_count % 2) ? $color1 : $color2;
  echo"".
  "". $myrow["id"]."".
  "". $myrow["JokeText"]. "".
  "". $myrow["JokeDate"]."";
  $row_count++;
 }
echo "";

$current_url = $_SERVER['PHP_SELF'];
echo("" ."Add a Joke!");
} // end main else statement
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Send XHTML emails with images

2004-11-05 Thread Gery Duyck
Hi,

I've made an XHTML page to be send as a rich e-mail so I can do more as just
tekst.
Everything is fine, except for the images.

In the source code I say the images are like http://www.domain.com/pic.jpg"; alt="" />
but wen I send the email, I can't see the images in Outlook Express or
Hotmail (in browser).

Here's my testing script:
\r\n";
$email = $_GET['mail'];
mail($email, $subject, $message, $headers);
?>

I dunno what I oversaw, maybe a missing header or something,
or maybe I need to embed the images with the e-mail in stead of opening them
from
somewhere else on the web.

Anyway, either way's I don't know how to do, so all hint's/tips are welcome!

Gery

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



Re: [PHP] Search a word in multiple tables

2004-11-05 Thread raditha dissanayake
Phpu wrote:
Hi,
How can i search a specific word in 2 tables
I use this but it is not working
sql = "SELECT a.product_id, a.".select_language('product_name_en', 'product_name_fr').", b.brand_name FROM products_accessories as a, brands as b 
WHERE (a.".select_language('product_name_en', 'product_name_fr')." LIKE '%".$word."%'  OR b.brand_name LIKE '%".$word."%')";
$result= mysql_query($sql);

Thanks
 

does this become a PHP question just because of
$result= mysql_query($sql); ??

--
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 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Search a word in multiple tables

2004-11-05 Thread Murray @ PlanetThoughtful
> Hi,
> How can i search a specific word in 2 tables
> I use this but it is not working
> 
> sql = "SELECT a.product_id, a.".select_language('product_name_en',
> 'product_name_fr').", b.brand_name FROM products_accessories as a, brands
> as b
>  WHERE (a.".select_language('product_name_en',
> 'product_name_fr')." LIKE '%".$word."%'  OR b.brand_name LIKE
> '%".$word."%')";
> $result= mysql_query($sql);

Are you using MySQL? If so, depending on which version you have, it might be
worth checking out UNION queries.

http://dev.mysql.com/doc/mysql/en/UNION.html

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

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



[PHP] Search a word in multiple tables

2004-11-05 Thread Phpu
Hi,
How can i search a specific word in 2 tables
I use this but it is not working

sql = "SELECT a.product_id, a.".select_language('product_name_en', 
'product_name_fr').", b.brand_name FROM products_accessories as a, brands as b 
 WHERE (a.".select_language('product_name_en', 'product_name_fr')." LIKE 
'%".$word."%'  OR b.brand_name LIKE '%".$word."%')";
$result= mysql_query($sql);

Thanks

[PHP] This is weird..whts the prob???

2004-11-05 Thread Aalee
Hi guys,
Working on PHP ver 4.3.8 with register_globals turned OFF and Apache 1.3.31.
MySQL ver 4.0.20a on winXP pro SP1. This script does not seems to work with
the method of POST. When I change it to GET method the data is entered into
the database, but with POST it does not. I have another script with the POST
method, but that script works with POST. What is wrong with this script.
Here goes the script. What am I doing wrong.




  Type your joke :
  
   
  



";
 echo mysql_error();
}
$color1 = "#66CCFF";
$color2 = "#66CC99";
$row_count = 1;

// -- Following lines list the jokes in the
database 
echo " These are the jokes we have got so far";
$db = mysql_connect("localhost","homesite","ju4754")  or die(mysql_error());
mysql_select_db("jokes",$db);
$sql = "SELECT id, JokeText, JokeDate from jokes";
$query = mysql_query($sql);
echo "
   
ID
  Joke Text
  Joke Date";
while ($myrow = mysql_fetch_array($query))
 {
 $row_color = ($row_count % 2) ? $color1 : $color2;
  echo"".
  "". $myrow["id"]."".
  "". $myrow["JokeText"]. "".
  "". $myrow["JokeDate"]."";
  $row_count++;
 }
echo "";

$current_url = $_SERVER['PHP_SELF'];
echo("" ."Add a Joke!");


} // end main else statement
?>

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



RE: [PHP] PDFLIB error 2516

2004-11-05 Thread Jack . van . Zanen
Thx

That was it.

Anybody have any ideas as to why this behaviour changed??


Regards



Jack

-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 05, 2004 12:46 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] PDFLIB error 2516


Hi,

Friday, November 5, 2004, 8:18:16 PM, you wrote:
JvZnc> Hi All,
JvZnc> I upgraded my test system to 4.3.9 (from 4.3.4) and now run into 
JvZnc> problems with pdf creation. Scripts that ran fine before now 
JvZnc> return the following
JvZnc> error:

JvZnc> Fatal error: PDFlib error: [2516] PDF_findfont: Metrics data for 
JvZnc> font 'Arial' not found in d:\website\pdf_graph.php on line 50


JvZnc> Has anybody seen this before and knows of the solution? Google 
JvZnc> returned no hits that solved the problem.

JvZnc> 

JvZnc> pdf_open_file($pdf, "d:\\website\\graphs.pdf");

JvZnc> pdf_set_info($pdf, "Author", "Automatically Generated"); 
JvZnc> pdf_set_info($pdf, "Title", "Management graphs"); 
JvZnc> pdf_set_info($pdf, "Creator", "Jacob A. van Zanen"); 
JvZnc> pdf_set_info($pdf, "Subject", "Management Graphs");



JvZnc> pdf_begin_page($pdf, 700, 600);
JvZnc> $bookmark1 = pdf_add_bookmark($pdf, "Information for machine 
JvZnc> SBPXXA1"); $arial = pdf_findfont($pdf, "Arial", "host", 1); 
JvZnc> pdf_setfont($pdf, $arial, 12);  //-this is line 50
JvZnc> pdf_show_xy($pdf, "1 Information for machine SBPXXA1 for
$_POST[day]/
JvZnc> $_POST[month]/$_POST[year]",50, 510);


JvZnc> 



JvZnc> TiA

JvZnc> Jack van Zanen


You have to tell pdf where to find the font, I do it this way

pdf_set_parameter($pdf, "FontOutline", "Arial=/path/to/arial.ttf");

-- 
regards,
Tom

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



RE: [PHP] Simple math failing - PHP Bug?

2004-11-05 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 05 November 2004 10:42, Olaf van der Spek wrote:

> Mike Ford wrote:
> > for.  (Some early business-oriented computers, and some calculators
> > (especially financial ones) did use a system called binary-coded
> > decimal -- BCD -- to calculate "accurately" in the sense you mean,
> > but the fact that they were never widely used and have died out
> > almost totally should tell you something about their usefulness.)
> 
> Wasn't that just a way to store 11 as 0x11 and 56 as 0x56?
> x86 has BCD instructions too.

Effectively, yes -- although it wasn't very usual to talk in hex back in the
days when I learnt about BCD!

But it also meant that a number such as 564.29897 was stored as 0x564.29897
(if you see what I mean!), so there were none of these nasty
binary<=>decimal rounding approximations and you always had an exact answer
(to the limit of the number of significant figures supported, anyway).  But
it makes the calculations more complex as you effectively have to do
everything byte-by-byte (since neither 0x8+0x8 nor 0x4*0x4 is 0x16!), and
hence both more expensive and slower (sometimes *much* slower), even when
done in hardware.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, 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] PDFLIB error 2516

2004-11-05 Thread Tom Rogers
Hi,

Friday, November 5, 2004, 8:18:16 PM, you wrote:
JvZnc> Hi All,
JvZnc> I upgraded my test system to 4.3.9 (from 4.3.4) and now run into problems
JvZnc> with pdf creation. Scripts that ran fine before now return the following
JvZnc> error:

JvZnc> Fatal error: PDFlib error: [2516] PDF_findfont: Metrics data for font
JvZnc> 'Arial' not found in d:\website\pdf_graph.php on line 50


JvZnc> Has anybody seen this before and knows of the solution? Google returned no
JvZnc> hits that solved the problem.

JvZnc> 

JvZnc> pdf_open_file($pdf, "d:\\website\\graphs.pdf");

JvZnc> pdf_set_info($pdf, "Author", "Automatically Generated");
JvZnc> pdf_set_info($pdf, "Title", "Management graphs");
JvZnc> pdf_set_info($pdf, "Creator", "Jacob A. van Zanen");
JvZnc> pdf_set_info($pdf, "Subject", "Management Graphs");



JvZnc> pdf_begin_page($pdf, 700, 600);
JvZnc> $bookmark1 = pdf_add_bookmark($pdf, "Information for machine SBPXXA1");
JvZnc> $arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial,
JvZnc> 12);  //-this is line 50
JvZnc> pdf_show_xy($pdf, "1 Information for machine SBPXXA1 for $_POST[day]/
JvZnc> $_POST[month]/$_POST[year]",50, 510); 


JvZnc> 



JvZnc> TiA

JvZnc> Jack van Zanen


You have to tell pdf where to find the font, I do it this way

pdf_set_parameter($pdf, "FontOutline", "Arial=/path/to/arial.ttf");

-- 
regards,
Tom

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



Re: [PHP] Re: Re: VOTE TODAY

2004-11-05 Thread Francisco M. Marzoa Alonso
That's true for Germany and France and probably another european 
countries, but in Spain by example we've just 512/128kbps paying the 
same that a french by 6Mbps/512kbps. Never mind, this dammed country 
continues being more the North of Africa than the South of Europe...

Best regards,
Michelle Konzack wrote:
Hello Michael and *,
Am 2004-11-04 16:10:02, schrieb Michael Lauzon:
 

6Mb, that's no fair, the highest we have in Canada is 4Mb; although
supposedly there is a 5Mb service somewhere...well there is 7Mb
service but you'll be paying out of your @$$ for it.
   

In Europe the prices for ADSL are falling endless
We can have 6MBit/512kBit for Internet, TeleVision and Telephone (SIP)
So I can see TV, phone with you and surf the Internet at the same time.
In Europe we have the biggest Backbones of the World...
Allone Strasbourg exceed some STM-64 (10 GBit Backbones) !!!
For 5 years it was only 3 STM-4 (622 Mbit) and some OC-3 (155,5 Mbit)
Greetings
Michelle
 

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


[PHP] Re: $_SERVER['HTTP_REFERER'] does not work

2004-11-05 Thread Michelle Konzack
Am 2004-11-05 13:23:01, schrieb Jason Wong:

> Look up "UseCanonicalName" in the Apache docs and see if this relates
> to your 
> problem.

I will look at it

> The surest way to prevent unauthorised access is to require a login.

.htaccess is no solution because * can surf my OnlienStore but
can not buy anything before login. 

I do not like to have linked my PHP Scripts/Pages from outside like
from GOOGLE. I do not know how GOOGLE know about my "onlinestore"
because it exist since one week... But gotten around 3700 hits from
"googlebot". 3700 Hits for nothing...

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[PHP] PDFLIB error 2516

2004-11-05 Thread Jack . van . Zanen
Hi All,
I upgraded my test system to 4.3.9 (from 4.3.4) and now run into problems
with pdf creation. Scripts that ran fine before now return the following
error:

Fatal error: PDFlib error: [2516] PDF_findfont: Metrics data for font
'Arial' not found in d:\website\pdf_graph.php on line 50


Has anybody seen this before and knows of the solution? Google returned no
hits that solved the problem.



pdf_open_file($pdf, "d:\\website\\graphs.pdf");

pdf_set_info($pdf, "Author", "Automatically Generated");
pdf_set_info($pdf, "Title", "Management graphs");
pdf_set_info($pdf, "Creator", "Jacob A. van Zanen");
pdf_set_info($pdf, "Subject", "Management Graphs");



pdf_begin_page($pdf, 700, 600);
$bookmark1 = pdf_add_bookmark($pdf, "Information for machine SBPXXA1");
$arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial,
12);  //-this is line 50
pdf_show_xy($pdf, "1Information for machine SBPXXA1 for $_POST[day]/
$_POST[month]/$_POST[year]",50, 510); 






TiA

Jack van Zanen






[PHP] Re: Re: VOTE TODAY

2004-11-05 Thread Michelle Konzack
Hello Michael and *,

Am 2004-11-04 16:10:02, schrieb Michael Lauzon:
> 6Mb, that's no fair, the highest we have in Canada is 4Mb; although
> supposedly there is a 5Mb service somewhere...well there is 7Mb
> service but you'll be paying out of your @$$ for it.

In Europe the prices for ADSL are falling endless

We can have 6MBit/512kBit for Internet, TeleVision and Telephone (SIP)

So I can see TV, phone with you and surf the Internet at the same time.

In Europe we have the biggest Backbones of the World...
Allone Strasbourg exceed some STM-64 (10 GBit Backbones) !!!

For 5 years it was only 3 STM-4 (622 Mbit) and some OC-3 (155,5 Mbit)

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[PHP] images doesn't seem to cache

2004-11-05 Thread anders thoresson
Hi,
I put all my images outside the web root, the prevent direct access, and 
then access them with a -tag like this:


where fnc_get_image.php is:
// Check if user is logged in
require_once 'global_includes.php';
$user =& new User();
// Get path to image for display
$path = $_GET['path'];
// Prepend path - prevents misuse
$pPath = "/home/username/albums/" . $path;
header("Cache-Control: private");
$extention = substr($path, -3);
if ($extention == "jpg")
header("Content-type: image/jpeg");
if ($extention == "gif")
header("Content-type: image/gif");
if ($extention == "bmp")
header("Content-type: image/bmp");
if ($extention == "png")
header("Content-type: image/png");
readfile("$pPath");
There is one slight problem though: To my eyes, it looks like the images
are downloaded from the server every time. Is this a side effect of this
method or is it just a optical illusion? Is there a way to tell for sure
if the image is downloaded or displayed from the browser cache?
I've tried with and without a Cache-Control header. It doesn't seem to 
do any difference at all.

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


Re: [PHP] Simple math failing - PHP Bug?

2004-11-05 Thread Olaf van der Spek
Mike Ford wrote:
for.  (Some early business-oriented computers, and some calculators
(especially financial ones) did use a system called binary-coded
decimal -- BCD -- to calculate "accurately" in the sense you mean,
but the fact that they were never widely used and have died out
almost totally should tell you something about their usefulness.)
Wasn't that just a way to store 11 as 0x11 and 56 as 0x56?
x86 has BCD instructions too.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: mailparse or imap* ?

2004-11-05 Thread Per Jessen
M. Sokolewicz wrote:

> I use scripts I wrote myself. Just read trough the whole RFC, and you'll
> find out exactly how each email message is made, and what it (has
> to/will) consist(s) of.

Oh, I fully appreciate that. I was just trying to avoid reinventing the wheel
again.  There's a lot more to parsing an email than just one RFC ...

/Per


-- 
Per Jessen, Zurich
Let your spam stop here -- http://www.spamchek.com

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



RE: [PHP] getting a number range from user input.. (weight)

2004-11-05 Thread Murray @ PlanetThoughtful
> You can probably figure ways to streamline this, but I think it may answer
> your basic question.  The best solution is one that works for you
> reliably,
> and there have to be at least 50 ways to do this.  This is just one.

Hmm. Personally I would have thought the best way to do this is to get the
db server to perform as much of the selection work as possible, thus the
suggestion of using a BETWEEN operation in a WHERE clause of an SQL
statement.

In small recordsets it probably wouldn't matter a great deal, but in a
larger recordset you would be returning a large array and having to iterate
through it in PHP when you can easily get the db server to simply return the
appropriate record and work with it from there.

In theory, db servers are optimized for this kind of work.

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

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



Re: [PHP] getting a number range from user input.. (weight)

2004-11-05 Thread Louie Miranda
out of desperation i have made a simple and long one and point to a
function. i'll also try ur suggestion, my code is long.

if ($get_WEIGHT_x <= .5) {
$get_WEIGHT = .5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 1) {
$get_WEIGHT = 1;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 1.5) {
$get_WEIGHT = 1.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 2) {
$get_WEIGHT = 2;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 2.5) {
$get_WEIGHT = 2.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 3) {
$get_WEIGHT = 3;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 3.5) {
$get_WEIGHT = 3.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 4) {
$get_WEIGHT = 4;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 4.5) {
$get_WEIGHT = 4.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 5) {
$get_WEIGHT = 5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 5.5) {
$get_WEIGHT = 5.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 6) {
$get_WEIGHT = 6;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 6.5) {
$get_WEIGHT = 6.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 7) {
$get_WEIGHT = 7;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 7.5) {
$get_WEIGHT = 7.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 8) {
$get_WEIGHT = 8;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 9.5) {
$get_WEIGHT = 9.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 10) {
$get_WEIGHT = 10;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 10.5) {
$get_WEIGHT = 10.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 11) {
$get_WEIGHT = 11;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 11.5) {
$get_WEIGHT = 11.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 12) {
$get_WEIGHT = 12;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 12.5) {
$get_WEIGHT = 12.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 13) {
$get_WEIGHT = 13;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 13.5) {
$get_WEIGHT = 13.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 14) {
$get_WEIGHT = 14;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 14.5) {
$get_WEIGHT = 14.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 15) {
$get_WEIGHT = 15;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 15.5) {
$get_WEIGHT = 15.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 16) {
$get_WEIGHT = 16;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 16.5) {
$get_WEIGHT = 16.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 17.5) {
$get_WEIGHT = 17.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 18) {
$get_WEIGHT = 18;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 18.5) {
$get_WEIGHT = 18.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 19) {
$get_WEIGHT = 19;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 19.5) {
$get_WEIGHT = 19.5;
lessthan_20Kg();
} elseif ($get_WEIGHT_x <= 20) {
$get_WEIGHT = 20;
lessthan_20Kg();
} elseif ($get_WEIGHT_x >= 20.001) {
$get_WEIGHT = ;
morethan_20Kg();
}

On Fri, 5 Nov 2004 00:19:15 -0800, Warren Vail <[EMAIL PROTECTED]> wrote:
> Sorry for the delay in getting back to you but I had a long commute tonight.
> 
> Suppose you load an array in high weight order (from the zone that applies).
> 
> weight   value
>  .5  9.45
> 1.0 10.71
> 1.5 11.97
> 2.0 13.23
> 
> load them into an array where like so;
> 
> select weight, zone$zn, from postage_costs
> 
> // looping thru returned rows, load an array ;
> $zonearray[] = array($weight, $value);
> 
> // then performing lookups;
> 
> unset($postage);
> foreach($zonearray as $entry) {
> list($wght, $val) = $entry;
> if($wght >= $actualpkgweight) {
> $postage = $val;
>   break;
> }
> }
> if(isset($postage)) // here you have the minimum postage to cover the
> package.
> else  // here you have a package that weighs more than your 
> largest
> weight
> 
> You can probably figure ways to streamline this, but I think it may answer
> your basic question.  The best solution is one that works for you reliably,
> and there have to be at least 50 ways to do this.  This is just one.
> 
> good luck,
> 
> Warren Vail
> 
> 
> 
> -Original Message-
> From: Louie Miranda [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 04, 2004 10:06 PM
> To: Murr

RE: [PHP] getting a number range from user input.. (weight)

2004-11-05 Thread Warren Vail
Sorry for the delay in getting back to you but I had a long commute tonight.

Suppose you load an array in high weight order (from the zone that applies).

weight   value
 .5  9.45
1.0 10.71
1.5 11.97
2.0 13.23

load them into an array where like so;

select weight, zone$zn, from postage_costs

// looping thru returned rows, load an array ;
$zonearray[] = array($weight, $value);

// then performing lookups;

unset($postage);
foreach($zonearray as $entry) {
list($wght, $val) = $entry;
if($wght >= $actualpkgweight) {
$postage = $val;
  break;
}
}
if(isset($postage)) // here you have the minimum postage to cover the
package.
else  // here you have a package that weighs more than your largest
weight

You can probably figure ways to streamline this, but I think it may answer
your basic question.  The best solution is one that works for you reliably,
and there have to be at least 50 ways to do this.  This is just one.

good luck,

Warren Vail

-Original Message-
From: Louie Miranda [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 04, 2004 10:06 PM
To: Murray @ PlanetThoughtful; [EMAIL PROTECTED]
Subject: Re: [PHP] getting a number range from user input.. (weight)


I have this on my db.

mysql> select * from rates_dhl where weight_kg = "6" between range and
Weight_KG;
++---+---++++++-
---+++
| id | range | Weight_KG | Zone_A | Zone_B | Zone_C | Zone_D | Zone_E
| Zone_F | Zone_G | Zone_H |
++---+---++++++-
---+++
|  1 | .000  | .5| 9.45   | 12.29  | 14.18  | 15.12  | 16.59
| 18.48  | 21.32  | 23.63  |
++---+---++++++-
---+++
1 row in set (0.00 sec)

When i did try the between, even when i try to change the weight_kg to
any number, it only display the first entry.


On Fri, 5 Nov 2004 15:52:16 +1000, Murray @ PlanetThoughtful
<[EMAIL PROTECTED]> wrote:
>
>
>
> > OK, here is what it should do.
> >
> > I have a fixed range of weights from .5 to 20.0 Kg (kilogram) and for
> > each weight it has a succeeding value, i cannot jump or just round off
> > the numbers. So i need a range detector to do it.
> >
> > Because for each of the item below:
> >
> > > weight   value
> > > .59.45
> > > 1.0 10.71
> > > 1.5 11.97
> > > 2.0 13.23
> >
> > I must get the exact value, so let say for example. I have 1.3 it
> > should fall under 1.5 the idea i had was to do this, so i can detect
> > where the number should fall..
>
> Put the weight ranges in a MySQL table and use the BETWEEN operator to
> retrieve the appropriate weight.
>
> Something like:
>
> fromweight, toweight, value
> 0,0.5,9.45
> 0.501,1.0,10.71
> 1.001,1.5,11.97
>
> Then, the following SQL statement will pull the appropriate value:
>
> SELECT value FROM weights WHERE 1.3 BETWEEN fromweight AND toweight
>
> Much warmth,
>
> Murray
> http://www.planetthoughtful.org
> Building a thoughtful planet,
> One quirky comment at a time.
>
> --
>
>
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.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