[PHP] Re: Bounce composition

2007-05-03 Thread Manuel Lemos
Hello,

on 05/02/2007 03:11 PM Richard Lynch said the following:
 Does anybody have or know of a good simple PHP script that can take an
 email as an input, and compose a Bounce email as output?
 
 I need something that does just that, without a huge framework or a
 zillion other features...

I don't have one exactly for that but there is one very similar with
this package that instead of bouncing it forwards the message. See the
test_attachment_message.php .

http://www.phpclasses.org/mimemessage

It is not very hard to make that script generate RFC compliant bounce
message. Just let me know if you would like me to hack it to generate
bounces.


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: Bounce composition

2007-05-03 Thread Manuel Lemos
Sorry, I meant test_forwarding_message.php example script.

on 05/03/2007 03:31 AM Manuel Lemos said the following:
 Hello,
 
 on 05/02/2007 03:11 PM Richard Lynch said the following:
 Does anybody have or know of a good simple PHP script that can take an
 email as an input, and compose a Bounce email as output?

 I need something that does just that, without a huge framework or a
 zillion other features...
 
 I don't have one exactly for that but there is one very similar with
 this package that instead of bouncing it forwards the message. See the
 test_attachment_message.php .
 
 http://www.phpclasses.org/mimemessage
 
 It is not very hard to make that script generate RFC compliant bounce
 message. Just let me know if you would like me to hack it to generate
 bounces.
 
 


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] excel macro into php

2007-05-03 Thread Tijnema !

On 5/2/07, Anton Krall [EMAIL PROTECTED] wrote:

Guys.. I have a problem and I was wondering if somebody with good php
knowledge could help.

I have this excel macro that converts number currency (mexican) into a
string and I was wondering if somebody could help translating it to php...

Her eis the macro, if you could help, I would really appreciate it.

Thanks guys!


I think that starting over is better then trying to convert this excel
macro. What exactly do you want to convert, from ?? to ??
Since all functions are in a language that isn't english, dutch,
german or frisian, I can't understand.



snip

laUnidades = Array(UN, DOS, TRES, CUATRO, CINCO, SEIS, SIETE,
OCHO, NUEVE, DIEZ, ONCE, DOCE, TRECE, CATORCE, QUINCE,
DIESISEIS, DIESISIETE, DIESIOCHO, DIESINUEVE, VEINTE, VEINTIUN,
VEINTIDOS, VEINTITRES, VEINTICUATRO, VEINTICINCO, VEINTISEIS,
VEINTISIETE, VEINTIOCHO, VEINTINUEVE)
laDecenas = Array(DIEZ, VEINTE, TREINTA, CUARENTA, CINCUENTA,
SESENTA, SETENTA, OCHENTA, NOVENTA)
laCentenas = Array(CIENTO, DOSCIENTOS, TRESCIENTOS, CUATROCIENTOS,
QUINIENTOS, SEISCIENTOS, SETECIENTOS, OCHOCIENTOS, NOVECIENTOS)

Nice array, if you need it, you can use it directly in PHP, just add a
$ sign before the variable and ; at the end, and it is a PHP array :)
snip

I've snipped the rest of your code, because it's very though to
understand the code if you can't read the language. Like i said, show
me what you want to convert from and to, so that i can help you
writing something new, or comment your own macro in english so that
people can understand it.

Tijnema

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



[PHP] Custom database session handler and data concurrent access from ajax request

2007-05-03 Thread n . quirin

Hi,

i'm currently working on a web site that use AJAX requests to load a web page by
part. So, my apache server gives quickly an answer and current client must wait
a little bit in order to have the entire web page, but while this loading step,
he can already see my partially displayed web page and use it!

This web site uses php session, based on cookies, but not only cookies (cookies
are just prefered). session.auto_start is false in order to allow object
declarations before session starts (so I can stored little object in session)
There is no session handler defined in php.ini, line has been commented).

In each php script, i start manually the session with session_start and i use
register_shutdown to register session_write_close in order to write current
session when the current script is finished.

Sessions are managed in a mysql database, with autocommit enabled. I'm using
mysql_pconnect in my handler to read/write session data (same user, same
password, same host, always).

Read/write session into database works...but not fine.

Scenario: scripts are parts of a main page, scripts are called by ASYNC AJAX GET
Script 1 modifies an object A from session and re-serializes it into session,
Script 2 is launched when client is receiving a response from the server for
script 1(php output buffering is enabled),
Script 2 displayed object A content from session and flush object A content,
re-serializes it into session, but sometime Script 2 doesn't displayed object A
modification by script 1. More terrible, reloading the entire page displays all
the content of the modified object A (but script 2 has flushed its content!)

I'm asking if custom session handler must implement mutex system or anything to
prevent concurrent access and terrible random errors of session writing/reading
and moreConcurrent access does'nt seems to be safely managed natively...

Any idea? comment? I can sent my session handler php class

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



[PHP] [opinions] Ashop Commerce

2007-05-03 Thread Marco Sottana

Ashop Commerce is a leading provider of hosted shopping cart software. It 
offers a complete solution for merchants to sell online. Please write your 
opinions of the service and if you can, use these keywords throughout your post 
in addition to the anchor text. Shopping cart software, shopping cart, 
ecommerce software.

Re: [PHP] [opinions] Ashop Commerce

2007-05-03 Thread Marco Sottana
ashop in a complete ecommerce application web based and without 
installation. you've got a complete administration of products, contents, 
theme and more ... is too good the stats area where you can see everything 
your customers or visitors see or buy in you ecommerce.


