Re: [PHP] Check a string does not contain invalid characters

2007-03-21 Thread Jim Lucas

John Comerford wrote:

Hi Folks,

I am new to php.

I want to accept a character string which I will use as a unique user 
id.  I want to check the string to ensure the user has not typed 
characters that I consider to be invalid as part of a user id.  I was 
thinking of doing something along the lines of:


if (strpbrk($userid, '[EMAIL PROTECTED]&*()_+=-{}[]\\|;\':"<>?,./`') <> null) { 
blah, blah, blah..




it is always better to know what you want to allow and only allow those.

this will catch anything that is not a letter of the alphabet.

if ( preg_match('!^[^a-zA-Z]+$!', $userid) == 1 ) {
die('Found something other then a letter.');
}

if ( preg_match('!^[^a-zA-Z0-9]+$!', $userid) == 1 ) {
die('Found something other then a number or letter.');
}

this returns an (int) either 0 or 1

0 = it did not match anything
1 = it matched at least on char that is invalid.

check out the function here  http://us2.php.net/preg_match

check out its big brother http://us2.php.net/preg_match_all

The big difference is that preg_match will only look until it finds the 
first match, then it stops looking and returns.


preg_match_all finds all possible matches in the input string.

Jim

but I think that would still leave me open to control characters. I am 
thinking maybe I should loop through the string character by character 
and check it's ascii value (using ord) is within the range of a-z and A-Z ?
Is this the best way of achieving this ?  Is there a php command to do 
something similar ?  I have done a few web searches and haven't come up 
with much.


TIA,
 JC



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



Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Robert Cummings
On Thu, 2007-03-22 at 08:14 +0400, Rabih Tayyem wrote:
> Actually I told you that the possibility of collision is small because I
> wanted to be scientific
> Scientifically, I can say this posibilty goes to 0...

Only as the length of the ID approaches infinity :B

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

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



[PHP] Question before upgrading to 5

2007-03-21 Thread Jake McHenry
Hi everyone,

I just got done going through all my configure options for php5, and finally
configure finished successfully... I didn't install it yet, have a question.
Can I have both 4 and 5 installed temporarily until I'm sure all my scripts
work ok? They should, I've been careful, but I want to be sure since this is
the only server I currently have. I was going to install a virtual copy of
fedora and do testing, but I don't have time, hopefully someone can answer.
I think I just have to change the prefix to something other than default and
load the new module in httpd. If I had more time I would do this the right
way, but we all know how that goes...

If this will work, I can then just uninstall 4.. Hopefully it won't break
anything.

I'll post my configure options if anyone would like to double check

Thanks,
Jake

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.16/729 - Release Date: 3/21/2007
7:52 AM
 

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



[PHP] Check a string does not contain invalid characters

2007-03-21 Thread John Comerford

Hi Folks,

I am new to php.

I want to accept a character string which I will use as a unique user 
id.  I want to check the string to ensure the user has not typed 
characters that I consider to be invalid as part of a user id.  I was 
thinking of doing something along the lines of:


if (strpbrk($userid, '[EMAIL PROTECTED]&*()_+=-{}[]\\|;\':"<>?,./`') <> null) { 
blah, blah, blah..


but I think that would still leave me open to control characters. 
I am thinking maybe I should loop through the string character by 
character and check it's ascii value (using ord) is within the range of 
a-z and A-Z ?
Is this the best way of achieving this ?  Is there a php command to do 
something similar ?  I have done a few web searches and haven't come up 
with much.


TIA,
 JC


Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Rabih Tayyem

Actually I told you that the possibility of collision is small because I
wanted to be scientific
Scientifically, I can say this posibilty goes to 0...
It is a random ID (not a totally random but based on the current timestamp)
generated not only once but twice based on two different time stamps.

Safe enough I believe...

Regards,
Rabih G. Tayyem

On 3/22/07, Jim Moseby <[EMAIL PROTECTED]> wrote:


> Rabih Tayyem writes:
>
> > PS: I don't take credit for the code as it is a modified version of
> > a code I found long time back (this same code is running on one of
> > my applications for months without any problem)..
>
> Thanks.  I'll find use for that!
>
> However, altho I know that by making the random number big enough
> the likelyhood of collisions can be made vanishingly small, I was
> actually concerned with eliminating the possibility of collisions
> altogether by checking to see if the number had been used before.
>
> I just don't know how to do that properly with Mysql.  Perhaps it
> is necessary to lock to table, check, make the insert and then
> unlock it.  But I was hoping that there would be a simpler way.

Replied off-list with a solution.

JM

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




Re: [PHP] Passing variables

2007-03-21 Thread Jeff
Thank you Chris!

"Chris" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Jeff wrote:
>> I want to thank you all for clearing me up on setting the 
>> register_globals to ON issue!! I have refrained from doing so and my code 
>> is running great with the $_GET.
>>
>> I am having NO trouble passing my "single" variable to the next page 
>> using..
>>
>> echo "Edit";
>>
>> as when the next page that load actually shows the character info, so 
>> basically you can see you are dealing with the correct record.
>>
>> NOW.
>>
>> I want to pass two variables to a delete page. The charid and the char 
>> name. Here is what I have but it will only pass the 1st variable ?charid
>>
>> echo "> ?char=".$myrow["char_name"]."\">Delete";
>
> The first one is preceded by a ?
>
> Subsequent ones are with an '&'.
>
> See http://en.wikipedia.org/wiki/Query_string
>
> -- 
> Postgresql & php tutorials
> http://www.designmagick.com/ 

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



Re: [PHP] Passing variables

2007-03-21 Thread Chris

Jeff wrote:
I want to thank you all for clearing me up on setting the register_globals 
to ON issue!! I have refrained from doing so and my code is running great 
with the $_GET.


I am having NO trouble passing my "single" variable to the next page using..

echo "Edit";

as when the next page that load actually shows the character info, so 
basically you can see you are dealing with the correct record.


NOW.

I want to pass two variables to a delete page. The charid and the char name. 
Here is what I have but it will only pass the 1st variable ?charid


echo "?char=".$myrow["char_name"]."\">Delete";


The first one is preceded by a ?

Subsequent ones are with an '&'.

See http://en.wikipedia.org/wiki/Query_string

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

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



[PHP] Passing variables

2007-03-21 Thread Jeff
I want to thank you all for clearing me up on setting the register_globals 
to ON issue!! I have refrained from doing so and my code is running great 
with the $_GET.

I am having NO trouble passing my "single" variable to the next page using..

echo "Edit";

as when the next page that load actually shows the character info, so 
basically you can see you are dealing with the correct record.

NOW.

I want to pass two variables to a delete page. The charid and the char name. 
Here is what I have but it will only pass the 1st variable ?charid

echo "Delete";

I get the 1st variable using the $charid = (int)$_GET['charid']; (on the 
next page)

I do however NOT get

$charname = $_GET["char"] to pull the name out. (on the next page)

I've tried putting a comma, a &, a % between the variables ie..

echo "Delete";

but it just won't let me pull the $_GET["char"]

I have even tried $_GET['char'] but am under the impression '_' are for 
integers and "_" are for text? Anyway, can someone please let me know the 
PROPER way to pass the two or more variables?

Thanks WAY in advance!! 

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



[PHP] Re: Random Unique ID

2007-03-21 Thread Myron Turner

Mark wrote:

[EMAIL PROTECTED] wrote:


Hello,

I want to add a random unique ID to a Mysql table.  Collisions
are unlikely but possible so to handle those cases I'd like to
regenerate the random ID until there is no collision and only
then add my row.  Any suggestions for a newbie as to the right
way to go about doing this?

Best,

Craig

.

I suggest looking into a GUID sort of thing, it is all coded for you and it
works just like you want.


If you are running Linux, you can get this using:
   $GUID =  exec("uuidgen");
--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



Re: [PHP] close session when browser is closed

2007-03-21 Thread Travis Doherty
Alain Roger wrote:

> Hi Brad,
>
> yes this is one possibility, but since i use https, i should not be
> afraid
> by storing data in $_SESSION variables.


Just a note that while SSL may help to protect the session id from being
packet sniffed you should still be concerned about storing sensitive
data in _SESSION.  Anyone local to the system can probably read
plaintext session data from the session cache.

HTTPS only protects communications between the client and the server at
best, do be afraid!

Travis Doherty

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



Re: [PHP] close session when browser is closed

2007-03-21 Thread Travis Doherty
Alain Roger wrote:

> Hi,
>
> I would like to know what is the best solution for my problem.
>
> When a user is connected to a https page and a session is open, if user
> close his browser, the session ID is still active in the browser
> "history".
> It means that next time when user will start his browser, the browser
> will
> re-use the same session ID and will work with php pages without any
> problem.
>
> I was thinking to use cookie to solve this issue, but what should i do
> when
> user browser refuse cookies ?
>
> thanks a lot,
>
This seems odd.  By default the session cookie expires when the browser
is closed.  You can change this by changing ini setting
session.cookie_lifetime to something other than default value of zero,
in number of seconds.

I don't believe using HTTPS changes any of this, I have more than one
app that use HTTPS for session cookies and have no problems with it
persisting after the browser is closed (well, some browsers can do weird
things sometimes... you never really know.)

If the browser refuses the cookie, sessions won't work anyway.  The
session key is sent to the browser as a cookie (unless its in the URL...)

www.php.net/session/
Take a look at cookie_lifetime and you might like the cache_expire docs
on the same page too.

Travis Doherty

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



Re: [PHP] Re: _Construct question

2007-03-21 Thread Chris

Erik Jones wrote:

That's not true, running with v. 5.2.1:



Outputs:

works


On Mar 21, 2007, at 8:06 AM, itoctopus wrote:

They're basically the same thing, however, you can only use 
__construct in

PHP5.


He meant that __construct() doesn't work in php4.

It's only available in php5.

php5 does this:

Is the function __construct available?
- Yes? Use it.
- No? Look for a function with the same name as the class. If that's 
available, use it.


So it's backwards compatible.

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

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



Re: [PHP] Re: _Construct question

2007-03-21 Thread Erik Jones

That's not true, running with v. 5.2.1:



Outputs:

works


On Mar 21, 2007, at 8:06 AM, itoctopus wrote:

They're basically the same thing, however, you can only use  
__construct in

PHP5.

--
itoctopus - http://www.itoctopus.com
"John Comerford" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Hi Folks,

I am still pretty new to PHP and I have a question regarding  
classes and

using _construct.  Up until now I have been creating my classes as

follows:


class test1 {
 var $name;
 function test1($pName) {
   $this->name = $pName;
 }
}

So I when I create a new class I can assign 'name' by doing '$t1 =  
new

test1("test1");'

As part of another thread I noticed the _construct function which  
(if I

am correct) does more or less the same thing:

class test2 {
 var $name;
 function _construct($pName) {
   $this->name = $pName;
 }
}

I have fished around a bit and cannot find why one might be better  
than

the other.  The only thing I can think is that maybe you need to use
_construct to be able to use "extends" ?

Is this the case ?   What is the advantage/disadvantage of using
_construct as opposed to using a function with the classname ?

Thanks,
  JC


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



erik jones <[EMAIL PROTECTED]>
software developer
615-296-0838
emma(r)





[PHP] Re: Random Unique ID

2007-03-21 Thread Mark
[EMAIL PROTECTED] wrote:

> Hello,
> 
> I want to add a random unique ID to a Mysql table.  Collisions
> are unlikely but possible so to handle those cases I'd like to
> regenerate the random ID until there is no collision and only
> then add my row.  Any suggestions for a newbie as to the right
> way to go about doing this?
> 
> Best,
> 
> Craig

First some computer science 101: A random number is not unique and a unique
number is not random. Learn it, know it, live it.

What you need is a component of the ID which is not random, but is probably
unique within the environment. Say, the IP address of the machine. Then,
perhaps the process id of Apache/PHP process. Then, the random component,
the time() (which is random with respect to the request, but unique for one
second), followed by some rand() requests seeded by some high resolution
micro timer. This will have a HUGH probability of uniqueness within the
single process, so it is virtually assured, and a guarantee of uniqueness
across all other processes and machines.

I suggest looking into a GUID sort of thing, it is all coded for you and it
works just like you want.

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



Re: [PHP] Sessions timing out, php5

2007-03-21 Thread Travis Doherty
Paul Nowosielski wrote:

>Dear all,
>
>I'm having an issue where sessions timeout after inactivity.
>
>I have session.cache_expire set to 1440.
>
>But some users have reported sessions timing out after a couple hours.
>
>  
>
Are you storing sessions in /tmp?

Possible that your OS has a cron job running that clears out that
directory, especially if these complaints are usually around midnight
when these types of jobs typically run.

Travis Doherty

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



Re: [PHP] References challenge with PHP4

2007-03-21 Thread Robert Cummings
On Wed, 2007-03-21 at 18:09 -0300, Martin Alterisio wrote:
>
> Actually, is not a bug, is expected behaviour and documented in the manual
> 
> http://php.net/static
> 
> See the last section, named "references with global and static variables"
> 
> static and global are implemented internally as references, that makes
> storing references into static variables impossible (which can be solved by
> using arrays of references as seen in Robert Cummings example).

Thanks for the tip, I've never actually had to use a static var to store
an object reference, usually I use singletons and properties or my
static vars just store scalars or arrays. Good to know though, since I
didn't think to check the documented behaviour... fortunately I didn't
get around to posting a bug report either :)

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

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



Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Robert Cummings
On Wed, 2007-03-21 at 16:40 -0600, [EMAIL PROTECTED] wrote:
> Jim Moseby writes: 
> 
> >> However, altho I know that by making the random number big enough
> >> the likelyhood of collisions can be made vanishingly small, I was
> >> actually concerned with eliminating the possibility of collisions
> >> altogether by checking to see if the number had been used before.  
> >> 
> >> I just don't know how to do that properly with Mysql.  Perhaps it
> >> is necessary to lock to table, check, make the insert and then
> >> unlock it.  But I was hoping that there would be a simpler way. 
> > 
> > One way is to make your id field a unique key.  MySQL will not let 
> > you insert a record with a duplicate unique key, and will issue an 
> > error.  Your code should always check for errors on insert anyway, 
> > so if you get an error, generate a new key and try again.
> 
> Thanks.  Yes, I check for errors.  But there are other types of errors
> so I'd need to verify that it is a duplicate key error and, in my
> ignorance, I have not yet figured out how to do that programatically.
> I worry about getting into an infinite loop.

Bleh, you can solve this with at most 2 queries.


CREATE TABLE foo
(
id  INT   NOT NULL AUTO_INCREMENT,
uid char( 50 ),

PRIMARY KEY ( id )
);  




There you go, a 50 character highly unguessable and guaranteed unique
ID. Sure everyone knows the ID of the entry now, but that shouldn't be
important. In fact it optimizes retrieval and validation by allowing the
lookup to occur on an integer then validation by matching the full UID
against the UID found for the ID. In all honesty though, hitting the
database with random generated md5() hashes is probably more efficient
since the likelihood of a collision is small and so in most cases you
will only make one database query.

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

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



[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Jim Moseby writes: 


However, altho I know that by making the random number big enough
the likelyhood of collisions can be made vanishingly small, I was
actually concerned with eliminating the possibility of collisions
altogether by checking to see if the number had been used before.  


I just don't know how to do that properly with Mysql.  Perhaps it
is necessary to lock to table, check, make the insert and then
unlock it.  But I was hoping that there would be a simpler way. 


One way is to make your id field a unique key.  MySQL will not let 
you insert a record with a duplicate unique key, and will issue an 
error.  Your code should always check for errors on insert anyway, 
so if you get an error, generate a new key and try again.


Thanks.  Yes, I check for errors.  But there are other types of errors
so I'd need to verify that it is a duplicate key error and, in my
ignorance, I have not yet figured out how to do that programatically.
I worry about getting into an infinite loop. 

Best, 

Craig 




--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743&co_branded=1 -
-- 



**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
** 


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



[PHP] Re: _Construct question

2007-03-21 Thread itoctopus
They're basically the same thing, however, you can only use __construct in
PHP5.

--
itoctopus - http://www.itoctopus.com
"John Comerford" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi Folks,
>
> I am still pretty new to PHP and I have a question regarding classes and
> using _construct.  Up until now I have been creating my classes as
follows:
>
> class test1 {
>  var $name;
>  function test1($pName) {
>$this->name = $pName;
>  }
> }
>
> So I when I create a new class I can assign 'name' by doing '$t1 = new
> test1("test1");'
>
> As part of another thread I noticed the _construct function which (if I
> am correct) does more or less the same thing:
>
> class test2 {
>  var $name;
>  function _construct($pName) {
>$this->name = $pName;
>  }
> }
>
> I have fished around a bit and cannot find why one might be better than
> the other.  The only thing I can think is that maybe you need to use
> _construct to be able to use "extends" ?
>
> Is this the case ?   What is the advantage/disadvantage of using
> _construct as opposed to using a function with the classname ?
>
> Thanks,
>   JC

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



[PHP] Re: newbie question

2007-03-21 Thread itoctopus
Means you're passing the variable as reference.
This means that any change in the variable inside your function will affect
the variable outside your function, in other terms:

if you have

function myfunc(&$var){
$var = 5;
}

$a = 6;
myfunc($a);

will result in having $a=5 after the function all.

--
itoctopus - http://www.itoctopus.com
"bob pilly" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all
>
> Can anyone tell me what '&' means before a var?
>
> e.g function(&$var)
>
> Thanks for any help in advance
>
>
>
>
>
> ___
> What kind of emailer are you? Find out today - get a free analysis of your
email personality. Take the quiz at the Yahoo! Mail Championship.
> http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

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



[PHP] Sessions timing out, php5

2007-03-21 Thread Paul Nowosielski
Dear all,

I'm having an issue where sessions timeout after inactivity.

I have session.cache_expire set to 1440.

But some users have reported sessions timing out after a couple hours.

Is there another php.ini setting I need to address??

Thank you,

-- 
Paul Nowosielski
Webmaster 

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



Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Stut

[EMAIL PROTECTED] wrote:

Stut writes:

[EMAIL PROTECTED] wrote:

I want to add a random unique ID to a Mysql table.  Collisions
are unlikely but possible so to handle those cases I'd like to
regenerate the random ID until there is no collision and only
then add my row.  Any suggestions for a newbie as to the right
way to go about doing this?


1) Not even slightly PHP related.


Perhaps not.  It is Mysql related.  And seeing other Mysql discussion
on this list inspired me to ask.


I refer you to the comment made earlier today by one of my honourable 
colleagues regarding murder.



2) Why random? Incrementing not good enough for you?


