Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
search for text in variable then appending to it
Old 11-17-2005, 07:03 PM search for text in variable then appending to it
Village Idiot's Avatar
Webmaster Talker

Posts: 535
Trades: 0
how do I search for text in a variable? I am making a poll script that records your IP for one vote per person reasons. what I need to do is check for their IP in the string that I have it stored in, then if they have no voted I need to append their IP to the list. what would be the functions for these?
__________________
I have the heart of a child, I keep it in a jar on my desk.
Village Idiot is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-17-2005, 08:15 PM
Nahele's Avatar
Extreme Talker

Posts: 204
Trades: 1
How will you be storing each ip? It sounds like you want to store all addresses in one long string like this:

192.168.32.1;255.136.54.128;...

If that's the case then you will need something like this: (assuming you seperate each address by a semicolon

PHP Code:
function test_ip (&$addresses$address_check) {
//$addresses in form 192.168.32.1;255.136.54.128;
//$address_check in form 192.168.32.1

if (substr_count ($addresses$address_check) == 0) {
 
$addresses $addresses $address_check ";"
 
return false;
}
else {
  return 
true;
}

Nahele is offline
Reply With Quote
View Public Profile
 
Old 11-17-2005, 08:22 PM
Village Idiot's Avatar
Webmaster Talker

Posts: 535
Trades: 0
great minds think alike, that is the method I was going to use. thanks.
__________________
I have the heart of a child, I keep it in a jar on my desk.
Village Idiot is offline
Reply With Quote
View Public Profile
 
Old 11-18-2005, 12:04 AM
Nahele's Avatar
Extreme Talker

Posts: 204
Trades: 1
No problem, that was a new function for me as well that I'm sure will come in handy down the road...but just to let you know this function is only in php v4 and on...through I don't think that should be a problem for anybody anymore.
Nahele is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to search for text in variable then appending to it
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19920 seconds with 12 queries