- Original Message - 
From: Marco Sottana [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 11:39 AM
Subject: [PHP] [opinions] Ashop Commerce



Ashop Commerce is a leading provider of hosted shopping cart software. It 
offers a complete solution for merchants to sell online. Please write your 
opinions of the service and if you can, use these keywords throughout your 
post in addition to the anchor text. Shopping cart software, shopping cart, 
ecommerce software. 


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



Re: [PHP] [opinions] Ashop Commerce

2007-05-03 Thread Crayon
Take your spam and shove it up your asshop.

-- 
Crayon

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



Re: [PHP] [opinions] Ashop Commerce

2007-05-03 Thread Stut
Ashop Commerce sucks. The product is anti-productive, badly written and 
riddled with potential exploits that may expose sensitive data. Don't 
use it if you value having customers and not being ripped off.


-Stut

NB: I have never used Ashop Commerce, nor will I ever use it. These 
opinions are purely based on them spamming this mailing list for exposure.


Marco Sottana wrote:

- Original Message -

 From: Marco Sottana [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 11:39 AM
Subject: [PHP] [opinions] Ashop Commerce

Ashop Commerce is a leading provider of hosted shopping cart software. 
It offers a complete solution for merchants to sell online. Please write 
your opinions of the service and if you can, use these keywords 
throughout your post in addition to the anchor text. Shopping cart 
software, shopping cart, ecommerce software.


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



Re: [PHP] [opinions] Ashop Commerce

2007-05-03 Thread Marco Sottana

ashop isn't mine ..
it isn't spam  
i only ask your opinion 
thanks!
- Original Message - 
From: Crayon [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 12:14 PM
Subject: Re: [PHP] [opinions] Ashop Commerce



Take your spam and shove it up your asshop.

--
Crayon

--
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] [opinions] Ashop Commerce

2007-05-03 Thread Marco Sottana

why Spam?
before to use ashop i ask ...
if i ask what ecommerce is better .. nobody answer me..
now.. you shout SPAM ..
there isn't link to ashop .. i only ASK !
thanks

ok .. what ecommerce you prefer ? and why ?

- Original Message - 
From: Stut [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 12:16 PM
Subject: Re: [PHP] [opinions] Ashop Commerce


Ashop Commerce sucks. The product is anti-productive, badly written and 
riddled with potential exploits that may expose sensitive data. Don't use 
it if you value having customers and not being ripped off.


-Stut

NB: I have never used Ashop Commerce, nor will I ever use it. These 
opinions are purely based on them spamming this mailing list for 
exposure.


Marco Sottana wrote:

- Original Message -

 From: Marco Sottana [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 11:39 AM
Subject: [PHP] [opinions] Ashop Commerce

Ashop Commerce is a leading provider of hosted shopping cart software. It 
offers a complete solution for merchants to sell online. Please write 
your opinions of the service and if you can, use these keywords 
throughout your post in addition to the anchor text. Shopping cart 
software, shopping cart, ecommerce software.


--
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] [opinions] Ashop Commerce

2007-05-03 Thread Stut

Marco Sottana wrote:

why Spam?
before to use ashop i ask ...
if i ask what ecommerce is better .. nobody answer me..
now.. you shout SPAM ..
there isn't link to ashop .. i only ASK !
thanks

ok .. what ecommerce you prefer ? and why ?


Please write your opinions of the service and if you can, use these 
keywords throughout your post in addition to the anchor text. Shopping 
cart software, shopping cart, ecommerce software.


That is not a request for an opinion, it's an attempt to get a product 
name associated with a set of keywords.


Add to that the fact that you then went ahead to offer your own 
opinion of this service that has nothing to do with you, and you start 
to see why we think it's spam.


As far as which ecommerce package is the best it depends on a lot of 
factors, and has been discussed at length on this mailing list many many 
times. Please check the archives.


-Stut


- Original Message - From: Stut [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 12:16 PM
Subject: Re: [PHP] [opinions] Ashop Commerce


Ashop Commerce sucks. The product is anti-productive, badly written 
and riddled with potential exploits that may expose sensitive data. 
Don't use it if you value having customers and not being ripped off.


-Stut

NB: I have never used Ashop Commerce, nor will I ever use it. These 
opinions are purely based on them spamming this mailing list for 
exposure.


Marco Sottana wrote:

- Original Message -

 From: Marco Sottana [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 11:39 AM
Subject: [PHP] [opinions] Ashop Commerce

Ashop Commerce is a leading provider of hosted shopping cart 
software. It offers a complete solution for merchants to sell online. 
Please write your opinions of the service and if you can, use these 
keywords throughout your post in addition to the anchor text. 
Shopping cart software, shopping cart, ecommerce software.


--
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] [opinions] Ashop Commerce

2007-05-03 Thread Marco Sottana

i am new ...
say me .. 2 or 3 nice e-commerce and why is nice.. please..



- Original Message - 
From: Stut [EMAIL PROTECTED]

To: Marco Sottana [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, May 03, 2007 12:36 PM
Subject: Re: [PHP] [opinions] Ashop Commerce



Marco Sottana wrote:

why Spam?
before to use ashop i ask ...
if i ask what ecommerce is better .. nobody answer me..
now.. you shout SPAM ..
there isn't link to ashop .. i only ASK !
thanks

ok .. what ecommerce you prefer ? and why ?


Please write your opinions of the service and if you can, use these 
keywords throughout your post in addition to the anchor text. Shopping 
cart software, shopping cart, ecommerce software.


That is not a request for an opinion, it's an attempt to get a product 
name associated with a set of keywords.


Add to that the fact that you then went ahead to offer your own 
opinion of this service that has nothing to do with you, and you start 
to see why we think it's spam.


As far as which ecommerce package is the best it depends on a lot of 
factors, and has been discussed at length on this mailing list many many 
times. Please check the archives.


-Stut


- Original Message - From: Stut [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 12:16 PM
Subject: Re: [PHP] [opinions] Ashop Commerce


Ashop Commerce sucks. The product is anti-productive, badly written 
and riddled with potential exploits that may expose sensitive data. 
Don't use it if you value having customers and not being ripped off.


-Stut

NB: I have never used Ashop Commerce, nor will I ever use it. These 
opinions are purely based on them spamming this mailing list for 
exposure.


Marco Sottana wrote:

- Original Message -

 From: Marco Sottana [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 11:39 AM
Subject: [PHP] [opinions] Ashop Commerce

Ashop Commerce is a leading provider of hosted shopping cart 
software. It offers a complete solution for merchants to sell online. 
Please write your opinions of the service and if you can, use these 
keywords throughout your post in addition to the anchor text. 
Shopping cart software, shopping cart, ecommerce software.


--
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: A problem with passing $_GET in an url

2007-05-03 Thread Dan Shirah

Could you please post your code.

It sounds like you have a submit button that when clicked goes to a
javascript function which pops up a confirmation box.  Is that correct?


On 5/3/07, Travis Moore [EMAIL PROTECTED] wrote:


If you're using window.location=./script.php?var=value, it's not
actually using a variable, it's using a string.

If you're just using the above as an example, then could you please post
the line of javascript for redirecting.

Travis.


Davis Chan wrote:
 Hi! New to this newsgroup and is debugging a strange behaviour in a site
 under development. The developement platform is a Linux box running
 Fedora Core 6, Apache 2.2.3-5 and php-5.1.6-3. Here is the general flow
 of that particular part of the site:

 php generated form ---(data submitted by pressing submit on the form
 and ok on a javascript confirm box)---
 window.location=./script.php?var=value --- script.php process the
 form data

 The problem is I cannot pass the var=value to script.php (the url on
 browser only says ./script.php? and $_GET is empty with a print_r() )
 but if I type in the url manually, the script.php works. I checked the
 javascript also and it is ok.

 I understand this might not be a php problem but I am totally lost. Any
 idea, insight, opinion is welcomed. Thanks.

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




Re: [PHP] [opinions] Ashop Commerce

2007-05-03 Thread Crayon
On Thursday 03 May 2007 18:36, Stut wrote:

 That is not a request for an opinion, it's an attempt to get a product
 name associated with a set of keywords.

By quoting the spam in full in your replies you are aiding and abetting.

-- 
Crayon

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



Re: [PHP] Discussion of bug #39062

2007-05-03 Thread Crayon
On Thursday 03 May 2007 03:18, Richard Lynch wrote:
 On Wed, May 2, 2007 1:14 pm, Bill Moran wrote:
  http://bugs.php.net/bug.php?id=39062

 This discussion may be better placed on Internals where the people
 who make these decisions hang out more...

Maybe Bill wanted us lowly users to know that the all powerful developers 
aren't listening to their users.

-- 
Crayon

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



Re: [PHP] Discussion of bug #39062

2007-05-03 Thread Bill Moran
In response to Crayon [EMAIL PROTECTED]:

 On Thursday 03 May 2007 03:18, Richard Lynch wrote:
  On Wed, May 2, 2007 1:14 pm, Bill Moran wrote:
   http://bugs.php.net/bug.php?id=39062
 
  This discussion may be better placed on Internals where the people
  who make these decisions hang out more...
 
 Maybe Bill wanted us lowly users to know that the all powerful developers 
 aren't listening to their users.

That wasn't the reason.  Actually, I'm not sure what the reason was, but I
suspect is has something to do with being overly busy and having 5 projects
competing for my time yesterday.  One of those, oops ... in hindsight that
wasn't the correct way to do that. kind of things.

I will post it to the internals list.  Sorry for the noise here.

-- 
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

[EMAIL PROTECTED]
Phone: 412-422-3463x4023

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



[PHP] Looking for an Architectural Guru

2007-05-03 Thread bruce
Hi.

We're creating a small team for the creation of some specific web based
apps/services. Currently we are 5-6 guys, covering
design/development/sales/marketing/Linux admin... We're in the process of
rounding out the team with DB skills, as well as a serious senior level kind
of architect resource.

(We're looking in a number of locations, and thought we'd post here as well.
If this isn't the right place, let us know, and just delete the posting!)

This is a seriously risky attempt at creating a business as we're creating a
team, where there is no initial compensation/salary. This is basically a
group of highly skilled guys getting together, to build what should be a
couple of successful consumer/business oriented apps. The approach is to
create a Sweat Equity based business, where equity is distributed to the
team.

In order to really succeed, we believe we need a seriously talented, highly
skilled architect, someone who's been though the battles, someone who can
architect apps/services that can handle 100,000s of users per month, in a
secure manner. We'd like the guru to have an overall understanding of both
the software and hardware aspects of creating scalable sites.

If you're interested, let's talk. If you also know of anybody that might fit
this description, who might be interested, please pass this to the person!

Thanks

Bruce Douglas
[EMAIL PROTECTED]

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



Re: [PHP] Re: Tag Cloud (WAS Deviation? Distribution? OT?)

2007-05-03 Thread Stut

Richard Lynch wrote:

  $query = select tag, popular from (select tag, count(*) as popular
from entry_tag group by tag order by popular desc limit 100) as p
order by tag;


I'm no expert, and I have no way to test this, but the following should 
work and gets shot of the sub-select...


select tag, count(1) as popular
from entry_tag
group by tag
order by popular desc, tag
limit 100

-Stut

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



Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Neo [GC]

Merlin schrieb:

Hi there,

I am checking plausability inside a php script that receives a POST 
submit. If an error occures the user should be redirected back, along 
with his original data filled into the forms.


There is a problem with this. As the GET method, which the redirect is 
using, only allows a certain amount of characters, the text is always 
cut down.


I use this:
HEADER(Location:.$data[rurl].?error=.$error.$parameter);

Is there a way to redirect the user to the form and fill in large text?

Thank you for your help,

Best regards, Merlin



This is a normal behaviour. Webservers trim the GET-request at a certain 
length.


You have several options:
- don't do a redirect but return the form, with most clean frameworks it 
should be no problem to include the action wich generates the form
- save the variables in a session, then send the redirect-header and 
clean the session after regenerating the form
- save the variables in a cookie stored at the client and clean the 
cookie afterwards (ugly)



Greetings,

--
Thomas 'Neo' Weber

Webmaster
GothNet.eu | Gothic-Chat.de

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



Re: [PHP] excel macro into php

2007-05-03 Thread Daniel Brown

   Sie nicht auch sprechen Spanischen, Tij?


On 5/3/07, Tijnema ! [EMAIL PROTECTED] wrote:


On 5/2/07, Anton Krall [EMAIL PROTECTED] wrote:
 Guys.. I have a problem and I was wondering if somebody with good php
 knowledge could help.

 I have this excel macro that converts number currency (mexican) into a
 string and I was wondering if somebody could help translating it to
php...

 Her eis the macro, if you could help, I would really appreciate it.

 Thanks guys!

I think that starting over is better then trying to convert this excel
macro. What exactly do you want to convert, from ?? to ??
Since all functions are in a language that isn't english, dutch,
german or frisian, I can't understand.

snip
 laUnidades = Array(UN, DOS, TRES, CUATRO, CINCO, SEIS,
SIETE,
 OCHO, NUEVE, DIEZ, ONCE, DOCE, TRECE, CATORCE, QUINCE,
 DIESISEIS, DIESISIETE, DIESIOCHO, DIESINUEVE, VEINTE,
VEINTIUN,
 VEINTIDOS, VEINTITRES, VEINTICUATRO, VEINTICINCO, VEINTISEIS,
 VEINTISIETE, VEINTIOCHO, VEINTINUEVE)
 laDecenas = Array(DIEZ, VEINTE, TREINTA, CUARENTA, CINCUENTA,
 SESENTA, SETENTA, OCHENTA, NOVENTA)
 laCentenas = Array(CIENTO, DOSCIENTOS, TRESCIENTOS,
CUATROCIENTOS,
 QUINIENTOS, SEISCIENTOS, SETECIENTOS, OCHOCIENTOS,
NOVECIENTOS)
Nice array, if you need it, you can use it directly in PHP, just add a
$ sign before the variable and ; at the end, and it is a PHP array :)
snip

I've snipped the rest of your code, because it's very though to
understand the code if you can't read the language. Like i said, show
me what you want to convert from and to, so that i can help you
writing something new, or comment your own macro in english so that
people can understand it.

Tijnema

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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


[PHP] Redirect via GET is loosing characters

2007-05-03 Thread Merlin

Hi there,

I am checking plausability inside a php script that receives a POST 
submit. If an error occures the user should be redirected back, along 
with his original data filled into the forms.


There is a problem with this. As the GET method, which the redirect is 
using, only allows a certain amount of characters, the text is always 
cut down.


I use this:
HEADER(Location:.$data[rurl].?error=.$error.$parameter);

Is there a way to redirect the user to the form and fill in large text?

Thank you for your help,

Best regards, Merlin

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



[PHP] Re: Tag Cloud (WAS Deviation? Distribution? OT?)

2007-05-03 Thread Richard Lynch
First and foremost, Oliver was right, and I was wrong.

The data is in a power curve, or maybe logarithmic, or whatever curve
you want to call it, depending on which expert you consult...

But as I realized last night, the data is ALREADY in that curve and
by simply breaking down in even increments from MIN to MAX, the
curve works itself out correctly.

Or, in other words, I was trying to complicate things by designing
logarithmic graph paper, when all I really wanted was standard graph
paper, to graph the data as it is in Reality.

Of course, others might choose to shape their curve by a log (or
other function) but most probably won't need to.

Here's the code I am using for my Tag Cloud (aka tagcloud), and it
works fine:


  //fat screen editor, sorry...
  $query = select tag, popular from (select tag, count(*) as popular
from entry_tag group by tag order by popular desc limit 100) as p
order by tag;
  $tagged = mysql_query($query, $connection);
  if (!$tagged){
$messages[] = Tagged Browsing offline for maintenance. Please try
again later or contact us.;
error_log(mysql_error($connection));
error_log($query);
  }
  $tagged_a = array();
  $max = 0;
  $min = 0x;
  while ($tagged  (list($tag, $popular) = mysql_fetch_row($tagged))){
$tagged_a[$tag] = $popular;
$max = max($max, $popular);
$min = min($min, $popular);
  }
  $distribution = ($max - $min) / 5;

// function here which prints out masthead, body, etc
// including anything in $messages array, with suitable div tag
// for error messages

  echo p id=\tagged\ style=\text-align: center\ ;
  foreach($tagged_a as $tag = $popular){
$tag_html = htmlentities($tag);
$pop = round(($popular - $min) / $distribution);
$pop = max(1, $pop); $pop = min(5, $pop);
echo a href=\tagged/$tag_html.htm\span
class=\t$pop\$tag_html/span/a ;
  }
  echo /p\n;

The CSS looks like:

.tagCloud {
  margin: 20px 0px 20px 0px;
  width: 830px;
}

.tagCloud span {
  padding: 3px;
}

.t1 {
  color: #c3c2ba;
  font-size: .8em;
}

.t2 {
  color: #8F8D7A;
  font-size: .9em;
}

.t3 {
  color: #615f4e;
  font-size: 1em;
}

.t4 {
  color: #535142;
  font-size: 1.2em;
}

.t5 {
  color: #434237;
  font-size: 1.4em;
}


Of course, you are free to tweak the colors and sizes as you see fit :-)

Since there are only a hundred items, ever, I chose to iterate the
result set, putting the data into an array, and track min/max as I go.

It might be slightly faster to run a second query to get min/max, or
to rewind the result set instead of making an array, or whatever, but,
really, it's fine as it is for only 100 items.

Thanks to Tedd for answering the question I asked, I think, even
though I was asking the wrong question. :-)

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

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



Re: [PHP] excel macro into php

2007-05-03 Thread Tijnema !

On 5/3/07, Daniel Brown [EMAIL PROTECTED] wrote:


Sie nicht auch sprechen Spanischen, Tij?


Nein, aber mein deutsch ist also nicht gut ;) Sprechen sie Spanischen Daniel?\

Tijnema




On 5/3/07, Tijnema ! [EMAIL PROTECTED] wrote:

 On 5/2/07, Anton Krall [EMAIL PROTECTED]  wrote:
  Guys.. I have a problem and I was wondering if somebody with good php
  knowledge could help.
 
  I have this excel macro that converts number currency (mexican) into a
  string and I was wondering if somebody could help translating it to
php...
 
  Her eis the macro, if you could help, I would really appreciate it.
 
  Thanks guys!

 I think that starting over is better then trying to convert this excel
 macro. What exactly do you want to convert, from ?? to ??
 Since all functions are in a language that isn't english, dutch,
 german or frisian, I can't understand.
 
 snip
  laUnidades = Array(UN, DOS, TRES, CUATRO, CINCO, SEIS,
SIETE,
  OCHO, NUEVE, DIEZ, ONCE, DOCE, TRECE, CATORCE, QUINCE,
  DIESISEIS, DIESISIETE, DIESIOCHO, DIESINUEVE, VEINTE,
VEINTIUN,
  VEINTIDOS, VEINTITRES, VEINTICUATRO, VEINTICINCO, VEINTISEIS,
  VEINTISIETE, VEINTIOCHO, VEINTINUEVE)
  laDecenas = Array(DIEZ, VEINTE, TREINTA, CUARENTA, CINCUENTA,
  SESENTA, SETENTA, OCHENTA, NOVENTA)
  laCentenas = Array(CIENTO, DOSCIENTOS, TRESCIENTOS,
CUATROCIENTOS,
  QUINIENTOS, SEISCIENTOS, SETECIENTOS, OCHOCIENTOS,
NOVECIENTOS)
 Nice array, if you need it, you can use it directly in PHP, just add a
 $ sign before the variable and ; at the end, and it is a PHP array :)
 snip

 I've snipped the rest of your code, because it's very though to
 understand the code if you can't read the language. Like i said, show
 me what you want to convert from and to, so that i can help you
 writing something new, or comment your own macro in english so that
 people can understand it.

 Tijnema

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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


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



Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Stut

Merlin wrote:
I am checking plausability inside a php script that receives a POST 
submit. If an error occures the user should be redirected back, along 
with his original data filled into the forms.


There is a problem with this. As the GET method, which the redirect is 
using, only allows a certain amount of characters, the text is always 
cut down.


I use this:
HEADER(Location:.$data[rurl].?error=.$error.$parameter);

Is there a way to redirect the user to the form and fill in large text?


http://php.net/session

-Stut

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



Re: [PHP] PHP + COM (IE Button COM Server)

2007-05-03 Thread Richard Lynch
http://php.net/com

But that's only going to work on the same machine where PHP is running
-- It does NOT add buttons and whatnot to my browser if I surf to your
website...

I actually doubt that the Python one does either, if you run it
server-side...

On Wed, May 2, 2007 6:53 pm, Iqbal Naved wrote:
 Hi Richard,

 Thanks for replying. But, I the thing is,  my intention is not
 server-side
 scripting, but to use php as a regular programming language to
 implement
 this task (just as the demo did for python). for example

 we can use

 $ie = new COM(InternetExplorer.Application);

 to call the ie com interfaces, such as Visible, Navigate etc. Also. we
 can
 use WSH scripting capabilities too. Check out,

 http://www.hudzilla.org/phpbook/read.php/14_0_0

 for some info on this. My guess is that if they can do it on Python,
 so can
 we on PHP :).

 Thanks again for replying,

 -Naved

 On 5/3/07, Richard Lynch [EMAIL PROTECTED] wrote:

 On Mon, April 30, 2007 1:46 pm, Iqbal Naved wrote:
  Anybody has implemented a IE button COM server in PHP ? I have
 found a
  python implementation for this in pywin32 package. My objective is
 to
  add a
  button in ie which will on click save the url in the address bar.
 I am
  attatching the iebutton.py with this mail. Also, this is a link in
  msdn
  instructing add toolbar buttons:
 
  http://msdn2.microsoft.com/en-us/library/aa753588.aspx
 
  Any code snippet will be extremely useful.

 What you want to do is something that happens on the CLIENT, the
 browser.

 PHP runs on the server.

 By the time the user is clicking on your button, there is NO php
 involved.

 Look into JavaScript or ActiveX or something.

 php ain't gonna do what you want.

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





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

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



Re: [PHP] Re: Tag Cloud (WAS Deviation? Distribution? OT?)

2007-05-03 Thread Richard Lynch


On Thu, May 3, 2007 10:00 am, Stut wrote:
 Richard Lynch wrote:
   $query = select tag, popular from (select tag, count(*) as
 popular
 from entry_tag group by tag order by popular desc limit 100) as p
 order by tag;

 I'm no expert, and I have no way to test this, but the following
 should
 work and gets shot of the sub-select...

 select tag, count(1) as popular
 from entry_tag
 group by tag
 order by popular desc, tag
 limit 100

But the whole point is to order by tag in the end, not popular desc...

In the final output, the tags are in alpha order for easy scanning
across.

The popularity is rendered in larger/bolder/darker text for, errr,
that not-quite-focuesed-zoom-in-on-big-things look. :-)

The inner query sorts by popularity to get the Top 100.

The outer query sorts that inner result alphabetized.

I don't *think* you can get that in a single non-join non-nexted
query, but I ain't no SQL expert either...

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

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



Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 9:26 am, Merlin wrote:
 I am checking plausability inside a php script that receives a POST
 submit. If an error occures the user should be redirected back, along
 with his original data filled into the forms.

 There is a problem with this. As the GET method, which the redirect is
 using, only allows a certain amount of characters, the text is always
 cut down.

 I use this:
 HEADER(Location:.$data[rurl].?error=.$error.$parameter);

 Is there a way to redirect the user to the form and fill in large
 text?

Not really, no, not with the re-direct...

But why do you feel the need to do a re-direct anyway?

With a simple re-structuring of your code, you can just do an
include to get the form back in with the data pre-filled, and have
them try again.

Why waste an HTTP connection, more hard drive hits to include all your
function libraries (or whatever), ...?

You've already GOT all the info you need in your hands right there to
display what you want to display.  Just display it.

:-)

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

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