I want to use it in a way that will expose it to the user.  And I
don't want to give out information as to the order of records in
my database.


This is not security. Your site should prevent them from accessing data 
they should not be accessing. If you're worried that they can do this 
simply by changing a number in a query string then you really need to 
rethink the way the site works.


If you decide to ignore my advice, then the only way to do this is to 
set the ID field as unique, pick a random number and try to insert the 
row. Repeat until the insert succeeds. Yes it sucks, but so does what 
you are trying to do.


-Stut

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



Re: [PHP] Message threading (was Job Opportunity)

2007-03-21 Thread Stut

Warren Vail wrote:

While Jim does have a point and is limited by the threading algorithm of
this list manager, someone can successfully argue that "this standard" has
it's drawbacks.

It is somewhat intuitive to pick up a message all pre addressed and reply to
all, especially when your intention is to send a message that will "reach
all".  


It is also somewhat intuitive to think that changing the subject means
starting a new thread, however with thread id's hidden in the headers, this
doesn't work.  You CAN argue that standards that don't work are a bad thing,
or at least, not a GOOD thing.  


The standard allows for a subject change mid-thread while still keeping 
that thread together (i.e. like this message which has a different 
subject but will retain its connection to the rest of the thread).



I don't, however, have a good solution, since basing threads on subject
lines has a different set of drawbacks like lots of broken or disjointed
threads that have a beginning in another thread.  These hidden ID's keep
things together but they also generate lots of off topic discussion within a
thread, like we are doing here ;-), pretty soon we should hear from those
police.


Believe me when I say this subject has been discussed at length by some 
of the brightest people in the world, and the current system is the best 
compromise they could come up with. Just because you don't agree with it 
doesn't mean you shouldn't respect it.


If I don't agree with murder being illegal does that make it right that 
I do it? Of course not, because people smarter than me decided that it 
should be. (Please note that this does not represent my opinion and is 
only being used as an extreme example).


-Stut

Jochem: I think I'm over it now!


-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 21, 2007 12:58 PM

To: Warren Vail
Cc: 'Jim Lucas'; 'Chris Ditty'; php-general@lists.php.net
Subject: Re: [PHP] Job Opportunity

Warren Vail wrote:

Too bad we have to constrain our messages to fit the threading algorithm

of

your list server.  Another case of where man becomes servant to the

machine?

8-)


