Jump to content

is_logged_in not working on one page


PrinceTaz

Recommended Posts

2 minutes ago, Barand said:

Sorry - misread the list above.

If there is nothing in $_GET['postID'] how do you expect to find the record with that id?

So I'm calling those echo's on the viewpost page. The url will say "?id=5" and so on that page normally i would just echo out the content that corresponds with that ID but nothing happens. It's just whitespace. But there is data in the database so it should be displaying. 

Link to comment
Share on other sites

Quote

Okay, I removed the "?>" tags from "config.php". Now do I remove it from the other pages as well? Even though I write php code inside the html?

You can safely remove the closing tag from the script.  If you have blocks of php and html intermingled you still need whatever separates the blocks.  Just to make it easy, anywhere you have a script and the ending code block is php, then remove the closing php tag.

I heartily endorse PHPFig's PSR-2 Coding Style Guide.

If there are things not covered in PSR-2, then go with the Symfony Coding Standards.

Getting started with these standards early in your career will help you write good code that is easy to read and consistent, which helps with debugging and will also help you read other people's code, as many modern projects utilize many of these same standards.

 

Link to comment
Share on other sites

1 hour ago, Barand said:

If your url is that then you should be passing $_GET['id'] to the query, not $_GET['postid']

 

EDIT - and you should get a message telling you index postID is not defined.

Yes! So I went home and installed my blog on my XAMP server and now the its recognizing my login and I get this error "Notice: Undefined index: postID". I'm assuming error reporting IS indeed turned of on my cpanel because now I'm getting tons of error messages! In fact, none of my $rows is working becuase it keeps saying they are undefined.

 

1 hour ago, gizmola said:

You can safely remove the closing tag from the script.  If you have blocks of php and html intermingled you still need whatever separates the blocks.  Just to make it easy, anywhere you have a script and the ending code block is php, then remove the closing php tag.

I heartily endorse PHPFig's PSR-2 Coding Style Guide.

If there are things not covered in PSR-2, then go with the Symfony Coding Standards.

Getting started with these standards early in your career will help you write good code that is easy to read and consistent, which helps with debugging and will also help you read other people's code, as many modern projects utilize many of these same standards.

 

Thank you for this, I shall read up on that.

Edited by PrinceTaz
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.