-
Posts
1,698 -
Joined
-
Last visited
-
Days Won
53
Everything posted by maxxd
-
Looks like you can set a password on the document, sheet, or cell: https://phpspreadsheet.readthedocs.io/en/latest/topics/recipes/#setting-security-on-a-spreadsheet
-
@ will suppress errors/notifications. The problem you're running in to is that $_SERVER['HTTP_ACCEPT_CHARSET'] isn't set and therefor can't be used; you're seeing the error despite the @ operator because it won't suppress fatal errors. Your best bet is to use isset() to check each $_SERVER array key and then only use the ones that exist to build the key.
-
I haven't used the SamKirkland/FTP-Deploy-Action action so I'm not sure exactly how it works, but it kinda looks like you're copying the files to the ftp server before you make the updates to the file. Use stream editor in your workflow steps to modify the .env, then place the modified files on the server. If you set up a .env.example file in the repo with a value like so: VERSION={{VERSION}} You'll be able to run this in your workflow (assuming VERSION is a variable in your repository): - run: | cp .env.example .env sed -i 's/{{VERSION}}/${{ vars.VERSION }}/g' .env
-
I've not tried it, but I've heard some good things about Rector. The best way - IMO - is to check the migration docs and manually update the code as needed.
-
You can always go old school and code your own with plain JS or jQuery at which point there really isn't a single "best practice" other than don't expose passwords, make sure you validate data, and never trust user input; however you'll be better off following requinix's advice and checking out the main three frameworks. I'll admit I find Vue easier than React and Angular, but that's just a personal opinion so your mileage may vary. Even using one of these, don't expose passwords, make sure you validate data, and never trust user input.
-
Loading the URL helper is not the same as loading the view. Follow the link in my post. To be honest, it's not going to be easier. CI4 uses more modern techniques and coding practices so you'll have an easier time not only getting answers to specific questions (the CI4 boards on the forum as active), but you'll be able to google the techniques more generally.
-
It's been a while since I've used CodeIgniter - especially an older version - but I don't see where you've loaded the URL helper. Check here for more information.
-
Where is $error output? I don't see the file `ffmpeg_submit.php` in the source for PHP-FFMpeg on GitHub so I assume it's something you've written. It could be as simple as creating a different variable and outputting that instead of (or in addition to) the $error variable, but as we can't see your code there's no way for us to tell.
-
Yeah, we're gonna need some more information. Copy the error and paste it here. Also, while I appreciate your attempt to not post unrelated code, you do need to post all the related code. We don't need the CSS or JavaScript, but the php and html directly associated with this functionality is necessary.
-
That makes no sense whatsoever given the code you posted. Where is $row defined?
-
There are several possibilities for this; for instance GitHub has secrets, bitbucket has secrets and variables, AWS has AWS Secrets Manager. I'm sure there are other services out there as well.
-
Validating the form, before create user in database
maxxd replied to flap's topic in PHP Coding Help
Typically you'll want to validate twice; first you validate on the client side in order to give immediate feedback to the user, and the you do it server-side to verify the data and protect the overall system. -
I'll admit I personally am not a big fan of React - for whatever reason it doesn't sing to me. I have, however, found that Vue is not untenable from this crotchety old bastard's point of view insofaras a JavaScript framework is concerned if you're determined not to deal with vanilla JavaScript, fetch(), and writing the code yourself.
-
If the OP is looking to find out if the numerical string is a palindrome, recursion isn't necessary. A palindrome is the same forward and backwards; use split(), reverse(), and join() on the input and compare it to the original string. However, the images of code in the first post have nothing to do with palindromes, they're all about something like the Fibonnacci sequence that requinix describes.
-
How to input 2 different $request->input() in foreach
maxxd replied to Nicho's topic in PHP Coding Help
I read the question wrong; please ignore me. -
Try https://www.php.net/manual/en/mysqli.insert-id.php. I'll skip the obligatory advice to switch to PDO for the moment.
-
I thought it might be loading order so I moved things around in my blade template, but that didn't seem to make a difference. Admittedly, I didn't know that console logging was lazy-loaded and I thought you had to specifically declare a script include as type="module" for it to be deferred without the `deferred` attribute being set but that all makes a ton of sense and it's a great place to start looking; gotta admit if it is as simple as wrapping everything in a loaded event I'm gonna be pretty red-faced while saying thanks!
-
This is not related to your actual question, but I'd feel remiss if I didn't point out that you're storing plain-text passwords in your database right now. Look at https://www.php.net/manual/en/function.password-hash.php and https://www.php.net/manual/en/function.password-verify.php. In the long run, your customers will thank you.
-
Hi y'all. I think I'm having a senior moment; I have the following code in `app.js`: import Swal from 'sweetalert2'; window.Swal = Swal; `app.js` is included in my blade templates, where I have a partial that includes this code: <script> console.log(window); console.log(window.Swal); </script> My console output is attached to this post. Note that apparently nothing is attaching to the window object - even if it's just a simple `window.st = "testing";`, that reports undefined as well.
-
This worked in my testing: let regexps = [ new RegExp('test', 'gi'), new RegExp('another', 'gi'), new RegExp('more', 'gi'), ]; let entries = [ 'More string', 'Second string', 'Super string', 'Basic string', ]; // loop through the RegExps let res = regexps.map(re => { // then loop through the strings return entries.map(itm => { return re.test(itm); }) // flatten the resulting arrays and pipe that to some() }).flat().some(e => { return e == true; }); console.log(res);
-
How to Add Element to end of currently Iterating array
maxxd replied to sen5241b's topic in PHP Coding Help
You can also use an ArrayIterator and the append method. From a random project I was working on, $u = new \ArrayIterator([1], \ArrayIterator::STD_PROP_LIST); while($u->valid()){ $x = 2 * $u->current() + 1; $y = 3 * $u->current() + 1; if($u->key() == $n){ // this is set elsewhere in the method; not really important for this example break; } $u->append($x); $u->append($y); $u->asort(); $u->next(); } -
Is json_array a JSON string or an array? Assuming it's an Array object, I'd say drop the square brackets from excludes (I'm assuming excludes is a valid Array object as well). Also, realize that Array.push() returns the resulting array, so if you're not assigning the return to anything you clearly won't see the updated values. Are you getting any errors in your console? What does the code around this look like? There's not really enough here to say with any certainty what issue(s) you're having.
-
Compressing a block of text in js, decompressing in PHP
maxxd replied to BillInKCMO's topic in PHP Coding Help
Please more fully explain what you're trying to do - I'm not sure at all what 'Going from a javascript window.open url with the text compressed to using that string on the server side in PHP decompressed.' means. -
Problems connecting to a database via Doctrine on server vs localhost
maxxd replied to Houden's topic in PHP Coding Help
That's a Redis exception, not a PDO exception. -
A variable not being set and being empty are two completely different things. You'll get errors checking for $_SESSION['owner'] == '' if the 'owner' index of the $_SESSION array isn't set (doesn't exist at all). So technically you should be checking with isset() and testing for empty; personally I have a tendency to use the empty(), but it's important to realize that this function comes with its own baggage. For instance, a false-y value will return true from empty(), so you'll need to plan for that as well.