Re: [PHP] Matching

2009-01-31 Thread Ashley Sheridan
On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:
 On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org 
 wrote:
  How do I determine the value oftx   from this string?
 
 
  page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
 
  My desired answer is: 8UM53005HH344951T
 
  I am trying to capture the serial number which follows tx= and ends
  immediately before the 
 
  Ron
 
 
 http://us.php.net/parse_str
 
 -- 
 http://www.voom.me | EFnet: #voom
 
Go regular expressions...

/tx=([^\]+)/

then do a preg_match with the string using the $matches array argument.
$matches[1] should be your value.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Matching

2009-01-31 Thread Eric Butera
On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:
 On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org 
 wrote:
  How do I determine the value oftx   from this string?
 
 
  page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
 
  My desired answer is: 8UM53005HH344951T
 
  I am trying to capture the serial number which follows tx= and ends
  immediately before the 
 
  Ron
 

 http://us.php.net/parse_str

 --
 http://www.voom.me | EFnet: #voom

 Go regular expressions...

 /tx=([^\]+)/

 then do a preg_match with the string using the $matches array argument.
 $matches[1] should be your value.


 Ash
 www.ashleysheridan.co.uk



There really isn't a need to even try to build something like that
when something already exists exactly for the purpose.  It's well
documented too.  Plus after this part works, there's probably a good
chance we'd be looking for that second variable. =)

-- 
http://www.voom.me | EFnet: #voom

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



Re: [PHP] Matching

2009-01-31 Thread Ashley Sheridan
On Sat, 2009-01-31 at 08:38 -0500, Eric Butera wrote:
 On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:
  On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org 
  wrote:
   How do I determine the value oftx   from this string?
  
  
   page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
  
   My desired answer is: 8UM53005HH344951T
  
   I am trying to capture the serial number which follows tx= and ends
   immediately before the 
  
   Ron
  
 
  http://us.php.net/parse_str
 
  --
  http://www.voom.me | EFnet: #voom
 
  Go regular expressions...
 
  /tx=([^\]+)/
 
  then do a preg_match with the string using the $matches array argument.
  $matches[1] should be your value.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
 
 There really isn't a need to even try to build something like that
 when something already exists exactly for the purpose.  It's well
 documented too.  Plus after this part works, there's probably a good
 chance we'd be looking for that second variable. =)
 
 -- 
 http://www.voom.me | EFnet: #voom
 
But isn't what you suggest to use only available in PHP5? When possible,
I try to build for PHP4, as my own hosting, and others I've seen only
support 4, and the old answer of find a better hosting is not always a
good solution.

Besides, if you need the second part of the URL, just adapt the regular
expression a bit. I don't why people seem so afraid of them to be
honest.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Matching

2009-01-31 Thread Eric Butera
On Sat, Jan 31, 2009 at 9:33 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 On Sat, 2009-01-31 at 08:38 -0500, Eric Butera wrote:
 On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:
  On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org 
  wrote:
   How do I determine the value oftx   from this string?
  
  
   page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
  
   My desired answer is: 8UM53005HH344951T
  
   I am trying to capture the serial number which follows tx= and ends
   immediately before the 
  
   Ron
  
 
  http://us.php.net/parse_str
 
  --
  http://www.voom.me | EFnet: #voom
 
  Go regular expressions...
 
  /tx=([^\]+)/
 
  then do a preg_match with the string using the $matches array argument.
  $matches[1] should be your value.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 

 There really isn't a need to even try to build something like that
 when something already exists exactly for the purpose.  It's well
 documented too.  Plus after this part works, there's probably a good
 chance we'd be looking for that second variable. =)

 --
 http://www.voom.me | EFnet: #voom

 But isn't what you suggest to use only available in PHP5? When possible,
 I try to build for PHP4, as my own hosting, and others I've seen only
 support 4, and the old answer of find a better hosting is not always a
 good solution.

 Besides, if you need the second part of the URL, just adapt the regular
 expression a bit. I don't why people seem so afraid of them to be
 honest.


 Ash
 www.ashleysheridan.co.uk




parse_str

(PHP 4, PHP 5)

parse_str — Parses the string into variables


