Jump to content

hansford

Members
  • Posts

    562
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by hansford

  1. error: I mean change [$i] to [$error] lol
  2. The problem is a syntax error here: $messageSend == "true"; should be $messageSend = "true";
  3. your using an $i variable which is usually associated with a for loop. the foreach loop is grabbing an associative value $myarray = array('a' => 'apple', 'b' => 'bobbing', 'c' => 'cats'); foreach($myarray as $key=>$value) { echo "<br> $key . " " . $value <br>"; } results: a apple b bobbing c cats
  4. this will just reload the page, but any and all info will be lost if(ins==3) window.location.href="http://www.yourdomain.com/thispage.html";
  5. you need to find this part of the code in the upload file page: Right after this is where you add the code. if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { --------------------------------------- This will create a thumbnail image, however you will need to edit $thumbpath so that it points to your directory where the thunbnails reside. This will not add anything to your DB. The thumbnail will be the same name as the original, but reside in a differnet folder. The thumbnail is only set for 100px wide with proportional height. If you want a differnet size, this will have to be edited as well. --------------------------------------------- $imgpath = $image; $thumbpath = $_SERVER['DOCUMENT_ROOT'] . "/thumbs/" . $_FILES['uploaded']['name']; $img = imagecreatefromjpeg($imgpath); list($imgwidth,$imgheight) = getimagesize($imgpath); //edit this section to change image width,height $flagwidth = 100; $percent = round(($flagwidth/$imgwidth) * 100) * .01; $newimgwidth = $imgwidth * $percent; $newimgheight = $imgheight * $percent; //end section $newimage = imagecreatetruecolor($newimgwidth, $newimgheight); imagecopyresampled($newimage, $img,0,0,0,0,$newimgwidth, $newimgheight, $imgwidth, $imgheight); imagejpeg($newimage, $thumbpath,100);
  6. for($i = 0; $i< sizeof(phpfreak_members); $i++){ if(phpfreak_members[$i] == 'phpscott'){ phpfreak_members[$i] = NULL; break; } }
  7. anything is possible. <?php echo "<script type='text/javascript'>"; echo "window.open('php121/php121im.php','name','height=500,width=240,left=20,top=20,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no');"; echo "</script>"; ?>
  8. You're killing me Chris. Post any and all relevent code and people will be glad to assist.
  9. function info($num){ $name = "Hello, my name is " . $this->$name[$num]; $age = "and I am " . $this->$name[$num] . " year's old"; $this->group = array("1","2","3","4","5"); }
  10. thats why Ben has all of them stars after his name
  11. the mail function in php is error prone and a security risk. Most people use something like http://phpmailer.codeworxtech.com/ there are features to send to multiple recipients
  12. class info{ var $name = array(); var $age = array(); var $group;
  13. I'm not understanding the question. I get that you want to put this into a function - do you want to pass it an argument -of what directory the image is in. You can't echo anything into a URL unless you wrote the URL Can you please be more specific
  14. sure there are. http://www.hscripts.com/scripts/php/visitorTracking.php just google: php visitor tracking to DB. Of course you have to modify them to suit your needs. Then after countless hours of sifting through someone elses code you wonder why you just didn't go ahead and write the thing yourself.
  15. Yeah DB is the best way. That way you can do your querys for logins, check IP's to see if they had been there before etc..
  16. You can right click in the main window to get src code and in the iframe to get that code. Same scroller, just tweaked. http://www.modernterrain.com/scroller/reworked_scoller.html
  17. The former commenter is correct. A page needs time to load. when you put the alert in there it gives it that extra time needed to run the onload event. if this function needs to run before the window.location then just call the function before.
  18. ok great. now we have the $description array I don't know how you want to iterate through it but if its consecutive we can just grab the first key and then move the pointer to the second and so on foreach($files as $file) { if($colCtr %$cols == 0) $descript = current($description); echo '</tr><tr><td colspan="' . $cols . '"><hr /></td></tr><tr>'; $allfiles .= $file . ',<br />'; echo '<td align="center"><a href="' . $images . $big . $file . '"><img width="300px" src="' . $images . $file . '" /></a><br />' . $descript . '</td>'; $colCtr++; next($description); }
  19. in this piece of your code I don't understand what is getting exploded. $line doesn't get defined until after explode(). Please explain while(!feof($fh)) { $temp = explode(",", $line); $description[$temp[0]] = $temp[1]; $line=fgets($fh); unset($temp); }
  20. $str = "abc-123-78ab-w"; $array1 = explode("-", $str); $array1[0] = 'abc' $array1[1] = '123' $array1[2] = '78ab' $array1[3] = 'w'
  21. Forget my previous post. I tried to write it off the top of my head without testing - it is buggy. This one I tested. the $flag variable sets the thumbnail width and based off that the height will be set so the thumb looks proportional. The script works for jpegs, but you can add if/else conditions to allow it to create any other image format. ------------------------------------------------------ <?php if(isset($_FILES['upfile'])) { $uploaddir1 = $_SERVER['DOCUMENT_ROOT'] ."/uploads/"; $uploadfile1 = $uploaddir1 . $_FILES['upfile']['name']; $upload = $_FILES['upfile']['tmp_name']; if(file_exists($_FILES['upfile']['tmp_name'])) { $err = move_uploaded_file($upload, $uploadfile1); if($err == FALSE){ echo "File upload failed"; exit(); } $imgpath = $uploadfile1; $thumbpath = $uploaddir1 . "/thumbs/" . $_FILES['upfile']['name']; $img = imagecreatefromjpeg($imgpath); list($imgwidth,$imgheight) = getimagesize($imgpath); echo $imgwidth . "<br>"; $flagwidth = 100; $percent = round(($flagwidth/$imgwidth) * 100) * .01; $newimgwidth = $imgwidth * $percent; $newimgheight = $imgheight * $percent; $newimgheight = $imgheight * $percent; $newimage = imagecreatetruecolor($newimgwidth, $newimgheight); imagecopyresampled($newimage, $img,0,0,0,0,$newimgwidth, $newimgheight, $imgwidth, $imgheight); imagejpeg($newimage, $thumbpath,100); $im = imagecreatefromjpeg($thumbpath); } } ?>
  22. this if for a jpeg but you can do if/else statements for other image file s if(isset($_FILES['upfile'])) { $uploaddir1 = $_SERVER['DOCUMENT_ROOT'] ."/uploads/"; $uploadfile1 = $uploaddir1 . $_FILES['upfile']['name']; $upload = $_FILES['upfile']['tmp_name']; if(file_exists($_FILES['upfile']['tmp_name'])) { $err = move_uploaded_file($upload, $uploadfile1); if($err == FALSE){ echo "File upload success"; } else{ echo "Failed"; } } } $imgpath = $uploadfile1; $thumbpath = $uploaddir1 . "/thumbs/" . $_FILES['upfile']['name']; $img = imagecreatefromjpeg($imgpath); $percent = 0.20; list($imgwidth,$imgheight) = getimagesize($imgpath); if($imgwidth > $imgheight){ $newimgwidth = 100; $newimgheight = (100/$width) * $imgheight; } else { $newimgheight = 100; $newimgwidth = (100/$imgheight) * $imgwidth; } $newimgheight = $imgheight * $percent; $newimage = imagecreatetruecolor($newimgwidth, $newimgheight); imagecopyresampled($newimage, $img,0,0,0,0,$newimgwidth, $newimgheight, $imgwidth, $imgheight); imagejpeg($newimage, $thumbpath,100); $im = imagecreatefromjpeg($thumbpath);
  23. yes, you can name the files whatever you want.
×
×
  • 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.