Jim has a point. Hi-jacking a thread by hitting reply to all and 
changing the subject line messes with the *standard* threading 
mechanism, and nobody can successfully argue that standards are a bad 
thing. It has nothing to do with Jim's setup.


-Stut



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



Re: [PHP] References challenge with PHP4

2007-03-21 Thread Martin Alterisio

2007/3/20, Jochem Maas <[EMAIL PROTECTED]>:


Robert Cummings wrote:
> On Tue, 2007-03-20 at 11:52 +0100, Jochem Maas wrote:
>> ok, I tried it in a whole number of variations -
>> no joy.
>>
>> you should use php5 if you want this kind of reference
>> stuff - in php5 it just works, php 4 will give you big headaches.
>
> Now now, don't be calling PHP5 "ALL THAT" when it can't do it right
> either (or did you not check it using PHP5 ;) ;)

god knows what I did - obviously something different to what I thought
I was testing :-/

> Everything works fine
> in PHP4 (also for PHP5 in this case if you just understand that static
> vars are buggy *lol* -- and this is first time I've noticed this bug).

I have never run into this bug before ... nice catch, seems like
a viable item for a bug report.



Actually, is not a bug, is expected behaviour and documented in the manual

http://php.net/static

See the last section, named "references with global and static variables"

static and global are implemented internally as references, that makes
storing references into static variables impossible (which can be solved by
using arrays of references as seen in Robert Cummings example).


RE: [PHP] Re: Random Unique ID

2007-03-21 Thread Jim Moseby
> Rabih Tayyem writes: 
> 
> > PS: I don't take credit for the code as it is a modified version of 
> > a code I found long time back (this same code is running on one of 
> > my applications for months without any problem)..
> 
> Thanks.  I'll find use for that! 
> 
> However, altho I know that by making the random number big enough
> the likelyhood of collisions can be made vanishingly small, I was
> actually concerned with eliminating the possibility of collisions
> altogether by checking to see if the number had been used before. 
> 
> I just don't know how to do that properly with Mysql.  Perhaps it
> is necessary to lock to table, check, make the insert and then
> unlock it.  But I was hoping that there would be a simpler way. 

Replied off-list with a solution.

JM

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



[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Rabih Tayyem writes: 

PS: I don't take credit for the code as it is a modified version of 
a code I found long time back (this same code is running on one of 
my applications for months without any problem)..


Thanks.  I'll find use for that! 


However, altho I know that by making the random number big enough
the likelyhood of collisions can be made vanishingly small, I was
actually concerned with eliminating the possibility of collisions
altogether by checking to see if the number had been used before. 


I just don't know how to do that properly with Mysql.  Perhaps it
is necessary to lock to table, check, make the insert and then
unlock it.  But I was hoping that there would be a simpler way. 

Best, 

Craig 




On 3/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


Hello, 


I want to add a random unique ID to a Mysql table.  Collisions
are unlikely but possible so to handle those cases I'd like to
regenerate the random ID until there is no collision and only
then add my row.  Any suggestions for a newbie as to the right
way to go about doing this? 

Best, 

Craig 


--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743&co_branded=1 -
-- 



**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
** 


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







--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743&co_branded=1 -
-- 



**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
** 


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



[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Stut writes: 


[EMAIL PROTECTED] wrote:

I want to add a random unique ID to a Mysql table.  Collisions
are unlikely but possible so to handle those cases I'd like to
regenerate the random ID until there is no collision and only
then add my row.  Any suggestions for a newbie as to the right
way to go about doing this?


1) Not even slightly PHP related.


Perhaps not.  It is Mysql related.  And seeing other Mysql discussion
on this list inspired me to ask. 


2) Why random? Incrementing not good enough for you?


I want to use it in a way that will expose it to the user.  And I
don't want to give out information as to the order of records in
my database. 

Best, 

Craig 



--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743&co_branded=1 -
-- 



**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
** 


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



RE: [PHP] Job Opportunity

2007-03-21 Thread Warren Vail
While Jim does have a point and is limited by the threading algorithm of
this list manager, someone can successfully argue that "this standard" has
it's drawbacks.

It is somewhat intuitive to pick up a message all pre addressed and reply to
all, especially when your intention is to send a message that will "reach
all".  

It is also somewhat intuitive to think that changing the subject means
starting a new thread, however with thread id's hidden in the headers, this
doesn't work.  You CAN argue that standards that don't work are a bad thing,
or at least, not a GOOD thing.  

I don't, however, have a good solution, since basing threads on subject
lines has a different set of drawbacks like lots of broken or disjointed
threads that have a beginning in another thread.  These hidden ID's keep
things together but they also generate lots of off topic discussion within a
thread, like we are doing here ;-), pretty soon we should hear from those
police.

Warren Vail

-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 21, 2007 12:58 PM
To: Warren Vail
Cc: 'Jim Lucas'; 'Chris Ditty'; php-general@lists.php.net
Subject: Re: [PHP] Job Opportunity

Warren Vail wrote:
> Too bad we have to constrain our messages to fit the threading algorithm
of
> your list server.  Another case of where man becomes servant to the
machine?
> 8-)

Jim has a point. Hi-jacking a thread by hitting reply to all and 
changing the subject line messes with the *standard* threading 
mechanism, and nobody can successfully argue that standards are a bad 
thing. It has nothing to do with Jim's setup.

-Stut

-- 
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] Job Opportunity

2007-03-21 Thread Stut

Warren Vail wrote:

Too bad we have to constrain our messages to fit the threading algorithm of
your list server.  Another case of where man becomes servant to the machine?
8-)


Jim has a point. Hi-jacking a thread by hitting reply to all and 
changing the subject line messes with the *standard* threading 
mechanism, and nobody can successfully argue that standards are a bad 
thing. It has nothing to do with Jim's setup.


-Stut

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



RE: [PHP] Job Opportunity

2007-03-21 Thread Warren Vail
Too bad we have to constrain our messages to fit the threading algorithm of
your list server.  Another case of where man becomes servant to the machine?
8-)

Warren Vail

-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 21, 2007 11:57 AM
To: Chris Ditty
Cc: php-general@lists.php.net
Subject: Re: [PHP] Job Opportunity

Sorry, replied to the wrong post...

well, I hate to correct you, but I think you need to be checking those 
headers.

here is a snapshot of my threaded view

http://www.cmsws.com/images/threads.jpg

With the re-written subject line, it didn't add Re:  to it, but it was a 
reply to another thread


Chris Ditty wrote:
> Hate to be a PITA, but going back 2 years, I only see Efrain posting 3
> times.  Each time he created a new thread.
> 
> On 3/21/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
>> you have done this a few different times over the past few weeks, it is
>> really annoying!!!
>>
>> for that matter, it is annoying for anybody to hi-jack a thread and
>> start something new with it.
>>
>> Just start your own/new thread...  PLEASE
>>
>>
>> Efrain Sarmiento wrote:
>> > I need people
>> > Willing to pay referral fees...
>> >
>> > LAMP Developer (Linux, Apache, MySQL, and PHP/Perl or Python):  Dealing
>> > with website-content management, security.  For a prestigious online 
>> New
>> > York newspaper.  NYC, 6+  months on going $65/hr (negotiable).
>> >
>> >
>> > _
>> >
>> > Efrain Sarmiento
>> > Technical Recruiter
>> > MISI company
>> >
>> > p: 212.355.5585 x332
>> > f: 212.751.5964
>> > c: 917.365.5656
>> > [EMAIL PROTECTED]
>> >
>> > Informed Usability  |  Innovative Solutions   |  Reliable Sourcing
>> > www.misicompany.com
>> > _
>> >
>> > The information contained in this message is sent in the strictest
>> > confidence for the addressee only. It is intended only for the use of
>> > the addressee and may contain legally
>> > privileged/confidential/proprietary information. If you have received
>> > this email in error you are requested to preserve its confidentiality
>> > and advise the sender.
>> >
>>
>>
>> -- 
>> Enjoy,
>>
>> Jim Lucas
>>
>> Different eyes see different things. Different hearts beat on different
>> strings. But there are times for you and me when all such things agree.
>>
>> - Rush
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 


-- 
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.

- Rush

-- 
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] Job Opportunity

2007-03-21 Thread Jim Lucas

Sorry, replied to the wrong post...

well, I hate to correct you, but I think you need to be checking those 
headers.


here is a snapshot of my threaded view

http://www.cmsws.com/images/threads.jpg

With the re-written subject line, it didn't add Re:  to it, but it was a 
reply to another thread



Chris Ditty wrote:

Hate to be a PITA, but going back 2 years, I only see Efrain posting 3
times.  Each time he created a new thread.

On 3/21/07, Jim Lucas <[EMAIL PROTECTED]> wrote:

you have done this a few different times over the past few weeks, it is
really annoying!!!

for that matter, it is annoying for anybody to hi-jack a thread and
start something new with it.

Just start your own/new thread...  PLEASE


Efrain Sarmiento wrote:
> I need people
> Willing to pay referral fees...
>
> LAMP Developer (Linux, Apache, MySQL, and PHP/Perl or Python):  Dealing
> with website-content management, security.  For a prestigious online 
New

> York newspaper.  NYC, 6+  months on going $65/hr (negotiable).
>
>
> _
>
> Efrain Sarmiento
> Technical Recruiter
> MISI company
>
> p: 212.355.5585 x332
> f: 212.751.5964
> c: 917.365.5656
> [EMAIL PROTECTED]
>
> Informed Usability  |  Innovative Solutions   |  Reliable Sourcing
> www.misicompany.com
> _
>
> The information contained in this message is sent in the strictest
> confidence for the addressee only. It is intended only for the use of
> the addressee and may contain legally
> privileged/confidential/proprietary information. If you have received
> this email in error you are requested to preserve its confidentiality
> and advise the sender.
>


--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush

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







--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



RE: [PHP] Job Opportunity

2007-03-21 Thread Efrain Sarmiento
Chris and Rob and all the rest who new I had nothing but good intentions
thanks :)

Jim..I will start my new thread now...  I am simply networking and
offering a paying gig

So thanks guys/gals :) 


_

Efrain Sarmiento
Technical Recruiter
MISI company

p: 212.355.5585 x332
f: 212.751.5964
c: 917.365.5656
[EMAIL PROTECTED]

Informed Usability  |  Innovative Solutions   |  Reliable Sourcing 
www.misicompany.com
_

The information contained in this message is sent in the strictest
confidence for the addressee only. It is intended only for the use of
the addressee and may contain legally
privileged/confidential/proprietary information. If you have received
this email in error you are requested to preserve its confidentiality
and advise the sender.


