Jump to content

Recommended Posts

hi all,
im doing a login.php page that analyses the user and password of a previous html form.

For this login to analyse the user/pass, it must connect to a database and use a "require_once" and a "include" in its code.


when i run this login on my computer, it works fine. But when i use it on the online server, i get the:

" Warning: Cannot modify header information - headers already sent by (output started at /home/rodrigopitta/www/teste/main.php:17) in /home/rodrigopitta/www/teste/login.php on line 21 "

main.php is the file that is "required_once"

i also have removed any blank spaces before the <?php and after the ?>....

must i delete the require_once or include files and make a direct connection to the database on every php page that requires a "header("Location: $header_login");" ?

what is the best way to redirect a page once the user/pass returns true? should i continue to use the headers method?

thanks everyone.
Link to comment
https://forums.phpfreaks.com/topic/5808-headers-already-sent-error/
Share on other sites

You can't have any HTML, JS, etc. even before the <?PHP tag. Check the required/included file also has no spaces, HTML, JS, etc. before issuing the header().

This has been asked to death. Please check these:

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=37442\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=37442[/a]

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=31047\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=31047[/a]


This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.