-- 
http://www.voom.me | EFnet: #voom

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



Re: [PHP] Matching

2009-01-31 Thread Nathan Rixham

Eric Butera wrote:

On Sat, Jan 31, 2009 at 9:33 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

On Sat, 2009-01-31 at 08:38 -0500, Eric Butera wrote:

On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:

On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org wrote:

How do I determine the value oftx   from this string?


page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01

My desired answer is: 8UM53005HH344951T

I am trying to capture the serial number which follows tx= and ends
immediately before the 

Ron


http://us.php.net/parse_str

--
http://www.voom.me | EFnet: #voom


Go regular expressions...

/tx=([^\]+)/

then do a preg_match with the string using the $matches array argument.
$matches[1] should be your value.


Ash
www.ashleysheridan.co.uk



There really isn't a need to even try to build something like that
when something already exists exactly for the purpose.  It's well
documented too.  Plus after this part works, there's probably a good
chance we'd be looking for that second variable. =)

--
http://www.voom.me | EFnet: #voom


But isn't what you suggest to use only available in PHP5? When possible,
I try to build for PHP4, as my own hosting, and others I've seen only
support 4, and the old answer of find a better hosting is not always a
good solution.

Besides, if you need the second part of the URL, just adapt the regular
expression a bit. I don't why people seem so afraid of them to be
honest.


Ash
www.ashleysheridan.co.uk





parse_str

(PHP 4, PHP 5)

parse_str — Parses the string into variables




lol - it's obviously an url guys..

http://php.net/parse_url
and
http://php.net/parse_str

$s = 'your/url/?with=parrams';
$parts = parse_url($s);
$arrayOfQueryParams = parse_str($parts['query']);
$theBitYouWant = $arrayOfQueryParams['tx'];
// output the bit you want
echo $theBitYouWant . PHP_EOL;
// output all the params
print_r($arrayOfQueryParams);

regards

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



Re: [PHP] Matching

2009-01-30 Thread Eric Butera
On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org wrote:
 How do I determine the value oftx   from this string?


 page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01

 My desired answer is: 8UM53005HH344951T

 I am trying to capture the serial number which follows tx= and ends
 immediately before the 

 Ron


http://us.php.net/parse_str

-- 
http://www.voom.me | EFnet: #voom

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



RE: [PHP] Matching

2009-01-30 Thread David Swenson
How do I determine the value of tx from this string?


page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01

My desired answer is: 8UM53005HH344951T

I am trying to capture the serial number which follows tx= and ends
immediately before the 

Ron

I'm sure Eric gave you the answer you needed if your parsing the string
in a page.

However,  if your pulling this as a URL redirect you can use the GET
global variable tx...

IE:
$tx = $_GET['tx'];
echo $tx;
//8UM53005HH344951T (printed to browser)

HTH  :)
David




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



Re: [PHP] Matching logins to an old htpasswd file

2007-03-03 Thread Holger Blasum
Hello Ryan,

On 03-03, Ryan A wrote:
 test:dGRkPurkuWmW2 (test:test)
 test1:dGlAW3zdxeAG2 (test1:test1)

$php -r print crypt('test',base64_encode('test'));;
- dGRkPurkuWmW2
$php -r print crypt('test1',base64_encode('test1'));;
- dGlAW3zdxeAG2

So compare the password string with the output of crypt with
the password as its key and salt argument.
(References: http://www.htaccesstools.com/forum/index.php/t/25/ ,
crypt(3) man page)

Remark: Asking users to send their login password via an
unencrypted webpage only should be done within secure networks.
(Anyone can sniff HTTP, use HTTPS otherwise.)

HTH,

-- 
Holger Blasum +49-174-7313590 (cell) GnuPG 1024D/ACDFC3B769DC1ED66B47

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



Re: [PHP] Matching numbers 1-100

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 11:09 am, Wikus Moller wrote:
 I want to know if anyone can help me with my code which matches a
 number to a range e.g. 1-15 and echoes an image if the number is in
 the range.

 The code would use the if statement and check if a variable for
 example 5  matches the range like 4-10 and if it does it echoes a
 certain image.

 Anyone know which function I should use and what regex I should use?

