PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 1st, 2009, 01:06 PM
peuplarchie's Avatar
peuplarchie peuplarchie is offline
Free the knowledge !
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Posts: 283 peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 14 h 47 m 9 sec
Reputation Power: 35
Post Match $var in text file ?

Good day to you all,
stupid as it sound, all the thing that I have tried to match a variable into a text file and execute according to it result.


PHP Code:
 $active "user_list.txt";
$pos strpos($active$_SESSION['username']);
if (
$pos === false) {
echo 
"<b id=\"userinfo\"><img src=\"enligne.png\" valign=\"bottom\" width=\"13px\"/></b>";
} else {
echo 
"<b id=\"userinfo\"><img src=\"horsligne.png\" valign=\"bottom\" width=\"13px\"/></b>";



Thanks !
__________________
That's why we are not alone on earth, to help each other !
Let's build !

Reply With Quote
  #2  
Old July 1st, 2009, 01:07 PM
simshaun's Avatar
simshaun simshaun is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2008
Location: North Carolina
Posts: 2,674 simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)  Folding Points: 57335 Folding Title: Beginner FolderFolding Points: 57335 Folding Title: Beginner FolderFolding Points: 57335 Folding Title: Beginner Folder
Time spent in forums: 4 Weeks 1 Day 20 h 5 m 45 sec
Reputation Power: 2671
You need to get the text file's contents first using file_get_contents or fopen.

Assuming the usernames are delimited, you should explode the contents and use in_array() instead of strpos.

Reply With Quote
  #3  
Old July 1st, 2009, 01:22 PM
peuplarchie's Avatar
peuplarchie peuplarchie is offline
Free the knowledge !
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Posts: 283 peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 14 h 47 m 9 sec
Reputation Power: 35
Thanks, I knew it was a stupid thing I was not seeing cause of the level of sleep I had last night !

Reply With Quote
  #4  
Old July 1st, 2009, 03:02 PM
peuplarchie's Avatar
peuplarchie peuplarchie is offline
Free the knowledge !
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Posts: 283 peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level)peuplarchie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 14 h 47 m 9 sec
Reputation Power: 35
can I delete it too ?

Reply With Quote
  #5  
Old July 1st, 2009, 03:06 PM
simshaun's Avatar
simshaun simshaun is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2008
Location: North Carolina
Posts: 2,674 simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)simshaun User rank is General 25th Grade (Above 100000 Reputation Level)  Folding Points: 57335 Folding Title: Beginner FolderFolding Points: 57335 Folding Title: Beginner FolderFolding Points: 57335 Folding Title: Beginner Folder
Time spent in forums: 4 Weeks 1 Day 20 h 5 m 45 sec
Reputation Power: 2671
Delete the specific username or the entire file? You can do both.

Delete file: unlink()
Delete username from file: unset it from the array, implode the array, and file_put_contents() or fwrite().

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Match $var in text file ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap