Jump to content

Set Cookies PHP Login

Recommended Posts

Okay, now you get to do what I've had to do a thousand times.... google your error message, click the first result and see which scenario applies to your script.

Debugging goes like this:
1.) Error reporting (you now have that at the top of your page)
2.) Google your errors
3.) Fix your errors.

p.s. I'm still bothered about your <form> tag which appears to have no action ... but I'm too lazy to read your code and see if you have a javascript form.submit() in there somewhere...

p.s#2 ..and the line of code that reads: if(isset($_COOKIE["id"])) .... where is "id" anywhere on what you posted? I see a setcookie("user_id" ..... and obviously "id" is different than "user_id" so does that need fixin' ???

Edited by StevenOliver
  • Thanks 1
Link to post
Share on other sites
1 hour ago, eddcaton said:

Do you think this might influence the cookie setting? 

no. it will set php's error related setting so that php will help you find what's causing the problem by reporting and displaying all the errors it detects.

Link to post
Share on other sites
21 minutes ago, StevenOliver said:

your <form> tag which appears to have no action ...

in html5, no action attribute at all means that the form submits to the same page. you can also set action='#' to submit to the same page, but an empty action attribute, action='', is not valid html5 markup (as of the last time i checked.)

  • Thanks 1
Link to post
Share on other sites

Thanks for all the help and assistance on this really annoying issue. 

I have now found the error in the code. 

When coding in Sublime everything looks fine and no issues. When i took a look at the file directly from Cpanel there was a single . before <?php which threw the whole lot off. 

I have removed the dot from the cpanel view and it works perfectly now.


Link to post
Share on other sites

Join the conversation

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

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.