Re: [PHP] Re: Tag Cloud (WAS Deviation? Distribution? OT?)

2007-05-03 Thread Stut

Richard Lynch wrote:

On Thu, May 3, 2007 10:00 am, Stut wrote:

Richard Lynch wrote:

  $query = select tag, popular from (select tag, count(*) as
popular
from entry_tag group by tag order by popular desc limit 100) as p
order by tag;

I'm no expert, and I have no way to test this, but the following
should
work and gets shot of the sub-select...

select tag, count(1) as popular
from entry_tag
group by tag
order by popular desc, tag
limit 100


But the whole point is to order by tag in the end, not popular desc...

In the final output, the tags are in alpha order for easy scanning
across.

The popularity is rendered in larger/bolder/darker text for, errr,
that not-quite-focuesed-zoom-in-on-big-things look. :-)

The inner query sorts by popularity to get the Top 100.

The outer query sorts that inner result alphabetized.

I don't *think* you can get that in a single non-join non-nexted
query, but I ain't no SQL expert either...


Ahh, right, with you. Indeed, I can't see a way to do that either. 
Ignore me, go about your business.


-Stut

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



Re: [PHP] Looking for an Architectural Guru

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 9:24 am, bruce wrote:
 sweat equity pitch

You might get more response if you include some kind of idea of what
sort of web app you are building...

Financial?  Social?  Entertainment?

It seems to me like we're back in Boom mode [1], and a sweat equity
pitch is gonna be kinda tough to fill, but who knows?

[1] So, has anybody coined Boom 2.0 yet? :-) I think I just did...

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

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



Re: [PHP] Custom database session handler and data concurrent access from ajax request

2007-05-03 Thread Nicolas Quirin

Nobody could help me???

THX
- Original Message - 
From: [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 03, 2007 11:45 AM
Subject: [PHP] Custom database session handler and data concurrent access 
from ajax request





Hi,

i'm currently working on a web site that use AJAX requests to load a web 
page by
part. So, my apache server gives quickly an answer and current client must 
wait
a little bit in order to have the entire web page, but while this loading 
step,

he can already see my partially displayed web page and use it!

This web site uses php session, based on cookies, but not only cookies 
(cookies

are just prefered). session.auto_start is false in order to allow object
declarations before session starts (so I can stored little object in 
session)

There is no session handler defined in php.ini, line has been commented).

In each php script, i start manually the session with session_start and i 
use
register_shutdown to register session_write_close in order to write 
current

session when the current script is finished.

Sessions are managed in a mysql database, with autocommit enabled. I'm 
using

mysql_pconnect in my handler to read/write session data (same user, same
password, same host, always).

Read/write session into database works...but not fine.

Scenario: scripts are parts of a main page, scripts are called by ASYNC 
AJAX GET
Script 1 modifies an object A from session and re-serializes it into 
session,
Script 2 is launched when client is receiving a response from the server 
for

script 1(php output buffering is enabled),
Script 2 displayed object A content from session and flush object A 
content,
re-serializes it into session, but sometime Script 2 doesn't displayed 
object A
modification by script 1. More terrible, reloading the entire page 
displays all
the content of the modified object A (but script 2 has flushed its 
content!)


I'm asking if custom session handler must implement mutex system or 
anything to
prevent concurrent access and terrible random errors of session 
writing/reading
and moreConcurrent access does'nt seems to be safely managed 
natively...


Any idea? comment? I can sent my session handler php class

--
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] Redirect via GET is loosing characters

2007-05-03 Thread Daniel Brown

   Beating a dead horse here, since it's been mentioned twice already, but
yeah --- $_SESSION's are the way to go with this.

?
   session_start();

   $_SESSION['error'] = $error;
   $_SESSION['parameter'] = $parameter;

   header(Location:.$data[rurl]);
   exit;
?

   And wherever you have your error handling, do:
?
   session_start(); // If not called from a header.php-like start file.

   if($_SESSION['error']) {
   // Do something with $_SESSION['error'] and $_SESSION['parameter']
   }
?

   And for the record, it's not just the HTTP server that trims it, but the
browser generally does, as well, to avoid things such as memory leaks, et
cetera.  Internet Exploder, for example, has had a limit of 2,083 total
characters in a GET request, but the actual RFC for HTTP/1.1 has no limit
for the protocol (RFC 2616 Section 3.2.1).

   And slightly off-topic, but think about how much the web has changed in
the last 20 years (well, 17, since the HTTP protocol came about in 1990)
and then think about the fact that it's all still based on nothing higher
than version 1.1.

On 5/3/07, Neo [GC] [EMAIL PROTECTED] wrote:


Merlin schrieb:
 Hi there,

 I am checking plausability inside a php script that receives a POST
 submit. If an error occures the user should be redirected back, along
 with his original data filled into the forms.

 There is a problem with this. As the GET method, which the redirect is
 using, only allows a certain amount of characters, the text is always
 cut down.

 I use this:
 HEADER(Location:.$data[rurl].?error=.$error.$parameter);

 Is there a way to redirect the user to the form and fill in large text?

 Thank you for your help,

 Best regards, Merlin


This is a normal behaviour. Webservers trim the GET-request at a certain
length.

You have several options:
- don't do a redirect but return the form, with most clean frameworks it
should be no problem to include the action wich generates the form
- save the variables in a session, then send the redirect-header and
clean the session after regenerating the form
- save the variables in a cookie stored at the client and clean the
cookie afterwards (ugly)


Greetings,

--
Thomas 'Neo' Weber

Webmaster
GothNet.eu | Gothic-Chat.de

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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] Discussion of bug #39062

2007-05-03 Thread Richard Lynch


On Thu, May 3, 2007 6:59 am, Crayon wrote:
 On Thursday 03 May 2007 03:18, Richard Lynch wrote:
 On Wed, May 2, 2007 1:14 pm, Bill Moran wrote:
  http://bugs.php.net/bug.php?id=39062

 This discussion may be better placed on Internals where the people
 who make these decisions hang out more...

 Maybe Bill wanted us lowly users to know that the all powerful
 developers
 aren't listening to their users.

:-)

Some of them are definitely listening here.

And all of them are trying to juggle needs/demands/desires of an
enormous community with more variety than, errr, dog species?

Lord knows I'm not real happy with some of the decisions/directions,
but you know what?  Anybody *really* unhappy that cares enough can get
off their butt and start submitting patches, and push things a
different direction.  Self included, mind you. :-)

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

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



Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Daniel Brown

   If it's on the same domain/user account, that's probably a better
idea but with $data['rurl'] being used, I'm (ignorantly) assuming that
RURL = Remote URL.

On 5/3/07, Richard Lynch [EMAIL PROTECTED] wrote:


On Thu, May 3, 2007 9:26 am, Merlin wrote:
 I am checking plausability inside a php script that receives a POST
 submit. If an error occures the user should be redirected back, along
 with his original data filled into the forms.

 There is a problem with this. As the GET method, which the redirect is
 using, only allows a certain amount of characters, the text is always
 cut down.

 I use this:
 HEADER(Location:.$data[rurl].?error=.$error.$parameter);

 Is there a way to redirect the user to the form and fill in large
 text?

Not really, no, not with the re-direct...

But why do you feel the need to do a re-direct anyway?

With a simple re-structuring of your code, you can just do an
include to get the form back in with the data pre-filled, and have
them try again.

Why waste an HTTP connection, more hard drive hits to include all your
function libraries (or whatever), ...?

You've already GOT all the info you need in your hands right there to
display what you want to display.  Just display it.

:-)

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

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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] Custom database session handler and data concurrent access from ajax request

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 4:45 am, [EMAIL PROTECTED] wrote:
 Sessions are managed in a mysql database, with autocommit enabled. I'm
 using
 mysql_pconnect in my handler to read/write session data (same user,
 same
 password, same host, always).

As noted in the user comments of the on-line manual, the sample code
in the manual does not (last I checked) handle the race condition of
multiple AJAX (or other) requests.

Several work-arounds are proposed, I believe.

 I'm asking if custom session handler must implement mutex system or
 anything to
 prevent concurrent access and terrible random errors of session
 writing/reading
 and moreConcurrent access does'nt seems to be safely managed
 natively...

Yes.

You *do* need to deal with this, and the sample code on php.net
doesn't do that.  It only works for the Web 1.0 (?) idea of
interaction with serial requests to alter session.

 Any idea? comment? I can sent my session handler php class

Some kind of lock/mutex/whatever will be needed -- which will make
your AJAX calls serial, not parallel.

So you want to MINIMIZE your session writing section of code, call
session_write_close at the end of it, and do that as soon as possible
at the tip-top of the script, to make the serial-ness of the scripts
as low-impact as possible.

Also re-consider if you really really need to cram as much stuff
into a session as you originally architected.  Often-times I've seen
folks putting an awful lot of stuff in session data, and they don't
NEED to, it was just convenient -- Once you start down the AJAX
road, it seems to me like you want to re-think that convenience and
go for minimalism of what you write into a session.  But I ain't been
down that road, so maybe I'm full of it. :-)

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

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



Re: [PHP] [opinions] Ashop Commerce

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 4:39 am, Marco Sottana wrote:
 deleted to minimize benefits to aforementioned software

My opinion is any user of this software should immediately switch to
anything else, to avoid supporting such spam.

jmho.

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

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



Re: [PHP] [opinions] Ashop Commerce

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 6:36 am, Marco Sottana wrote:
 i am new ...
 say me .. 2 or 3 nice e-commerce and why is nice.. please..

RTFA

I was sick of this thread in 1997!!!