This sounds a heck of a lot like a homework assignment...

Oh well.

?php
$input = '42';
$number = (int) $input; //make sure it's a number
if ($number = 1 and $number = 15) echo an image;

This will be problematic if you need to detect '0', since 'a' turns
into '0' in the typecast.  In that case, you'd want
http://php.net/pcre


-- 
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] Matching numbers 1-100

2007-02-03 Thread tedd

At 5:09 PM + 2/3/07, Wikus Moller wrote:

Hi.

I want to know if anyone can help me with my code which matches a
number to a range e.g. 1-15 and echoes an image if the number is in
the range.

The code would use the if statement and check if a variable for
example 5  matches the range like 4-10 and if it does it echoes a
certain image.

Anyone know which function I should use and what regex I should use?

Thanks


Hi:

Wasn't this same question just asked by Chilling Lounge Admin?

It does seem that similar questions rise at similar times, must be sun spots.

In any event, its the same answer -- use a switch.

http://us2.php.net/switch

hth's

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

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



Re: [PHP] Matching Number of Times a Word Occurs...

2005-04-19 Thread Matthew Fonda
Hello,
http://us4.php.net/substr_count
Regards,
Matthew Fonda
Russell P Jones wrote:
Im trying to count the number of times a word occurs in a string - is the
only way to do this preg_match_all?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Matching Number of Times a Word Occurs...

2005-04-19 Thread Prathaban Mookiah
substr_count() should be more easy, but limited in functionality.

Prathap

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



Re: [PHP] Matching *exact* string?

2004-10-31 Thread Klaus Reimer
Nick Wilson wrote:
How can I alter the above so that only *exact* matches are banned?
Using ^ and $ to mark the begin and end of the line. So try this
/^$ip\$/
--
Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18)
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger [EMAIL PROTECTED] to get public key)


signature.asc
Description: OpenPGP digital signature


RE: [PHP] matching search terms

2004-09-13 Thread Jay Blanchard
[snip]
I am hoping that there is some internet resource 
[/snip]

Which begs the question, have you STFW?

http://www.google.com/search?q=search+functionhl=enlr=ie=UTF-8start=
10sa=N

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



Re: [PHP] matching certain values

