0

First of all, excuse my for my bad English.

I've made a webapp which allows an user or admin to login and basically the admin can make new (news)articles, look att all articles in an archive, read one article per page and edit existing articles. The user only can look at all the articles in the archive and read one article per page.

So I have a database for the articles and users who can login. Now my question why I can't login. My database is connected correctly.

And I also always get this error:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/furkantu/public_html/demo/dtt/header.php:15) in /home/furkantu/public_html/demo/dtt/index.php on line 48

I've made header.php which contains all the links(libraries, css) scripts and use this on every page. On line 48 of index.php I start a session.

I really can use some help, I've been searching so long on the internet. Maybe it is important to mention I'm not using hash or striplashes in my loginscript.

jowazzp
  • 23
  • 4
  • @Fredd-ii- It still doesn't work. I've on top of every page: ``. On this very page I've at the bottom my login script. I tried to put those all in one ``. What do I need to do? – jowazzp Mar 05 '15 at 17:42
  • See `header.php` line 15 for the code that is generating your problematic output. It is probably an error or a warning that needs attending to. – halfer Mar 05 '15 at 17:56
  • @halfer Yeah, I looked it up. The header.php file contains a html-tag, a head-tag with the libraries etc and only the -tag. Sorry for not using the usual markup, I'm using the StackOverflow app on mobile. – jowazzp Mar 05 '15 at 18:52
  • It sounds like you are sending output to the browser deliberately, in that file. You cannot set or reset headers after doing so, so whatever is in `index.php` line 48 that calls `header()` needs to do it before HTML is sent. That information should sort you out, but if it does not, please post both files in your question. – halfer Mar 05 '15 at 19:10
  • @halfer So you can take a look at this [index.php](http://pastebin.com/n8GfCMty) and [header.php](http://pastebin.com/35sGsTMc). Do I need to start session at the top of the page, because at line 48 I did that. – jowazzp Mar 05 '15 at 19:17
  • Ah right, move everything in your `index.php` in the ` – halfer Mar 05 '15 at 19:44
  • @halfer Still not working. – jowazzp Mar 05 '15 at 20:28
  • "Doesn't work" is not an ideal failure report, I am afraid - it gives me nothing new to respond to (we recommend here that you strike this phrase from your lexicon entirely). If you have moved the POST handler to the start of that file, so that nothing has been output by the time you get to the `header()` calls, then it really will work. If you are sure you have done that, post the new files and the new error message(s), including line numbers, and I will take another look. – halfer Mar 05 '15 at 20:34
  • 1
    @halfer I am sorry for my comment. I will try it myself first and if I don't manage to figure it out I would like to contact you again. Thanks for your help and effort. :) – jowazzp Mar 05 '15 at 20:36
  • OK, no problems, and good luck. – halfer Mar 05 '15 at 20:37

0 Answers0