Jump to content

3 Errors in login script


rjcfan4ever

Recommended Posts

So I have 3 errors in my login script...

If I wanna login in my login system (on my localhost) he gives this error:

http://imageshack.us/photo/my-images/200/erroris.jpg

This is the code on line 116:

http://imageshack.us/photo/my-images/17/line116.jpg/

This is the code on line 118:

http://imageshack.us/photo/my-images/3/line118.jpg/

This is the code on line 124:

http://imageshack.us/photo/my-images/39/line124.jpg/

(Sorry but I can't place the image directly on the forum)

Already thank you for helping me :D

Link to comment
Share on other sites

You have outputted something before sending headers. You cant have any kind of output before headers. ACtually you have invalid PHP syntax also. You need to put that Key my site thing into "Key my site" or 'Key my site'. Same goes for the other line.

Link to comment
Share on other sites

most likely you are outputting code before either setting your cookies or using the header() function..which you cannot do, can you post your code so we can help

Well he will get errors atleast outputted before that header() call since he has invalid php syntax on the two first lines.

Link to comment
Share on other sites

true..you will need to wrap you $name argument in quotes...

 

<?php

setcookie("Key_my_site", $_POST['pass'], $hour);

?>

 

Also, please post your code if you need help with clearing up the headers errors.

Link to comment
Share on other sites

it should be what I previously posted..instead of what you had

 

<?php

setcookie(Key_my_site, $_POST['pass'], $hour);

?>

 

it should become

 

<?php

setcookie("Key_my_site", $_POST['pass'], $hour);

?>

Link to comment
Share on other sites

It will be the name of the cookie you are setting with function set_cookie() -> http://fi2.php.net/manual/en/function.setcookie.php . I suggest you start reading some very simple php tutorials which can be found tons with a simple google search for example. Also keep php manual open and read, read and read more and the hardest part: UNDERSTAND what you read.

Link to comment
Share on other sites

Yeah the solution has been already mentioned few times earlier in this thread but here we go once again.

 

// Line 116
setcookie('ID_my_site', $_POST['username'], $hour);

// Line 118
setcookie('Key my site', $_POST['pass'], $hour);

 

And the line 124 is just fine as it is.

Link to comment
Share on other sites

line 116 is the same issue as the previous cookie, you need to wrap the cookie name in quotes ""

 

as for line 124...header()

As I previously stated, you cannot output any code to the browser before using either the setcookie() or header() functions...none at all..

 

In order to properly help you with this if you still do not understand how to solve this, please post the code

 

Link to comment
Share on other sites

still have:

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\login\login.php:1) in C:\xampp\htdocs\login\login.php on line 116

 

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\login\login.php:1) in C:\xampp\htdocs\login\login.php on line 118

 

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\login\login.php:1) in C:\xampp\htdocs\login\login.php on line 124

Link to comment
Share on other sites

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.