Re: [PHP] Comparing strings (revisited)

2009-05-27 Thread Clancy
On Mon, 25 May 2009 02:11:24 -0400, pa...@quillandmouse.com (Paul M Foster) wrote: . This is why I originated a thread along these lines some time ago. I sympathize with your pain, being a C programmer as well. Apparently, PHP plays fast and loose with types when doing == comparisons.

Re: [PHP] Comparing strings (revisited)

2009-05-25 Thread Paul M Foster
On Mon, May 25, 2009 at 12:46:16PM +1000, Clancy wrote: For some time I have been working on a text based database, in which each entry contains one or more lines of data, with the various fields delimited by semicolons, e.g. A;b;20GM;Restaurant;090508 n;;;Arintji;; a;Federation

[PHP] Comparing strings (revisited)

2009-05-24 Thread Clancy
For some time I have been working on a text based database, in which each entry contains one or more lines of data, with the various fields delimited by semicolons, e.g. A;b;20GM;Restaurant;090508 n;;;Arintji;; a;Federation Square;;; p;9663 9900;;;9663 9901;;i...@arintji.com.au; All was

Re: [PHP] Comparing strings (revisited)

2009-05-24 Thread Eddie Drapkin
With the initial explode, I may be wrong but I don't think it's possible to force every entry to be string-typed. However, this little snippet could help: $foo = explode(';', $db); foreach($foo as $bar) { $bar = settype($bar, 'string); } which will set each element's type to string, but is

Re: [PHP] Comparing strings... need advice. :)

2006-08-29 Thread Ivo F.A.C. Fokkema
On Mon, 28 Aug 2006 19:39:49 -0400, Robert Cummings wrote: On Mon, 2006-08-28 at 16:50 +0200, Ivo F.A.C. Fokkema wrote: On Mon, 28 Aug 2006 09:47:02 +0100, Stut wrote: Micky Hulse wrote: I am looking for the most secure/efficient way to compare these two strings:

Re: [PHP] Comparing strings... need advice. :)

