Jump to content

michaellunsford

Members
  • Posts

    1,023
  • Joined

  • Last visited

Everything posted by michaellunsford

  1. update - I ran it form the command line, and it works fine. So, maybe this is caused by something related to apache?
  2. this is weird, this php script worked great on my old server, but the new one reports "unable to open file" but conspicuously absent is the "permission denied" part. I've verified the path four times and made sure the directory has 777 permissions, I've even recursively set the 777 permissions about six times and verified via "ls -l" that they're wide open. I also temporarily turned off PHP safe mode and ran it a few more times without success. Finally, I provided "NULL" in imagejpeg()'s filename field and it dumped out the image (so we know there's one in there). I'm just stumped. Any other ideas? <?php //paths simplified for example $myrow['PHOTO1']="some_random_photo.jpg"; $im=imagecreatefromstring(file_get_contents("/".$myrow['PHOTO1'])); imagejpeg($im,"/thumbs/".$myrow['PHOTO1'],80); ?>
  3. Got it! #menu ul li ul { position:relative; /* changed from absolute to relative */
  4. I've gone through this a dozen times. IE 7 indents the submenu, and it's driving me crazy. I know it's some default style I'm forgetting to reset - but which one? Ugh... ps> works in FireFox, Safari, Opera, Camino, SeaMonkey, Flock, blah blah live example: http://qqad.com @charset "UTF-8"; /* CSS Document */ #menu { background:#69b7c5; height:38px; width:781px; margin:0 auto; font:13px normal Arial, Helvetica, sans-serif; } #menu ul { padding:0; margin:0; cursor:pointer; } #menu ul li { width:110px; float:left; height:30px !important; list-style-type: none; background:#69B7C5; padding-top:4px; padding-bottom:2px; text-align:center; } #menu ul li ul { position:absolute; display:none !important; float:none !important; background:#157e93 !important; border:2px solid #157e93; border-top:none; width:110px; } #menu ul li:hover > ul, ul li ul:hover { display:block !important; } #menu ul li a { text-decoration:none !important; display:block; color:#000 !important; height:30px; } #menu ul li:hover > a, ul li > ul a:hover { background:#157e93; }
  5. @xtopolis yeah, you're right. I must have confused it with mysql_fetch_row. Where's the unpost button?
  6. I'm not seeing any weird character. I did something like this once. I measured to the last space before the length limit and broke the lines into an array. Then cycled through the array, "printing" one line at a time. Unfortunately, I think the actual code is on a backup DVD someplace, and not close at hand.
  7. mysql_fetch_array will return $row[0],$row[1],$row[2], etc. If you want $row['userid'] you'll need to call mysql_fetch_assoc() instead. It's the same with $row1['phone'] and ['provider'].
  8. nope, but javascript does: http://www.w3schools.com/jsref/jsref_onunload.asp
  9. sorry, that $newim line should have 'name' instead of 'tmp_name'
  10. I wrote this a few years back - still use it for resizing images: <?php ini_set("memory_limit","128M"); //optional - I find it useful if you're expecting really big files to be uploaded function resize_image($func_im,$width,$height) { if(imagesx($func_im)>imagesy($func_im)) { if(imagesx($func_im)<=$width) { $func_newim=imagecreatetruecolor(imagesx($func_im),imagesy($func_im)); imagecopy($func_newim,$func_im,0,0,0,0,imagesx($func_im),imagesy($func_im)); } else { $func_newim=imagecreatetruecolor($width,((imagesy($func_im)/imagesx($func_im))*$width)); imagecopyresampled($func_newim,$func_im,0,0,0,0,$width,((imagesy($func_im)/imagesx($func_im))*$width),imagesx($func_im),imagesy($func_im)); } } else { if(imagesy($func_im)<=$height) { $func_newim=imagecreatetruecolor(imagesx($func_im),imagesy($func_im)); imagecopy($func_newim,$func_im,0,0,0,0,imagesx($func_im),imagesy($func_im)); } else { $func_newim=imagecreatetruecolor(((imagesx($func_im)/imagesy($func_im))*$height),$height); imagecopyresampled($func_newim,$func_im,0,0,0,0,((imagesx($func_im)/imagesy($func_im))*$height),$height,imagesx($func_im),imagesy($func_im)); } } return($func_newim); } //function ends - here's how I call it: do { if((key($_FILES)!="") AND (strlen(file_get_contents($_FILES[key($_FILES)]['tmp_name'])))) { $im=imagecreatefromstring(file_get_contents($_FILES[key($_FILES)]['tmp_name'])); $newim=resize_image($im,300,240); $thumb=resize_image($im,75,75); imagejpeg($thumb,"/full/path/to/file/".$_FILES[key($_FILES)]['name'],90); imagejpeg($newim,"/full/path/to/file/".$_FILES[key($_FILES)]['tmp_name'],90); } }while(each($_FILES)); ?>
  11. I added "sql_mode = IGNORE_SPACE" to the my.cnf and restarted mysql, but the query "SELECT @@GLOBAL.sql_mode;" still coming back with a blank record.
  12. the sql query simply returns a blank record. Neither server has a "sql-mode" setting in the my.cnf.
  13. You're going to have to tell me how to do that. Is it in a table?
  14. check my body tag - there's an onmousemove that calls a function. It's also tied to a few other functions, copy them all to your javascript and you should be good to go.
  15. Well, for one, you didn't close your popGoAway() function. Also, you'll need to layout the page using CSS to make it appear properly. here's the CSS used on the example page .reader_photo { width:80px; height:80px; float:left; padding:5px; background:#a7def0; border:3px solid #0eb8f0; margin:25px; text-align:center; } I'd encourage you to use Firefox and install the firebug and web developer add-ons. These can help you to with figuring out the client side of things - like javascript errors.
  16. http://us2.php.net/curl_exec $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "google.com?0=name"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $curl_res = curl_exec($ch); curl_close($ch); results stored in $curl_res variable.
  17. by the way, I have a typo, flclose should be fclose. Considering you didn't get an error, I'm thinking you might have error reporting turned off. http://us.php.net/manual/en/function.error-reporting.php Add that to the top of the code and add an echo as well. It should present you with your filename on success -- or it should whine if it fails. <?php error_reporting(E_ALL); do { $fp=fopen('upload.xml','a+'); fwrite($fp,$_FILES[key($_FILES)]['name']); fclose($fp); echo $_FILES[key($_FILES)]['name'])."<br />\r\n"; } while(each($_FILES)); ?>
  18. Seriously, dude, the PHP has little to do with what you're trying to do. The layout is an attached CSS stylesheet, the mouseover code is an attached javascript file; all of which is publicly accessible via your browser's "view source" function. Since you're convinced there's some magic in the PHP, here's exactly what every bit of PHP on that page does; it should look quite familiar. <div id="reader_photos"> <?php $query="SELECT * FROM `table`"; $result=mysql_query($query); while($get_row=mysql_fetch_assoc($result)) { echo "\r\n\t<div class=\"reader_photo\">"; echo "\r\n\t\t<img src=\"/thumbs/".$get_row['filename']."\" alt=\"".$get_row['filename']."\" onmouseover=\"popPreview('".$get_row['filename']."');\" onmouseout=\"popGoAway();\" />"; echo "\r\n\t</div>"; } } ?> </div> <div id="preview_window"></div>
  19. PFMaBiSmAd spelled it out for you: the "From: $email" is probably being blocked by the mail server because it doesn't allow relaying. Use "Reply-to: $email" instead. Also, I'd validate that the provided email address is a real email address and doesn't include an exploit that hackers can use to send spam. <?php $emailFilter="/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i"; if(preg_match($emailFilter,$email) mail( "me@site.com", "Subject: $subject", $message, "Reply-to: $email"); else echo "error with email address." ?>
  20. There's only one $_FILES['Filedata']['name'] - you'd need to break it up. Here's how I'd do it <?php do { $fp=fopen('upload.xml','a+'); fwrite($fp,$_FILES[key($_FILES)]['name']); flclose($fp); } while(each($_FILES)); ?>
  21. reveal code on that page and you'll see the same stuff all over this forum thread.
  22. Yeah, just checked that. no spaces. sorry for the delayed response - it's been a really long day.
  23. Here's a functional example you can look at. http://theadvertiser.com/cruzzers Remember, just because it doesn't have whatever little piece you want doesn't mean you throw the whole thing away. Take what works, add what you need and move on.
×
×
  • 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.