View Full Version : how can I edit only a certain thing in a file?
HotelUser
15-08-2007, 01:23 AM
I can't use a database though I wish I could. I have multiple accounts in a file database (a .php file) like this:
[bob]
login=bob
pass=pwhere
[frank]
login=frank
pass=duck
and I want to be able to go to a certain webpage and I want it to be able to edit this file, but not all of it just one account at a time so I go to this edit page and it shows
[frank]
login=frank
pass=duck
for example then I save it and it updates just this user in the database file. Cutenews somehow does it and I can't figure out how, if anybody could help me I would appreciate this!
Mentor
15-08-2007, 01:30 AM
it looks like an ini file lol, wouldnt it be easyer 2 use an array or somthing for php? o.0
HotelUser
15-08-2007, 02:19 AM
it looks like an ini file lol, wouldnt it be easyer 2 use an array or somthing for php? o.0
I can't change it, I made a script to add users to an ftp server which stores it in an ini file but now I want it to be able to edit these users. As well as a script for vhosts. Can it be done though?
Jackboy
15-08-2007, 08:41 AM
Ahh yes search on google..
codewalkers + php file handling and read the guide. It helped me alot
Use:
www.php.net/parse_ini_file
If you want to load the file.
HotelUser
15-08-2007, 01:20 PM
I want to be able to load a certain part of the file then be able to edit just that part then be able to save it back to the file. None of this has that :S.
Luckyrare
15-08-2007, 10:44 PM
I know this isn't answering your question but you would be much better using a database such as MySQL. The text based database may seem easier because you dont setup any database but for coding ease and server speed your better using SQL.
Jackboy
16-08-2007, 07:39 AM
I can't use a database though I wish I could.
Answers your question Tim :p
I think he shud use a db too.
HotelUser
16-08-2007, 06:44 PM
Answers your question Tim :p
I think he shud use a db too.
I know this isn't answering your question but you would be much better using a database such as MySQL. The text based database may seem easier because you dont setup any database but for coding ease and server speed your better using SQL.
Like I said before I can't use an SQL database, it is build into the program where the config file is.
timROGERS
16-08-2007, 08:10 PM
Answers your question Tim :p
I think he shud use a db too.
I am Tim, Luckyrare is Danny :P But anyway, it does work better if you use MySQL - I used to use flat file databases for all my PHP, but then I saw the light :P
Jackboy
17-08-2007, 09:43 AM
I am Tim, Luckyrare is Danny :P
Loool soz :P
Yeh hes right use mysql
ShaneIsMe
17-08-2007, 09:49 AM
cant you people read? he can't use a database because it's built into his config or some ****.
HotelUser
17-08-2007, 08:57 PM
You guys are blind I hope? ROFL I have said like 3 times I can't edit the program to use mysql..:eusa_wall:eusa_wall:eusa_wall:eusa_wall:eu sa_wall
HotelUser
23-08-2007, 12:46 AM
Can't anyone help?
Invent
23-08-2007, 01:05 AM
There isn't a reason why you CAN'T use SQL? Just have a page where you update the passwords/usernames (stored in SQL Tables), then when you click save, it updates the SQL Tables.
Then does a while() loop and creates variables for all the users and then fwrites it to the users file.
HotelUser
23-08-2007, 02:49 AM
There isn't a reason why you CAN'T use SQL? Just have a page where you update the passwords/usernames (stored in SQL Tables), then when you click save, it updates the SQL Tables.
Then does a while() loop and creates variables for all the users and then fwrites it to the users file.
I've already said many times I can not use SQL because the FTP server reads from an INI file and I can't just make it read from a database.
Invent
23-08-2007, 03:32 AM
Fgs, read what I said.
The data is saved into an SQL Table and then upon saving the users info it writes to the INI file.
This causes the FTP Server to have NO interaction with the SQL :\
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.