-
Posts
15,289 -
Joined
-
Last visited
-
Days Won
436
Everything posted by requinix
-
Read. The. Error. Messages. Please don't make me bold the relevant parts.
-
So if you open up your user settings, let's say the JSON file, you can see in there an entry for php.debug.executablePath with the correct file path? And another entry for php.validate.executablePath with the same file path?
-
Both of the messages there (the two that are actual errors, that is) tell you what to do. Have you done that?
-
Help With Ordering An Array Vertically Into HTML Columns
requinix replied to atpnifb's topic in PHP Coding Help
What you currently do is chunk it into groups of 4 (so it goes 1,2,3,4; 5,6,7,8; 9,10,11,12) and then use array_column to get the Nth member of each group into the Nth column (column 1 has 1,5,9; column 2 has 2,6,10, etc). What you want to do is chunk it so there are 4 groups, and then put the contents of the Nth group into the Nth column. Now here's a question. If you have 10 items to put into those four columns, do you want 1 | 4 | 7 | 10 2 | 5 | 8 | 3 | 6 | 9 | where the last "column" is incomplete, or 1 | 4 | 7 | 9 2 | 5 | 8 | 10 3 | 6 | | where the last "row" is incomplete? The normal answer here, with the values going column-by-column, would be the first. That means there are ceil(10 items / 4 columns) = 3 items per column, except the last which has (10 items - 3 items per column * 3 columns not counting the last) = 1 item remaining. Fortunately you only need to figure out how many items you want in each of the 4 chunks - that is, ceil(number of items / number of columns). Then PHP will give you an array with four elements and each column can foreach over its respective chunk, just like you're doing now except you're asking it to chunk with the wrong number. -
Python problem - Doesn't print to screen
requinix replied to LeonLatex's topic in Other Programming Languages
I don't know what you were doing in those screenshots but it sure doesn't look like you tried running "python app.py". -
File save forbidden, depending on text file content?
requinix replied to DrJBN's topic in PHP Coding Help
Yeah, don't do that. See if your hosting provider is willing (and able) to turn off mod_security for you: it's a great thing in theory but reports so many false positives that it just ends up being a pain in the ass. If that's not an option, all you have to do to bypass this particular security measure is to encode the data. For example, with base 64. Submit the data encoded and have your PHP decode it. -
Actually, it looks like PHP itself protects you from the kind of attack I was thinking of. So that's nice. So not just any file can be read. However your script will still let anyone read any PDF file that exists on your server. And it's simple: all they have to do is pass the right "fname" and "lname" values to create a $path that goes where they want it to go. That would have been it, yes: var_dump would create some output on its own, then you would echo the true value that it returned (which would display as "1").
-
File save forbidden, depending on text file content?
requinix replied to DrJBN's topic in PHP Coding Help
Congratulations, you have mod_security installed. Are you on shared hosting or do you have a dedicated server you can control? -
It's just regular old normalization: if you have two pieces of data then you need two columns to hold them. Slight clarification to a thing I said: non-float with the smallest unit, so for an integer column you'd have $1.23 as 123 but with a decimal(_,2) column you'd have 1.23 perfectly fine. But with a decimal you have to care about the number of decimal places, and as pointed out different currencies use different scales.
-
Hard to know without being able to see what it was that didn't work. But what you have isn't actually correct. And I don't just mean because of the significant remote file inclusion vulnerability you've created - one that would allow anyone to view any file that exists on your server, including PHP source code and configuration files and confidential files and really anything they can imagine. $a = glob($path); $b=($a[0]); $cd=($b); $cc = ("$cd"); - $a will be an array of files matching the $path pattern. Good. - $b will be the first file in the array. The parentheses don't do anything and are useless. - $cd will be the same as $b. There's no point to having both $cd and $b. The parentheses don't do anything here either. - $cc will be the value of $cd (a filename) put into a string (it was already a string) - or in other words, the same as $cd and $b. No point to this. And ditto about the parentheses here again. Please, do yourself a favor and learn PHP. That way you will not have to stumble around anymore. A non-obvious thing is your use of the Accept-Ranges header. Your script does not actually support ranges. Do not send this header because your server will be lying to the browser.
-
There is no standard hybrid format for currency and amount. Use a non-float column that stores the amount measured in the lowest units (so $1.23 is 123 and ¥123 is also 123) and a string column for the currency code.
-
What's your current code?
-
Start by learning about arrays. The syntax you need is simple and mentioned on the page, but you'll probably learn some other things talked about on the page as you look for it.
-
Do you know what it means when you try to var_dump something and it outputs "Array"?
-
No. It will print "Array" and "[0] =>" and the filename. Think about what that might mean.
-
Pretty sure some fact here isn't quite as you think it is. Check the browser's error console for messages. Also check the network requests to see if there's something that stands out there.
-
What kind of "basics" are you looking for? All you need is to start VS Code, open a folder, and start writing.
-
Why modal forms opened with JS show method shows ugly modal ?
requinix replied to mstdmstd's topic in Javascript Help
If the modal is powered by a jQuery plugin then you need to be using the plugin's own methods to open the modal - by which I mean something that will probably look similar to $('#modal-signin').modal('show') - not simply manually .show()ing it. -
There will very, very likely be some command or /proc stat you can execute/read within PHP to give you the information. The CGI scripts might be textual scripts, like Perl or Python. It'll take time but you could try reading through entry.cgi to find out how that's getting the information.
-
How do I combine values of same col inside a foreach loop?
requinix replied to imgrooot's topic in PHP Coding Help
You mean you want the SUM of the balances? Perhaps GROUPed BY the recipient? -
An ID means there is only one on the page, there can only ever possibly be that one on the page, and it should probably represent something specific and special. A class means you want to apply some CSS rules or Javascript processing to it. <div class="container"> <div id="page-navigation" class="left"></div> <div id="page-content" class="center"></div> <div id="page-sidebar" class="right"></div> </div> The first DIV is the one, single container used by the page for the main content. It doesn't need an ID because you don't need to do anything special to it. It does act like a generic .container. #page-navigation has links or whatever relevant to the page. It has an ID because you might want to style the contents differently. Inside the container it acts like a .left. #page-content is the content for the page. It has an ID because maybe it has some special border or background, or maybe you want to run some Javascript on what's inside. It acts like a .center. #page-sidebar has maybe ads or additional information or something like that. It has an ID because that way to can target it with Javascript to place the ads. It acts like a .right.
-
Read the documentation for pg_fetch_result to find out what $raw is.
-
How to open next/prior step block with JS code?
requinix replied to mstdmstd's topic in Javascript Help
HTML does not do wizards. Javascript does not have the concept of "wizards". jQuery does not either but there will be some jQuery-based plugin that does - presumably jQuery UI. Read the documentation for jQuery UI to see how you can use its wizard thing. -
How to open next/prior step block with JS code?
requinix replied to mstdmstd's topic in Javascript Help
The wizard steps are normally driven by Javascript. Your version where you need to do AJAX is also based on Javascript. Find a mechanism which allows you to tell the wizard to advance to a new step and use it. -
Incorrect datetime value: '2022-01-24T20:52:00.000Z' for function str_to_date
requinix replied to AJM2's topic in MySQL Help
If the field is a date then it should be a date. Don't make it a string. But what I was trying to point out was that you were asking MySQL to interpret the timestamp 2022-01-22T20:52:00.000Z according to the format %c-%e-%Y %T, or in other words M-D-YYYY HH:MM:SS. That's not going to work.