Jump to content

section31

Members
  • Content Count

    335
  • Joined

  • Last visited

Everything posted by section31

  1. Thanks David. Your first method will do nicely. Thanks.
  2. I have some issues with modrewrite and the ampersand. I encoded the ampersand to %26, but it doesn't seem to work. View the following php scripts to replicate the issue. Using Simple Get Request http://section31.us/temp/modrewrite/get.php?foo=a%26b >prints Array ( [foo] => a&b ) Using Mod Rewrite (RewriteRule ^foo/(.*) get.php?foo=$1) http://section31.us/temp/modrewrite/foo/a%26b >prints Array ( [foo] => a [b] => ) Anyone have any experience using an ampersand with mod rewrite.
  3. Hm, now I can't seem to send any type of email to hotmail without it being filtered as spam. I've tried doing a very basic email using mail(), then I tried using php mail classes like PHP Mailer and Richard Heyes Mail Class. All emails are being put in the junk email. Any ideas? Has anyone had success with this?
  4. Ok, I was trying to break the habit of using the mail() function and instead start using pear's mail library so I can authenticate myself and I won't have to send as "nobody". Well, I wrote a sample script and had it send 3 emails, one for each of the largest free email providers. One to gmail, yahoo, and hotmail. All of them go through fine except hotmail. It doesn't throw it in the junk mail, it just doesn't get delivered. I've tried this on 2 servers, one on tch and also on another host. Same results...Any Ideas? If someone wants to try it out, that would be great. Here is the snippet of code to get you going. http://section31.us/scripts/test/smtp/hotmail.wth.phps ><? error_reporting(E_ALL); include('Mail.php'); $headers['From'] = 'name <user@yourdomain.tld>'; // put your name and email here $headers['Subject'] = 'Testing SMTP Mail'; $body = 'This is a plain text body message.'; $params['auth'] = true; $params['host'] = 'localhost'; $params['username'] = 'user@yourdomain.tld'; // put your username here which is your email address $params['password'] = 'pass'; // pur your pass here $params["persist"] = true; $mail_object =& Mail::factory('smtp', $params); foreach (array('user@hotmail.com', 'user@yahoo.com', 'user@gmail.com') as $to) { // put your emails here $headers['To'] = $to; $mail_object->send($to, $headers, $body); echo "Email sent to $to!<br />"; } ?>
  5. nevermind, it was my fault. I was using an email forwarder and hadn't set up a proper inbox for that email... LOL sorry.
  6. When I send out an email with php's mail() function and I add the 5th parameter to specify the return path to on my valid email address ex. admin@****, is the email suppose to bounce back to that address if it fails to send it. I just tried doing that, and I can't get it to bounce back.
  7. Hi guys, does anyone happen to know a script that can do the exact same thing cpanel does when you go into subdomain stats and click on latest visitors. It gives you like some type of path analysis to show you how the client navigated your site. Here is a screenshot from cpanel. Even the exact same script in perl or php would be great.
  8. so did you fix it because it seems to be working on my end.
  9. Why is it that error_reporting(E_ALL) doesn't report all errors, yet using that .htaccess file does?
  10. Yeah, i don't really understand why the '2>&1' made the difference and not the z flag. My files did have spaces in them, but that -print0 and xargs -0 fixed that problem.
  11. Hey david, It appears the 2>&1 fixed the problem, but now I figured out a way without it. So, here is the final solution to my goal for the record. ># Works with spaces in filenames/directorys too find './foobarDir/' -iregex '.*\.\(jpg\|jpeg\)' -maxdepth 1 -print0 | xargs -0 tar -cvzf backup.tar.gz Thanks you two for being so patient with me.
  12. Indeed it would do it recursively. I have it set to maxdepth 1 because I don't want it to archive recursively.
  13. I took off the trailing slash and no change. This is whats returned, so there isn't much to work with. Is there a way I can force out more error codes or something. I'm going to start weeping if we don't figure this out. >exec($cmd, $output, $returnCode); echo '<pre>' , print_r($output, true) , "\nReturn Code - " , $returnCode , '</pre>'; The above returns this Array ( ) Return Code - 2 NOTE: in case you need a link to exec() http://us3.php.net/function.exec
  14. Sorry I took so long for the reply. Yeah, I tried using the find first and I get the identical results as the other method. It works when I use find . but doesn't work when I use find ./someDir/. You mean something like this right? >find . -iregex '.*\.\(jpg\|jpeg\)' -maxdepth 1 | xargs tar -cvf backup.tar.gz
  15. Tried that bruce, and I got the same results an empty archive. I double checked what find returns and the results were correct either way, you're way or my way. This is odd behavior isn't it?
  16. i've been trying to troubleshoot this for a long time now and I can't figure it out :cry: I was hoping to see if anyone had problems like this? Purpose: To make a gzipped tarball of a subdirectory. Please look at the 2nd bit of code, thats where the problem is. Whenever I change the path of the find directory, it doesn't work properly even after I checked the find's results and they are correct. The problem happens when making the tar.gz, like stated below it creates an empty archive instead. ><?php /* This Works Fine */ /* finds any jpg or jpegs in the current working directory and makes a gzip tarball of it. */ $cmd = "tar -cvf backup.tar.gz `find . -iregex '.*\.\(jpg\|jpeg\)' -maxdepth 1`"; exec($cmd, $output, $returnCodes); /* This Does Not Work, it puts an emtpy gzip tarball thats app. 10k in the directory */ /* The only thing thats diff here is i change the find to look in a subdirectory */ $cmd = "tar -cvf backup.tar.gz `find './foobarDir/' -iregex '.*\.\(jpg\|jpeg\)' -maxdepth 1`"; exec($cmd, $output, $returnCodes); ?>
  17. Ok, I figured it out. In case anybody wants to use it someday. ><? // Makes thumbnails to a fixed size and uses padding to keep aspect ratio. // email section31 at gmail to report bugs or improvements. :) function makeThumb($file) { $dstWidth = 80; $dstHeight = 120; list(, , $type, ) = getimagesize($file); //1 = GIF, 2 = JPG, 3 = PNG if ($type == 2) $handle = @imagecreatefromjpeg($file); elseif ($type == 3) $handle = @imagecreatefrompng($file); elseif ($type == 1) $handle = @imagecreatefromgif($file); elseif (!$handle) return false; else return false; $srcWidth = @imagesx($handle); $srcHeight = @imagesy($handle); if ($srcWidth >= $dstWidth && $srcHeight >= $dstHeight) { $newHandle = @imagecreatetruecolor($dstWidth, $dstHeight); if ($srcWidth/$srcHeight > $dstWidth / $dstHeight) { $thumbwidth = $dstWidth; $thumbheight = round( ($thumbwidth / $srcWidth) * $srcHeight ); $xOffset = 0; $yOffset = round(($dstHeight - $thumbheight) / 2); } else { $thumbheight = $dstHeight; $thumbwidth = round( ($thumbheight / $srcHeight) * $srcWidth ); $xOffset = round(($dstWidth - $thumbwidth) / 2); $yOffset = 0; } // Fill background with RGB Color ex. 255, 0, 0 equales RED $background = imageColorAllocate($newHandle, 0, 0, 0); imagefilledrectangle($newHandle, 0, 0, $dstWidth, $dstHeight, $background); if (!@imagecopyresampled($newHandle, $handle, $xOffset, $yOffset, 0, 0, $thumbwidth, $thumbheight, $srcWidth, $srcHeight)) return false; @imagedestroy($handle); if ($type == 3) @imagepng($newHandle, $file); elseif ($type == 2) @imagejpeg($newHandle, $file, 90); elseif ($type == 1) @imagegif($newHandle, $file); else return false; @imagedestroy($newHandle); return true; } else return false; } ?>
  18. Does anyone happen to have a function using GD to create thumbnails while maintaining their proportions and padded to a fixed resolution? Any of the above opensource scripts happen to do that?
  19. If you aren't going to be accessing tables from the other databases, I'd keep them seperate. It makes things a whole lot easier when backing up, restoring, etc.
  20. thanks for the reply david. Yeah, I don't think i'll ever be using ob_start again for storing stuff to a variable for later use. Its just I've come across all these contradicting sites doing things different ways that claim to be more efficient and I have this urge to find the most appropriate way of doing something. I don't really like just taking their word for it, so I benchmark it myself.
  21. In case anyone is actually interested in this stuff, I'm going to continue my own debate on this issue.l I think i might have made a mistake on my previous code. Granted that article explicitely states that using obstart is faster than concatenating multiple small strings but now my benchmarks contradict that. http://section31.us/scripts/benchmarks/bench.php http://section31.us/scripts/benchmarks/bench.phps For some reason on the code I used before, the string i used wasn't the same length....lol I've tested both of these using ab and have confirmed the results. Now i'm really confused, just when I thought it was all becoming clear to me.
  22. You nailed it david... Thanks and I will notify the techs.
×
×
  • Create New...