Jump to content

cmgmyr

Members
  • Posts

    1,278
  • Joined

  • Last visited

    Never

Everything posted by cmgmyr

  1. it would be for the user so when user 1 enters zip 13903 and reloads the page 5 times...it only enters it once now user 2 goes and enters 13903...now since it it s different user...it gets inserted
  2. if you have a user id in the table that is associated with the zip before you do the insert you can see if there are any records where the user and the zip are the same as that wants to do the insert. So: 1. Do select statement 2. count rows 3. if($count == 0){ //Insert statement } And you are done. So they can reload the page as much as they want and it will only insert once
  3. 1. (and only one) when you think you have learned something about them they change...and you are wrong again.
  4. yeah i actually did that last night and thought it was pretty funny
  5. try http://www.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart
  6. I just made a new thumb code with a few less things and it worked...o well
  7. re-uploaded a few images to a smaller file size...still nothing
  8. thanks for the help and thank about the site
  9. hmm...i'll resize them in photoshop and re-upload them with a lower file size and see if it works...
  10. I had it out before and that's what froze it up
  11. yes i already change it to _get and it still didn't work...I copied the whole code over again and it still didn't work
  12. i just updated it...still didn't work
  13. hmmm, the gd library looks like it's working...any other ideas?
  14. ...yes It's something like this: <img src="thumb.php?src=images/cms_images/<?php echo $image ?>" /> The script works in php4 and not php5
  15. if you are using a database you can do something like: SELECT max(price) as highest, min(price) as lowest FROM table
  16. Hey Guys, This is my script that I use for image resizing. I have a client on php5 and now i'm just getting those little red x's. He does have GD library and it is running. What do I need to change in order for it to work? <?php header("Content-type: image/jpeg"); $source = imagecreatefromjpeg($src); $orig_w=imagesx($source); $orig_h=imagesy($source); //See if there is a different height and width if(!$_GET['wmax']){ $wmax=100; } if(!$_GET['hmax']){ $hmax=100; } $quality=90; $bgcol=000000; if ($orig_w>$wmax || $orig_h>$hmax) { $thumb_w=$wmax; $thumb_h=$hmax; if ($thumb_w/$orig_w*$orig_h>$thumb_h) $thumb_w=round($thumb_h*$orig_w/$orig_h); else $thumb_h=round($thumb_w*$orig_h/$orig_w); } else { $thumb_w=$orig_w; $thumb_h=$orig_h; } if (!@$bgcol) { $thumb=imagecreatetruecolor($thumb_w,$thumb_h); imagecopyresampled($thumb,$source, 0,0,0,0,$thumb_w,$thumb_h,$orig_w,$orig_h); } else { $thumb=imagecreatetruecolor($wmax,$hmax); imagefilledrectangle($thumb,0,0,$wmax-1,$hmax-1,intval($bgcol,16)); imagecopyresampled($thumb,$source, round(($wmax-$thumb_w)/2),round(($hmax-$thumb_h)/2), 0,0,$thumb_w,$thumb_h,$orig_w,$orig_h); } if (!@$quality) $quality=90; imagejpeg($thumb,"",$quality); imagedestroy($thumb); ?> Thanks, -Chris
  17. Yes, for internal stuff like that you need to use padding...not margin (like lando said)
  18. Hey guys, thanks for the help. What I did is just at another statement for php5 ... to do nothing. When I uploaded it everything worked great. Here it is: <?php $phpver = phpversion(); if ($phpver < '4.1.0') { $_GET = $HTTP_GET_VARS; $_POST = $HTTP_POST_VARS; $_SERVER = $HTTP_SERVER_VARS; } if($phpver > '5.0'){ //Do nothing } else if ($phpver >= '4.0.4pl1' && strstr($_SERVER["HTTP_USER_AGENT"],'compatible')) { if (extension_loaded('zlib')) { ob_end_clean(); ob_start('ob_gzhandler'); } } else if ($phpver > '4.0') { if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) { if (extension_loaded('zlib')) { $do_gzip_compress = TRUE; ob_start(array('ob_gzhandler',5)); ob_implicit_flush(0); } } } $phpver = explode(".", $phpver); $phpver = "$phpver[0]$phpver[1]"; if ($phpver >= 41) { $PHP_SELF = $_SERVER['PHP_SELF']; } if (!ini_get("register_globals")) { import_request_variables('GPC'); } ?> Is this right? (it works )
  19. *bump* anyone?
  20. Ok here is what I have right now: <?php $phpver = phpversion(); if ($phpver < '4.1.0') { $_GET = $HTTP_GET_VARS; $_POST = $HTTP_POST_VARS; $_SERVER = $HTTP_SERVER_VARS; } if ($phpver >= '4.0.4pl1' && strstr($_SERVER["HTTP_USER_AGENT"],'compatible')) { if (extension_loaded('zlib')) { ob_end_clean(); ob_start('ob_gzhandler'); } } else if ($phpver > '4.0') { if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) { if (extension_loaded('zlib')) { $do_gzip_compress = TRUE; ob_start(array('ob_gzhandler',5)); ob_implicit_flush(0); } } } $phpver = explode(".", $phpver); $phpver = "$phpver[0]$phpver[1]"; if ($phpver >= 41) { $PHP_SELF = $_SERVER['PHP_SELF']; } if (!ini_get("register_globals")) { import_request_variables('GPC'); } ?> Right now I have a client with php 5.1.6 and currently this script makes it freeze up. How can I make this compatable with PHP 5? Thanks, -Chris
  21. *bump* anyone?
  22. sounds like you have to slice it
  23. I'm making a "Hot or Not" site for one of my clients and I was just thinking about the rating system. How would the best way to handle a LOT of ratings and averages? Option 1: List everything in one big table. (id, userid, rating) then when a query is made it has to scan through all of this and get the average. Option 2: Use same table as above but add a "master" ratings table. (userid, total_rating, total_count) So that when I only have 1 row to query instead of 10,000+... The reason why I want to keep the one big table is to keep track of who voted and what they rated but I know if I just kept this one only eventually it will slow everything down. I'm kind of leaning toward option 2, but that means that I would have to do and insert/update twice. So...do you forsee any problems with using option 2? Do you have any other suggestions? Thanks, -Chris
×
×
  • 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.