2003-09-18 Thread Jason Wong
On Thursday 18 September 2003 15:55, Louie Miranda wrote:
 Im trying to match some words on the value that i have impost on php.
 But i dont know why it doesnt seem to catch some certain fields.

 if ($HTTP_USER_AGENT === 'MSIE ')

 I know something is wrong :(

Did you *try* finding out what is wrong?

Simple things like 

  echo $HTTP_USER_AGENT 

to see what it really contains?

And if you're only matching part of a string you should be using things like 
strpos() or preg_match() etc.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A straw vote only shows which way the hot air blows.
-- O'Henry
*/

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



Re: [PHP] matching certain values

2003-09-18 Thread Louie Miranda
thanks for the reference. strpos will be good for my problem.


- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 4:11 PM
Subject: Re: [PHP] matching certain values


 On Thursday 18 September 2003 15:55, Louie Miranda wrote:
  Im trying to match some words on the value that i have impost on php.
  But i dont know why it doesnt seem to catch some certain fields.
 
  if ($HTTP_USER_AGENT === 'MSIE ')
 
  I know something is wrong :(

 Did you *try* finding out what is wrong?

 Simple things like

   echo $HTTP_USER_AGENT

 to see what it really contains?

 And if you're only matching part of a string you should be using things
like
 strpos() or preg_match() etc.

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 A straw vote only shows which way the hot air blows.
 -- O'Henry
 */

 --
 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] matching two form fields function?

2002-05-23 Thread Kevin Stone

Tis a tad easier than that.

function match_str($str1, $str2)
{
if ($str1 == $str2)
return true;
else
return false;
}

// If the fields don't match exit with error.
if (!match_str($field1, $field2))
{
echo The fields must match.;
exit;
}

-Kevin

- Original Message -
From: Jeff Field [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 23, 2002 2:09 PM
Subject: [PHP] matching two form fields function?


 I feel bad about asking a question like this, but I've spent quite a bit
of
 time trying to track down what should be a simple answer and, no luck.
 Anyway...

 I'm trying to create a simple function that will match two form fields
 against each other, e.g. Email equals Repeat Email.  The following
 function seems to work, however, I'm a little uncomfortable because I
don't
 understand it.  Specifically, I don't understand why returning $str1 by
 itself (or $str2 by itself) makes it work.

 -
 /* checks two fields against each other to make sure they match and if
they
 don't match it throws an error message into the $err_text array */

 function CheckMatch($str1, $str2, $name)
 {
 global $err_text;
 $match = ($str1 == $str2);
 if ($match != true)
 {
 $err_text[] = $name must match.;
 }
 return $str1;
 }
 -

 Any help is appreciated!  Thanks!

 Jeff


 --
 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] matching two form fields function?

2002-05-23 Thread Dennis Moore

Also make sure you trim() the input variables before your comparison...
2cents...

/dkm

- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 23, 2002 4:30 PM
Subject: Re: [PHP] matching two form fields function?


 Tis a tad easier than that.

 function match_str($str1, $str2)
 {
 if ($str1 == $str2)
 return true;
 else
 return false;
 }

 // If the fields don't match exit with error.
 if (!match_str($field1, $field2))
 {
 echo The fields must match.;
 exit;
 }



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




Re: [PHP] Matching strings in a flat/text file?

2001-10-23 Thread Pavel Jartsev

Nick Richardson wrote:
 
 ...

 Example: I want to pass a string using the URL (blah.php?car=civic_si) then
 search for ##civic_si in the text file, and print everything until it finds
 ##end.  So the text file will look like this:
 
 ##civic_si
 This is my content, blah blah
 ##end
 
 ##nissan
 This is more content... yadda yadda
 ##end
 
 ...


Try this little code snippet:

?
$filename = 'cars.data';
$car = $HTTP_GET_VARS['car'];
if ($car != '') {
 $file = file($filename);
 if (is_array($file)) {
  $read = FALSE;
  foreach ($file as $f) {
   if (!$read  ereg('^##'.$car, $f))
$read = TRUE;
   elseif ($read  ereg('^##end', $f)) {
$read = FALSE;
break;
   } elseif ($read)
$content .= $f;
  }
 }
}
echo content=$contentbr;
?


Hope this helps. :)

-- 
Pavel a.k.a. Papi

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Matching strings in a flat/text file?

2001-10-23 Thread Mark

On Mon, 22 Oct 2001 22:09:56 -0700, Nick Richardson wrote:
Hey everyone,

Anyone out there know how i could do this:

I have a client who is an import car tuner.  They would like to
feature the
cars they work on in their website.  Instead of creating a new .html
or .php
file for every car they add to include the background setup, and the
general
content (type of car, owner, etc...) i want to put the information
in to
text file and search for it in there.

So that's where i need help.  I want to be able to put the info into
a text
file and pass the string to search for through the URL, then match
everything between that line and an ending line in the text file,
and print
that out to the browser.

Example: I want to pass a string using the URL
(blah.php?car=civic_si) then
search for ##civic_si in the text file, and print everything until
it finds
##end.  So the text file will look like this:

##civic_si
This is my content, blah blah
##end

##nissan
This is more content... yadda yadda
##end

Any ideas on how i can do this???

the easiest way would be with sed:
$data=`sed -n '/##civic_si/,/##end/p' $filename`



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Matching strings in a flat/text file?

2001-10-22 Thread Jack Dempsey

