Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Posts posted by scootstah

  1. My project is sort of designed for simplicity, as in extract all once (and upload to single location).

    That's fine, moving the application outside of the document root doesn't change that. You could either set a constant for the base application path and reference it any time you need that path, or if you're using proper OOP structure, you'd just tell your autoloader where to look.

  2. The idea is that you store which topics they have viewed in the database. Within a given time frame, if a topic does not have a row in that "viewed" table, then it is new. Very simple, nothing complicated here. This is a feature that every forum package within the last decade or more has implemented, most of which in this very same way. That's just how it works.

     

    You could track it client-side if you wanted, but then you don't have persistence cross-device. At that point you have to decide what your end goal is.

  3. What does “large” even mean in this context? 1,000 rows? 10,000 rows? 100,000 rows? That's laughable.

    This forum has 166,826 members and 1,515,137 posts. It doesn't tell me how many topics. So worst case scenario, that's 252,764,245,162 rows, ha. But, it would be easy enough to keep that table pruned and at a reasonable size. There were 16,296 total topic views for this month. 314,000 for the year. So, yeah, it's completely manageable.

  4. Why does it matter if they "know"? If you rewrite it gives false impressions.

     

    But, this is what you want:

    RewriteEngine on
    RewriteRule ^priv(.*)$ index.php?q=$1
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?q=$1 [B,L,QSA]
    You can change how you want the parameters to appear to index.php.

     

    But for the record, can you expand on this?

    Good solution but its part of a single package so the mod_rewrite solution is what I'm after, thanks

    If you are routing things through index.php, then only needs to be visible to the public. The entirety of your application should live behind the document root. That is standard practice and the correct way to do things these days.

    • Like 1
  5. I always recommend the minimum, highlight posts and topics that are new since they last visited.

    I've used a ton of different forum software over the years, and I can't think of one that works that way. If you do it that way, new posts will only be new until you refresh the page. Or, you have some kind of offset where it remains new for X minutes.

     

    Most forum software, like this one, will maintain state cross-device. So if I login on my PC and there are 10 new threads, and I read one, and then I login on my phone there will only be 9 new threads.

     

    You could prune the table when data gets so old if you desire. It's an expensive feature.

     

    EDIT: And I think you've got it backwards. You don't track what they haven't read, you track what they have explicitly read.

  6. It's been a while since I have played with forum software, so I don't remember details off the top of my head.

     

    One way is you would have a "users" table and a "topics" table. Then you would have a "viewed_topics" table (or whatever you want to call it). "viewed_topics" would just have columns for the user id, topic id, and maybe a date or post id. When a user views the topic a row gets added to "viewed_topics". When a new post is created, all rows in "viewed_topics" get deleted. When displaying topics, you can just JOIN the "viewed_topics" table and determine if it is new or not by whether a row exists there or not.

    • Like 1
  7. I'm not sure what would have caused them to index those pages to start with. Maybe some other site linked to your site with those pages for some reason. In any case, now that they are indexed, they're likely to remain that way for a while. Are you returning a proper 404 header for those pages?

  8. Here's something that might help you out or get you going in the right direction - I can't guarantee that it'll work for the might be bugs (errors) that I have overlooked. ;D

    You don't need to filter HTML special characters when interacting with a database.

     

    $stmt->execute([':username' => $data['username']]);
    Where did $data['username'] come from?
  9. I dont understand how i can get rid of the vulnerability in the url you can change the username and token and take over accounts with my current code i don't understand how i can prevent this

    You need to SELECT the user first, to make sure the information given is valid. Then you can perform the update.

×
×
  • 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.