- Where Developers Learn, Share, & Build Careers
Good it's really confusing I have two pages, A and amp; Both use the following code:
$ row = mysqli_fetch_array ($ data); $ _SESSION ['user_id'] = $ line ['user_id']; $ _SESSION ['username'] = $ line ['username']; Setkey ('user_id', $ line ['user_id'], time () + (60 * 60 * 24 * 30)); // Setkeykey ('username', $ line ['user name'], time () + (60 * 60 * 24 * 30) ends in 30 days;); // expires in 30 days $ home_url = 'http: //' $ _SERVER ['HTTP_HOST'] Dirname ($ _ SERVER ['PHP_SELF']) '/main.php'; Header ('location:' $ Home_url); A code will execute after the settings of the headers (you have been removed for easy) and then set the header; After setting the header of B. will execute the code and will not set the header.
I have checked a lot of answers, and there is no white spot, the main.php file is set to normal, A and A; The B file looks alike, but which is useless with different content before the IF statement.
No errors appear; Redirect (The headers on which the header is installed and respond to it, as you are logging out (hence no headers are active) should be on B, whereas this is the purpose that appears on A.
Setting two code block cookies (if IF statement) is that the IF statement is different, according to the code it looks before it.
What is the difference between what types of things Should refer to A & B in terms of Od?
(PS: I also know that the headers are not set because the session is not started, by entering IF $ _SESSION ... code $. $ Line = mysqli_fetch_array ($ data); $ _SESSION [$ User_id '] = $ line ['
session_start () User_id ']; $ _SESSION [' username '] = $ line [' user name ']; setcookie (' user_id ', $ line [' user_id '], time () + (60 * 60 * 24 * 30)) ; // SetQuee ('username', $ line ['user name]], time () + (60 * 60 * 24 * 30); // in 30 days in 30 days Is brief. Home_url = 'http: //' $ _SERVER ['HTTP_HOST'] Dirname ($ _ SERVER ['PHP_SELF']) '/main.php'; Header ('location:' $ Home_url); Go out; View -
-
Comments
Post a Comment