Jump to content

jakebur01

Members
  • Posts

    885
  • Joined

  • Last visited

Everything posted by jakebur01

  1. when i try to do -2, -3, -4 and so on... it works but if i just try -1 it shows the current month echo date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
  2. I have an error on the gif resizer: Fatal error: Class 'Imagick' not found
  3. Does anyone have any ideas on what might be causing this?
  4. Now it is not resizing the original image. I have $max_image_width=400; $max_image_height=300; set in the config file.
  5. Got it~ Thank you much! $img1_size=$_FILES['img1_name']['size']; $img1_name=$_FILES['img1_name']['name']; $img1_type=$_FILES['img1_name']['type']; $img1=$_FILES['img1_name']['tmp_name']; $img1_error=$_FILES['img1_name']['error'];
  6. I tried this: $img1_name=$_FILES['img1_name']['size']; $img1_name.=$_FILES['img1_name']['name']; $img1_name.=$_FILES['img1_name']['type']; $img1_name.=$_FILES['img1_name']['tmp_name']; $img1_name.=$_FILES['img1_name']['error']; But,.... I get this: Error: .jpg or .gif File Types Only Please
  7. This is what I was looking for. How can I store all of these into the $img1_name variable?
  8. I have tried all three extensions. I think the problem may be that I am not properly posting the file to the page. I am currently using: $img1_name = $_FILES['img1_name'];
  9. I doubt that. The jpeg I was trying to upload is 8kb.
  10. Hello, I just moved my image uploader script from a windows server to linux. Somehow I guess php was grabbing the post variables automatically on the windows server. Any way, my problem is that it is not reading the file on the upload page. It throws the error "Error: No File Specified". I tried putting $img1_name=$_FILES['img1_name']; then I was getting a file extension error. form <FORM ACTION="/imageuploader/image_receiver.php" METHOD="POST" NAME="udata" ENCTYPE="multipart/form-data"> <FONT SIZE=-1> <p class="m_text">Your post may not contain any foul content! <br />Your ip address is <?php echo $ip; ?> and will be stored for our records.</p> <p><B>Enter Photo Upload Code:</B> <INPUT TYPE="password" NAME="pass" SIZE=10> <img src="images/secretcode.jpg" alt="secret code" width="150" height="45"></p> <p><B>Enter File Name:</B> <INPUT TYPE="file" NAME="img1_name" id="img1_name" SIZE="30"> </p> <p><B>Name:</B> <label> <input name="name" type="text" id="name" value="" size="30" maxlength="30"> </label> </p> <p><B>Description:</B> <label> <input name="description" type="text" id="description" value="" size="50" maxlength="80"> </label> </p> <p> <INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Upload File"> </p> </FORM> image upload page <?php $name = $_POST['name']; $description = $_POST['description']; $pass = $_POST['pass']; ////////////////// Image Uploader Receiver /////////////////// // Copyright (c) 2003 CarTest Software, All Rights Reserved // ////////////////////////////////////////////////////////////// include "image_receiver_header.html"; require "image_config.php"; // check password if($require_password_to_upload && $pass != $password) die("Invalid Password Entered"); // file specified? if($img1_name == "") die("Error: No File Specified"); // allowed file types $ext1=".jpg"; $ext2=".gif"; $ext=strtolower(substr($img1_name, strlen($img1_name)-4)); $imageType=0; if($ext == $ext1) { $imageType=1; } elseif ($ext == $ext2) { $imageType=2; } else { die("Error: $ext1 or $ext2 File Types Only Please"); } $ran = rand () ; $img1_name = $ran.date(MDY)."$ext"; $db = new mysqli('localhost', 'tuser', 'user', 'table'); if (mysqli_connect_errno()) { echo 'Error: Could not connect to database. Please try again later.'; exit; } $ip=$_SERVER['REMOTE_ADDR']; $url= "http://www.mysite.com/imageuploader/uploads/$img1_name"; $query = "insert into extremephoto values ('0', '$url', '$name', '$description', '$ip', 'no')"; $result = $db->query($query) or die(mysqli_error()); if ($result) echo $db->affected_rows.' message inserted into database. '; $db->close(); // file size limit if($file_size_limit >= 0 && $img1_size > $file_size_limit) die ("File Size Exceeds $file_size_limit Byte Limit"); // replace certain characters with _ $img1_name=strtr($img1_name," ","_"); $img1_name=strtr($img1_name,"#","_"); $img1_name=strtr($img1_name,"/","_"); $img1_name=strtr($img1_name,"\\","_"); // need to escape the backslash character $img1_name=strtr($img1_name,"%","_"); // check if file already exists $fullpath_to_image=$path_to_images.$img1_name; if(file_exists($fullpath_to_image)) { die("Error: File Already Exists"); } // check for banned ip if(strlen($banned_ip_list_file_name) > 0) { $fo=fopen($banned_ip_list_file_name,"rt"); if($fo != 0) { while(!feof($fo)) { $ipaddr=fgets($fo); $ipaddr=substr($ipaddr, 0, strlen($ipaddr)-1); // strip \n character at end automatically read in $l=strlen($ipaddr); if($l > 0 && substr($REMOTE_ADDR, 0, $l) == $ipaddr) die("Uploader Closed"); } $fc=fclose($fo); } } // full paths to thumbnails if(strlen($path_to_thumbnails) > 0 && $thumbnail_width > 0 && $thumbnail_height > 0) { $fullpath_to_thumbnail=$path_to_thumbnails.$img1_name; $thumbs=true; } else { $thumbs=false; } // save image, @ symbol means ignore errors generated copy($img1 , $fullpath_to_image) or die("Error: Couldn't Upload Your File"); // add file name, ip address, and timestamp to log file // open, lock the file, seek file pointer to end, write record, close (unlocks) if(strlen($upload_log_file_name) > 0) { $fo=fopen($upload_log_file_name,"a+t"); $fl=flock($fo,LOCK_EX); $fs=fseek($fo, 0, SEEK_END); $fw=fputs($fo,$img1_name." ".$REMOTE_ADDR." ".date("M d Y, H:i")."\n"); $fc=fclose($fo); } // resize? if($max_image_width > 0 && $max_image_height > 0) { $resize=true; } else { $resize=false; } // resize image to (maxwidth x maxheight) preserving existing aspect ratio (unless already smaller) and resave with fixed compression level // and create thumbnail .jpeg only if($imageType == 1) { // create images if($thumbs) $imgthumb=@imageCreateTrueColor($thumbnail_width, $thumbnail_height) or die ("Error: Cannot Create Thumbnail Image"); // need an image resource for resizing, do this even if not resizing to check for valid jpeg format file $im=@imageCreateFromJpeg($fullpath_to_image); if($im === false) { @unlink($fullpath_to_image) or die("Error: Improper Jpeg Image, Couldn't Delete File"); die ("Error: Improper Jpeg Image, Image Deleted"); } // original image size $sx=imageSx($im); $sy=imageSy($im); if($thumbs) { // use Resampled rather than Resize otherwise thumbnail is terrible @imageCopyResampled($imgthumb, $im, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $sx, $sy) or die("Error: Error Resizing for Thumbnail"); // write to subdirectory with same name as large file @imageJpeg($imgthumb, $fullpath_to_thumbnail, $image_quality) or die("Error: Couldn't Save Jpeg Thumbnail"); } if($resize) { // delete initial image @unlink($fullpath_to_image) or die("Error: Couldn't Delete Original Image"); // resize original image if($sx > $max_image_width || $sy > $max_image_height) { $rx=round($max_image_width); $ry=round($rx/($sx/$sy)); if($ry > $max_image_height) { $ry=round($max_image_height); $rx=round($ry*($sx/$sy)); } $imresized=@imageCreateTrueColor($rx, $ry) or die ("Error: Cannot Create Resized Image"); @imageCopyResampled($imresized, $im, 0, 0, 0, 0, $rx, $ry, $sx, $sy) or die("Error: Error Resizing Image"); @imageJpeg($imresized, $fullpath_to_image, $image_quality) or die("Error: Couldn't Save Resampled/Resized Jpeg"); } else { @imageJpeg($im, $fullpath_to_image, $image_quality) or die("Error: Couldn't Save Resampled Jpeg"); } } } else { // image size only for .gif $as = Array(); $as=getImageSize($fullpath_to_image); $sx=$as[0]; // image width $sy=$as[1]; // image height } echo "<BR><BR><BR>"; echo "<H1>File Upload Successful!</H1>"; //echo "<P>Successfully Sent: $img1_name, a $img1_size byte, $sx x $sy (original size) file with the extension type of $img1_type"; echo "<BR>"; if($resize && $imageType == 1) { $newsize=filesize($fullpath_to_image); if($sx > $max_image_width || $sy > $max_image_height) { // echo "<P>Image was resized to $rx x $ry and recompressed to $newsize bytes<BR>"; } else { //echo "<P>Image was recompressed to a file size of $newsize bytes<BR>"; } }
  11. What program do you edit in?
  12. I was missing quotes on all the other ones. Thank you for your help.
  13. got it working now: <select name="Store"> <option value="Academy"<?php if($myrow['Store']=="Academy") {echo' selected="selected"';}?>>Academy</option> <option value="B & R"<?php if($myrow['Store']=="B & R") {echo' selected="selected"';}?>>B & R</option> <option value="Brookshire"<?php if($myrow['Store']=="Brookshire") {echo' selected="selected"';}?>>Brookshire</option> <option value="Bass Pro"<?php if($myrow['Store']=="Bass Pro") {echo' selected="selected"';}?>>Bass Pro</option> <option value="Extreme"<?php if($myrow['Store']=="Extreme") {echo' selected="selected"';}?>>Extreme</option> <option value="prospect"<?php if($myrow['Store']=="prospect") {echo' selected="selected"';}?>>prospect</option> </select>
  14. <select name="Store"> <option value="Academy"<?php if($myrow['Store']==Academy) {echo' selected="selected"';}?>>Academy</option> <option value="B & R"<?php if($myrow['Store']=="B %26 R") {echo' selected="selected"';}?>>B & R</option> <option value="Brookshire"<?php if($myrow['Store']==Brookshire) {echo' selected="selected"';}?>>Brookshire</option> <option value="Bass Pro"<?php if($myrow['Store']==Bass Pro) {echo' selected="selected"';}?>>Bass Pro</option> <option value="Extreme"<?php if($myrow['Store']==Extreme) {echo' selected="selected"';}?>>Extreme</option> <option value="prospect"<?php if($myrow['Store']==prospect) {echo' selected="selected"';}?>>prospect</option> </select>
  15. I also tried this: <option value="B & R"<?php if($myrow['Store']=="B %26 R") {echo' selected="selected"';}?>>B & R</option>
  16. I tried that, but it is still not taking it. PHP Parse error: syntax error, unexpected T_STRING
  17. i am getting a syntax error with the line below <option value="B & R"<?php if($myrow['Store']==B %26 R) {echo' selected="selected"';}?>>B & R</option> how else can I write $myrow['Store']==B %26 R to make it go through?
  18. That got it. Thank you.
  19. Could you give me an example please? echo "<a href=\"view_dealers.php?type=B ".urlencode(&)." R\">Bill and Ralphs</a> - ";
  20. This new design freaked me out! It looks pretty and everything. But, I was comfortable with the old design. Not sure whether I like it or not.
  21. ok... now ?type=B%20&%20R is in my url. and i have this $i = urlencode($_GET['type']); echo"$i"; But, it echos this: B+
  22. Hi, I have some data to pull based on type. The variable being passed is B & R. Only, when I try to pass it.. it passes B and cuts off everything else. How can I handle this correctly? echo "<a href=\"view_dealers.php?type=".B .'&'. R."\">Bill and Ralphs</a> - "; elseif ($_GET['type'] == true) { $i = $_GET['type']; echo"$i"; }
  23. if I echo calculate_shipping_costs() using a weight of 999, the function will return 9 for some reason.
  24. I have comma screwing up my shipping calculation. I have been trying to replace the comma with nothing but I am still having trouble. function calculate_shipping_cost() { // as we are shipping products all over the world // via teleportation, shipping is fixed // return 20.00; $base = $_SESSION['weight']; //$base = 12; // $base=str_replace(',','',$base); $multiply = $base*1.1; // $multiply=str_replace(',','',$multiply); $final = $multiply+8; // $final=str_replace(',','',$final); return $final; } function display_shipping($shipping) { // display table row with shipping cost and total price including shipping $_SESSION['shipping']=number_format($shipping, 2); $_SESSION['complete_order']=number_format($shipping+$_SESSION['total_price'], 2); ?> <table border = 0 width = '100%' cellspacing = 0> <tr><td align = 'left'>Shipping</td> <td align = 'right'> <?php echo number_format($shipping, 2); ?></td></tr> <tr><th bgcolor='#cccccc' align = 'left'>TOTAL INCLUDING SHIPPING</th> <th bgcolor='#cccccc' align = 'right'>$<?php echo number_format($shipping+$_SESSION['total_price'], 2); ?></th> </tr> </table><br /> <?php } if(!isset($_SESSION['cart'])) { $_SESSION['cart'] = array(); $_SESSION['items'] = 0; $_SESSION['total_price'] ='0.00'; $_SESSION['weight'] = 0; } if(isset($_SESSION['cart'][$new])) $_SESSION['cart'][$new]++; else $_SESSION['cart'][$new] = 1; $_SESSION['total_price'] = calculate_price($_SESSION['cart']); $_SESSION['items'] = calculate_items($_SESSION['cart']); $_SESSION['weight'] = calculate_weight($_SESSION['cart']); } if(isset($_POST['save'])) { foreach ($_SESSION['cart'] as $isbn => $qty) { if($_POST[$isbn]=='0') unset($_SESSION['cart'][$isbn]); else $_SESSION['cart'][$isbn] = $_POST[$isbn]; } $_SESSION['total_price'] = calculate_price($_SESSION['cart']); $_SESSION['items'] = calculate_items($_SESSION['cart']); $_SESSION['weight'] = calculate_weight($_SESSION['cart']); }
  25. it is not pulling anything.... I was unsure if `Store` = 'B & R' and`Store` = 'Extreme' was the correct way to do it.
×
×
  • 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.