I sure don't want to see it again!

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

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



Re: [PHP] excel macro into php

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 4:37 am, Tijnema ! wrote:
 On 5/2/07, Anton Krall [EMAIL PROTECTED] wrote:
 Guys.. I have a problem and I was wondering if somebody with good
 php
 knowledge could help.

 I have this excel macro that converts number currency (mexican) into
 a
 string and I was wondering if somebody could help translating it to
 php...

 Her eis the macro, if you could help, I would really appreciate it.

 Thanks guys!

 I think that starting over is better then trying to convert this excel
 macro. What exactly do you want to convert, from ?? to ??
 Since all functions are in a language that isn't english, dutch,
 german or frisian, I can't understand.

 snip
 laUnidades = Array(UN, DOS, TRES, CUATRO, CINCO, SEIS,
 SIETE,
 OCHO, NUEVE, DIEZ, ONCE, DOCE, TRECE, CATORCE,
 QUINCE,
 DIESISEIS, DIESISIETE, DIESIOCHO, DIESINUEVE, VEINTE,
 VEINTIUN,
 VEINTIDOS, VEINTITRES, VEINTICUATRO, VEINTICINCO,
 VEINTISEIS,
 VEINTISIETE, VEINTIOCHO, VEINTINUEVE)
 laDecenas = Array(DIEZ, VEINTE, TREINTA, CUARENTA,
 CINCUENTA,
 SESENTA, SETENTA, OCHENTA, NOVENTA)
 laCentenas = Array(CIENTO, DOSCIENTOS, TRESCIENTOS,
 CUATROCIENTOS,
 QUINIENTOS, SEISCIENTOS, SETECIENTOS, OCHOCIENTOS,
 NOVECIENTOS)
 Nice array, if you need it, you can use it directly in PHP, just add a
 $ sign before the variable and ; at the end, and it is a PHP array :)
 snip

 I've snipped the rest of your code, because it's very though to
 understand the code if you can't read the language. Like i said, show
 me what you want to convert from and to, so that i can help you
 writing something new, or comment your own macro in english so that
 people can understand it.

I deleted the original, but...

90% of the macro can be converted to PHP by putting $ in front of all
the variables.

90% of the function names are the same, or very similar.

There was one MOD call that needs to change to %

Do all that, run it in PHP, fix any syntax errors, and then run tests
side-by-side and compare outputs.

I'm betting it's a no-brainer conversion, based on what I recall of
the OP.

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

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



Re: [PHP] Looking for an Architectural Guru

2007-05-03 Thread Daniel Brown

   Ha!  You and the 2.0 terminology

   If you're coining that, I'm registering the domain boo20.com
(boo2.comwas already taken).

On 5/3/07, Richard Lynch [EMAIL PROTECTED] wrote:


On Thu, May 3, 2007 9:24 am, bruce wrote:
 sweat equity pitch

You might get more response if you include some kind of idea of what
sort of web app you are building...

Financial?  Social?  Entertainment?

It seems to me like we're back in Boom mode [1], and a sweat equity
pitch is gonna be kinda tough to fill, but who knows?

[1] So, has anybody coined Boom 2.0 yet? :-) I think I just did...

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

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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] excel macro into php

2007-05-03 Thread Daniel Brown

   Tij:

   Ja, spreche ich Spanischen.  Me habla espanol bien no muy bien, pero
bastante bueno.  Ik leer enkel het Nederlands. Het is als het Engels, maar
er is één of ander verschil.

   Richard (the original, if you want it):

Guys.. I have a problem and I was wondering if somebody with good php
knowledge could help.

I have this excel macro that converts number currency (mexican) into a
string and I was wondering if somebody could help translating it to php...

Her eis the macro, if you could help, I would really appreciate it.

Thanks guys!

Function CantidadEnLetra(tyCantidad As Currency) As String
Dim lyCantidad As Currency, lyCentavos As Currency, lnDigito As Byte,
lnPrimerDigito As Byte, lnSegundoDigito As Byte, lnTercerDigito As Byte,
lcBloque As String, lnNumeroBloques As Byte, lnBloqueCero
tyCantidad = Round(tyCantidad, 2)
lyCantidad = Int(tyCantidad)
lyCentavos = (tyCantidad - lyCantidad) * 100
laUnidades = Array(UN, DOS, TRES, CUATRO, CINCO, SEIS, SIETE,
OCHO, NUEVE, DIEZ, ONCE, DOCE, TRECE, CATORCE, QUINCE,
DIESISEIS, DIESISIETE, DIESIOCHO, DIESINUEVE, VEINTE, VEINTIUN,
VEINTIDOS, VEINTITRES, VEINTICUATRO, VEINTICINCO, VEINTISEIS,
VEINTISIETE, VEINTIOCHO, VEINTINUEVE)
laDecenas = Array(DIEZ, VEINTE, TREINTA, CUARENTA, CINCUENTA,
SESENTA, SETENTA, OCHENTA, NOVENTA)
laCentenas = Array(CIENTO, DOSCIENTOS, TRESCIENTOS, CUATROCIENTOS,
QUINIENTOS, SEISCIENTOS, SETECIENTOS, OCHOCIENTOS, NOVECIENTOS)
lnNumeroBloques = 1
Do
lnPrimerDigito = 0
lnSegundoDigito = 0
lnTercerDigito = 0
lcBloque = 
lnBloqueCero = 0
For i = 1 To 3
lnDigito = lyCantidad Mod 10
If lnDigito  0 Then
Select Case i
Case 1
lcBloque =laUnidades(lnDigito - 1)
lnPrimerDigito = lnDigito
Case 2
If lnDigito = 2 Then
lcBloque =laUnidades((lnDigito * 10) + lnPrimerDigito - 1)
Else
lcBloque =laDecenas(lnDigito - 1)  IIf(lnPrimerDigito  0,  Y,
Null)  lcBloque
End If
lnSegundoDigito = lnDigito
Case 3
lcBloque =IIf(lnDigito = 1 And lnPrimerDigito = 0 And lnSegundoDigito
= 0, CIEN, laCentenas(lnDigito - 1))  lcBloque
lnTercerDigito = lnDigito
End Select
Else
lnBloqueCero = lnBloqueCero + 1
End If
lyCantidad = Int(lyCantidad / 10)
If lyCantidad = 0 Then
Exit For
End If
Next i
Select Case lnNumeroBloques
Case 1
CantidadEnLetra = lcBloque
Case 2
CantidadEnLetra = lcBloque  IIf(lnBloqueCero = 3, Null,  MIL) 
CantidadEnLetra
Case 3
CantidadEnLetra = lcBloque  IIf(lnPrimerDigito = 1 And lnSegundoDigito = 0
And lnTercerDigito = 0,  MILLON,  MILLONES)  CantidadEnLetra
End Select
lnNumeroBloques = lnNumeroBloques + 1
Loop Until lyCantidad = 0
CantidadEnLetra = (  CantidadEnLetra  IIf(tyCantidad  1,  PESOS , 
PESO )  Format(Str(lyCentavos), 00)  /100 M.N. )
End Function

On 5/3/07, Tijnema ! [EMAIL PROTECTED] wrote:


On 5/3/07, Daniel Brown [EMAIL PROTECTED] wrote:

 Sie nicht auch sprechen Spanischen, Tij?

Nein, aber mein deutsch ist also nicht gut ;) Sprechen sie Spanischen
Daniel?\

Tijnema



 On 5/3/07, Tijnema ! [EMAIL PROTECTED] wrote:
 
  On 5/2/07, Anton Krall [EMAIL PROTECTED]  wrote:
   Guys.. I have a problem and I was wondering if somebody with good
php
   knowledge could help.
  
   I have this excel macro that converts number currency (mexican) into
a
   string and I was wondering if somebody could help translating it to
 php...
  
   Her eis the macro, if you could help, I would really appreciate it.
  
   Thanks guys!
 
  I think that starting over is better then trying to convert this excel
  macro. What exactly do you want to convert, from ?? to ??
  Since all functions are in a language that isn't english, dutch,
  german or frisian, I can't understand.
  
  snip
   laUnidades = Array(UN, DOS, TRES, CUATRO, CINCO, SEIS,
 SIETE,
   OCHO, NUEVE, DIEZ, ONCE, DOCE, TRECE, CATORCE,
QUINCE,
   DIESISEIS, DIESISIETE, DIESIOCHO, DIESINUEVE, VEINTE,
 VEINTIUN,
   VEINTIDOS, VEINTITRES, VEINTICUATRO, VEINTICINCO,
VEINTISEIS,
   VEINTISIETE, VEINTIOCHO, VEINTINUEVE)
   laDecenas = Array(DIEZ, VEINTE, TREINTA, CUARENTA,
CINCUENTA,
   SESENTA, SETENTA, OCHENTA, NOVENTA)
   laCentenas = Array(CIENTO, DOSCIENTOS, TRESCIENTOS,
 CUATROCIENTOS,
   QUINIENTOS, SEISCIENTOS, SETECIENTOS, OCHOCIENTOS,
 NOVECIENTOS)
  Nice array, if you need it, you can use it directly in PHP, just add a
  $ sign before the variable and ; at the end, and it is a PHP array :)
  snip
 
  I've snipped the rest of your code, because it's very though to
  understand the code if you can't read the language. Like i said, show
  me what you want to convert from and to, so that i can help you
  writing something new, or comment your own macro in english so that
  people can understand it.
 
  Tijnema
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 --
 Daniel P. Brown
 [office] (570-) 587-7080 Ext. 272
 [mobile] (570-) 766-8107





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] PHP's ldap_sasl_bind tries to authenticate with KRB5CCNAME other than the one provided by mod_auth_kerb

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 12:33 am, gil ran wrote:
 I dunno what klist does, nor what any of the KRB stuff is, but if
 you
 want to preserve this KRB thingie from page to page, it looks like
 you
 will need to do more than just run 'klist'...

 I don't want to preserve this KRB thingie from page to page. The
 opposite is correct: I don't understand why the old file-name is used
 instead of the new one.

How could GSSAPI know *which* Apache child's environment to check?...

 When using ldap_sasl_bind with the 4th argument set to GSSAPI we are
 trying to bind to the ldap server using sasl and GSSAPI. The GSSAPI
 ignores any provided username/password (authcid, for those of you who
 are familiar with sasl). Instead, it uses the information kept in the
 credential cache file. This is the file Apache (mod_auth_kerb)
 creates. This is the file-name provided by it in
 $_SERVER['KRB5CCNAME'].

If you aren't passing it from Apache to GSSAPI, then it's going to
snag whichever env happens to have been set last or...

There's a differnt ENV floating around for each Apache child, I think,
so how is GSSAPI supposed to know which one to snag?

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

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



Fw: [PHP] Custom database session handler and data concurrent access from ajax request

2007-05-03 Thread Nicolas Quirin