-Original Message-
From: Chris Ditty [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 21, 2007 2:36 PM
Cc: php-general@lists.php.net
Subject: Re: [PHP] Job Opportunity

Hate to be a PITA, but going back 2 years, I only see Efrain posting 3
times.  Each time he created a new thread.

On 3/21/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
> you have done this a few different times over the past few weeks, it 
> is really annoying!!!
>
> for that matter, it is annoying for anybody to hi-jack a thread and 
> start something new with it.
>
> Just start your own/new thread...  PLEASE
>
>
> Efrain Sarmiento wrote:
> > I need people
> > Willing to pay referral fees...
> >
> > LAMP Developer (Linux, Apache, MySQL, and PHP/Perl or Python):  
> > Dealing with website-content management, security.  For a 
> > prestigious online New York newspaper.  NYC, 6+  months on going
$65/hr (negotiable).
> >
> >
> > _
> >
> > Efrain Sarmiento
> > Technical Recruiter
> > MISI company
> >
> > p: 212.355.5585 x332
> > f: 212.751.5964
> > c: 917.365.5656
> > [EMAIL PROTECTED]
> >
> > Informed Usability  |  Innovative Solutions   |  Reliable Sourcing
> > www.misicompany.com
> > _
> >
> > The information contained in this message is sent in the strictest 
> > confidence for the addressee only. It is intended only for the use 
> > of the addressee and may contain legally 
> > privileged/confidential/proprietary information. If you have 
> > received this email in error you are requested to preserve its 
> > confidentiality and advise the sender.
> >
>
>
> --
> Enjoy,
>
> Jim Lucas
>
> Different eyes see different things. Different hearts beat on 
> different strings. But there are times for you and me when all such
things agree.
>
> - Rush
>
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
> http://www.php.net/unsub.php
>
>

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

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



Re: [PHP] Job Opportunity

2007-03-21 Thread Chris Ditty

Hate to be a PITA, but going back 2 years, I only see Efrain posting 3
times.  Each time he created a new thread.

On 3/21/07, Jim Lucas <[EMAIL PROTECTED]> wrote:

you have done this a few different times over the past few weeks, it is
really annoying!!!

for that matter, it is annoying for anybody to hi-jack a thread and
start something new with it.

Just start your own/new thread...  PLEASE


Efrain Sarmiento wrote:
> I need people
> Willing to pay referral fees...
>
> LAMP Developer (Linux, Apache, MySQL, and PHP/Perl or Python):  Dealing
> with website-content management, security.  For a prestigious online New
> York newspaper.  NYC, 6+  months on going $65/hr (negotiable).
>
>
> _
>
> Efrain Sarmiento
> Technical Recruiter
> MISI company
>
> p: 212.355.5585 x332
> f: 212.751.5964
> c: 917.365.5656
> [EMAIL PROTECTED]
>
> Informed Usability  |  Innovative Solutions   |  Reliable Sourcing
> www.misicompany.com
> _
>
> The information contained in this message is sent in the strictest
> confidence for the addressee only. It is intended only for the use of
> the addressee and may contain legally
> privileged/confidential/proprietary information. If you have received
> this email in error you are requested to preserve its confidentiality
> and advise the sender.
>


--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush

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




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



[PHP] Trans id

2007-03-21 Thread Luciano Tolomei

I have a big problem with trans id.
i have to use it on a particolar site cause a security restriction of a 
group of users.


So i have to:
use only trans id and to disable cookies.

php correctly work on get variables but when it add the input hidden in 
the form it does not work on submit and put us out of session.


i checked the resulting html code and all seem correct.
but if the method of the form is "post" it does not work.

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



Re: [PHP] Job Opportunity

2007-03-21 Thread Jim Lucas
you have done this a few different times over the past few weeks, it is 
really annoying!!!


for that matter, it is annoying for anybody to hi-jack a thread and 
start something new with it.


Just start your own/new thread...  PLEASE


Efrain Sarmiento wrote:

I need people
Willing to pay referral fees...

LAMP Developer (Linux, Apache, MySQL, and PHP/Perl or Python):  Dealing
with website-content management, security.  For a prestigious online New
York newspaper.  NYC, 6+  months on going $65/hr (negotiable). 



_

Efrain Sarmiento
Technical Recruiter
MISI company

p: 212.355.5585 x332
f: 212.751.5964
c: 917.365.5656
[EMAIL PROTECTED]

Informed Usability  |  Innovative Solutions   |  Reliable Sourcing 
www.misicompany.com

_

The information contained in this message is sent in the strictest
confidence for the addressee only. It is intended only for the use of
the addressee and may contain legally
privileged/confidential/proprietary information. If you have received
this email in error you are requested to preserve its confidentiality
and advise the sender.




--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



Re: [PHP] Job Opportunity

2007-03-21 Thread Jim Lucas

Quit hi-jacking posts.

create your own!!!


Efrain Sarmiento wrote:

I need people
Willing to pay referral fees...

LAMP Developer (Linux, Apache, MySQL, and PHP/Perl or Python):  Dealing
with website-content management, security.  For a prestigious online New
York newspaper.  NYC, 6+  months on going $65/hr (negotiable). 



_

Efrain Sarmiento
Technical Recruiter
MISI company

p: 212.355.5585 x332
f: 212.751.5964
c: 917.365.5656
[EMAIL PROTECTED]

Informed Usability  |  Innovative Solutions   |  Reliable Sourcing 
www.misicompany.com

_

The information contained in this message is sent in the strictest
confidence for the addressee only. It is intended only for the use of
the addressee and may contain legally
privileged/confidential/proprietary information. If you have received
this email in error you are requested to preserve its confidentiality
and advise the sender.




--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



[PHP] Job Opportunity

2007-03-21 Thread Efrain Sarmiento
I need people
Willing to pay referral fees...

LAMP Developer (Linux, Apache, MySQL, and PHP/Perl or Python):  Dealing
with website-content management, security.  For a prestigious online New
York newspaper.  NYC, 6+  months on going $65/hr (negotiable). 


_

Efrain Sarmiento
Technical Recruiter
MISI company

p: 212.355.5585 x332
f: 212.751.5964
c: 917.365.5656
[EMAIL PROTECTED]

Informed Usability  |  Innovative Solutions   |  Reliable Sourcing 
www.misicompany.com
_

The information contained in this message is sent in the strictest
confidence for the addressee only. It is intended only for the use of
the addressee and may contain legally
privileged/confidential/proprietary information. If you have received
this email in error you are requested to preserve its confidentiality
and advise the sender.

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



Re: [PHP] close session when browser is closed

2007-03-21 Thread Alain Roger

Hi Brad,

yes this is one possibility, but since i use https, i should not be afraid
by storing data in $_SESSION variables.
So i see that solution as a heavy one.

Is there another possibility ?
thanks,

Al.

On 3/21/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:


Alain Roger wrote:
> Hi,
>
> I would like to know what is the best solution for my problem.
>
> When a user is connected to a https page and a session is open, if user
> close his browser, the session ID is still active in the browser
> "history".
> It means that next time when user will start his browser, the browser
> will
> re-use the same session ID and will work with php pages without any
> problem.
>
> I was thinking to use cookie to solve this issue, but what should i do
> when
> user browser refuse cookies ?
>
> thanks a lot,
>
Why not store the session data in a database and set an expiration for
that session, so even if the session data is preserved it would be
expired, and thus force the user to re-authenticate or reload their
session variables.
-B





--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


Re: [PHP] close session when browser is closed

2007-03-21 Thread Brad Bonkoski

Alain Roger wrote:

Hi,

I would like to know what is the best solution for my problem.

When a user is connected to a https page and a session is open, if user
close his browser, the session ID is still active in the browser 
"history".
It means that next time when user will start his browser, the browser 
will
re-use the same session ID and will work with php pages without any 
problem.


I was thinking to use cookie to solve this issue, but what should i do 
when

user browser refuse cookies ?

thanks a lot,

Why not store the session data in a database and set an expiration for 
that session, so even if the session data is preserved it would be 
expired, and thus force the user to re-authenticate or reload their 
session variables.

-B

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



Re: [PHP] Random Unique ID

2007-03-21 Thread Rabih Tayyem

function GenerateID ()
{
$len = 3;
$base='ABCDEFGHKLMNOPQRSTWXYZ';
$max=strlen($base)-1;
$activatecode='';
mt_srand((double)microtime()*100);
while (strlen($activatecode)<$len+1)$activatecode.=$base{mt_rand(0,$max)};

$len = 7;
$base='1234567890';
$max=strlen($base)-1;
mt_srand((double)microtime()*100);
while (strlen($activatecode)<$len+1) $activatecode.=$base{mt_rand(0,$max)};

return $activatecode;

}
this will generate and ID of 4 letters and 4 digits based on the current
time stamp..
ex: *QCKS9046 ...* the possibility of generating the same ID again is almost
0... (and you can make it even less if you increase the length)...

PS: I don't take credit for the code as it is a modified version of a code I
found long time back (this same code is running on one of my applications
for months without any problem)..

Regards,
Rabih G. Tayyem





On 3/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


Hello,

I want to add a random unique ID to a Mysql table.  Collisions
are unlikely but possible so to handle those cases I'd like to
regenerate the random ID until there is no collision and only
then add my row.  Any suggestions for a newbie as to the right
way to go about doing this?

Best,

Craig

--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743&co_branded=1 -
--


**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
**

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




Re: [PHP] Re: Keep the PHP list ON TOPIC!

2007-03-21 Thread Robert Cummings
On Wed, 2007-03-21 at 12:35 -0500, Myron Turner wrote:
> Jochem Maas wrote:
> > I would have made a similar comment - but I have soap stuck between my 
> > teeth atm :-P
> >   
> Just use a little of that saliva that you've been wasting on spitballs. ;-)

I always preferred soap as a kid over a belting. At least with soap I
could pretend it really bothered me... bruises not so easy :)

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

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



Re: [PHP] Re: Keep the PHP list ON TOPIC!

2007-03-21 Thread Myron Turner

Jochem Maas wrote:

I would have made a similar comment - but I have soap stuck between my teeth 
atm :-P
  

Just use a little of that saliva that you've been wasting on spitballs. ;-)

--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



[PHP] close session when browser is closed

2007-03-21 Thread Alain Roger

Hi,

I would like to know what is the best solution for my problem.

When a user is connected to a https page and a session is open, if user
close his browser, the session ID is still active in the browser "history".
It means that next time when user will start his browser, the browser will
re-use the same session ID and will work with php pages without any problem.

I was thinking to use cookie to solve this issue, but what should i do when
user browser refuse cookies ?

