Cannot modify header information
Hello,
I am adding user login and authentication to my website. I am using following code in checklogin.php file: try { login($username, $password); session_start(); $_SESSION['valid_user'] = $username; header("Location: webpage1"); }catch (Exception $e){ header("Location: webpage2"); } I am using login method to validate userid and password from database. After successful login the user goes to webpage1. At webpage1, before displaying the content I am trying to verify - if the user really logged in. Just to make sure that someone should not access the webpage2 without proper authentication. Therefore, I am adding below code at the start of webpage1. <phpcode> <?php session_start(); if(!session_is_registered(valid_user)){ header("Location: invalid login wbpage"); } ?> </phpcode> However, I am getting below error: Warning:Cannot modify header information - headers already sent by (output started at /home/foldername/websitename/wp-includes/link-template.php:1203) in /home/foldername/websitename/wp-content/plugins/pluginfolder/page.php on line 4 After reading some posts before, I removed any space at the end of page where ?> is present. But still not working. Can you please help me with this? Thanks in Advance ! |
what version of Atahualpa and WP?
What is the url? |
I am using WordPress 3.2.1 and Atahualpa 3.6.7
Please let me know, which URL shall I send it to you. Thanks ! ----- Just an update...this code is working fine on localhost, but once I move it to host server I am getting that error. I have same WP and Atahualpa versions on localhost. Thanks ! |
what is the site's url - where I can see the issue
|
Quote:
Thanks ! |
Quote:
This has nothing to do with the theme. How many places have you put PHP code into a page or a widget? Remove them one by one till you find the offender. Why are you coding a login your self and not using one of the login plugin's? see [SOLVED] A login plugin that will point to two different pages depending... |
Quote:
Thanks ! |
That thread is in the GOLD FORUM (available to users who have donated $20 or more) but it suggested using the 'Capability Manager' plugin
|
All times are GMT -6. The time now is 03:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.