- Original Message - 
From: Nicolas Quirin [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
Sent: Thursday, May 03, 2007 6:22 PM
Subject: Re: [PHP] Custom database session handler and data concurrent 
access from ajax request




Ok thanks a lot to confirm my problem.
I have partially implemented a write/read session class handler (not the 
customized session save handler wich read/write data from database)
This class is only a semaphore manager for read/write object in the 
current session. Semaphore is created if not existent, semaphore is 
acquired if free, blocking if process must wait for this ressource.


From my first tests of it, less error occured...

But having a semaphore by safe object stored in the current session is 
cost memory issue: a created semaphore must have a time to live equal to 
the life time of the current session since i could'nt know which script is 
executed before another and which script could remove the semaphore...


So semaphore are removed by session garbage collector. :-s.

This issue cannot support 1 connected users...I think:

1 * (nbsafeobjet * semaphore memory size) = ARGH

To finish, I must create a file per semaphore since sem_get require an id 
generated with ftock()!!!

Heavy issue

Is this solution really bad?

I have search and find another solution : flock() and create a file per 
safe objet in the session.


- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, May 03, 2007 5:59 PM
Subject: Re: [PHP] Custom database session handler and data concurrent 
access from ajax request




On Thu, May 3, 2007 4:45 am, [EMAIL PROTECTED] wrote:

Sessions are managed in a mysql database, with autocommit enabled. I'm
using
mysql_pconnect in my handler to read/write session data (same user,
same
password, same host, always).


As noted in the user comments of the on-line manual, the sample code
in the manual does not (last I checked) handle the race condition of
multiple AJAX (or other) requests.

Several work-arounds are proposed, I believe.


I'm asking if custom session handler must implement mutex system or
anything to
prevent concurrent access and terrible random errors of session
writing/reading
and moreConcurrent access does'nt seems to be safely managed
natively...


Yes.

You *do* need to deal with this, and the sample code on php.net
doesn't do that.  It only works for the Web 1.0 (?) idea of
interaction with serial requests to alter session.


Any idea? comment? I can sent my session handler php class


Some kind of lock/mutex/whatever will be needed -- which will make
your AJAX calls serial, not parallel.

So you want to MINIMIZE your session writing section of code, call
session_write_close at the end of it, and do that as soon as possible
at the tip-top of the script, to make the serial-ness of the scripts
as low-impact as possible.

Also re-consider if you really really need to cram as much stuff
into a session as you originally architected.  Often-times I've seen
folks putting an awful lot of stuff in session data, and they don't
NEED to, it was just convenient -- Once you start down the AJAX
road, it seems to me like you want to re-think that convenience and
go for minimalism of what you write into a session.  But I ain't been
down that road, so maybe I'm full of it. :-)

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

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







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



Re: [PHP] Deviation? Distribution? OT?

2007-05-03 Thread tedd

At 3:11 PM -0500 5/2/07, Richard Lynch wrote:

On Wed, May 2, 2007 7:55 am, tedd wrote:

 Let me estate the problem. From your dB of things (the population),
 you're going to pull out the top 100 most popular items and then
 divide them into five groups using labels t1 through t5. Considering
 that it's css guy asking for this, he's probably making a tag
 cloud. They are kind of neat, you can look it up.


It is DEFINITELY a tag cloud.

That's precisely what it is, actually...

Now if I can just see how to relate your sample web page to what I'm
looking for, I'm all set... :-)


Richard:

Ok,

1. Pull out the top 100.

2. Run a standard deviation on the group,

3. Take all those who fall within a standard deviation from the top 
and make that the t5 group (the most popular) and remove them from 
future consideration.


For example, if top value is 100 and the standard deviation is 5, 
then take all things that fall between 95 and 100 as the t5 group.


4. Then expand standard deviation twice and take the next group that 
falls within the second deviation and tag them t4 and remove them 
from future consideration.


5. Repeat and finally everything that falls outside of t2 is t1.

I think that will do it.

Cheers,

tedd

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

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



Re: [PHP] excel macro into php

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 11:17 am, Daniel Brown wrote:
 Function CantidadEnLetra(tyCantidad As Currency) As String

function CantidadEnLetra ($tyCantidad) {

/*
 Dim lyCantidad As Currency, lyCentavos As Currency, lnDigito As Byte,
 lnPrimerDigito As Byte, lnSegundoDigito As Byte, lnTercerDigito As
 Byte,
 lcBloque As String, lnNumeroBloques As Byte, lnBloqueCero
*/

 tyCantidad = Round(tyCantidad, 2)

$tyCantidad = round($tyCantidad, 2);

 lyCantidad = Int(tyCantidad)

$lyCantidad = (int) $tyCantidad; //or IntVal

 lyCentavos = (tyCantidad - lyCantidad) * 100

$lyCentavos = ($tyCantidad - $lyCantidad) * 100;

 laUnidades = Array(UN, DOS, TRES, CUATRO, CINCO, SEIS,
 SIETE,
 OCHO, NUEVE, DIEZ, ONCE, DOCE, TRECE, CATORCE, QUINCE,
 DIESISEIS, DIESISIETE, DIESIOCHO, DIESINUEVE, VEINTE,
 VEINTIUN,
 VEINTIDOS, VEINTITRES, VEINTICUATRO, VEINTICINCO,
 VEINTISEIS,
 VEINTISIETE, VEINTIOCHO, VEINTINUEVE)

$laUnidades = array(...);

 laDecenas = Array(DIEZ, VEINTE, TREINTA, CUARENTA,
 CINCUENTA,
 SESENTA, SETENTA, OCHENTA, NOVENTA)
 laCentenas = Array(CIENTO, DOSCIENTOS, TRESCIENTOS,
 CUATROCIENTOS,
 QUINIENTOS, SEISCIENTOS, SETECIENTOS, OCHOCIENTOS,
 NOVECIENTOS)

$laDecenas = array(...);

 lnNumeroBloques = 1

$luNumeroBloques = 1;

 Do

do {
 lnPrimerDigito = 0
 lnSegundoDigito = 0
 lnTercerDigito = 0
 lcBloque = 
 lnBloqueCero = 0

//I refuse to re-type these with $ in front at this point. You do it.
//In fact, from here on, I only translate any new syntax

 For i = 1 To 3

for ($i = 1; $i = 3; $i++){

 lnDigito = lyCantidad Mod 10

$lnDigito = $lyCantidad % 10;

 If lnDigito  0 Then

if ($lnDigito != 0){ //  might actually work in php as well...

 Select Case i

switch ($i){
 Case 1
case 1:
 lcBloque =laUnidades(lnDigito - 1)

$lcBloque =   . laUnidades($lnDigito - 1);

 lnPrimerDigito = lnDigito
//$ and ;
 Case 2
case 2:
 If lnDigito = 2 Then
 lcBloque =laUnidades((lnDigito * 10) + lnPrimerDigito - 1)
 Else
 lcBloque =laDecenas(lnDigito - 1)  IIf(lnPrimerDigito  0, 
 Y,
 Null)  lcBloque

$lcBloque =   . laDecenas($lnDigito - 1) . ($lnPrimerDigito != 0 ? 
Y : '') . $lcBloque;

 End If

}

 lnSegundoDigito = lnDigito
 Case 3
 lcBloque =IIf(lnDigito = 1 And lnPrimerDigito = 0 And
 lnSegundoDigito
 = 0, CIEN, laCentenas(lnDigito - 1))  lcBloque

Use  in PHP for And in VB or whatever this is.

 lnTercerDigito = lnDigito
 End Select

}

 Else
 lnBloqueCero = lnBloqueCero + 1
 End If
 lyCantidad = Int(lyCantidad / 10)
 If lyCantidad = 0 Then
 Exit For

break; //get out of for loop

 End If

}

 Next i

}

 Select Case lnNumeroBloques
 Case 1
 CantidadEnLetra = lcBloque
 Case 2
 CantidadEnLetra = lcBloque  IIf(lnBloqueCero = 3, Null,  MIL) 
 CantidadEnLetra
 Case 3
 CantidadEnLetra = lcBloque  IIf(lnPrimerDigito = 1 And
 lnSegundoDigito = 0
 And lnTercerDigito = 0,  MILLON,  MILLONES)  CantidadEnLetra
 End Select
 lnNumeroBloques = lnNumeroBloques + 1
 Loop Until lyCantidad = 0

I've lost track of where this loop is going at this point, because
the indentation of the macro is non-existent...

Indent the PHP code correctly, and it should get pretty clear.

 CantidadEnLetra = (  CantidadEnLetra  IIf(tyCantidad  1,  PESOS
 , 
 PESO )  Format(Str(lyCentavos), 00)  /100 M.N. )

Format is probably some variant of http://php.net/sprintf

 End Function

}


 On 5/3/07, Tijnema ! [EMAIL PROTECTED] wrote:

 On 5/3/07, Daniel Brown [EMAIL PROTECTED] wrote:
 
  Sie nicht auch sprechen Spanischen, Tij?

 Nein, aber mein deutsch ist also nicht gut ;) Sprechen sie
 Spanischen
 Daniel?\

 Tijnema
 
 
 
  On 5/3/07, Tijnema ! [EMAIL PROTECTED] wrote:
  
   On 5/2/07, Anton Krall [EMAIL PROTECTED]  wrote:
Guys.. I have a problem and I was wondering if somebody with
 good
 php
knowledge could help.
   
I have this excel macro that converts number currency
 (mexican) into
 a
string and I was wondering if somebody could help translating
 it to
  php...
   
Her eis the macro, if you could help, I would really
 appreciate it.
   
Thanks guys!
  
   I think that starting over is better then trying to convert this
 excel
   macro. What exactly do you want to convert, from ?? to ??
   Since all functions are in a language that isn't english, dutch,
   german or frisian, I can't understand.
   
   snip
laUnidades = Array(UN, DOS, TRES, CUATRO, CINCO,
 SEIS,
  SIETE,
OCHO, NUEVE, DIEZ, ONCE, DOCE, TRECE, CATORCE,
 QUINCE,
DIESISEIS, DIESISIETE, DIESIOCHO, DIESINUEVE,
 VEINTE,
  VEINTIUN,
VEINTIDOS, VEINTITRES, VEINTICUATRO, VEINTICINCO,
 VEINTISEIS,
VEINTISIETE, VEINTIOCHO, VEINTINUEVE)
laDecenas = Array(DIEZ, VEINTE, TREINTA, CUARENTA,
 CINCUENTA,
SESENTA, SETENTA, OCHENTA, NOVENTA)
laCentenas = Array(CIENTO, DOSCIENTOS, TRESCIENTOS,
  CUATROCIENTOS,
QUINIENTOS, SEISCIENTOS, SETECIENTOS, OCHOCIENTOS,
  NOVECIENTOS)
   Nice array, if you need it, you can use it directly in PHP, just
 add a
   $ sign before the variable and ; at the end, and it is a PHP
 array :)
   snip
  

Re: Fw: [PHP] Custom database session handler and data concurrent access from ajax request

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 11:24 am, Nicolas Quirin wrote:

 current session. Semaphore is created if not existent, semaphore is
 acquired if free, blocking if process must wait for this ressource.

 From my first tests of it, less error occured...

less, or none?

If it's not none there is something wrong with the semaphore
implementation...

 But having a semaphore by safe object stored in the current session
 is
 cost memory issue: a created semaphore must have a time to live
 equal to
 the life time of the current session since i could'nt know which
 script is
 executed before another and which script could remove the
 semaphore...

 So semaphore are removed by session garbage collector. :-s.

...

[and I repeat myself]
 So you want to MINIMIZE your session writing section of code, call
 session_write_close at the end of it, and do that as soon as
 possible
 at the tip-top of the script, to make the serial-ness of the
 scripts
 as low-impact as possible.

So, no, you probably don't want to have a semaphore living for the
entire length of the script.

 Also re-consider if you really really need to cram as much stuff
 into a session as you originally architected.  Often-times I've
 seen
 folks putting an awful lot of stuff in session data, and they don't
 NEED to, it was just convenient -- Once you start down the AJAX
 road, it seems to me like you want to re-think that convenience
 and
 go for minimalism of what you write into a session.  But I ain't
 been
 down that road, so maybe I'm full of it. :-)

And you may want to minimize your session usage, as I said.

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

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



Re: [PHP] Re: A problem with passing $_GET in an url

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 6:45 am, Dan Shirah wrote:
...

 On 5/3/07, Travis Moore [EMAIL PROTECTED] wrote:

 If you're using window.location=./script.php?var=value, it's not
 actually using a variable, it's using a string.

 If you're just using the above as an example, then could you please
 post
 the line of javascript for redirecting.

...

This would help, but it's almost certainly a Javascript problem...

 Davis Chan wrote:
...
  php generated form ---(data submitted by pressing submit on the
 form
  and ok on a javascript confirm box)---
  window.location=./script.php?var=value --- script.php process
 the
  form data

You need to compose the URL in Javascript with the correct var and
value in it.

Do something like:

url = './script.php?var=' + value;
alert(url);
window.location = url;

so you can SEE the URL you are using.

  The problem is I cannot pass the var=value to script.php (the
 url on
  browser only says ./script.php? and $_GET is empty with a
 print_r() )

Yes, if the browser only has ? and the $_GET is empty, that is
consistent.

There is no ?var=value there.

  but if I type in the url manually, the script.php works. I checked

Excellent!

 the
  javascript also and it is ok.

I don't see how it CAN be okay, since, like, it's not sending you to
the right URL, and it's not working... :-)

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

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



Re: [PHP] Script feedback: insert string into another string

2007-05-03 Thread Richard Lynch
On Wed, May 2, 2007 6:36 pm, Micky Hulse wrote:
 1. wordwrap() is a little different than the function I wrote because
 it
 counts characters only... I need to count words. I am sure wordwrap
 could be modified to count words, but I have yet to really explore
 this
 option.

Counting words is almost always a Bad Idea, since you may have users
who use big fat words (University professors and Market-speak) and you
have have texters who, like, don't even use words...

u c ? i mean?
:-v

 2. Brad S. posted some information about cookies and my script, but
 did
 not really explain what he was talking about... I just read your post
 about what those cookies are, and it makes things a bit more clear
 (thanks!), but what was Brad getting at? I want good security, and it
 sounded like Brad was saying he could access cookies through my form?
 I
 am not very familiar with XSS attacks, but that sounded like what Brad
 was getting at... So my first thought was this:

 I thought striptags() would take care of such problems [XSS
 attack]...
 but it sounds like I need to filter my [input] strings [via form] with
 htmlentities... no?

striptags will attempt to remove any HTML tags.

This avoids most XSS attacks, as the attack is buried in an HTML tag.

You could probably *still* manage to take some kind of user input, and
output some kind of HTML that would have an XSS attack...

But you'd have to work pretty hard at it...

You generally want to call striptags() on the data as it comes in, if
you are not allowing HTML input.  And possibly raise an error if the
original input and the striptags() result don't match, as the user
probably *thought* you were going to accept HTML input...

Or, don't do striptags at all, and, instead...


htmlentities takes text that is about to go to the browser, and makes
it browser-safe to display that text as text, and not as HTML.