thanks a lot,

--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


Re: [PHP] Random Unique ID

2007-03-21 Thread Stut

[EMAIL PROTECTED] wrote:

I want to add a random unique ID to a Mysql table.  Collisions
are unlikely but possible so to handle those cases I'd like to
regenerate the random ID until there is no collision and only
then add my row.  Any suggestions for a newbie as to the right
way to go about doing this?


1) Not even slightly PHP related.

2) Why random? Incrementing not good enough for you?

-Stut

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



[PHP] Random Unique ID

2007-03-21 Thread ccspencer
Hello, 


I want to add a random unique ID to a Mysql table.  Collisions
are unlikely but possible so to handle those cases I'd like to
regenerate the random ID until there is no collision and only
then add my row.  Any suggestions for a newbie as to the right
way to go about doing this? 

Best, 

Craig 


--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743&co_branded=1 -
-- 



**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
**

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



Re: [PHP] Re: Keep the PHP list ON TOPIC! (was: [PHP] MYSQLyog)

2007-03-21 Thread Jochem Maas
Robert Cummings wrote:
> On Wed, 2007-03-21 at 10:47 -0500, Myron Turner wrote:
>> Jonathan Kahan wrote:
>>
>> I've been following this thread on and off, because I found the 
>> unnecessarily hostile tone of the initial response so off-putting.  But 
>> while this rather small infraction of OT code, which can in fact be 
>> defended, had been taking place, at the same time on this list an 
>> ongoing, extensive discussion of the relative merits of various 
>> databases has been going on and yet no one has said a word.  My guess is 
>> that Jonathan, as new to the list, was being selectively picked on, 
>> while the guardians of the list looked the other way with respect to the 
>> other thread because some of the people involved there are long time, 
>> valuable contributors, with lots of weapons at their disposal.  I could 
>> be wrong, of course. But I'm certainly not wrong to believe that the 
>> remedy for a foul mouth is soap and water.
> 
> I'm sorry, but your rant is off topic. Please find another list for it.

I would have made a similar comment - but I have soap stuck between my teeth 
atm :-P

> 
> ;) :B
> 
> Cheers,
> Rob.

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



Re: [PHP] MYSQLyog

2007-03-21 Thread Stut

Richard Lynch wrote:

On Tue, March 20, 2007 3:24 pm, Jochem Maas wrote:

Stut wrote:

Jochem Maas wrote:

Stut wrote:

Jonathan Kahan wrote:

...

The wildcard for the hostname is not * it's %.

-Stut

your being friendly today Stut, wassup with that ;-)

New job. Too happy.

anything we can do to remedy that? ;-)


Just give it some time, I'm sure it'll pass ;-)


But I *like* the kinder, gentler Stut [*]

More seriously, you guys, and now I, have spent WAY more "noise" then
the original Q...

* This is not to say I didn't also like the irrascable Stut. :-)


Well, isn't that nice. I'm lost for words (which is a very odd phrase 
because if it were true I wouldn't even be able to say "I'm lost for 
words", but what the hey!).


-Stut

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



Re: [PHP] Flash animation without install Flash!

2007-03-21 Thread Mikey

Helder Lopes wrote:

Hi people,

Because the problems with virus in internet the people dont install activex
controls.
My question is:

How to put a flash in the website without asking the person to install
activex control??

/Helder Lopes



Flash is such a ubiquitous form of media these days that I don't think 
you need worry about people installing the control.  More of a concern 
these days is the annoying "Click to activate this control" message that 
IE now displays.  This can be scripted around with Javascript however, 
and a fix may be found here:


http://www.thefutureoftheweb.com/blog/2006/8/work-around-click-to-activate-and-use-this-control

HTH,

Mikey

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



Re: [PHP] Re: Keep the PHP list ON TOPIC! (was: [PHP] MYSQLyog)

2007-03-21 Thread Robert Cummings
On Wed, 2007-03-21 at 10:47 -0500, Myron Turner wrote:
> Jonathan Kahan wrote:
>
> I've been following this thread on and off, because I found the 
> unnecessarily hostile tone of the initial response so off-putting.  But 
> while this rather small infraction of OT code, which can in fact be 
> defended, had been taking place, at the same time on this list an 
> ongoing, extensive discussion of the relative merits of various 
> databases has been going on and yet no one has said a word.  My guess is 
> that Jonathan, as new to the list, was being selectively picked on, 
> while the guardians of the list looked the other way with respect to the 
> other thread because some of the people involved there are long time, 
> valuable contributors, with lots of weapons at their disposal.  I could 
> be wrong, of course. But I'm certainly not wrong to believe that the 
> remedy for a foul mouth is soap and water.

I'm sorry, but your rant is off topic. Please find another list for it.

;) :B

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

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



Re: [PHP] IP to City detection

2007-03-21 Thread Satyam
It is very hard to get to the level of city. It is the way the networks are 
built.  I live in a minor town.  My provider has a node in this city, but it 
gathers all the traffic of the whole area (my town and neighboring towns) 
and sends it through an internal link to their major regional center. 
Depending on availability, my traffic might get to the  Internet (uppercase 
Internet, the big, public, global one which links us all together) right 
through that regional node or, depending on traffic, it might get beamed 
over somewhere else and get into the Internet at another less busy node. 
Big providers are constantly shufling traffic around depending on the 
availabilty of their own internal network and that of their wholesale 
provider.   The IP you see exposed to the Internet is that of the node where 
your provider internal network connects to the public network, the uppercase 
Internet.  Due to national regulations, it is usually hard for one national 
provider to use IP addresses belonging to another country so, IP to country 
tables are quite reliable.   IP to city is not reliable at all, there is not 
external rules imposing arbitrary borders on traffic so a provider is free 
to send packets wherever it becomes more efficient.  Moreover, if a client 
has the same provider as your service, the IP address you receive might be 
an internal IP address and not an actual Interner address.  Internal IP 
addresses have little restrictions, they can be almost anything.  If that 
were the case, all bets are off.


These days with the CeBit show running at Frankfurt, Deutsch Telekom (sorry 
about the spelling) might be struggling with their bandwith around that 
area.  Data packets might be popping about everywhere in Germany and, if 
they have agreements with neighboring countries, some might be showing up at 
Denmark, Austria or Poland, who knows!  My town is close to Barcelona, 
Spain.  When they had the 3G mobile phone conference there last month, my 
packets might be going to Tarragona, Valencia or even all the way to Madrid.


Comercial IP to location databases, at least, keep in close contact with the 
major providers so they have a close idea of how are they routing their 
packets.  Non-comercial databases don't have the resoorces to keep updated. 
The only reason they are more or less reliable at the IP to country level is 
that governments have different regulations in each country and they know 
there is value in the information flowing through the optical fibers so, 
while they figure out how to tax those bits and bytes, they make it just a 
little more hard for them to flow from one country to the next, but within a 
single country, there are no limits.


Satyam



- Original Message - 
From: "William Lovaton" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, March 21, 2007 1:24 PM
Subject: [PHP] IP to City detection



Hi people,

Is there a way to detect the city of a person based on the IP address? I
mean something like ip2nation http://www.ip2nation.com/ but for cities
so I can use it in my PHP web application.

Thanks for any help you can give me,

-William

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 
20/03/2007 8:07





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



Re: [PHP] Re: Keep the PHP list ON TOPIC! (was: [PHP] MYSQLyog)

2007-03-21 Thread Myron Turner

Jonathan Kahan wrote:

Understood.

I will think harder next time before posting.

- Original Message - From: "Jim Moseby" 
<[EMAIL PROTECTED]>
To: "'Jochem Maas'" <[EMAIL PROTECTED]>; "Jonathan Kahan" 
<[EMAIL PROTECTED]>

Cc: "Stut" <[EMAIL PROTECTED]>; 
Sent: Wednesday, March 21, 2007 9:17 AM
Subject: Keep the PHP list ON TOPIC! (was: [PHP] MYSQLyog)





so that make's your totally offtopic question okay then does?
I suppose you condone murder also because, heck, others have
done it before, right?

> And yes in my mind this is part of  PHP in that PHP
> interacts with MYSQL and thus this has a bearing on my
ability to write
> PHP programs in the future.

your mind seems rather clouded or just plain narrow.
you can't connect to a mysql server using some window gui app
... there is
no php there, period.

> I have already written a few PHP programs
> without using the mysql functions which yes are a part of PHP.

technically the mysql wrapper functions are part of a php extension.
there are plenty of people who run php without the mysql
extension btw.

> This is
> an email support group-I am not attempting a masters thesis here.

this is general php support list - please do come back when
you have trouble
with mysql_connect(), mysql_query() and the like.

otherwise go get your help from the correct source, I'm sure there is
plenty to be found at mysql.com for example (or webyog.com???).



Put another (kinder? gentler?) way:

While the fine folks of the PHP General list might be able to make a 
pretty
good guess as to the solution to your non-PHP problem, you would find 
much
better, quicker, more accurate (and less prickly) advice from the 
MYSQLyog

or MYSQL support lists.

The more we can keep the topic focused on PHP here, the better the 
perpetual

archive will be for PHP knowledge seekers going forward.

JM




I've been following this thread on and off, because I found the 
unnecessarily hostile tone of the initial response so off-putting.  But 
while this rather small infraction of OT code, which can in fact be 
defended, had been taking place, at the same time on this list an 
ongoing, extensive discussion of the relative merits of various 
databases has been going on and yet no one has said a word.  My guess is 
that Jonathan, as new to the list, was being selectively picked on, 
while the guardians of the list looked the other way with respect to the 
other thread because some of the people involved there are long time, 
valuable contributors, with lots of weapons at their disposal.  I could 
be wrong, of course. But I'm certainly not wrong to believe that the 
remedy for a foul mouth is soap and water.


--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



Re: [PHP] Flash animation without install Flash!

2007-03-21 Thread Tijnema !

On 3/21/07, Helder Lopes <[EMAIL PROTECTED]> wrote:

Hi people,

Because the problems with virus in internet the people dont install activex
controls.
My question is:

How to put a flash in the website without asking the person to install
activex control??

/Helder Lopes


It is not possible to use flash without having the client flash
installed. What you can do is creating things that look like flash,
this would mean some kind of PHP/AJAX script. I don't know if you are
a programmer, if not, forget it :)
If yes, you might think about it, but it's not a script of a few
lines, it would really take you a few months i think.(Unless somebody
else did it already)

Tijnema




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



[PHP] Re: Keep the PHP list ON TOPIC! (was: [PHP] MYSQLyog)

