How to prevent posting duplicate comments on Wordpress? [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have looked everywhere, here and on the web, and couldn't find the solution.
Basically, I'm trying to prevent posting duplicate comments on WordPress.
I have read somewhere that it's not that simple, and first WordPress needs to compare already posted comments.
Maybe someone has a quick and easy solution, or have done/implemented something similar on their own Wordpress blog.
Maybe a simple code for functions.php?
Any help would be greatly appreciated.

Although what you ask seems reasonable, in reality it has a design flow: ensuring that every comment, ever, is unique is expensive as it depends linearly on all your comment base. This means that every time a user posts a comment, that operation will take more and more to complete.
Beside this, defeating this expensive validation is trivial and involves just adding some padding characters: suddenly, you must implement more custom checks for every comment posted, thus slowing down your site more.
The more your site slows down, the more resources (and money) and money you need. Assuming you are fighting spam, there are plugins designed for that purpose (like Akismet cited in the comments). A spam filter plugin doesn't scan all your comments, but uses more advanced techniques to evaluate different aspect of the text to be analyzed, and then decide whether or not to filter it.

Related

Is it ok (is it really bad) to make many small queries in a loop? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Skip that if you value your time.
I am making a website that has a special "control panel" for a few (less than 20) people. It is a calendar where you can see which days aren't occupied yet and book "events" to them if it's needed. Panel uses php and mysql database to hold usernames, events etc. It is pretty much finished, but i noticed that i need to check if exact same data isn't stored in database already (it wouldn't cause problems, but it would be better to avoid redundancy).
First solution i came up with is just add a query (checking if there is an appointment in the time) to every added row (they are added in a loop) and do the INSERT only if checking query returned 0 rows.
You can really ignore anything higher than that, i added explanation only to clarify situation more.
My question is: Is it really bad for the server if there are many small queries run in a loop, or that doesn't really matter because queries are not that hard for a server? Maybe it really matters and i should for example run one, bigger query and save it into an array or something?
It probably doesn't matter but i am using object oriented setup from there
I am asking mostly to expand my knowledge, because this utility will be used only by one person anyways, so server will keep up even if it is not really efficient.
This is too long for a comment.
Is it a really bad idea? Depends on your definition of bad. In general, multiple such queries are more expensive. And multiple queries introduce more opportunities for race conditions. Doesn't sound like a "good" idea to me.
More importantly, though, is checking for duplicates in the application. You have a database and can use the database to prevent duplicates. This is called a "unique" constraint or a unique index (the former is implemented using the latter). Your question doesn't have enough information to make a concrete suggestion, but that sounds like what you really need.

Would writing my own ecommerce site result in my site most likely getting hacked? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am considering redoing my WordPress website by rewriting myself to get something a little lighter weight. The only problem I see myself getting into is rewriting my WooCommerce section. I certainly don't want anyone getting in danger. I will only be using Paypal but we still have to collect shipping information.
Is it too much of a security risk to write my own online store?
Simple answer: Unless you are an expert, it is generally too risky to write your own anything. Well, you can write stuff, just don't use it or publish it for others to use unless you're damn sure it's secure. Since you're asking, I'm going to assume you're not an expert.
The only problem I see myself getting into is rewriting my WooCommerce section. I certainly don't want anyone getting in danger. I will only be using Paypal but we still have to collect shipping information. Any thoughts?
I can't speak to the security features of WooCommerce, as I've never audited a WooCommerce project as of this writing.
Unless you can do it better than what's available, use what's available. They might have prevented vulnerabilities that you would never even have thought could exist.
However, if you're doing it for your own educational purposes, please do experiment with your own solutions. You might find a better way to implement a feature than what already exists and possibly not realize it.
As long as you make it plain and clear that the code is experimental, and you don't actually deploy it to a production system without getting examined by a security expert, the "don't write your own" advice can be ignored.

is there any profit of using E-commerce PHP Frameworks? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I want to know from a technical view if there is any profit of using E-commerce PHP
frameworks instead of hard coding every single detail in the website.
I see everybuddy talk about using those but is there any real profit (not just because it is more easy it should be done no ?) for now i have a project of a commercial site and i have build-ed from scratch the search engine and the navigation system and some other few things any help please (NO VOTE DOwn PLEASE if this is a bad question one comment and it will vanish).
the good things in E-commerce PHP frameworks is that they are well documented, easy to install, full functionality, less to work as updates and upgrades most of the time.
if you want to build one from scrach you should take a note that it could last several months (depends on the size of the project) and you will never know what bugs you have ... as the only person who knows the backend is you.
there is a profit ... since a new one from scrach takes a lot of time and testing ... and time=money ...
Why don't you test, most of them give out demos and there are a lot of them that are open source ...
e-commerce is more of a pain in the ass than you think at first. you have to make a large order form and build validation and sanitation scripts and spend a lot of time making the layout not look like scrap, encryption and SSL integration and then after all that it needs an admin with way too much to account for. i've done this and ... never again.

searching for a great php overview [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
as the title reads I'd like to find a webpage which presents an overview of the php language cause it's been a little while since I stopped to program server scripts.
By overview I see a page with the basic writing of the language (variable writing and the types, the control flows, some writing recommandations and some common functions about arrays and string manipulation) of course without the explicative text that generally comes with tutorials, I just want to refresh my memory about the basis.
I used google to find my request but not seeing anything like this on the first page.
I prefer asking here cause I trust in the stackoverflow community. If you have a personal page that refers to my wanting feel free to post back
edit: this sheet seems to be fine if you want php get the surface of your brain back
http://www.emezeta.com/weblog/emezeta-php-card-v0.1.png
I would say this:
http://oreilly.com/catalog/phppr/chapter/php_pkt.html
Combined with this:
http://www.addedbytes.com/cheat-sheets/php-cheat-sheet/
One great source to find information is actually stackoverflow. Whatever specific problem you encounter, the answer is sure to be found on this site :)
Good luck, PHP is fun!

Blacklist of words on content to filter message [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
For a website that takes input from kids we need to filter any naughty / bad words that they use when they enter their comments in the website (running PHP).
The comments are a free field and users can enter whatever comments they want. The solution I can think of is to have a words list like
BLACKLIST: bad,bad,word,woord,craap,craaaap, (We can fill this with all the blacklisted words).
Then when the form is saved we can look at the list and if any of the words are present then we will not allow the comment to be saved.
BUT the prolem with this method is that they can get around by adding letters to the words to make it skip the filter EG: shiiiiit
Let me know what you think is the best way to create some filter for these words.
You're never going to be able to filter every permutation. Perhaps the most feasible solution is to filter the obvious, and implement a "Report Abuse" mechanism so someone can manually look over (and reject) suspect comments.
SO you are going to ban shit, shït, shıt, śhit, and śhiŧ?
Blacklisting is not a viable solution in the Unicode age. Yet banning € outright seems excessive.
If you have enough time, it is worthwhile reading about the Scunthorpe problem.
Jeff Atwood also has a post on the futility of obscenity filters.
Thanks to too much php I've found some links which might be a solution for your case:
http://wiki.cdyne.com/wiki/index.php?title=Profanity_Filter
http://www.webpurify.com/
Use uClassify to train bad comments, when the system is trained well enough you can flag the offending comments for moderation.
Also there is always the possibility to filter word like "bass" which of course includes one of the words which is not permitted. At the moment some good moderators seem like the best solution to such a problem.

Categories