It converts any special characters that have meaning to a browser
into their HTML equivalent entities that will render the symbol that
looks like the original text, rather than tell the browser to render
something else entirely.

You generally want to call htmlentities() right before you send *any*
data to the browser:

$text = Some big long  block o' text  that you have stored in your
DB.;
$url = http://example.com/var=; . urlencode('nasty  ugly value, eh?');
$text_html = htmlentities($text);
$url_html = htmlentities($url);
echo p$text/p\n;
echo a href=\$url_html\$url_html/a\n;

It may seem odd at first, but, really, *ANY* data you send to the
browser as data should have htmlentities() called on it.

The only exception would be if you have data that already has HTML
tags buried in it -- and that's almost always a Bad Idea in the first
place, as it gets really tricky to be sure that you aren't sending out
very broken HTML and XSS-infected HTML and ...  An exception might be
if you generate static HTML and cache that, using the techniques above
to create the static HTML in the first place.

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

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



Re: [PHP] excel macro into php

2007-05-03 Thread Tijnema !

On 5/3/07, Daniel Brown [EMAIL PROTECTED] wrote:

   Tij:

   Ja, spreche ich Spanischen.  Me habla espanol bien no muy bien, pero
bastante bueno.  Ik leer enkel het Nederlands. Het is als het Engels, maar
er is één of ander verschil.


Haha, dat is toch redelijk nederlands :)  Dutch

Bien, esto es mi español, Eso Es todo puedo decir  Spanish

Engels is quite easy for me, but i still make some grammar faults
...:( English

Meine Deutsch ist besser dann meine Francés.  German

Je parle un petit français de morceau  French

Mar ik sprek ek frysk  Frisian

Sei um português pequeno de bit demais  Portuguese

И немного русский язык  Russian

So can you read all those languages? :P

Tijnema



snip


Re: [PHP] excel macro into php

2007-05-03 Thread Daniel Brown

   Actually, yes, about half but I didn't use a translator, dork!  ;-P

On 5/3/07, Tijnema ! [EMAIL PROTECTED] wrote:


On 5/3/07, Daniel Brown [EMAIL PROTECTED] wrote:
Tij:

Ja, spreche ich Spanischen.  Me habla espanol bien no muy bien,
pero
 bastante bueno.  Ik leer enkel het Nederlands. Het is als het Engels,
maar
 er is één of ander verschil.

Haha, dat is toch redelijk nederlands :)  Dutch

Bien, esto es mi español, Eso Es todo puedo decir  Spanish

Engels is quite easy for me, but i still make some grammar faults
...:( English

Meine Deutsch ist besser dann meine Francés.  German

Je parle un petit français de morceau  French

Mar ik sprek ek frysk  Frisian

Sei um português pequeno de bit demais  Portuguese

И немного русский язык  Russian

So can you read all those languages? :P

Tijnema

snip





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Neo [GC]
Ah, i thought to remember that the limit is lower on IIS than on Apache, 
maybe i've just some memory faults. ;)


GET is meant to define what to GET, not to define content. This sounds a 
bit academic, but remember that the GET-args are a part of the URI and 
so will also go into the http-log for example. One don't want to have 
2kb per log-line. ;)
Additionally, please think of the great talent of users to fuck things 
up: GET-args will become bookmarks, links etc. and WILL do funny things 
when overused (session-ids...). ;)



Daniel Brown schrieb:


Beating a dead horse here, since it's been mentioned twice already, 
but yeah --- $_SESSION's are the way to go with this.


?
session_start();

$_SESSION['error'] = $error;
$_SESSION['parameter'] = $parameter;

header(Location:.$data[rurl]);
exit;
?

And wherever you have your error handling, do:
?
session_start(); // If not called from a header.php-like start file.

if($_SESSION['error']) {
// Do something with $_SESSION['error'] and $_SESSION['parameter']
}
?

And for the record, it's not just the HTTP server that trims it, but 
the browser generally does, as well, to avoid things such as memory 
leaks, et cetera.  Internet Exploder, for example, has had a limit of 
2,083 total characters in a GET request, but the actual RFC for HTTP/1.1 
has no limit for the protocol (RFC 2616 Section 3.2.1).


And slightly off-topic, but think about how much the web has changed 
in the last 20 years (well, 17, since the HTTP protocol came about in 
1990) and then think about the fact that it's all still based on 
nothing higher than version 1.1.


On 5/3/07, *Neo [GC]* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
wrote:


Merlin schrieb:
  Hi there,
 
  I am checking plausability inside a php script that receives a POST
  submit. If an error occures the user should be redirected back, along
  with his original data filled into the forms.
 
  There is a problem with this. As the GET method, which the
redirect is
  using, only allows a certain amount of characters, the text is always
  cut down.
 
  I use this:
  HEADER(Location:.$data[rurl].?error=.$error.$parameter);
 
  Is there a way to redirect the user to the form and fill in large
text?
 
  Thank you for your help,
 
  Best regards, Merlin
 

This is a normal behaviour. Webservers trim the GET-request at a
certain
length.

You have several options:
- don't do a redirect but return the form, with most clean frameworks it
should be no problem to include the action wich generates the form
- save the variables in a session, then send the redirect-header and
clean the session after regenerating the form
- save the variables in a cookie stored at the client and clean the
cookie afterwards (ugly)


Greetings,

--
Thomas 'Neo' Weber

Webmaster
GothNet.eu | Gothic-Chat.de

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




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



--
Thomas 'Neo' Weber

Webmaster
GothNet.eu | Gothic-Chat.de

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



[PHP] Creating a table for login system

2007-05-03 Thread Karl James
Team,

Can you provide a very accurate tutorial on how to create a login system.
I am using website to control a fantasy football league and teams.
one sign in only for each league member/team owner.

I am using phpmyadmin.

Can you please help me with how the table should be.

Also, help provid a script for registering and logging in.


my site that i will be using this for is www.theufl.com
Check it out.

Thanks, Karl

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



Re: [PHP] Creating a table for login system

2007-05-03 Thread Dan McCullough

http://www.devshed.com/c/a/PHP/Logging-With-PHP/

enjoy!

On 3 May 2007 18:38:02 GMT, Karl James [EMAIL PROTECTED] wrote:

Team,

Can you provide a very accurate tutorial on how to create a login system.
I am using website to control a fantasy football league and teams.
one sign in only for each league member/team owner.

I am using phpmyadmin.

Can you please help me with how the table should be.

Also, help provid a script for registering and logging in.


my site that i will be using this for is www.theufl.com
Check it out.

Thanks, Karl

--
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] Creating a table for login system

2007-05-03 Thread Daniel Brown

   Sounds like something that may be better posted at ScriptLance.  :-\

   Check out this link --- it's pretty concise:
   http://www.olate.co.uk/articles/185


On 3 May 2007 18:38:02 GMT, Karl James [EMAIL PROTECTED] wrote:


Team,

Can you provide a very accurate tutorial on how to create a login system.
I am using website to control a fantasy football league and teams.
one sign in only for each league member/team owner.

I am using phpmyadmin.

Can you please help me with how the table should be.

Also, help provid a script for registering and logging in.


my site that i will be using this for is www.theufl.com
Check it out.

Thanks, Karl

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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


RE: [PHP] Looking for an Architectural Guru

2007-05-03 Thread Daevid Vincent
 
 This is a seriously risky attempt at creating a business as 
 we're creating a
 team, where there is no initial compensation/salary. This is 
 basically a
 group of highly skilled guys getting together, to build what 
 should be a
 couple of successful consumer/business oriented apps. The 
 approach is to
 create a Sweat Equity based business, where equity is 
 distributed to the team.

...there's a word for all that. It's called a startup.

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



Re: [PHP] PHP's ldap_sasl_bind tries to authenticate with KRB5CCNAME other than the one provided by mod_auth_kerb

2007-05-03 Thread gil ran

On 5/3/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Thu, May 3, 2007 12:33 am, gil ran wrote:
 I dunno what klist does, nor what any of the KRB stuff is, but if
 you
 want to preserve this KRB thingie from page to page, it looks like
 you
 will need to do more than just run 'klist'...

 I don't want to preserve this KRB thingie from page to page. The
 opposite is correct: I don't understand why the old file-name is used
 instead of the new one.

How could GSSAPI know *which* Apache child's environment to check?...


I really don't know. I guess that's the main thing I want to find out.
I guessed that the environment variable that is set (in the c) code
just before calling ldap_sasl_interactive_bind_s would be used, but I
was wrong (the auth log showed me that I was wrong).

I'm sure that it is consistent. I'm sure of that because the same
filename is written to the auth log each time. What you wrote got me
to thinking that maybe Apache gets the request  (that starts a new
session), handles it, and then forks and lets the child to handle the
session, although the parent process keeps handling GSSAPI calls.

I tried to check this, but I didn't find how to get the ENV of all the
httpd processes (I tried /proc/pid/environ, but it seems that it is
not updated during runtime - it always contains the initial
environment). This would probably tell me where GSSAPI could get the
old KRB5CCNAME from. Do you know how to do this?


 When using ldap_sasl_bind with the 4th argument set to GSSAPI we are
 trying to bind to the ldap server using sasl and GSSAPI. The GSSAPI
 ignores any provided username/password (authcid, for those of you who
 are familiar with sasl). Instead, it uses the information kept in the
 credential cache file. This is the file Apache (mod_auth_kerb)
 creates. This is the file-name provided by it in
 $_SERVER['KRB5CCNAME'].

If you aren't passing it from Apache to GSSAPI, then it's going to
snag whichever env happens to have been set last or...

There's a differnt ENV floating around for each Apache child, I think,
so how is GSSAPI supposed to know which one to snag?


Theoretically, each child has its own environment, and the different
environments should not be accessible to the other children. This
means that (again, theoretically), the process that created the PHP
thread should pass its ENV to PHP that should pass it to ldap that
should pass it to sasl that should pass it to GSSAPI. One of them
seems to look at the environment of another process (probably the
parent).

How can this be? Shouldn't the operating system protect the processes?
After all, ENV is a block of memory that belongs to a certain process.
How come another process is able to access it?

The only thing I can think of is that something along the way is
created in shared memory, and used from all of the processes. In this
case the first process that passed its ENV will win.

This seems to get very far away from PHP. I'm starting to think that I
should look for what ever it is that is not working/configured
properly somewhere else. Up until now I looked at PHP and Apache. Now
I'm starting to think that the source of this problem can be in
openldap/cyrus-sasl/heimdal. I'm not sure.

Any other ideas will be welcome. In the meantime I will ask the
Apache, ldap, sasl and kerb experts as well...

Thank,
  Gil Ran.


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




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



[PHP] File uploading and saving info on mysql

2007-05-03 Thread Marcelo Wolfgang

Hi all,

I'm developing for my first time an upload file form which will populate 
a sql insert query, I think I got everything working fine, but the data 
isn't been saved on the database. Can someone help me with what I'm 
doing wrong here ?


the code follow:

?php
if (($_FILES[file][type] == application/msword)
|| ($_FILES[file][type] == application/pdf)
 ($_FILES[file][size]  200))
  {
  if ($_FILES[file][error]  0)
{
echo Return Code:  . $_FILES[file][error] . br /;
}
  else
{
if (file_exists(../downloads/ . $_FILES[file][name]))
  {
  echo $_FILES[file][name] .  already exists. ;
  }
else
  {
  move_uploaded_file($_FILES[file][tmp_name],
  ../downloads/ . $_FILES[file][name]);
  }
}
  }
else
  {
  echo Invalid file;
  }
$title = $_POST[title];
$filePath =   ../downloads/ . $_FILES[file][name];
if($_FILES[file][type] == application/pdf){
$fileType = pdf;
} else if ($_FILES[file][type] == application/msword){
$fileType = doc;
}
echo($title) . br /; //outputs 'yada' ( correctly as I've typed on 
the form;
echo($filePath) . br /; //outputs '../downloads/66321-Estrutura.doc' 
and I can check that the file is there;

echo($fileType) . br /; //outputs 'doc' this is correct;

mysql_connect(localhost,$db_user,$db_pass) or die (mysql_error());;
mysql_select_db ($db_table);
$user_Query = mysql_query(INSERT INTO tb_downloads (var_title, 
var_filepath, var_filetype, dt_data, bol_active) VALUES ('$title', 
'$filePath','$fileType','NOW(),1));

mysql_close();

echo($user_Query) . br /; //outputs nothing (? I suck at debugin 
queries)


header(Location: 
http://www.w3ol.com.br/50congresso/adm/downloads.php;); // I know that 
this won't work while I echo something on the page, but the echo is 
there for debug only


?

TIA
Marcelo Wolfgang

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



[PHP] PHPInfo data

2007-05-03 Thread Chris Boget
In looking at the PHPInfo data on our two seperate servers, I see that one 
server (server 1) has the following settings (while the other one, server 2, 
does not):


Apache Environment
 downgrade-1_0
 force-response-1_0

Environment
 BMC_GLOBALC_HOME
 PATROL_GC_VERSION
 PATROL_HOME
 PATROL_TEMP
 RTSERVERS
 TARGET

Server 2 has the following settings (while the other one, server 1, does 
not):


Apache Environment
 SSL_CIPHER
 SSL_CIPHER_ALGKEYSIZE
 SSL_CIPHER_EXPORT
 SSL_CIPHER_USEKEYSIZE
 SSL_CLIENT_VERIFY
 SSL_PROTOCOL
 SSL_SERVER_A_KEY
 SSL_SERVER_A_SIG
 SSL_SERVER_I_DN
 SSL_SERVER_I_DN_C
 SSL_SERVER_I_DN_CN
 SSL_SERVER_I_DN_Email
 SSL_SERVER_I_DN_L
 SSL_SERVER_I_DN_O
 SSL_SERVER_I_DN_OU
 SSL_SERVER_I_DN_ST
 SSL_SERVER_M_SERIAL
 SSL_SERVER_M_VERSION
 SSL_SERVER_S_DN
 SSL_SERVER_S_DN_CN
 SSL_SERVER_S_DN_O
 SSL_SERVER_S_DN_OU
 SSL_SERVER_V_END
 SSL_SERVER_V_START
 SSL_SESSION_ID
 SSL_VERSION_INTERFACE  mod_ssl/2.8.25
 SSL_VERSION_LIBRARY  OpenSSL/0.9.8a


HTTP Headers Information
 Transfer-Encoding  chunked

I've looked in the php.ini and httpd.conf and I don't see the settings in 
either.  I ran windows search to find files with any of the text within and 
nothing was returned.  Where can I find where these settings are defined and 
ensure that both servers are showing the same thing in PHPInfo?


thnx,
Chris 


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



Re: [PHP] PHPInfo data

2007-05-03 Thread Daniel Brown

   Those are Apache configuration settings that are compiled into the
Apache modules.  You'll probably want to recompile both Apache binaries with
the same options if you want both servers to show that information
identically.

On 5/3/07, Chris Boget [EMAIL PROTECTED] wrote:


In looking at the PHPInfo data on our two seperate servers, I see that one
server (server 1) has the following settings (while the other one, server
2,
does not):

Apache Environment
  downgrade-1_0
  force-response-1_0

Environment
  BMC_GLOBALC_HOME
  PATROL_GC_VERSION
  PATROL_HOME
  PATROL_TEMP
  RTSERVERS
  TARGET

Server 2 has the following settings (while the other one, server 1, does
not):

Apache Environment
  SSL_CIPHER
  SSL_CIPHER_ALGKEYSIZE
  SSL_CIPHER_EXPORT
  SSL_CIPHER_USEKEYSIZE
  SSL_CLIENT_VERIFY
  SSL_PROTOCOL
  SSL_SERVER_A_KEY
  SSL_SERVER_A_SIG
  SSL_SERVER_I_DN
  SSL_SERVER_I_DN_C
  SSL_SERVER_I_DN_CN
  SSL_SERVER_I_DN_Email
  SSL_SERVER_I_DN_L
  SSL_SERVER_I_DN_O
  SSL_SERVER_I_DN_OU
  SSL_SERVER_I_DN_ST
  SSL_SERVER_M_SERIAL
  SSL_SERVER_M_VERSION
  SSL_SERVER_S_DN
  SSL_SERVER_S_DN_CN
  SSL_SERVER_S_DN_O
  SSL_SERVER_S_DN_OU
  SSL_SERVER_V_END
  SSL_SERVER_V_START
  SSL_SESSION_ID
  SSL_VERSION_INTERFACE  mod_ssl/2.8.25
  SSL_VERSION_LIBRARY  OpenSSL/0.9.8a


HTTP Headers Information
  Transfer-Encoding  chunked

I've looked in the php.ini and httpd.conf and I don't see the settings in
either.  I ran windows search to find files with any of the text within
and
nothing was returned.  Where can I find where these settings are defined
and
ensure that both servers are showing the same thing in PHPInfo?

thnx,
Chris

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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] File uploading and saving info on mysql

2007-05-03 Thread Jim Lucas

Marcelo Wolfgang wrote:

Hi all,

I'm developing for my first time an upload file form which will populate 
a sql insert query, I think I got everything working fine, but the data 
isn't been saved on the database. Can someone help me with what I'm 
doing wrong here ?


the code follow:

?php
if (($_FILES[file][type] == application/msword)
|| ($_FILES[file][type] == application/pdf)
 ($_FILES[file][size]  200))
  {
  if ($_FILES[file][error]  0)
{
echo Return Code:  . $_FILES[file][error] . br /;
}
  else
{
if (file_exists(../downloads/ . $_FILES[file][name]))
  {
  echo $_FILES[file][name] .  already exists. ;
  }
else
  {
  move_uploaded_file($_FILES[file][tmp_name],
  ../downloads/ . $_FILES[file][name]);
  }
}
  }
else
  {
  echo Invalid file;
  }
$title = $_POST[title];
$filePath =   ../downloads/ . $_FILES[file][name];
if($_FILES[file][type] == application/pdf){
$fileType = pdf;
} else if ($_FILES[file][type] == application/msword){
$fileType = doc;
}
echo($title) . br /; //outputs 'yada' ( correctly as I've typed on 
the form;
echo($filePath) . br /; //outputs '../downloads/66321-Estrutura.doc' 
and I can check that the file is there;

echo($fileType) . br /; //outputs 'doc' this is correct;

mysql_connect(localhost,$db_user,$db_pass) or die (mysql_error());;
mysql_select_db ($db_table);
$user_Query = mysql_query(INSERT INTO tb_downloads (var_title, 
var_filepath, var_filetype, dt_data, bol_active) VALUES ('$title', 
'$filePath','$fileType','NOW(),1));

You have an error in your SQL statement.
You have a single quote opening just before your NOW() call.

I usually setup my query in a string before I place it in the mysql_query() 
command.

This way I can echo it out and see it before it get executed.

$SQL = INSERT INTO tb_downloads (
var_title,
var_filepath,
var_filetype,
dt_data,
bol_active
) VALUES (
'$title',
'$filePath',
'$fileType',
NOW(),
1
);

echo $SQL;

plus, just for debugging, you should add this to your query line

$user_Query = mysql_query($SQL) or die(SQL Error #[.mysql_errno().]:br 
/\n . mysql_error());



mysql_close();

echo($user_Query) . br /; //outputs nothing (? I suck at debugin 
queries)

this will only output the Result pointer from mysql.

You need to use something like this:


print_r(mysql_fetch_assoc($user_Query));

you might want to look at mysql_num_rows() also.  This will tell you the number of results you got 
back.


Take a look at this example, it will give you all the needed parts to make this 
work

http://us.php.net/mysql_fetch_assoc#id5291494



header(Location: 
http://www.w3ol.com.br/50congresso/adm/downloads.php;); // I know that 
this won't work while I echo something on the page, but the echo is 
there for debug only


?

TIA
Marcelo Wolfgang




--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



Re: [PHP] PHPInfo data

2007-05-03 Thread Richard Lynch
I believe those are all settings from httpd.conf of Apache rather than
php.ini, at least based on what they are...

On Thu, May 3, 2007 3:23 pm, Chris Boget wrote:
 In looking at the PHPInfo data on our two seperate servers, I see that
 one
 server (server 1) has the following settings (while the other one,
 server 2,
 does not):

  Apache Environment
   downgrade-1_0
   force-response-1_0

  Environment
   BMC_GLOBALC_HOME
   PATROL_GC_VERSION
   PATROL_HOME
   PATROL_TEMP
   RTSERVERS
   TARGET

 Server 2 has the following settings (while the other one, server 1,
 does
 not):

  Apache Environment
   SSL_CIPHER
   SSL_CIPHER_ALGKEYSIZE
   SSL_CIPHER_EXPORT
   SSL_CIPHER_USEKEYSIZE
   SSL_CLIENT_VERIFY
   SSL_PROTOCOL
   SSL_SERVER_A_KEY
   SSL_SERVER_A_SIG
   SSL_SERVER_I_DN
   SSL_SERVER_I_DN_C
   SSL_SERVER_I_DN_CN
   SSL_SERVER_I_DN_Email
   SSL_SERVER_I_DN_L
   SSL_SERVER_I_DN_O
   SSL_SERVER_I_DN_OU
   SSL_SERVER_I_DN_ST
   SSL_SERVER_M_SERIAL
   SSL_SERVER_M_VERSION
   SSL_SERVER_S_DN
   SSL_SERVER_S_DN_CN
   SSL_SERVER_S_DN_O
   SSL_SERVER_S_DN_OU
   SSL_SERVER_V_END
   SSL_SERVER_V_START
   SSL_SESSION_ID
   SSL_VERSION_INTERFACE  mod_ssl/2.8.25
   SSL_VERSION_LIBRARY  OpenSSL/0.9.8a


  HTTP Headers Information
   Transfer-Encoding  chunked

 I've looked in the php.ini and httpd.conf and I don't see the settings
 in
 either.  I ran windows search to find files with any of the text
 within and
 nothing was returned.  Where can I find where these settings are
 defined and
 ensure that both servers are showing the same thing in PHPInfo?

 thnx,
 Chris

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




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

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



Re: [PHP] File uploading and saving info on mysql

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 3:23 pm, Marcelo Wolfgang wrote:

 I'm developing for my first time an upload file form which will
 populate
 a sql insert query, I think I got everything working fine, but the
 data
 isn't been saved on the database. Can someone help me with what I'm
 doing wrong here ?

 the code follow:

 ?php
 if (($_FILES[file][type] == application/msword)
 || ($_FILES[file][type] == application/pdf)

Browsers will probably NOT populate these reliably...

Mac Safari, might, for example, choose application/x-pdf for the PDF
file.

You really can't rely on 'type' to be useful in any way, shape, or form.

See various recent thread regarding mime_magic and other options.

  ($_FILES[file][size]  200))
{
if ($_FILES[file][error]  0)
  {
  echo Return Code:  . $_FILES[file][error] . br /;
  }
else
  {
  if (file_exists(../downloads/ . $_FILES[file][name]))
{
echo $_FILES[file][name] .  already exists. ;
}
  else
{
move_uploaded_file($_FILES[file][tmp_name],
../downloads/ . $_FILES[file][name]);
}
  }
}
 else
{
echo Invalid file;
}
 $title = $_POST[title];
 $filePath =   ../downloads/ . $_FILES[file][name];
 if($_FILES[file][type] == application/pdf){
   $fileType = pdf;
 } else if ($_FILES[file][type] == application/msword){
   $fileType = doc;
 }
 echo($title) . br /; //outputs 'yada' ( correctly as I've typed on
 the form;
 echo($filePath) . br /; //outputs
 '../downloads/66321-Estrutura.doc'
 and I can check that the file is there;
 echo($fileType) . br /; //outputs 'doc' this is correct;

 mysql_connect(localhost,$db_user,$db_pass) or die (mysql_error());;
 mysql_select_db ($db_table);
 $user_Query = mysql_query(INSERT INTO tb_downloads (var_title,
 var_filepath, var_filetype, dt_data, bol_active) VALUES ('$title',
 '$filePath','$fileType','NOW(),1));

That's not a query, that's a result...

And you aren't checking it to see if it's an error, and you're not
using http://php.net/mysql_error to find out what the error is.

 mysql_close();

 echo($user_Query) . br /; //outputs nothing (? I suck at debugin
 queries)

And once you have closed the connection mysql_close() the result is
GONE, so if you do want to see it, you'd need it to be before the
mysql_close() probably.  It won't be very interesting, really, as it
will be FALSE if your SQL is messed up, and just a number from 1 to N
(where N is the number of queries you have sent) if the query
succeeded.

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

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



Re: [PHP] Script feedback: insert string into another string

2007-05-03 Thread Micky Hulse
Hi Richard, thanks again for the detailed reply, I really appreciate you 
help.


Richard Lynch wrote:

Counting words is almost always a Bad Idea, since you may have users
who use big fat words (University professors and Market-speak) and you
have have texters who, like, don't even use words...
u c ? i mean?
:-v


LOL! Yah, I c ? u mean! :)

Good point. I hope the only person using this form will be me and a few 
others (will be posting it in a secure location)... Basically I wanted a 
good way to insert template tags for pagination links (done via my CMS) 
at specific word counts... Mostly doing this to get well-balanced pages 
for SEO purposes -- Also, it is hard as heck to visualize well-balanced 
page breaks.



But you'd have to work pretty hard at it...


Ahh, very interesting. :)


You generally want to call striptags() on the data as it comes in, if
you are not allowing HTML input.  And possibly raise an error if the
original input and the striptags() result don't match, as the user
probably *thought* you were going to accept HTML input...


Oh, kinda reminds me of filtering the comments of a Contact Form... I 
have used strip tags on the textareas and then compared the strings... 
This worked well, but I bet most folks do not think they can use HTML 
when it comes to a comment form (except spammers)... Thanks for pointing 
this out. :)



Or, don't do striptags at all, and, instead...
snip
$text = Some big long  block o' text  that you have stored in your
DB.;
$url = http://example.com/var=; . urlencode('nasty  ugly value, eh?');
$text_html = htmlentities($text);
$url_html = htmlentities($url);
echo p$text/p\n;
echo a href=\$url_html\$url_html/a\n;


Sweet! Thanks for the example and the great explanation!


It may seem odd at first, but, really, *ANY* data you send to the
browser as data should have htmlentities() called on it.


That sounds good to me.


The only exception would be if you have data that already has HTML
tags buried in it -- and that's almost always a Bad Idea in the first
place, as it gets really tricky to be sure that you aren't sending out
very broken HTML and XSS-infected HTML and ...  An exception might be
if you generate static HTML and cache that, using the techniques above
to create the static HTML in the first place.


Ahhh, very interesting thought... Many thanks for the detailed reply 
Richard, it has been extremely helpful to me. :)


