|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
how can i change or update the content of the text file.
|
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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....
![]() |
|
#4
|
|||
|
|||
|
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. ![]() |
|
#5
|
||||
|
||||
|
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..
|
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
Re: php
Quote:
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 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|