2007-03-21 Thread Jonathan Kahan

Understood.

I will think harder next time before posting.

- Original Message - 
From: "Jim Moseby" <[EMAIL PROTECTED]>
To: "'Jochem Maas'" <[EMAIL PROTECTED]>; "Jonathan Kahan" 
<[EMAIL PROTECTED]>

Cc: "Stut" <[EMAIL PROTECTED]>; 
Sent: Wednesday, March 21, 2007 9:17 AM
Subject: Keep the PHP list ON TOPIC! (was: [PHP] MYSQLyog)




Jonathan Kahan wrote:
> I will look at Jim's suggestion. I tried the % and it still failed.
> FYI-I have seen posts here much less related to PHP than my
own without
> such responses.

so that make's your totally offtopic question okay then does?
I suppose you condone murder also because, heck, others have
done it before, right?

> And yes in my mind this is part of  PHP in that PHP
> interacts with MYSQL and thus this has a bearing on my
ability to write
> PHP programs in the future.

your mind seems rather clouded or just plain narrow.
you can't connect to a mysql server using some window gui app
... there is
no php there, period.

> I have already written a few PHP programs
> without using the mysql functions which yes are a part of PHP.

technically the mysql wrapper functions are part of a php extension.
there are plenty of people who run php without the mysql
extension btw.

> This is
> an email support group-I am not attempting a masters thesis here.

this is general php support list - please do come back when
you have trouble
with mysql_connect(), mysql_query() and the like.

otherwise go get your help from the correct source, I'm sure there is
plenty to be found at mysql.com for example (or webyog.com???).



Put another (kinder? gentler?) way:

While the fine folks of the PHP General list might be able to make a 
pretty

good guess as to the solution to your non-PHP problem, you would find much
better, quicker, more accurate (and less prickly) advice from the MYSQLyog
or MYSQL support lists.

The more we can keep the topic focused on PHP here, the better the 
perpetual

archive will be for PHP knowledge seekers going forward.

JM




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



Re: [PHP] Re: Getting last record ID created from DB

2007-03-21 Thread Robert Cummings
On Wed, 2007-03-21 at 10:37 -0400, Mark wrote:
> Richard Lynch wrote:
> 
> > On Tue, March 20, 2007 8:00 pm, Mark wrote:
> > 
> > I'd agree with you, except now you've pulled the rug out and inserted
> > a 3rd party connection pool.
> 
> That's not "pulling the rug out," that is a legitimate possibility.
> 
> > 
> > Well, duh, if you're dumb enough to think you can just slap it in and
> > everything will work by magic, you deserve what you get.
> 
> That is my point.
> 
> > 
> > One would hope the connection pooling docs have at least SOME warning
> > that they BREAK certain crucial functionality.
> 
> 
> My point in this discussion is that there are ways that work better and more
> widely across multiple platform than depending on specific features of
> specific systems.

There's always a tradeoff. As the master of my project I get to choose
whether I want runtime speed, development simplicity, platform
compatibility, etc, etc. All these things are never compatible at the
exact same time.

> One can write completely generic SQL that works correctly *regardless* of
> connection pooling, transactional support, etc. The problem is that by not
> thinking about the problem in the general case, you limit the applicability
> of the project for no good reason.

One *can* write completely generic SQL that works correctly... as you
said... but then one can also write completely non generic SQL that runs
faster and serves up more pages for your audience on a tighter budget.
Developers quite often have a good reason for their choices-- whether
you agree with it or not.

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


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



Re: [PHP] Re: Getting last record ID created from DB

2007-03-21 Thread Mark
Richard Lynch wrote:

> On Mon, March 19, 2007 10:58 pm, markw@mohawksoft.com wrote:
>>> markw@mohawksoft.com wrote:
> markw@mohawksoft.com wrote:
>>> On Sat, 2007-03-17 at 12:19 -0400, Mark wrote:
>>> Check the documentation - currval returns the last one *for that
>>> session* - it does not return the last global change.
>>>
>>> http://www.postgresql.org/docs/current/static/functions-sequence.html
>>>
>>> It is perfectly safe to use this.
>>
>> In theory that may be true, but can the application developer make any
>> assumption about the underlying architecture? Might you be familiar
>> with
>> connection pooling? Where multiple threads or processes share a
>> database
>> connection or "session?"
> 
> If the pool breaks the documentation about current session, the pool
> is broken.
> 
> Fix it.
> 
> :-)
> 
> I don't think the "pool" will give you somebody else's ID, for the
> record. It's smart enough to not do that, I *believe*, mostly on
> faith.

I've seen some pretty disturbing behavior in some Oracle connection pooling
software. The problem is that you don't know it is the connection pool
causing the problem until you chase it down.

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



Re: [PHP] Re: [GENERAL] phpPgAdmin - prior version available?

2007-03-21 Thread Tijnema !

On 3/21/07, Robert Treat <[EMAIL PROTECTED]> wrote:

On Sunday 18 March 2007 12:41, Bob Hartung wrote:
> Hi all,
>I have been struggling with phpPgAdmin 4.1 - login failures.  There
> does not yet seem to be a fix.  Where can I find a prior version for FC6
> - rpm, tar.gz etc.
>

Can you be a bit more specific on the problem you're seeing?


I already solved his problem, he replied to that, but not to the list...
his message:

got it,  Thanks again!

Bob


--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

--
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: Getting last record ID created from DB

2007-03-21 Thread Mark
Richard Lynch wrote:

> On Tue, March 20, 2007 8:00 pm, Mark wrote:
> 
> I'd agree with you, except now you've pulled the rug out and inserted
> a 3rd party connection pool.

That's not "pulling the rug out," that is a legitimate possibility.

> 
> Well, duh, if you're dumb enough to think you can just slap it in and
> everything will work by magic, you deserve what you get.

That is my point.

> 
> One would hope the connection pooling docs have at least SOME warning
> that they BREAK certain crucial functionality.


My point in this discussion is that there are ways that work better and more
widely across multiple platform than depending on specific features of
specific systems.

One can write completely generic SQL that works correctly *regardless* of
connection pooling, transactional support, etc. The problem is that by not
thinking about the problem in the general case, you limit the applicability
of the project for no good reason.

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



Re: [PHP] PHP DOM saveHTML outputs entities

2007-03-21 Thread Eli
Hi Nicholas,

Nicholas Yim wrote:
> how save() method

The save() method, or actually saveXML() method dumps the DOM in XML
format and not HTML format, and browsers do not know how to handle it
correctly.

-thanks

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



[PHP] Re: [GENERAL] phpPgAdmin - prior version available?

2007-03-21 Thread Robert Treat
On Sunday 18 March 2007 12:41, Bob Hartung wrote:
> Hi all,
>I have been struggling with phpPgAdmin 4.1 - login failures.  There
> does not yet seem to be a fix.  Where can I find a prior version for FC6
> - rpm, tar.gz etc.
>

Can you be a bit more specific on the problem you're seeing? 

-- 
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

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



[PHP] sourceforge garage sale shopping carts?

2007-03-21 Thread jtjohnston

Are there any shopping carts at Sourceforge that you would recommend? Or
other Open Source script? I don't mean to be cheap, just find a fast
solution for a friend.
Something simple, a simple garage sale with a few options and categories.
I created the shopping cart for www.compcanlit.ca, and would not have
the time to recreate another.
I'm always happy to share code, especially if that one suits someone.
John
www.jtjohnston.ca

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



RE: [PHP] IP to City detection

2007-03-21 Thread Jim Moseby
PHP] IP to City detection
> 
> 
> There's a MaxMind's GeoLite City service for that. It's free.
> 
> http://www.maxmind.com/app/geolitecity
> 


That is probably a better alternative than the one I sent, which relies on
data from api.hostip.info.

JM

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



RE: [PHP] IP to City detection

2007-03-21 Thread Hidayet Dogan

There's a MaxMind's GeoLite City service for that. It's free.

http://www.maxmind.com/app/geolitecity

On Wed, 21 Mar 2007, Jim Moseby wrote:


Hi people,

Is there a way to detect the city of a person based on the IP
address? I
mean something like ip2nation http://www.ip2nation.com/ but for cities
so I can use it in my PHP web application.

Thanks for any help you can give me,

-William




I have one that 'sort of' works.  It might be a start for you.  I don't take
credit for it, but I can't find in the source code any credits.  I'll send
it to you off list.

JM

--
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] IP to City detection

2007-03-21 Thread Jim Moseby
> Hi people,
> 
> Is there a way to detect the city of a person based on the IP 
> address? I
> mean something like ip2nation http://www.ip2nation.com/ but for cities
> so I can use it in my PHP web application.
> 
> Thanks for any help you can give me,
> 
> -William
> 


I have one that 'sort of' works.  It might be a start for you.  I don't take
credit for it, but I can't find in the source code any credits.  I'll send
it to you off list.

JM

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



[PHP] IP to City detection

2007-03-21 Thread William Lovaton
Hi people,

Is there a way to detect the city of a person based on the IP address? I
mean something like ip2nation http://www.ip2nation.com/ but for cities
so I can use it in my PHP web application.

Thanks for any help you can give me,

-William

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



[PHP] Keep the PHP list ON TOPIC! (was: [PHP] MYSQLyog)

2007-03-21 Thread Jim Moseby
> 
> Jonathan Kahan wrote:
> > I will look at Jim's suggestion. I tried the % and it still failed.
> > FYI-I have seen posts here much less related to PHP than my 
> own without
> > such responses. 
> 
> so that make's your totally offtopic question okay then does?
> I suppose you condone murder also because, heck, others have 
> done it before, right?
> 
> > And yes in my mind this is part of  PHP in that PHP
> > interacts with MYSQL and thus this has a bearing on my 
> ability to write
> > PHP programs in the future. 
> 
> your mind seems rather clouded or just plain narrow.
> you can't connect to a mysql server using some window gui app 
> ... there is
> no php there, period.
> 
> > I have already written a few PHP programs
> > without using the mysql functions which yes are a part of PHP. 
> 
> technically the mysql wrapper functions are part of a php extension.
> there are plenty of people who run php without the mysql 
> extension btw.
> 
> > This is
> > an email support group-I am not attempting a masters thesis here.
> 
> this is general php support list - please do come back when 
> you have trouble
> with mysql_connect(), mysql_query() and the like.
> 
> otherwise go get your help from the correct source, I'm sure there is
> plenty to be found at mysql.com for example (or webyog.com???).
> 

Put another (kinder? gentler?) way: 

