SunQuest
 
           Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 28th, 2003, 12:17 AM
kiruba kiruba is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 kiruba User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question php

how can i change or update the content of the text file.

Reply With Quote
  #2  
Old January 28th, 2003, 12:56 AM
limnil limnil is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Lithuania
Posts: 20 limnil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

Write to file:

$fwr = fopen ("file.txt", "w+");
fwrite ($fwr, "to lazy to read manuals");
fclose ($fwr);

Read from file:

$frd = fopen ("file.txt", "r");
$bytes = 4;
$buffer = fread($frd, $bytes);
fclose ($frd);
print $buffer //your output will be the first 4 bytes of file.txt file

Reply With Quote
  #3  
Old January 28th, 2003, 01:49 AM
kiruba kiruba is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 kiruba User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php

i am familiar with the reading and writing of files.i just want to change a particular field in the file.for example i need to change or replace the old password with the new one.thank u....

Reply With Quote
  #4  
Old January 28th, 2003, 02:25 AM
limnil limnil is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Lithuania
Posts: 20 limnil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb

i think it'll be difficult to do it.
for e.g if you have pass in your file u must know where it is, and he must be there always, and if u want to replace it whit another, the pass must contain the same character lenght, ofcourse u can specify that the pass variable must hold all the line and then u can replace this line, this will make your problem easier. But if u want do to some pass, login areas or hold some interesting data i'm offering u do to this whit mysql.

Reply With Quote
  #5  
Old January 30th, 2003, 03:01 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
It would be much easier if you stored this information in a database.. that way you could just use the UPDATE option in a sql query to update that one field..

Reply With Quote
  #6  
Old January 31st, 2003, 01:16 AM
vlasblom vlasblom is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Netherlands
Posts: 14 vlasblom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 45 sec
Reputation Power: 0
Exclamation

It is possible to store such information, like passwords, in a text file, but the file must have a format (e.g. CSV or INI) that can be parsed, so you can identify the password field.

- Simple read the file.
- (Parse the contents.)
- Identify the required password field.
- Update the field contents.
- Write back the file.

If you prefer, or just for security, you could write a backup of your file first.

Using a CSV format could be an alternative for a users table in a SQL-database, when this is the only information you want to store or you're working on an environment where no database engine is available or possible.

Having this in mind, even the '.htaccess' file can be used for this purpose. It is in a parseable format, so it can be analysed and updated.
Make sure you write the password in the proper encrypted format.

Give it a try and have fun,

Last edited by vlasblom : January 31st, 2003 at 01:52 AM.

Reply With Quote
  #7  
Old February 1st, 2003, 01:55 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Re: php

Quote:
Originally posted by kiruba
how can i change or update the content of the text file.


Kiruba,

Please read the forum rules before posting a topic. Your title is insufficient. Please use descriptive titles.

Rules: http://www.devarticles.com/forum/an...p?s=&forumid=11
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > php


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway