-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Well... Given just that code it's going to be really hard for anyone besides you to understand what the problem could be. You say the page is refreshing but it sounds like that's just the regular page load from submitting the form. Write out a list of steps that the code is supposed to follow, then verify each one in turn. For example, one of those steps is going to be that the code checks if the "submitButton" was pressed, so you need to verify that (1) there is a submit button, (2) it is named "submitButton", (3) it has a value so that it can be sent along with the form, and (4) you are using it to submit the form.
-
It should probably come as no surprise to learn that the answer is "to check if the input is the right combination". You have a query that looks for matching username and password. What will happen if there is a match? What will happen if there is not a match? How can you get the code to tell which is happening?
-
Seems reasonable enough. What's the problem?
-
No specific rules. Consider how useful the new information is, how old the thread is, how likely people are to come across the thread and need the new information, whether the post is likely to revive a discussion that really has no need to be revived, stuff like that. Worst case the post isn't useful and some staff member removes (hides) it because they don't feel it contributes enough. Warnings are mostly for repeat offenders and folks who put a minimum amount of thought into what they do.
-
Is the cf_type "url"? What incorrect URL are you trying?
-
A question about csrf token in login form submission
requinix replied to colap's topic in PHP Coding Help
Potentially. How about going into more detail about what you're dealing with? -
Can't Detect isset() for text box (only 1 box)
requinix replied to jahicki's topic in PHP Coding Help
How is that accomplished? You wouldn't happen to be setting disabled to "false", would you? -
Single ' quotes are for strings and only for strings. They will not work for table or column names. You don't normally need quotes for table or column names, and you should try to avoid putting yourself into a situation where you do need them, but if you must then for PostgreSQL you should use double " quotes.
-
I upgraded to PHP 7.4 locally because duh. Recently I needed to deal with a Laravel 5.x app. Does it work on PHP 7.4? Yeah, even though it's an older version. Well, almost worked. Somewhere in a plugin there was a call to implode() with the arguments backwards and support for that was E_DEPRECATED. Okay, deprecated, fine. But you see, in Laravel's infinite wisdom, it decided that every single error of any severity needs to be shoved into an ErrorException and thrown. So the entire application breaks down because of a single line in a single plugin that is still working perfectly fine, it just won't work "perfectly fine" after hypothetically changing the system configuration at some undetermined point in the future. So yeah. "Version too high" is stupid.
-
-
How do I insert multiple checkbox data as 1 or 0 in multiple columns?
requinix replied to ke-jo's topic in PHP Coding Help
Allow me to summarize the posts in this thread: (OP) I'm trying to learn OOP. Regardless, I have some problems with checkboxes in that I can't tell which checkboxes are which. (me) Checkboxes are only submitted when they're checked. If you need to know which fruits were selected then it requires looking at the values in the checkbox array. (Psycho) Don't use submitted data as field names in a query. The user could have done something malicious that will mess up your application. (OP to Psycho) I removed some code but I still don't know what's wrong. (OP to me) I completely changed the checkboxes and the code so it doesn't use an array. Here is some validation code that no longer works because it expected an array. (me) Why did you completely change how the checkboxes and the code look? The array from before was fine. (OP) So what do I do? It still doesn't work. Please give me code. Here's another explanation of what I want. (me) I don't know what "completely changed" is but you need the fruit name in the array somehow. You can then check if each fruit was selected using one of two methods. (OP) This isn't helpful. I'm going to take my question somewhere else. (me) I don't think that will make a difference. We weren't going to give you the new code. Not even sure we had enough information to do so. But we can try to tell you what is wrong and how it needs to be changed. Unfortunately, that wasn't good enough. -
How do I insert multiple checkbox data as 1 or 0 in multiple columns?
requinix replied to ke-jo's topic in PHP Coding Help
At this rate, probably not. See how much spending money you have and hire a programmer to do the work for you. -
Ajax Post Data to Jquery Datatable and Return Another Value
requinix replied to jarvis's topic in Javascript Help
Seems like you're kinda just guessing. If you make the "ajax" a function instead of an object, then you can do whatever you want. Like make your own AJAX request. When you do that, you'll get back the information that the DataTable wants as well as the header string thing. Put the header string thing into your header element thing, then use the "callback" to hand the table data off for processing. -
Ajax Post Data to Jquery Datatable and Return Another Value
requinix replied to jarvis's topic in Javascript Help
Not the xhr event. I said "ajax". As in what I linked to in the documentation. As in "ajax": { method :"POST", url : '<?php echo admin_url('admin-ajax.php');?>', data : {action:action,tax:tax,id:id,}, }, that. -
How do I insert multiple checkbox data as 1 or 0 in multiple columns?
requinix replied to ke-jo's topic in PHP Coding Help
I don't know what your checkboxes look like now, but you've put the name of the fruit as an array key or as an array value. If you put it as a key then test if each fruit was selected using isset(). If you put it as a value then test using in_array(). -
How do I insert multiple checkbox data as 1 or 0 in multiple columns?
requinix replied to ke-jo's topic in PHP Coding Help
How about you go back to using an array? I don't understand why you had to change that. It was fine. -
Ajax Post Data to Jquery Datatable and Return Another Value
requinix replied to jarvis's topic in Javascript Help
The thing you pass as the "ajax" value needs to be a function. It take a few arguments, as seen in the documentation, and when it's done it uses the callback function it received. What code do you have trying to do that? What do you expect to happen when you view the table and what actually happens? -
Ajax Post Data to Jquery Datatable and Return Another Value
requinix replied to jarvis's topic in Javascript Help
So what you need is to be able to customize how the DataTable does the AJAX request, right? You can perform the actual request yourself, then give the DataTable just the "example" data while you borrow the "search-results-header" data for something else. When in doubt, check the documentation. -
Ajax Post Data to Jquery Datatable and Return Another Value
requinix replied to jarvis's topic in Javascript Help
What? Do you want to add that markup to the page? Or are you trying to return a value from PHP that should be inserted into that DIV which is already written on the page? -
How do I insert multiple checkbox data as 1 or 0 in multiple columns?
requinix replied to ke-jo's topic in PHP Coding Help
A checkbox is only submitted when it is checked. You cannot simply look at [0] and [1] and so on to know what value it has. The answer is, hopefully not too surprisingly, to look at the value. You've got it right there. fruit_selection will be an array and all you have to do is see if that array contains each fruit. -
I'm not sure there even is anything wrong. Not with the code. You know what this thing does, right? You feed it a nickname and the script looks for IP addresses it used, then for each of those it finds nicknames, then for each of those it finds IP addresses, and so on until it runs out of stuff. You searched for "Matej_Cizik"? Look in the database table yourself for that nickname. Does any of the data seem to be off? Then try searching according to the IP addresses you just found. Then those nicknames. Does it seem to be spiraling out of control?
-
Programming isn't like piecing together LEGO blocks. You can't just go onto the internet and get an "admin dashboard" component and shove it into your application. If you're working with WordPress or some other cookie-cutter framework then there might be a plugin out there to do what you want. Otherwise you'll probably have to (gasp) learn some PHP and HTML and CSS. Because it's not like there are people out there who know your website and are climbing over each other to write free stuff that will work with it in the hopes that you'll go download their thing.
-
The #1 way to have vulnerable code is to copy and paste what you find on the internet. There is no substitute for learning PHP and secure coding practices. That said, the thing you found is actually one of the safest versions I've seen in that it does not fall prey to any of the common problems that plague most of what you'll find online. Would be nice if they talked more about it, tried to address issues like file permissions or access control, but I suppose this is one of the few good examples of w3schools doing things right. Good developers write good code. Bad developers write bad code. Language has nothing to do with it.
-
Make an upload script. The internet has a lot of resources to help with that. Be careful that you don't allow anybody who stops by to upload anything they want. Put the files somewhere not accessible through your website with a regular URL. Make a download script. Specifically, you need a PHP script that will download the requested file to your browser. Also lots of resources to help with that. URL rewriting would help. Then update that download script so it deletes the file after sending its contents.
-
Check your variable names. By the way, when a word is plural that normally means there is more than one, and the singular version is when there is just one.