Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. you don't need a for loop, just a variable you increment each time you fetch a row.
  2. Did you try and install the mysql command line client on your home machine, and connect to the remote database? mysql -u user -p -h youripaddress
  3. Yes it does work on Windows OS's. GD is one of many extensions, and is in fact a c library that has been interfaced to php. In other words, you need to install GD for it to work with PHP, and the instructions for doing that is of course different. The php manual covers these sorts of things very well in my experience.
  4. If the operand is not an arrray, then you're going to have an issue with foreach. Under certain circumstances your $_POST['move'] probably either doesn't exist at all or isn't an array. My recommendation for a quick examination of this is to use print_r() on the $_POST['move'] variable to understand what's happening better.
  5. There's no good solution to the issue of phrases, nor for that matter, simple variations to get around the filter. My suggestion would be to simply focus on the extreme vulgarity.
  6. It sounds like you are best off looking into using a commercial mailing list service. http://www.google.com/Top/Computers/Internet/E-mail/Mailing_Lists/Hosted_Services/
  7. Well lookie at that, while I was typing Daniel did the same thing, but even more elegantly.
  8. I agree with proud that regex is the way to go, What he has provided is powered by the "\b" metacharacter, which in regex matches a "word boundary". The basic regex that does the work, is actually "\b$var\b". If you haven't used the preg_ functions before, you need to wrap the string in a begin and end character, which in his example is the "/" character. The last "i" character is a modifier that basically says: match case insensitively. If you want to retain the strategy of your function, rather than doing replacements, this is probably closer to what you want to do: function check_porn_terms($input){ $porn_terms = array("porn", "sex", "tits", "cock", "penis", "vagina", "pussy", "itakeithard", "hard_cock", "really_hard_cock", "suckmydickbitch", "fuck"); //add terms here $porn_regex = array(); foreach ($porn_terms as $term) { $porn_regex[] = '\b' . $term . '\b'; } $porn_regex = '/' . implode('|', $porn_regex) . '/i'; if (preg_match($porn_regex, $input)) { // A bad word found return false; } else { // String ok return true; } } Note: didn't check that this code actually works In this case I make one big regex string and only invoke the regex library once, rather than invoking it for every single bad word in your list as was done in proud's snippet. My guess is that this will be more efficient, although if you want a search/replace feature, proud's is the way to go.
  9. You need a LEFT OUTER JOIN. Something like this may work SELECT c.* FROM Clients c LEFT JOIN (Claims cl) ON (cl.ClientId = c.ID AND cl.ClientId IS NULL)
  10. Well, it sounds like your webpage is not utilizing the UTF-8 characters set, but rather has fallen back to something like 8859-1. This is causing the site to convert input into html entities. Hence you are getting the html entity rather than the real utf-8 character stored in your database. You can test this quickly by setting the header: header('Content-Type:text/html; charset=UTF-8'); Does this fix the problem? Ultimately the default character set can also be set in the php.ini.
  11. Is your database ever going to be large? Are you aware that when you do LIKE '%SOMETHING%' MySQL will table scan? Using Regex functions to accomplish the same thing will also table scan. It's just not a great approach for full text searching. MySQL does have the Fulltext index type. My suggestion would be to use the fulltext index type, and as you fetch each row in the result: 1. Make a copy of the data column(s) variables, use preg_replace to remove any URL's from the copy of the data. 2. Use strpos on the url eliminated data, and if you get a match on any of the words in the search phrase, return the row, otherwise exclude it. If you do match, you want to return the original data, so that you don't improperly filter out url's.
  12. No, the support of https is simply via software. Certainly if they care about security, then the entry of passwords should be done over https. Do some reading about packet sniffing, to understand more about the reason for SSL.
  13. gizmola

    Empty pages

    I don't understand your question. The pages gets buffered and if there are queries, it already won't display until it has data, however there are limits and if things timeout, you may get things that are broken. It seems like you're looking for a way around trying to actually figure out what your issue is. There's nothing simpler and more effective initially than the two suggestions I gave you. *Not* looking into those is like putting your head in the sand.
  14. I thought the same thing.. turns out, it's simply recursive, so while the first P represents PHP, it is not a representation of Personal Home Page - if that's what you meant). I was trying to dig up a thread that delved into this topic once... (oh, found it). That's all revisionist BS. It was indeed named for Personal Home Page. I was working in the web dev business at the time, and knew some of the early PHP contributors. I'm not sure why they're ashamed of the name these days -- guess they think it went out of fashion.
  15. Since there's so much that's improved there, I'd suggest you guys focus on the upgrade and see if that fixes the problem.
  16. There's no comparison. Javascript runs on the client. jQuery is a great javascript client library that makes all sorts of neat clientside tricks possible. PHP by comparison is a server side language. PHP code resides on the server, and runs on it. It's goal is work with the webserver to accomplish things programmatically and pass web pages back to the client. These pages can certainly include javascript and often do. ZF is an application framework and library for PHP version 5 that includes all sorts of goodness to help developers create their PHP applications. They even include integration that makes using jQuery in your applications easy to accomplish. One of the often mentioned benefits of a framework is that it implements proven design patterns like MVC, which can make your application more reliable, secure and easy to maintain and extend.
  17. gizmola

    Empty pages

    You want to see the error log which is typically the apache error log. Usually it's in /var/log/httpd/. Assuming this is a vhost the log name gets configured by the person who sets up the server. On the mysql side you want to have the slow query log turned on, and see if there are issues there. In regards to network latency, anything is possible but you'd have to rule out a lot of other issues, and I'd expect you'd see some sort of error in the error logs.
  18. Ok, I think i understand what these tables represent. The various columns contain the inventory for each? Ultimately, there is nothing in SQL that will let you bring this all together in a good way, because the design of these tables is relationally unsound. with that said, if you outer join from productInfo to all the other tables, you will get a row that has all the columns of all the tables. There will however, only be non Null values in the columns of the one table that has a corresponding match to the productInfo.productId column. Although you didn't say, I'll assume that you are using mysql: SELECT pi.*, ss.*, ws.* FROM productInfo pi LEFT JOIN shoeSize ss ON (pi.productId = ss.ProductId AND pi.productId = 13) LEFT JOIN womensize ws ON (pi.productId = ws.ProductId)
  19. Can you provide the schema for the tables and some sample data from each?
  20. Many projects continue to use smarty. It hasn't changed much because it's been relatively stable. Some people love smarty and others hate it. At the end of the day the goal of smarty is to seperate the markup related code from program logic, as well as adding in page caching. It should be pointed out that at the time, smarty only addressed the markup side of the issue, and left the rest of it to be solved by others. Now there are any number of mature php frameworks out there that have a complete top to bottom solution to the problem. Smarty can be used with newer frameworks. I worked on a project recently where Zend framework was used for the server side code, while the UI/frontend was all done with smarty templates. Ultimately it was my opinion that the templates ended up with way too much business logic in them, but it certainly worked acceptably. If you already know smarty very well and are productive in it, then it continues to be a viable option. With that said, I think it's rather long in the tooth at this point, and would prefer something that was native to whatever framework I was working in, so long as those frameworks provided at least as much seperation and functionality as well as the same caching capabilities. Caching is certainly important in a lot of high traffic scenarios.
  21. What is your mta? Is phpmailer sending email directly?
  22. An abstract class is not an option. An abstract class is basically a skeleton for a derived class. You can't directly instantiate an abstract class. It does sound like you want a singleton pattern. You can do this either by creating it statically or instantiating an object that enforces the singleton pattern. I don't think it matters too much which you utilize. With that said, MVC is a very popular pattern, and if you were to pursue an MVC pattern, then there would be very little reason to create something like that, since your queries would live in the models and be tightly bound the the related data.
  23. This is what mrtg is for. You should be able to meter the individual usage for each of the vhosts -- they will after all, each require one or more IP addresses, that you will assign, and the Host whether it be Xen or Virtuozzo or whatever, can be setup to keep track of bandwidth usage. At that point it simply is a matter of deciding how you want to prices bandwidth for your clients.
×
×
  • 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.