Current location: Hot Scripts Forums » Programming Languages » PHP » Only add if not found...

Only add if not found...

 
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-01-09, 05:21 PM
peuplarchie's Avatar
peuplarchie peuplarchie is offline
Newbie Coder
 
Join Date: Nov 2008
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Post Only add if not found...

Good day to you all,
My code is looking for user name in a file, if match found, do nothing, if no match found, add to list.

Right now, it add anyway !

PHP Code:


$activeadmlist 
"user_list.txt";
$pos strpos($activeadmlist$_SESSION['username']);

if (
$pos === false) {

$output$_SESSION['username']."\n";
$newfile="user_list.txt";
$file fopen ($newfile"a");
fwrite($file$output);
fclose ($file); 


} else {
    


Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Multi script PayPal add to cart order form Tito1 JavaScript 5 02-23-09 05:21 AM
Read from file, add to list Saturn Job Offers & Assistance 10 02-08-09 11:00 PM
Add another two fields blinn_shade JavaScript 1 10-15-07 11:35 PM
Assembler Coding downsouth The Lounge 1 12-18-06 03:58 AM
Alter Table Help DDRcasey PHP 0 06-14-05 01:08 AM


All times are GMT -5. The time now is 10:12 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.