I’m trying to write something to an existing php file using FILE _APPEND.
I want to add the code below to “myString”, The full code. If I place that in between the quotes I get an error. It seems like it doesn’t like the $ symbol. What can I do? I’m not a php expert
$useradmin = array('login' => 'admin'); //// add this to myString
$file = "settings.php"; $myString = " "; file_put_contents($file, $myString, FILE_APPEND); $getData = file_get_contents($file); echo $getData;
Thanks!
Timothy
OK, disregard my last message. I’m now gonna use str_replace.
I got it working, but I need one last thing! I have a simple HTML form with a field name=”albumpass”
How do I add a .$_POST to the second str_replace so it submits what the user places inside that field.
Here is my code:
$fname = "settings.php";
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
$content = str_replace("defaultpass", "WHAT_EVER_USER_TYPED", $content);
$fhandle = fopen($fname,"w");
fwrite($fhandle,$content);
fclose($fhandle);
Thanks!
Got it!
$_POST['albumpass'];
$fname = "settings.php";
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
$content = str_replace("defaultpass", "$albumpass", $content);
$fhandle = fopen($fname,"w");
fwrite($fhandle,$content);
fclose($fhandle);
Looks like creating a thread about it helped you, you should post here more often 
Crakken said
Looks like creating a thread about it helped you, you should post here more often![]()
haha you know what? This crap always happens to me.
I always search for my problems before posting on threads, then after post a thread I figure out my problem. I don’t get it 
timmylogue said
Crakken said
Looks like creating a thread about it helped you, you should post here more often![]()
haha you know what? This crap always happens to me.
I always search for my problems before posting on threads, then after post a thread I figure out my problem, I don’t get it![]()
Stuffs happen.