I owe you and Tijnema a beer!

Have a great day/night!
Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Script feedback: insert string into another string

2007-05-03 Thread Tijnema !


I owe you and Tijnema a beer!

Have a great day/night!
Cheers,
Micky


I'm sorry, you have to wait another 9 months, because only than i can
legally drink a beer :) (than i will be  16 :) )

Tijnema

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



[PHP] Re: File uploading and saving info on mysql

2007-05-03 Thread itoctopus
Here's the file upload class making your life easier:

?php
 /*
  @class FileManager
  @description This class handles interaction with Files
  @copyright itoctopus 2007 - The Genoc Library
 */
 class FileManager{
  /*
   [EMAIL PROTECTED] save
   [EMAIL PROTECTED] this function saves the file in the database
   [EMAIL PROTECTED] array $file_handle A handle on the file (ex. 
$_FILES['the_file'])
   [EMAIL PROTECTED] string $field_name The name of the field
   [EMAIL PROTECTED] string $action Update or save the file in the table. 
Defaults to 
save.
   [EMAIL PROTECTED] string $file_source The name of the source table saving 
the file 
(such as realestate)
   [EMAIL PROTECTED] string $file_source_id The id of the row in the source 
table
   [EMAIL PROTECTED] object $db The database handle
  */
  static function save($file_handle, $file_source, $file_source_id, 
$action='save', $allowed_types = array(), $db){
   if (empty($file_handle['tmp_name']))
return;
   $data = addslashes(fread(fopen($file_handle['tmp_name'], r), 
$file_handle['size']));
   if ($action == 'save'){
$creationdate = $lastupdatedate = Date(Y-m-d H:i:s);
$sql = 'INSERT INTO file (file_name, file_type, file_size, file_source, 
file_source_id, file_binary, file_creationdate, file_lastupdatedate) VALUES 
(\''.$file_handle['name'].'\', \''.$file_handle['type'].'\', 
\''.$file_handle['size'].'\', \''.$file_source.'\', \''.$file_source_id.'\', 
\''.$data.'\', \''.$creationdate.'\', \''.$lastupdatedate.'\')';

//now if the type is an image, then create a thumbnail (resize should be 
relative)

   }
   else{
$lastupdatedate = Date(Y-m-d H:i:s);
$sql = 'UPDATE file SET file_name=\''.$file_handle['name'].'\', 
file_type=\''.$file_handle['type'].'\', file_source=\''.$file_source.'\', 
file_source_id=\''.$file_source_id.'\', file_binary=\''.$data.'\', 
file_lastupdatedate=\''.$lastupdatedate.'\'';

//now if the type is an image, then update a thumbnail

   }
   $result= $db-query($sql);
  }

  /*
   [EMAIL PROTECTED] get
   [EMAIL PROTECTED] This function returns a link to the file based on the id
   [EMAIL PROTECTED] string $file_id The id of the file in the database
   [EMAIL PROTECTED] object $db The database handle
   [EMAIL PROTECTED] void
  */
  static function get($file_id, $db){
   $sql = 'SELECT file_id, file_name, file_type, file_size, file_binary FROM 
file where file_id=\''.$file_id.'\'';
   $result= $db-query($sql);
   header('Content-length:'.$result[0]['file_size']);
   header('Content-type:'.$result[0]['file_type']);
   //if it's not an image then download it, otherwise display it
   if (strpos($result[0]['file_type'], 'image') !== FALSE)
header(Content-type: .$result[0]['file_type'].; 
filename=.$result[0]['file_name']);
   else
header(Content-Disposition: attachment; 
filename=.$result[0]['file_name']);
   echo($result[0]['file_binary']);
  }

  /*
   [EMAIL PROTECTED] delete
   [EMAIL PROTECTED] This function delete a file from the database
   [EMAIL PROTECTED] integer $file_id The id of the file to be deleted
   [EMAIL PROTECTED] object $db The database handle
   [EMAIL PROTECTED]
  */
  static function delete($file_id, $db){
   $sql = 'DELETE FROM file WHERE file_id=\'$file_id\'';
   $result= $db-query($sql);
  }

 }
?

-- 
itoctopus - http://www.itoctopus.com
Marcelo Wolfgang [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi all,

 I'm developing for my first time an upload file form which will populate a 
 sql insert query, I think I got everything working fine, but the data 
 isn't been saved on the database. Can someone help me with what I'm doing 
 wrong here ?

 the code follow:

 ?php
 if (($_FILES[file][type] == application/msword)
 || ($_FILES[file][type] == application/pdf)
  ($_FILES[file][size]  200))
   {
   if ($_FILES[file][error]  0)
 {
 echo Return Code:  . $_FILES[file][error] . br /;
 }
   else
 {
 if (file_exists(../downloads/ . $_FILES[file][name]))
   {
   echo $_FILES[file][name] .  already exists. ;
   }
 else
   {
   move_uploaded_file($_FILES[file][tmp_name],
   ../downloads/ . $_FILES[file][name]);
   }
 }
   }
 else
   {
   echo Invalid file;
   }
 $title = $_POST[title];
 $filePath =   ../downloads/ . $_FILES[file][name];
 if($_FILES[file][type] == application/pdf){
 $fileType = pdf;
 } else if ($_FILES[file][type] == application/msword){
 $fileType = doc;
 }
 echo($title) . br /; //outputs 'yada' ( correctly as I've typed on the 
 form;
 echo($filePath) . br /; //outputs '../downloads/66321-Estrutura.doc' 
 and I can check that the file is there;
 echo($fileType) . br /; //outputs 'doc' this is correct;

 mysql_connect(localhost,$db_user,$db_pass) or die (mysql_error());;
 mysql_select_db ($db_table);
 $user_Query = mysql_query(INSERT INTO tb_downloads (var_title, 
 var_filepath, var_filetype, dt_data, bol_active) VALUES ('$title', 
 '$filePath','$fileType','NOW(),1));
 mysql_close();

 

[PHP] Re: Redirect via GET is loosing characters

2007-05-03 Thread itoctopus
You just have to store your form inputs in the session.

-- 
itoctopus - http://www.itoctopus.com
Merlin [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi there,

 I am checking plausability inside a php script that receives a POST 
 submit. If an error occures the user should be redirected back, along with 
 his original data filled into the forms.

 There is a problem with this. As the GET method, which the redirect is 
 using, only allows a certain amount of characters, the text is always cut 
 down.

 I use this:
 HEADER(Location:.$data[rurl].?error=.$error.$parameter);

 Is there a way to redirect the user to the form and fill in large text?

 Thank you for your help,

 Best regards, Merlin 

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



[PHP] Re: Split string

2007-05-03 Thread itoctopus

if ($your_string !== ''){
$arr_string = explode(',', $your_string);
$first_part = $arr_string[0];
array_shift($arr_string);
$second_part = implode(',', $arr_string);
}


-- 
itoctopus - http://www.itoctopus.com
Lester Caine [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Can someone with a few more working grey cells prompt me with the correct 
 command to split a string.

 The entered data is names, but I need to split the text up to the first 
 space or comma into one string, and the rest of the string into a second. 
 It's the 'first either space or comma' that eludes me at the moment :(

 In know it's probably obvious, but it always is when you know the answer.

 -- 
 Lester Caine - G8HFL
 -
 Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
 L.S.Caine Electronic Services - http://home.lsces.co.uk
 MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
 Firebird Foundation Inc. - http://www.firebirdsql.org/index.php 

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



Re: [PHP] What does mean?

2007-05-03 Thread itoctopus
never ever used it...
I also voted!

-- 
itoctopus - http://www.itoctopus.com
Philip Thompson [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Apr 30, 2007, at 2:17 PM, Greg Donald wrote:

 On 4/30/07, Nick Gorbikoff [EMAIL PROTECTED] wrote:
 Hello, folks.
 I rember I've since this somewhere in perl and it has somethign to  do 
 with
 blocks of code. I came across the same thing in some PHP code.

  END
  some code
 END

 What exactly does it mean.

 BTW:
 PHP .net search breaks if you search for 


 It's heredoc syntax.

 http://us2.php.net/manual/en/ 
 language.types.string.php#language.types.string.syntax.heredoc


 Ok, let's gather some stats to see how many people actually use the 
 heredoc syntax. I created this quick little form to gather the data.  It's 
 takes 2 seconds (literally) - vote here:

 http://thril.uark.edu/heredoc/

 I'm interested in knowing if this is used a lot. If it is, then I may 
 consider tying it into my code (if it calls for it).

 ~Philip 

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



[PHP] Re: A problem with passing $_GET in an url

2007-05-03 Thread Davis Chan

Hi! Everyone, here is the javascript function:

function Ask_Confirm() 
{

response = confirm(Are you sure?);
if(response == true)
{
to_url = ./admin.php?to_be_rm= + document.forms[1].to_be_rm.value;
// alert(to_url);
window.location = to_url;
}
else
{
// Do Nothing.
}
}



The alert(to_url) shows the correct/expected url. to_be_rm is the id 
of a select on the second form on the page. Thanks again.


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



[PHP] Re: A problem with passing $_GET in an url

2007-05-03 Thread Davis Chan

(sorry if you see 2 posts, I was trying to cancel a post, edit, and repost)
Hi! Everyone, Dan is right, after submit button is clicked, the 
javascript function below is called. I am trying here is the javascript 
function:


 function Ask_Confirm() {
 response = confirm(Are you sure?);
 if(response == true)
 {
 to_url = ./admin.php?to_be_rm= + document.forms[1].to_be_rm.value;
 // alert(to_url);
 window.location = to_url;
 }
 else
 {
 // Do Nothing.
 }
 }


The alert(to_url) shows the correct/expected url. to_be_rm is the id 
of a select on the second form on the page. Thanks again.


I also have a question about using this newsgroup, why is messages I got 
from using Thunderbird not as update as the digest I got via email?


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



Re: [PHP] MySQL change-tracking

2007-05-03 Thread Chris

Richard Lynch wrote:


On Wed, May 2, 2007 4:32 pm, Brad Fuller wrote:

Richard Lynch wrote:

I have this simple database and I'm going to have a handful
of people editing it...

I'd like to track each and every edit with username, and,
ideally, provide myself an easy Undo if I decide [bleep] is
an idiot and shouldn't have done that.

Now, I'm not real concerned about the relational foreign key
aspect here, and I'd like to keep this as simple as possible...

I've considered doing a dump and putting the output into subversion,
even...

I realize there may be some nifty MySQL tool that does this,
so I'll be researching that shortly, but I'm wondering if
there's a nifty change-management php package out there that
I should check out.

The users are currently slated to be logging in via HTTP
Basic Authentication, but I could change that, I guess.

K.I.S.S. is definitely the motto around here -- If it takes
more than a day or two to figure out, install, and implement;
then forget it, as I can just hack something together myself in that
time-frame.

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

I'm not aware of any existing package that offers this, and if there
isn't
one I wouldn't be surprised.  I think that there are just too many
variables
for it to be universal enough...

But, I thought about it for a second and here's what I came up with...

I realize this is not a very efficient way to store data, but it's
just an
idea...

What about instead of running UPDATE queries, you INSERT a new record
on
top of it, and if you need to undo someone's change, just DELETE
that
record.

I'm not sure how the tables would relate, but it would be something
like...
initial insert generates customerID - customerID and customer data go
into
a separate table - subsequent changes get stacked up in this table
and the
most recent record gets displayed when you click to view the customer.
Voila, you have a history table and a simple way to undo changes.

Whaddya think?


I worked on a HIPPA-compliant medicasl system like that once (HIPPA
basically don't let you ever ever ever delete any data about a
patient).

It had a version field that got incremented on each insert and you
never did an update or delete.

It annoyed the bleep out of me at the time, mainly because the tables
got really large really fast...

I'll have to think about this and see if the tables I care about will
grow ridiculously large, and I can always archive the older stuff
after time...


Have a second table that has the 'history' of the record. Basically a 
copy of the first table.


Easy to keep the history:

insert into history_table select * from main_table where id='X'

then update the main table's record.

That way you're not making the main table really large but you'll be 
able to go back a version if you needed to.


You could even keep the history table under check (only keep 50 records).

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

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