While the fine folks of the PHP General list might be able to make a pretty
good guess as to the solution to your non-PHP problem, you would find much
better, quicker, more accurate (and less prickly) advice from the MYSQLyog
or MYSQL support lists. 

The more we can keep the topic focused on PHP here, the better the perpetual
archive will be for PHP knowledge seekers going forward.

JM

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



RE: [PHP] read only texbox to html with php

2007-03-21 Thread Edward Kay
2007. 03. 21, szerda keltezéssel 11.51-kor Ross ezt írta:
> I have a readonly textbox that gets mailed as a newsletter. The 
text is a 
> standard covering letter. The problem is when I try and convert 
it to html 
> it doesn't work  It is inserted into a variable via a form textarea 
> $mail_text.
> 
>  "available on the web site  href="http://www.myurl.org";>http://www.myurl.org so you can 
see who is 
> doing."
> 

If I understand correctly, you are setting the value of an HTML textbox to some 
HTML code. When viewing the page, you want the HTML in the textbox to be 
rendered. This isn't possible.

> I tried this
> 
> htmlentities((stripslashes($mail_text)));
> 
> 
> Any ideas?
> 

Why can't you forget the textbox just output the HTML directly?

Edward

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



Re: [PHP] read only texbox to html with php

2007-03-21 Thread Shafiq Rehman

Please elaborate the question

--
Shafiq Rehman (ZCE)
http://phpgurru.com | http://shafiq.pk

On 3/21/07, Ross <[EMAIL PROTECTED]> wrote:


I have a readonly textbox that gets mailed as a newsletter. The text is a
standard covering letter. The problem is when I try and convert it to html
it doesn't work  It is inserted into a variable via a form textarea
$mail_text.

"available on the web site http://www.myurl.org";>http://www.myurl.org so you can see who is
doing."

I tried this

htmlentities((stripslashes($mail_text)));


Any ideas?

R.

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




Re: [PHP] Name Capitalization

2007-03-21 Thread Shafiq Rehman

Hi,

Some problems are universal and we cannot fix them in computer science. I
think it's better to educate/guide your visitors about such names that they
write in correct capitalization

Regards
--
Shafiq Rehman (ZCE)
http://phpgurru.com | http://shafiq.pk

On 3/21/07, Tijnema ! <[EMAIL PROTECTED]> wrote:


On 3/21/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Tue, March 20, 2007 8:41 am, Tijnema ! wrote:
> > What's against just capitalizing the first letter?
> >
> > Of course there exists a lot of different combinations where a capital
> > letter should be, but if names are coming in like MCDONALD or
> > mcdonald, a user would be happy if he sees Mcdonald.
>
> You have clearly never ever dealt with musicians. :-)
>
> They will not just accept the wrong capitalization.
>
> You will need to fix it.
>
> I'll hazard a wild guess somebody will complain about the uc_first
> solution, and for every complaint, you can count on 10 more who just
> shrugged it off, but it's still wrong.

Well, then you are working for hours on implementing filters for
special names, and then you still get a few names wrong... and then
you did all that work for a few fixes. It's just not worth to create
such filter.

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

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




Re: [PHP] read only texbox to html with php

2007-03-21 Thread Németh Zoltán
2007. 03. 21, szerda keltezéssel 11.51-kor Ross ezt írta:
> I have a readonly textbox that gets mailed as a newsletter. The text is a 
> standard covering letter. The problem is when I try and convert it to html 
> it doesn't work  It is inserted into a variable via a form textarea 
> $mail_text.

what do you mean by converting to html?
if it is just plain text what do you want to do with it? enclose it
within  tags, etc? or what?
and what do you mean by doesn't work?

greets
Zoltán Németh

> 
>  "available on the web site  href="http://www.myurl.org";>http://www.myurl.org so you can see who is 
> doing."
> 
> I tried this
> 
> htmlentities((stripslashes($mail_text)));
> 
> 
> Any ideas?
> 
> R.
> 

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



[PHP] read only texbox to html with php

2007-03-21 Thread Ross
I have a readonly textbox that gets mailed as a newsletter. The text is a 
standard covering letter. The problem is when I try and convert it to html 
it doesn't work  It is inserted into a variable via a form textarea 
$mail_text.

 "available on the web site http://www.myurl.org";>http://www.myurl.org so you can see who is 
doing."

I tried this

htmlentities((stripslashes($mail_text)));


Any ideas?

R.

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



Re: [PHP] PHP DOM saveHTML outputs entities

2007-03-21 Thread Nicholas Yim
Hello Eli,



Best regards, 
  
=== At 2007-03-21, 15:13:29 you wrote: ===

>Hi,
>
>I'm loading a utf-8 xml file into PHP5 DOM, and then use saveHTML() 
   how save() method
>method. The result output always convert characters to html entities in 
>any case.
>How can I avoid this? I want to output utf-8 html string with no html 
>entities.
>
>-thanks!
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>

= = = = = = = = = = = = = = = = = = = =

Nicholas Yim
[EMAIL PROTECTED]
2007-03-21

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



Re: [PHP] Flash animation without install Flash!

2007-03-21 Thread Shafiq Rehman

Impossible with flash... You can add GIF for tiny animations.

--
Shafiq Rehman (ZCE)
http://phpgurru.com | http://shafiq.pk

On 3/21/07, Helder Lopes <[EMAIL PROTECTED]> wrote:


Hi people,

Because the problems with virus in internet the people dont install
activex
controls.
My question is:

How to put a flash in the website without asking the person to install
activex control??

/Helder Lopes



[PHP] trouble with function openssl_csr_new()

2007-03-21 Thread Albert Kopka

Hi ...

I want to generate certificate for smardcard login (MS Win-XP)
and for do that the subject of certificate should contain same key
(in key:value of $dn) multiple times for example ...

cert generated by ca suplied with W-2003 server for smartcard login
contains:
Subject: DC = local, DC = foo, CN = Users, CN = bar

but $dn is an array ... so if I define array as:

$dn = array ( "DC" => "local", "DC" => "foo" );

I've got array with one key:value pair "DC" => "foo" ...

Is there any other way to pass the $dn to function ...
(using other structure ... or formated string ... )
or mayby I can use other function whitch supports repeated keys ?

-- 
Albert Kopka
[EMAIL PROTECTED]

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



Re: [PHP] Flash animation without install Flash!

2007-03-21 Thread Németh Zoltán
2007. 03. 21, szerda keltezéssel 09.58-kor Helder Lopes ezt írta:
> Hi people,
> 
> Because the problems with virus in internet the people dont install activex
> controls.
> My question is:
> 
> How to put a flash in the website without asking the person to install
> activex control??

I think there is no way to do that

greets
Zoltán Németh

> 
> /Helder Lopes

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



RE: [PHP] Problem with MySQL

2007-03-21 Thread Németh Zoltán
2007. 03. 21, szerda keltezéssel 00.04-kor Richard Lynch ezt írta:
> On Tue, March 20, 2007 11:08 am, Ford, Mike wrote:
> >> what do you want with that '@' here?
> >> that operator can be used to suppress error messages when calling
> >> functions but not when using a variable
> 
> This is most definitely way wrong.
> 
> > What complete tosh!  @ is a unary operator, so can be applied to any
> > expression.
> >
> > Proof:
> >
> >> echo "no @ --", $HTTP_GET_VARS['bogus'], "\n";
> > echo "with @ --", @$HTTP_GET_VARS['bogus'], "\n";
> >   ?>
> >
> > Result:
> >
> >   no @ --
> >   Warning: Undefined index: bogus in
> > c:\www-lco\scripts_etc\lco\php\test.php on line 18
> >
> >   with @ --
> >
> >
> > Also:
> >
> >> $a = 123;
> > echo "no @ --", $a/0, "\n";
> > echo "with @ --", @($a/0), "\n";
> >   ?>
> >
> > Result:
> >
> >   no @ --
> >   Warning: Division by zero in c:\www-lco\scripts_etc\lco\php\test.php
> > on line 19
> >
> >   with @ --
> >
> >
> > Not that I'm necessarily advocating this as a technique, but let's not
> > spread disinformation!
> 
> While it has now been proven that @ is "more" than a function
> error-suppressant, I suspect it may technically be a Language
> Construct rather than a simple unary operator...
> 
> Not that I can come up with anything yet to prove it, as all my
> examples so far were total syntax errors...
> 
> Although I did find an interesting anomoly...
> 
> What would you expect this to output?
> 
> 
> Hint:
> I figured it would apply the @ to no expression at all and do nothing.
> I was wrong.
> 
> I suppose I could try to read PHP source and figure all this out
> someday...

actually I tried it and the output suprised me also
it was
Parse error: syntax error, unexpected ';'
in /var/www/tests/kukactest1.php on line 1

although I tried it with the unary operator !

that produces the same output

so this behaviour is probably the way operators behave...
but it is really interesting ;)

greets
Zoltán Németh

> 

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



[PHP] Flash animation without install Flash!

2007-03-21 Thread Helder Lopes

Hi people,

Because the problems with virus in internet the people dont install activex
controls.
My question is:

How to put a flash in the website without asking the person to install
activex control??

/Helder Lopes


Re: [PHP] Re: PHP DOM saveHTML outputs entities

2007-03-21 Thread Eli

Tijnema ! wrote:

Did you set the UTF8 format in the html_entity_decode function?
so your code would become:
loadXML("שלום");
$output = $dom->saveHTML();
header("Content-Type: text/html; charset=UTF-8");
echo html_entity_decode($output,ENT_QUOTES,"UTF-8");
?>


Yes. This works... thanks! :-)

But actually I wanted to avoid the saveHTML() method from converting to 
html entities in the first place, if possible at all.


-thanks!

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



Re: [PHP] Out source files

2007-03-21 Thread Manuel Vacelet

2007/3/21, Richard Lynch <[EMAIL PROTECTED]>:

On Tue, March 20, 2007 4:37 am, Manuel Vacelet wrote:
> 2007/3/20, Richard Lynch <[EMAIL PROTECTED]>:
>> One common pattern in PHP is to not put the file in the web tree at
>> all, and write a PHP script with 'readfile' (or fopen/fread/echo
>> loop
>> for larger files).
>>
>> You can then control access to the file, and log any kind of stats
>> you
>> need about accessing the file.
>
> Yes I already do that with all my scripts that are dealing with files.
>
>> Once you have that, then you can also put the files on some other
>> server, and use URL fopen to read them, if you like.
>
> Is it considered as secure ?

as secure as what?  I don't think you've established a baseline for
comparison...


It's a typo I wanted to write (more simple though) 'Is it secure ?'
In several PHP security recommendation we can read "Do not let PHP
open URLs through fopen, ".
I think it's mostly related to crapy php applications that could be
let users do what they want but is there any other problems with this
practice ?