lots of ideas nick, but can you use a database? MySQL is free and i've found
its almost always better to use databases when you can...
if you can't, you could do something like this:
1. find the pos of the string you need using strpos
2. find the pos of the ending delimiter
3. substr from the first pos to the end (you'll need to add/subtract some
strlen's to slice off the delimiters as well...

jack

-Original Message-
From: Nick Richardson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 23, 2001 1:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Matching strings in a flat/text file?


Hey everyone,

Anyone out there know how i could do this:

I have a client who is an import car tuner.  They would like to feature the
cars they work on in their website.  Instead of creating a new .html or .php
file for every car they add to include the background setup, and the general
content (type of car, owner, etc...) i want to put the information in to
text file and search for it in there.

So that's where i need help.  I want to be able to put the info into a text
file and pass the string to search for through the URL, then match
everything between that line and an ending line in the text file, and print
that out to the browser.

Example: I want to pass a string using the URL (blah.php?car=civic_si) then
search for ##civic_si in the text file, and print everything until it finds
##end.  So the text file will look like this:

##civic_si
This is my content, blah blah
##end

##nissan
This is more content... yadda yadda
##end

Any ideas on how i can do this???

//Nick Richardson
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Matching strings in a flat/text file?

2001-10-22 Thread Nick Richardson

Jack, thanks for the response:

I can use a database if really really needed.  The main reason for wanting
to use a flat file is for ease of update from the client's side.  They are
not technical in the least, and this will save me from having to update a
database everytime.

Although i guess i could write a front end to let them add stuff to the
database... but i'm lazy like that ;).

To do the 3 things you suggested, can you give me a code snippet to do that?

//Nick

-Original Message-
From: Jack Dempsey [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 10:20 PM
To: [EMAIL PROTECTED]; Nick Richardson
Subject: RE: [PHP] Matching strings in a flat/text file?


lots of ideas nick, but can you use a database? MySQL is free and i've found
its almost always better to use databases when you can...
if you can't, you could do something like this:
1. find the pos of the string you need using strpos
2. find the pos of the ending delimiter
3. substr from the first pos to the end (you'll need to add/subtract some
strlen's to slice off the delimiters as well...

jack

-Original Message-
From: Nick Richardson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 23, 2001 1:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Matching strings in a flat/text file?


Hey everyone,

Anyone out there know how i could do this:

I have a client who is an import car tuner.  They would like to feature the
cars they work on in their website.  Instead of creating a new .html or .php
file for every car they add to include the background setup, and the general
content (type of car, owner, etc...) i want to put the information in to
text file and search for it in there.

So that's where i need help.  I want to be able to put the info into a text
file and pass the string to search for through the URL, then match
everything between that line and an ending line in the text file, and print
that out to the browser.

Example: I want to pass a string using the URL (blah.php?car=civic_si) then
search for ##civic_si in the text file, and print everything until it finds
##end.  So the text file will look like this:

##civic_si
This is my content, blah blah
##end

##nissan
This is more content... yadda yadda
##end

Any ideas on how i can do this???

//Nick Richardson
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Matching Question

2001-08-04 Thread Mark Maggelet

On Sat, 4 Aug 2001 12:40:42 -0500, Jeff Oien ([EMAIL PROTECTED])
wrote:
After a sign up page I want to check if someone is already entered
into a database. The First Name, Last Name and Address all have
to match exactly in order for it to be considered a duplicate.
However
this isn't doing what I want. I get the Error produced if the
Address matches
but the name doesn't. Not sure what I'm doing wrong. Thanks.
Jeff Oien

you're going about this the wrong way.
try it like this:

$result=mysql_query(select * from table where first='$first' and
last='$last' and address='$address');

if(mysql_num_rows($result)){
  // error code
}

you want to keep the result sets that mysql gives back as small as
possible because they take up tons of resources.

while ($row = mysql_fetch_array($result)) {
   $First_Name = $row['First_Name'];
   $Last_Name = $row['Last_Name'];
   $Address = $row['Address'];
   
   if (($M_First_Name || $F_First_Name == $First_Name) 
   ($M_Last_Name || $F_Last_Name == $Last_Name)
($Address1 == $Address)) {
   echo 
   htmlheadtitleError/title/head
   body bgcolor=\#FF\ text=\#00\ link=\#ff\
vlink=\#660099\
   h3Error/h3
etc...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: php-list-
[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Matching Question

2001-08-04 Thread Jeff Oien

Thank you. That worked and I'm sure will have made it work a lot
faster later on when there is a lot of data in the database.
Jeff Oien

 On Sat, 4 Aug 2001 12:40:42 -0500, Jeff Oien ([EMAIL PROTECTED]) 
 wrote:
 After a sign up page I want to check if someone is already entered
 into a database. The First Name, Last Name and Address all have
 to match exactly in order for it to be considered a duplicate. 
 However
 this isn't doing what I want. I get the Error produced if the 
 Address matches 
 but the name doesn't. Not sure what I'm doing wrong. Thanks.
 Jeff Oien 
 
 you're going about this the wrong way.
 try it like this:
 
 $result=mysql_query(select * from table where first='$first' and 
 last='$last' and address='$address');
 
 if(mysql_num_rows($result)){
   // error code
 }
 
 you want to keep the result sets that mysql gives back as small as 
 possible because they take up tons of resources.
 
 while ($row = mysql_fetch_array($result)) {
  $First_Name = $row['First_Name'];
  $Last_Name = $row['Last_Name'];
  $Address = $row['Address'];
  
  if (($M_First_Name || $F_First_Name == $First_Name)  
  ($M_Last_Name || $F_Last_Name == $Last_Name) 
   ($Address1 == $Address)) {
  echo 
  htmlheadtitleError/title/head
  body bgcolor=\#FF\ text=\#00\ link=\#ff\ 
 vlink=\#660099\
  h3Error/h3
 etc...
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: php-list-
 [EMAIL PROTECTED]
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Matching Question

2001-08-04 Thread hassan el forkani

ok,
if i understand you correctly, you're taking data from a form and want to 
check that it is not already in the database, right?
then why don't you include the submitted vars in the query like this:

$sql = SELECT First_Name, Last_Name, Address FROM $table_name
WHERE (Family_Position = 'H' or Family_Position = 'S') and first_name = 
'$form_First_Name' and last_name='$form_last_name' and 
address='$form_address';
$result = @mysql_query($sql,$connection) or die( Couldn't execute query.);
$number_of_matches = mysql_num_rows($result);
if ($number_of_matches  0)
{print bla bla;
else{
//submitted info is ok and can be inserted 
}
please correct me if i missunderstood your question


regards


At 21:52 04/08/01, you wrote:
Here is the query part:

$sql = SELECT First_Name, Last_Name, Address FROM $table_name
WHERE Family_Position = 'H' or Family_Position = 'S';
//$result = @mysql_query($sql,$connection) or die( Couldn't execute query.);
if(! $result = mysql_query($sql,$connection)) {
 print(ERROR .mysql_errno().: 
 .mysql_error().br\n$sqlbr\n);
 }

 
  whta does your query look like?
 
  At 19:40 04/08/01, you wrote:
  After a sign up page I want to check if someone is already entered
  into a database. The First Name, Last Name and Address all have
  to match exactly in order for it to be considered a duplicate. However
  this isn't doing what I want. I get the Error produced if the Address 
 matches
  but the name doesn't. Not sure what I'm doing wrong. Thanks.
  Jeff Oien
  
  while ($row = mysql_fetch_array($result)) {
   $First_Name = $row['First_Name'];
   $Last_Name = $row['Last_Name'];
   $Address = $row['Address'];
  
   if (($M_First_Name || $F_First_Name == $First_Name) 
   ($M_Last_Name || $F_Last_Name == $Last_Name)
($Address1 == $Address)) {
   echo 
   htmlheadtitleError/title/head
   body bgcolor=\#FF\ text=\#00\ link=\#ff\
   vlink=\#660099\
   h3Error/h3
  etc...
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Matching irregular cases

2001-01-17 Thread jalist

(/me smacks head) thanks, completely forgot about that.

Steve

-Original Message-
From: Robert Collins [mailto:[EMAIL PROTECTED]]
Sent: 17 January 2001 15:57
To: 'jalist'; [EMAIL PROTECTED]
Subject: RE: [PHP] Matching irregular cases


Steve,

Try the ereg_replace()somthing like this:

eregi_replace($search_query, "b$search_query/b", $row[6]);


Robert W. Collins
Web Developer II
Insight / TC Computers
www.insight.com
www.tccomputers.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Matching irregular cases

2001-01-17 Thread Toby Butzon

 displayed, I want to change the search query so it stands out in the
result
 list. I'm just using...
 ereg_replace($search_query, "b$search_query/b", $row[6]);
 ...at the moment, but it wont match results where the case doesn't match.

Try eregi_replace...

php.net/eregi_replace

--Toby


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]