Jump to content

tmallen

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tmallen's Achievements

Member

Member (2/5)

0

Reputation

  1. Taking a stab since you didn't really state your requirements...this passes your test at least. <?php function humanize($input){ return preg_replace('/ (?<=[\]})]) # Closing char to the left (?=[A-Za-z]) # Letter to the right /x', ' ', # Insert a space preg_replace('/ (?<=[A-Za-z]) # Letter to the left (?=[[({]) # Opening char to the right /x', ' ', $input) # Insert a space ); } $string = 'test Test TesT test[test] test(test) test[test test] test[test]test'; echo humanize($string);
  2. That's not really a usable recommendation...
  3. If you want to make a cell span more than one column, which is what you said you wanted to do, use the "colspan" attribute: http://www.w3.org/TR/html401/struct/tables.html#adef-colspan This code is inherently wrong because it is outputting HTML in little bits, mixed with programming logic. I suggest you replace this code when you can to make it more accessible to other developers.
  4. I only have experience with one-way encryption in PHP (the md5 and sha1 algorithms), but from what I understand, there are ways of performing two-way encryption (what you want) with the mcrypt library. http://php.net/manual/en/book.mcrypt.php http://www.phpro.org/classes/Two-Way-Encryption-With-PHP-Mcrypt.html
  5. if (true && 2 >1) The (bool) value of each operand, that is, the value of each expression (left and right-hand) when cast as boolean, evaluate to true, so the full "&&" statement evaluates to true. http://www.php.net/manual/en/language.operators.logical.php http://www.php.net/manual/en/language.operators.precedence.php
  6. Does anybody know of a simple, reliable PHP-based URL routing library? I have found two candidates, neither of which meets my requirements: routemap: http://code.google.com/p/routemap/ Horde Routes: http://dev.horde.org/routes/ routemap is too direct: It dispatches directly to static class methods, thus enforcing a structure. Horde Routes do not behave as documented on the website. Note that the returned match array below has no controller set. <?php $map = new Horde_Routes_Mapper(); $map->createRegs(array('test', 'cat', 'dog')); $map->connect(':controller/:action/:id'); var_dump($map->match('/test')); // array with action => 'index' and id => null
  7. ob_get_flush returns the contents of the output buffer. After the clean, shouldn't the include add to the buffer, being the contents of that returned string?
  8. The cache file is created, but it's empty. I can pass in a debug string which is written successfully. <?php function page($name, $params = array(), $cache = false) { if(is_array($params)) { extract($params); } else { $title = $params; } function put_page($name) { ob_start(); include sprintf('pages/%s.php', $name); $content = ob_get_clean(); include 'pages/page.php'; return ob_get_flush(); } if($cache) { $cache_file = sprintf('cache/page/%s.html', $name); if(file_exists($cache_file)) { echo file_get_contents($cache_file); unlink($cache_file); } else { if(!is_dir('cache/page')) { mkdir('cache/page'); } $cached = fopen($cache_file, 'w'); fwrite($cached, put_page($name)); fclose($cached); } } else { put_page($name); } }
  9. In the end, I just had to open 3306 to the other IP (no MySQL setting was required).
  10. Thanks! I had the first parts (grant privileges from the remote IP, point mysql_connect vice versa) but I didn't know about external connection allowance.
  11. I'm working on a multi-server setup, and I have a big problem: How do I make my application server talk to a separate database server? I know that I can't just point mysql_connect to the other IP address. Does anyone know of good resources about configuring each server to talk to the other?
  12. By government sites I mean that they're advertising the sale of government-owned properties (for DC firms) and licensing opportunities. Sort of a gray area, not quite the same as hosting a DOD site; I'd expect the government to provide a secure host in that case.
  13. I tried Linode, and that was a living hell. I'm a web developer, not a server administrator, and while I can set up a nice LAMP stack, I'll be damned if I can pull the same off for DNS, email, FTP, etc. Where's the (affordable) middle ground? Linode is $20-30 a month for a reasonable server, and I pay $13 a month on Hostgator for, most importantly, unlimited bandwidth. This is important because I host a government site there that has several enormous PDFs for download.
  14. So is it more likely that the mail server on my shared host is being abused by a separate party? I use HostGator, and one would expect that a host of that size would by now have solved this problem for their customers, which is why I'm apprehensive to believe so.
  15. I have a simple "contact us" form on my website, and I think it may be used to send spam. Email from my mail server (off of a shared host) is now being rejected by Craigslist, and on occasion (maybe once a month) I get a "viagra!" type of bounceback for an undeliverable message. I've always hard-coded the email address in the mail() call, but I wouldn't be surprised if I'm doing something wrong here. What can I do to audit this? There are a few other contact forms on the same server for two other sites. All of the direct email forms have a hard-coded "to" parameter for mail(), and the two that send an email based on an email form value also write to the database. I checked over the database for these two, and of 120 people who have submitted the form, perhaps ten appear to be junk. So, what's going on, if anything? How can I know? I get this feeling...that my domain name will be blacklisted or has been already, but I'm pretty careful when I use mail(). Of course, I'm no hacker nor a security expert.
×
×
  • 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.