Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


kicken last won the day on September 21

kicken had the most liked content!

1 Follower

About kicken

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Bonita, FL
  • Age

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

kicken's Achievements

Prolific Member

Prolific Member (5/5)




Community Answers

  1. If you think your PC might be compromised in some way, the best thing to do is to wipe your hard drives and re-install your OS and other programs from scratch. Don't bother with trying to find and fix the infection.
  2. It's unclear to me whether you'd modify that or add a new type since your Permission vs PermissionEnum is confusing to me. I've not used Enums personally yet, so I was unsure if Doctrine had generic support for them or not. From that bug report, it looks like it does and you might just need to downgrade for a bit and wait for the fix to get released.
  3. As far as I am aware, no. If you want the numeric value, you access the ->value property. I believe what you'll have to do is change your doctrine configuration to not use a generic small int type and instead use specific PermissionEnum type.
  4. Because you're asking for the number of rows, not the actual data. You want to fetch the row data and use that. Some searching suggests that you'd do that using this code: return $query->row()->total_paid_amount Also, if you're trying to get a sum of all payments, you probably don't want to be using GROUP BY, and should remove p_id from your select list.
  5. You can tell composer to pull a specific commit by adding #hash after version. "api-platform/core": "3.0.x-dev#14c7cba" Normally just doing 3.0.x-dev would pull the latest version, but I think because both the main branch and 3.0 branch use this alias it causes an issue and for some reason composer prefers the main branch.
  6. For what it's worth, and maybe it'll help with your conception of this being a "problem", the database won't do some complex re-index operation with each insert. The database maintains the index in a particular sorted structure and would just insert the new row data into that structure where it needs to go. I have a system setup that is pretty much exactly as requinix is describing. When a user visits a particular discussion I insert a row recording the time they visited that discussion. Table is simple, just the discussion id, login id, and the time with an index across the three columns. CREATE TABLE discussion_view_history ( DiscussionId int NOT NULL, LoginId int NOT NULL, ViewedOn datetime NOT NULL, index IX_last_viewed (DiscussionId, LoginId, ViewedOn) ) To obtain a list of discussions with a count of total and unread posts, the query looks a little something like this. select d.Id , d.Title , COUNT(p.Id) as totalPosts , sum(case when vh.lastViewedOn is null or p.PostedOn > vh.lastViewedOn then 1 else 0 end) as totalUnread from discussion d inner join forum f on f.DiscussionId=d.Id inner join discussion_post p on p.DiscussionId=d.Id left join ( select DiscussionId, LoginId, MAX(ViewedOn) as lastViewedOn from discussion_view_history group by DiscussionId, LoginId ) vh on vh.DiscussionId=d.Id and vh.LoginId=$viewerLoginId where f.Id=$forumId group by d.Id, d.Title For some context that might help alleviate that fear as well, my discussion table has 250,050 rows, discussion_view_history table has 2,104,958 rows, and discussion_post table has 4,226,291 rows and that query returns results in 44 milliseconds. Focus on making well structured tables with appropriate indexes and good queries. Don't worry about how big your tables or indexes might end up being.
  7. Make sure your mail server accepts email via SMTP and then configure phpBB to use SMTP and enter in the details for your server.
  8. You don't have any new lines in your command string, so when shell_exec pass it to the shell it'll be as if you'd typed it all out on a single line in your shell, e.g.: blah@example:$: uci add firewall rule uci set firewall.@rule[-1].name='my iphone' ... service firewall restart Presumably that'd just result in some error as it's not really valid. Add some new lines or semi-colons to your command string to separate the commands and try again. If it still doesn't work, make an array of individual commands and run them one by one in a loop.
  9. <label> is an inline element. Inline elements don't have a specific width, they just take up whatever space is necessary. If you want to assign a width them, you need to change the display to either block or inline-block.
  10. I'd probably just do that if it were me. Regenerating the user on every request isn't really going to be an issue I think, and might be necessary anyway more often than you'd think. I think what this error means is that you're trying to persist the App\Security\TokenUser object, but that object does not correspond to any known entity. Likewise for the other class. I've never used this library so really don't know anything about it. My initial comment was based on a quick look at the class where it seemed like it just extracted a string value from a user object. Doing a little more googling, I'm thinking maybe doctrine's reference proxies might be a solution for you. Since I don't know how things are structured, I can't really provide a good example but whever you were passing a fully hydrated user before, you'd change to just passing a reference, something like: $reference=$em->getReference(User::class, $jwt->getUserIdentifier()); $blamable->setUser($reference);
  11. The BlameableListener only wants the username / identifier. If you store that in your JWT, then just pass it along. There's no need to re-generate the full user object just to pass it into the listener.
  12. Yea, I usually just do something like this: $storageDir = '/wherever/you/want'; do { $name = bin2hex(random_bytes(16)); } while (file_exists($storageDir.'/'.$name)); The loop probably isn't really necessary, the chance of a collision is statistically insignificant I think, but I throw it in anyway just in case. I'll usually create a few sub-directories as well rather than literally have everything in one directory. Take the first few characters of the name and make a sub-directory based on that. For example, if the result were c6c1ce8c2bcf000daea561cbcca4a671 then I'd end up saving the file to: /wherever/you/want/c6/c1/c6c1ce8c2bcf000daea561cbcca4a671. Keeps the directory sizes more manageable just in case you need to manually browse to some file.
  13. It sounds like what you're describing / debating is a how to create a multi-tenant application, is that right? Essentially you have an application that is dynamically configured and has separate data for each user instance (ie, several different wordpress blogs sharing the same code base). I'm not sure I see the need for such complexity based on what is mentioned. That just sounds like basic user management / access to me. You have your users table and a files table and associate the files with their users. How you physically store the files on disk isn't really that relevant. Just ensure you code your editor so it can only load files the user has access to. Is there some public aspect to this where you need to isolate the user's files based on just the URL and not the user being logged in? Last time I did something like this, it was based on the host name, but a URL directory would work as well. Using the host name could have allowed the end-users to apply their own domain name to application instead of having to use mine (though that was never actually done). Based on the info provided so far, I'd probably just be doing essentially what I think you're already considering, just without the creation of separate folders for users bit. I'd just store all the files for all users in one directory structure somewhere with random names. The database would contain the original file name/mime type and user association information. I'd use either mod_rewrite or FallbackResource in apache to handle public access to the files and normal login procedure for the editing/uploading bits.
  14. This can be a frequent issue, which is why it's important to test on multiple browser. You can also reference caniuse.com to get an idea of what is supported on which browser versions. If you look up position: sticky there for example, it says for chrome (up to 90, which is your version) it's partially supported with the note: Modern chrome fully supports it.
  15. Not entirely sure what you're asking about, however it sounds like you're wondering about the variable names? The names you assign in the function are irrelevant to the names (if any) or what you end up passing in when you call the function. function choose($x, $z){ //$x is whatever value is passed in first //$z is whatever value is passed in second. } You can pass in whatever variables you want when you call it, or just some static value and not a variable at all. They don't have to have the same name (though it's common that they do since they usually represent some type of data). $a = 1; $b = 3; choose($a, $b); // $x = 1, $z = 3 choose(6, $a); // $x = 6, $z = 1 Any changes you make to $x and $z inside the function will not affect the original variable passed into it. Generally that is the desired behavior, and you just return some value from the function as it's output. If you have a specific need to change that behavior and want the original variables to be modified, then you must indicate that by declaring the parameter as a reference parameter using &. function accumulate(&$x, $y){ $x += $y; } $a = 1; accumulate($a, 2); echo '$a = '.$a; // $a = 3 accumulate($a, $a); echo '$a = '.$a; // $a = 6 accumulate($a, 5); echo '$a = '.$a; // $a = 11 Don't use references unless you really have a specific need to. They can get messy and cause you debugging headaches just like globals. If you're wondering about the discrete variables vs array thing, the difference is instead of defining a bunch of variables as parameters, you just define one which receives an array of values. So instead of this: function doStuff($colA, $colB, $colC, $colD, $colE, $colF){ //Do stuff with $colA, $colB, $colC, $colD, $colE, $colF } $row = $db->query($sql)->fetch(); doStuff($row['colA'], $row['colB'], $row['colC'], $row['colD'], $row['colE'], $row['colF']); You'd do this: function doStuff($row){ //Do stuff with $row['colA'], $row['colB'], $row['colC'], $row['colD'], $row['colE'], $row['colF'] } $row = $db->query($sql)->fetch(); doStuff($row); It keeps the argument list smaller which is good, but more importantly it lets the function be responsible for accessing the data it needs rather than you having to hand it out individually. If in the future you need to add something to doStuff that needs access to colZ, you won't have to go around your application updating all the function calls to include colZ.
  • 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.