2006-08-29 Thread Micky Hulse
Ivo F.A.C. Fokkema wrote: Ah, thanks. Misunderstood the question, then. Thought just checking if it's a file in that directory was what's needed. You were right. :) I did not plan on looking-in anything other than one or two hard-coded folder locations. But, it is good to know the details.

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Stut
Micky Hulse wrote: I am looking for the most secure/efficient way to compare these two strings: /folder1/folder2/folder3/folder4/ /folder1/folder2/folder3/folder4/file.php Basically I am trying to setup as many security features as possible for a simplistic (home-grown/hand-coded) CMS...

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Micky Hulse
Stut wrote: First of all make sure you are sending both strings through realpath (http://php.net/realpath) to remove any symbolic links and relative references. Then you can compare the two strings. The way you're doing it will work but it's probably not very efficient. This is what I use...

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread David Tulloh
Micky Hulse wrote: Hi, I am looking for the most secure/efficient way to compare these two strings: /folder1/folder2/folder3/folder4/ /folder1/folder2/folder3/folder4/file.php Basically I am trying to setup as many security features as possible for a simplistic (home-grown/hand-coded)

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Ivo F.A.C. Fokkema
On Mon, 28 Aug 2006 09:47:02 +0100, Stut wrote: Micky Hulse wrote: I am looking for the most secure/efficient way to compare these two strings: /folder1/folder2/folder3/folder4/ /folder1/folder2/folder3/folder4/file.php Basically I am trying to setup as many security features as

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Robert Cummings
On Mon, 2006-08-28 at 09:47 +0100, Stut wrote: Micky Hulse wrote: I am looking for the most secure/efficient way to compare these two strings: /folder1/folder2/folder3/folder4/ /folder1/folder2/folder3/folder4/file.php Basically I am trying to setup as many security features as

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Micky Hulse
Wow, thanks for all the great information folks (Stut, Ivo, Rob, and David.) I really appreciate all of the top-notch advice and expert information. :D Looks like I have a lot to think about... Currently, I hard-code the paths to the folders that house the files I want my CMS to edit (via a

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Robert Cummings
On Mon, 2006-08-28 at 16:50 +0200, Ivo F.A.C. Fokkema wrote: On Mon, 28 Aug 2006 09:47:02 +0100, Stut wrote: Micky Hulse wrote: I am looking for the most secure/efficient way to compare these two strings: /folder1/folder2/folder3/folder4/ /folder1/folder2/folder3/folder4/file.php

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Robert Cummings
On Mon, 2006-08-28 at 16:28 -0700, Micky Hulse wrote: Wow, thanks for all the great information folks (Stut, Ivo, Rob, and David.) I really appreciate all of the top-notch advice and expert information. :D Looks like I have a lot to think about... Currently, I hard-code the paths to the

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Micky Hulse
Hi Robert, Robert Cummings wrote: How are these saved files then imported into the content? Are they included or do you retrieve the contents using something like file(), file_get_contents(), or fread() and then echo it? If you are using Currently I am using readfile() (plus some other

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Robert Cummings
On Mon, 2006-08-28 at 17:07 -0700, Micky Hulse wrote: Hi Robert, Robert Cummings wrote: How are these saved files then imported into the content? Are they included or do you retrieve the contents using something like file(), file_get_contents(), or fread() and then echo it? If you are

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Micky Hulse
Robert Cummings wrote: Readfile works great, it's the same as file_get_contents() and then Ah, good to hear. :D issuing an echo. You may want to also stored content generated by web users outside of the web tree. There may not be any issue with how you [...] with PHP tags and accesses it

[PHP] Comparing strings... need advice. :)

2006-08-27 Thread Micky Hulse
Hi, I am looking for the most secure/efficient way to compare these two strings: /folder1/folder2/folder3/folder4/ /folder1/folder2/folder3/folder4/file.php Basically I am trying to setup as many security features as possible for a simplistic (home-grown/hand-coded) CMS... This appears to

[PHP] Comparing Strings

2006-07-24 Thread Nils Holland
Hi folks, well, I have a really dumb question: I have the following script at http://www.tisys.org/misc/test.php: ?php echo $_GET['license']; ? Now I call it like this: http://www.tisys.org/misc/test.php? license=0701770160811371731660412452242420381052542100071831272071031621

[PHP] comparing strings - again!

2006-06-20 Thread Ross
if (isset($_POST['Submit'])) { //echo post equals.$_POST['x']. corect is.$correct_answers[$page-1]; $compare1 = $_POST['x']; echo page is.$page; $compare2 = $correct_answers[($page-1)]; echo compare1 is .$compare1; echo BR; echo compare2 is .$compare2; if (strcmp($compare1, $compare2) == 0) {

[PHP] comparing strings does not work

2002-06-11 Thread andy
Hi there, I would like to compare 2 strings. I do always get a 0 return (not equal) but they are difinatelly equal, I double checked it. They are just in two different vars. Here is how I did it: if (strcmp($city, $city_new) != 0) $error = true; Does anybody see the error? Or am I going

RE: [PHP] comparing strings does not work

2002-06-11 Thread Jonathan Rosenberg
strcmp returns 0 if the two strings are equal. In any case, why not just do if ($city == $city_new) $error = true; -Original Message- From: andy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 9:10 AM To: [EMAIL PROTECTED] Subject: [PHP] comparing strings does

[PHP] Comparing strings

2001-11-01 Thread phantom
Bear with me, new to PHP and got a beginner's questions How do I run an if statement and the if statement compares a String? IN ASP (yes I Know, ASP is evil) I would have wrote if (String(Request(Action))==Submit) do this In PHP I have tried if ($Action == Submit) but I get a parse

Re: [PHP] Comparing strings

2001-11-01 Thread Michael Egan
I feel fairly new to this as well but I think that, whilst your logic is right, the syntax may be a little off. if ($action == textstring) { echo true; } else { echo false; } Above should show how the syntax will rok. Good luck Michael phantom wrote: Bear with me, new to PHP and got a