Assuming you control the other server, you can make it as secure as
you like...


The server is fully under my control and I can order other servers if
I can highlight that's a better approach to ensure the security of the
data we serve.


That server can also reject any requests that aren't from your web
server IP (or list of IPs for a web-server farm).


It's an approach but if my front-end is under the control of a cracker
it will be unfortunately useless.


You could set it up with SSL and use curl instead of url fopen --
You'd probably not want to waste $$$ on a CA, so you'd need the
CURLOPT stuff to not check the peer stuff.


I don't imagine using SSL without trusted CA.


How secure is secure enough?
Depends what your data and application are, more than any external
factor.


I cannot speak about the kind of data I have to protect on a public ML
but data are confidential and I have to propose something to guaranty
a vulnerability of the application doesn't expose all the data to the
cracker.


I'd also consider curl before FTP, personally, as it is more flexible
if you decide later to use something other than the FTP protocol.


You are right.


>> It depends more on what you are trying to secure, and why, than it
>> does on any sort of general principle, really...  And just personal
>> preference on how to do this sort of thing... And your performance
>> needs are a big factor, sometimes.
>
> Security is the major point (before performances).

It's not that simple...

Would you be happy with a web server that requires a human to review
each HTTP request and sign off a form in triplicate before the HTTP
response went out?


:) that's an idea.
I maybe should add in the requirement that the service should be usable :)

Note: I don't mandate the service to be easy to use though. I fully
accept constraints to access to the data if it's worth it.


> The mains goal is to be still protected if their is an element under
> attack on the application server, for instance a vulnerability in
> apache (or even php according to the March month ;).

What data are you protecting?


See above.
It's not just the picture of my last week-end (I don't even host images ;) !


> I want to be protected against:
> - cracker uploads a file and use a vulnerability to execute it on the
> server (I can avoid it with a partition mounted without exec rights or
> with another server that hosts the files).

Sure.

Or you could just put them outside the webtree and not write stupid
PHP code that lets them get executed.


An attacker can use a vulnerability of either apache or php to gain
apache user rights and make files executable and even run it (or run
it with another vulnerability in another application required on the
server).


And you could check the upload files for validity, to insure that they
meet certain criteria of non-executable files in the first place.


Unfortunately, I cannot restrict the file type I accept. I would say
that one of the goal of the application is to delivery binaries
(executable).


> - cracker uses a vulnerability and obtains the same rights than the
> web server (due to mod_php) she will be able to access to all the
> files (at least in read mode) because the user who runs apache have to
> be able to read them.

Is this on a shared server?


No it's not.
We are talking about a dedicated box in a DMZ with all the network
security devices tailored.


Is your PHP binary reading script dumb enough to allow them to access
the files they shouldn't be accessing?


I don't think so (code was audited) but I cannot guaranty there is no
bugs in my application.


> There are probably other things I don't imagine but I think the usage
> of another server to host data is a good approach.

I think it's a great approach, if the data being secured warrants it
and the web application is well-written.

I think it's a waste of time if the data being secured is not w

Re: [PHP] image digit to check password

2007-03-21 Thread Dave Goodchild

Om

On 3/20/07, Jochem Maas <[EMAIL PROTECTED]> wrote:


Tijnema ! wrote:
> On 3/20/07, Dave Goodchild <[EMAIL PROTECTED]> wrote:
>> Have a look at this:
>
> Have a look at nothing :)

I believe this Dave's way of pointing people to the Great Void :-)

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





--
http://www.web-buddha.co.uk


Re: [PHP] Sockets problem

2007-03-21 Thread Adrian Gheorghe

Thanks for the answer.
In the meantime I've managed to solve the problem be removing the
pcntl_wait call. Actually I think this is a bug, because as I
understand things pcntl_wait shouldn't block the main process, but I
don't have experience with either sockets or Unix process, so I might
be wrong.

On 3/21/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Tue, March 20, 2007 8:27 am, Adrian Gheorghe wrote:
> I've sent a bug report earlier and it got marked as bogus, so I
> decided to ask here about a possible solution. You can see the bug
> report at http://bugs.php.net/bug.php?id=40864

Looks like a pretty cogent bug report to me...

Perhaps Tony would like to see the same script in non-fork
single-connection mode on the same server, to prove that the
ports/firewalls/etc are not at fault.

Or, perhaps, there's something inherently wrong with that script...

I'd also suggest taking out the 'fork' business and just opening up
two sockets in two scripts, to remove the pcntl (possible) red herring
-- boil it down to absolute minimum.

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




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



[PHP] Re: Reuse PHP functions in a third-party application

2007-03-21 Thread Mikey

Robert Enyedi wrote:
I'm not very familiar with the internal architecture of the Zend PHP 
engine nor with the PHP module mechanism, but can you reuse compiled PHP 
modules in other applications?


Is there a way of calling the functions of a compiled module from a 
third party C application?


Thanks,
Robert


Compiled PHP modules could be loaded by any C program (as with any C 
shared object) but there would be a large number of hoops you would have 
to jump through before you would be able to make any function calls. 
However, is the module you wish to use something that is available 
exclusively to PHP?  Most modules are wrappers around existing C 
libraries and as such it would be much easier to just use the base 
library rather than trying to emulate a SAPI to load a PHP module.


If you still want to go down this path, then reading the manual section 
about creating PHP modules will give you an insight into how this 
process works.


Mikey

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



Re: [PHP] Reuse PHP functions in a third-party application

2007-03-21 Thread Robert Enyedi

Richard,

Thanks for the info. Under these circumstances I suppose that the CGI 
calling mode is the best suited.


On the other hand this option might raise some performance penalty. I 
wonder if better performance could be achieved if I would use a socket 
based call interface to my module running inside the running PHP server.


Regards,
Robert

Richard Lynch wrote:

On Tue, March 20, 2007 5:27 am, Robert Enyedi wrote:

I'm not very familiar with the internal architecture of the Zend PHP
engine nor with the PHP module mechanism, but can you reuse compiled
PHP
modules in other applications?

Is there a way of calling the functions of a compiled module from a
third party C application?


Probably not...

I suppose that Prioblender thingie or one of the compilers might be
able to be hacked with a PHP CLI binary to kind of do that, but a base
PHP install doesn't ever actually store the opcodes anywhere in a
compiled form as you are imagining.

Even the various Caches only store opcode, and not machine
code/binaries, so you still need the Zend Engine to rip through and
execute them somewhere somehow, I think.

Of course, you could use PHP to provide REST, SOAP, WebDAV, etc



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



Re: [PHP] Re: PHP DOM saveHTML outputs entities

2007-03-21 Thread Tijnema !

On 3/21/07, Eli <[EMAIL PROTECTED]> wrote:

> What about html_entity_decode?
> http://www.php.net/html_entity_decode

No. It doesn't help in this case.

DOMDocument->saveHTML() method converts any non-ascii characters into
entities.
For example, if the dom document has the text node value of:
   שלום
It converts the string to entities:
   שלום
Although the string is already in UTF-8. The DOMDocument is already
initialized with version "1.0" and encoding "UTF-8", the php file is in
UTF-8, the xml file is in UTF-8 and got  header.

Example:
loadXML("שלום");
$output = $dom->saveHTML();
header("Content-Type: text/html; charset=UTF-8");
echo $output;
?>

-thanks


Did you set the UTF8 format in the html_entity_decode function?
so your code would become:
loadXML("שלום");
$output = $dom->saveHTML();
header("Content-Type: text/html; charset=UTF-8");
echo html_entity_decode($output,ENT_QUOTES,"UTF-8");
?>

I'm not really sure about it, but i'm not using UTF8. Also have a look
at the comments under the html_entity_decode function, and at the
functions/comments of utf8_encode/utf8_decode.

Tijnema


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




Re: [PHP] _Construct question

2007-03-21 Thread Tijnema !

On 3/21/07, Chris <[EMAIL PROTECTED]> wrote:

John Comerford wrote:
> Hi Folks,
>
> I am still pretty new to PHP and I have a question regarding classes and
> using _construct.  Up until now I have been creating my classes as follows:
>
> class test1 {
> var $name;
> function test1($pName) {
>   $this->name = $pName;
> }
> }
>
> So I when I create a new class I can assign 'name' by doing '$t1 = new
> test1("test1");'
>
> As part of another thread I noticed the _construct function which (if I
> am correct) does more or less the same thing:
>
> class test2 {
> var $name;
> function _construct($pName) {
>   $this->name = $pName;
> }
> }

It's __construct (double underscore).

PHP5 uses __construct

PHP4 uses the class name.

To support both:

class test {
  // php5 calls this
  function __construct()
  {
   echo 'do stuff here';
  }

  // php4 calls this
  function test()
  {
$this->__construct();
  }
}

:D


To support both, i wouldn't even think about the PHP5 __Construct. I
would just do it like this:

class test {
  function test()
  {
   echo 'do stuff here';
  }
}


Tijnema


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

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




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



[PHP] Re: PHP DOM saveHTML outputs entities

2007-03-21 Thread Eli

What about html_entity_decode?
http://www.php.net/html_entity_decode 


No. It doesn't help in this case.

DOMDocument->saveHTML() method converts any non-ascii characters into 
entities.

For example, if the dom document has the text node value of:
שלום
It converts the string to entities:
שלום
Although the string is already in UTF-8. The DOMDocument is already 
initialized with version "1.0" and encoding "UTF-8", the php file is in 
UTF-8, the xml file is in UTF-8 and got encoding="UTF-8"?> header.


Example:
loadXML("שלום");
$output = $dom->saveHTML();
header("Content-Type: text/html; charset=UTF-8");
echo $output;
?>

-thanks

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



Re: [PHP] Name Capitalization

2007-03-21 Thread Tijnema !

On 3/21/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Tue, March 20, 2007 8:41 am, Tijnema ! wrote:
> What's against just capitalizing the first letter?
>
> Of course there exists a lot of different combinations where a capital
> letter should be, but if names are coming in like MCDONALD or
> mcdonald, a user would be happy if he sees Mcdonald.

You have clearly never ever dealt with musicians. :-)

They will not just accept the wrong capitalization.

You will need to fix it.

I'll hazard a wild guess somebody will complain about the uc_first
solution, and for every complaint, you can count on 10 more who just
shrugged it off, but it's still wrong.


Well, then you are working for hours on implementing filters for
special names, and then you still get a few names wrong... and then
you did all that work for a few fixes. It's just not worth to create
such filter.

Tijnema


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




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