Jump to content

scmeeker

Members
  • Posts

    153
  • Joined

  • Last visited

    Never

Everything posted by scmeeker

  1. Thanks SO much for that help. It pushed me in the right direction and I soon found a simple, easy way to upload my swf files with NO problem. I appreciate it!!
  2. Do you think the Image Resizer is causing a problem? I also tried setting the SWF as $_FILES["image_upload_box"]["type"] == "media/swf" with no luck. No transfer to the image file. Any suggestions??
  3. Okay...I tried it out towards the beginning and the end of the code as $image = $FILES["image_upload_box"]["type"]; Then at the very end I echoed the $image variable but nothing comes up when I test it. Any suggestions at what I'm not doing right?
  4. Thanks for that! Did you have a chance to look at the code? I'm so puzzled! I researched and it looked as though I could simply replace the jpeg file name with the SWF file name for the uploader. I don't know if its because it is image/swf...because its actually a movie file which is causing the problem? Any ideas?
  5. sorry...they've changed the tagging since I posted last. It used to be above where you type and I looked for it. Sorry! Do you simply put <?php at the beginning of the PHP code and ?> at the end for it to show up properly in the post?
  6. Trying to have my image uploader transfer up SWF files without any luck. It uploads the file name correctly but is not transferring the file itself to the file directory. It works fine with my regular images but just not with the SWF files. I've changed all occurences of JPG and replaced them with SWF. Help? Perhaps I'm missing something? Thanks for your help! <?php $item_image = $_FILES['image_upload_box']['name']; $item_id = $_GET['id']; $sql="UPDATE imagetable SET sp_image='$item_image' WHERE id = '$item_id'"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } else { // upload the file if ((isset($_POST["submitted_form"])) && ($_POST["submitted_form"] == "image_upload_form")) { // file needs to be jpg,gif,bmp,x-png and 4 MB max if (($_FILES["image_upload_box"]["type"] == "image/swf" || $_FILES["image_upload_box"]["type"] == "image/pjpeg" || $_FILES["image_upload_box"]["type"] == "image/gif" || $_FILES["image_upload_box"]["type"] == "image/x-png") && ($_FILES["image_upload_box"]["size"] < 400000000)) { // some settings $max_upload_width = 800; $max_upload_height = 300; // if user chosed properly then scale down the image according to user preferances if(isset($_REQUEST['max_width_box']) and $_REQUEST['max_width_box']!='' and $_REQUEST['max_width_box']<=$max_upload_width){ $max_upload_width = $_REQUEST['max_width_box']; } if(isset($_REQUEST['max_height_box']) and $_REQUEST['max_height_box']!='' and $_REQUEST['max_height_box']<=$max_upload_height){ $max_upload_height = $_REQUEST['max_height_box']; } // if uploaded image was JPG/JPEG if($_FILES["image_upload_box"]["type"] == "image/swf" || $_FILES["image_upload_box"]["type"] == "image/swf"){ $image_source = imagecreatefromswf($_FILES["image_upload_box"]["name"]); } // if uploaded image was GIF if($_FILES["image_upload_box"]["type"] == "image/gif"){ $image_source = imagecreatefromgif($_FILES["image_upload_box"]["name"]); } // BMP doesn't seem to be supported so remove it form above image type test (reject bmps) // if uploaded image was BMP if($_FILES["image_upload_box"]["type"] == "image/bmp"){ $image_source = imagecreatefromwbmp($_FILES["image_upload_box"]["name"]); } // if uploaded image was PNG if($_FILES["image_upload_box"]["type"] == "image/x-png"){ $image_source = imagecreatefrompng($_FILES["image_upload_box"]["name"]); } $remote_file = "image_files/".$_FILES["image_upload_box"]["name"]; imagejpeg($image_source,$remote_file,100); chmod($remote_file,0644); // get width and height of original image list($image_width, $image_height) = getimagesize($remote_file); if($image_width>$max_upload_width || $image_height >$max_upload_height){ $proportions = $image_width/$image_height; if($image_width>$image_height){ $new_width = $max_upload_width; $new_height = round($max_upload_width/$proportions); } else{ $new_height = $max_upload_height; $new_width = round($max_upload_height*$proportions); } $new_image = imagecreatetruecolor($new_width , $new_height); $image_source = imagecreatefromswf($remote_file); imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height); imagejpeg($new_image,$remote_file,100); imagedestroy($new_image); } imagedestroy($image_source); MOD EDIT: . . . BBCode tags added.
  7. That did it! Thank you SO much! I appreciate your feedback.
  8. found it...finally! It was the fact that there were no quotes around the variable 'username' and so on. It's working fine now. $username = mysql_real_escape_string($_POST[username]); Thanks for your help!
  9. Yes, it's giving me this error: "Warning: Cannot modify header information - headers already sent " with the line #.
  10. When I tested it out on my home server, it works fine but is not working "live." That's where its giving me problems. I have - ini_set('display_errors', 0); at the top of the page but no errors show up. Is there something else I should do to show the errors? Thanks.
  11. Perhaps I need another set of eyes on this but after Inserting into the Table (which that works fine), its not going to the next page: header("location:finalize.php"); It's inserting the new user, then staying on a blank page and not moving on to "finalize.php." Here is the code from the page: <?php session_start (); ?> <?php include('connect.php'); $username = mysql_real_escape_string($_POST[username]); $first_name = mysql_real_escape_string($_POST[first_name]); $last_name = mysql_real_escape_string($_POST[last_name]); $password = mysql_real_escape_string($_POST[password]); $membership = mysql_real_escape_string($_POST[membership]); $level = mysql_real_escape_string($_POST[level]); $terms = mysql_real_escape_string($_POST[terms]); $sql2="INSERT INTO user (first_name, last_name, username, password, membership, level, terms, date) VALUES ('$first_name', '$last_name', '$username', '$password', '$membership', '$level', '$terms', CURDATE())"; if (!mysql_query($sql2)) { die('Error: ' . mysql_error()); }else { header("location:finalize.php"); } ?>
  12. I'm still stumped on this one and would really appreciate the help. I'm still researching but without any luck. Thanks!
  13. What I'm really trying to figure out is how I get this to loop around and add all the selected entries instead of only the last one. Thanks!
  14. The information is drawn in from a table into a form that the user will click submit and all the rows will be inputted into the table with their username association. With this form, its only inputting the last row and not all of them. You're help is much appreciated! Here is the form in the PHP area: while($row=mysql_fetch_array($get_items_sql)){ $name =$row['item']; $date = ($row['expiration_date']); $exp_date = date('M d Y', strtotime($row['expiration_date'])); $content .= ""; $content .="<table width=\"450\" border=\"0\"><tr><td width=\"200\"><span class=\"anotherfont\"><input name=\"item[]\" type=\"hidden\" value=\"$name\" id=\"item[]\">$name</span></td><td width=\"200\"><span class=\"greenfont\"><input name=\"expiration_date[]\" type=\"hidden\" value=\"$date\" id=\"expiration_date[]\">$exp_date</span><input name=\"username[]\" type=\"hidden\" value=\"$username\" id=\"username[]\"/> </td></tr><br /></table>"; $content .= "\n"; } $content .= "</ul>\n"; Then below is part of the HTML Form with $content referenced: <form action="add_select.php?source_id=<?php echo $coupon_source ?>" method="post" enctype="multipart/form-data" name="add_new" id="add_new"> <?php echo $content ?> <input name="SUBMIT" type="submit" value="submit" /></form><br /> Then here is the section from the "add_select.php" file from the form: include('connect.php'); foreach($_POST['item'] as $row=>$item) { $Item_name=$item; $expiration_date=$_POST['expiration_date'][$row]; $username=$_POST['username'][$row]; } foreach($_POST['item'] as $row=>$item) { $Item_name=mysql_real_escape_string($item); $expiration_date=mysql_real_escape_string($_POST['expiration_date'][$row]); $username=mysql_real_escape_string($_POST['username'][$row]); } $sql2="INSERT INTO place (item, expiration_date, username) VALUES ('$Item_name', '$expiration_date', '$username')"; if (!mysql_query($sql2)) { die('Error: ' . mysql_error()); }else { header("location:insert_complete.php"); }
  15. This resizer works fine except I would like it to save the original image AND the thumbnail. Right now its only saving the cropped thumbnail. It's seems simple enough but I've tried several different ways but can't get it to work. I would appreciate your help. define( 'DESIRED_IMAGE_WIDTH', 150 ); define( 'DESIRED_IMAGE_HEIGHT', 150 ); $source_path = $_FILES[ 'thumb' ][ 'tmp_name' ]; $timestamp = time(); $target = "image_files/".$imagename; move_uploaded_file($source, $target); // // Add file validation code here // list( $source_width, $source_height, $source_type ) = getimagesize( $source_path ); switch ( $source_type ) { case IMAGETYPE_GIF: $source_gdim = imagecreatefromgif( $source_path ); break; case IMAGETYPE_JPEG: $source_gdim = imagecreatefromjpeg( $source_path ); break; case IMAGETYPE_PNG: $source_gdim = imagecreatefrompng( $source_path ); break; } $source_aspect_ratio = $source_width / $source_height; $desired_aspect_ratio = DESIRED_IMAGE_WIDTH / DESIRED_IMAGE_HEIGHT; if ( $source_aspect_ratio > $desired_aspect_ratio ) { // // Triggered when source image is wider // $temp_height = DESIRED_IMAGE_HEIGHT; $temp_width = ( int ) ( DESIRED_IMAGE_HEIGHT * $source_aspect_ratio ); } else { // // Triggered otherwise (i.e. source image is similar or taller) // $temp_width = DESIRED_IMAGE_WIDTH; $temp_height = ( int ) ( DESIRED_IMAGE_WIDTH / $source_aspect_ratio ); } // // Resize the image into a temporary GD image // $temp_gdim = imagecreatetruecolor( $temp_width, $temp_height ); imagecopyresampled( $temp_gdim, $source_gdim, 0, 0, 0, 0, $temp_width, $temp_height, $source_width, $source_height ); // // Copy cropped region from temporary image into the desired GD image // $x0 = ( $temp_width - DESIRED_IMAGE_WIDTH ) / 2; $y0 = ( $temp_height - DESIRED_IMAGE_HEIGHT ) / 2; $desired_gdim = imagecreatetruecolor( DESIRED_IMAGE_WIDTH, DESIRED_IMAGE_HEIGHT ); imagecopy( $desired_gdim, $temp_gdim, 0, 0, $x0, $y0, DESIRED_IMAGE_WIDTH, DESIRED_IMAGE_HEIGHT ); // // Render the image // Alternatively, you can save the image in file-system or database // header( 'Content-type: image/jpeg' ); imagejpeg( $desired_gdim, "image_files/" . $timestamp . $_FILES["thumb"]["name"] );
  16. I'm having trouble getting my variable to update the database a NULL value. It keeps giving it the value of zero. This is what I'm using and I've tried it several different ways without luck. elseif ($item_fee > "1") { $sold = NULL; }
  17. I found the problem. I needed to include http:// before the $item_url and now its working perfect. Thanks!
  18. I'm having a problem with including a list of clickable links. They keep including my website address before the web address instead of the the web address alone. Here is the code I'm using for it. The $item_url is the web address from the database. $content .="<table width=\"700\" height=\"50\" border=\"0\"><tr><td width=\"500\" class=\"titles\"><a href=$item_url target=\"_blank\">$item_title</a></td></tr><tr> <td width=\"400\" class=blackfont>Location: {$item_city}, {$item_state}</td></tr><tr><td class=blackfont>Country: {$item_country}</td></tr><br /> </table>";
  19. I read through the article but didn't see how I could bypass it to a new custom page. Here is the code I'm using to try to bypass it: <?php include('web_connect.php'); $username = mysql_real_escape_string($_POST[username]); $email = mysql_real_escape_string($_POST[email]); $result = mysql_query("SELECT email, username FROM artist ") or die(mysql_error()); if (mysql_num_rows($result) < 1) { $categoryList = "<p><em>Sorry, no artists.</em></p>"; } else { while ($items = mysql_fetch_array($result)) { $artist_email .= $items['email']; $artist_username .= $items['username']; } } if ($artist_username == $username ) { header("location:join_duplicate_username_error.php"); }
  20. When there is a duplicate entry in my database, I would like it to go to the another page that indicates the error, rather than the "Error: Duplicate entry 'username' for key 1". It happens if someone is going to join and there is a duplicate entry. I would rather it show one of my customized php pages rather than a black page stating the error. I've tried to catch the entry with some php code but it bypasses it and continues with the duplicate error. I would appreciate any direction with this. Thanks!
  21. Sorry, here is that code: <a href="index.php"><img src="Logo.gif" width="200" height="75" border="0" /></a> <a href="join.php">Join</a> <a href="sell.php">Sell</a> <a href="the_hub.php">The Hub</a> <a href="about.php">About</a> <a href="faq.php">FAQ</a> <a href="user_login.php">LOGIN</a> <?php echo $display_block = "<a href=\"sign_in.php?username=".$_SESSION['username']."\"><strong>My sGallery</strong></a>" ?> <?php if (isset($_SESSION['username']) && $_SESSION['username'] == $_SESSION['username']) { echo 'Welcome:';} ?> <span class="orangefont"><?php echo $_SESSION['username'] ?></span> <?php if (isset($_SESSION['username']) && $_SESSION['username'] == $_SESSION['username']) { echo "<a href=\"logout.php\" class=\"submissionfont\">logout </a>";} ?>
  22. Here is the code on the product page. It's from this page if a link is clicked on this link form the large code listed below, it changes the session id to the seller. <?php echo $display_block = "<a href=\"artist_store.php?username=".$item_username."&id=".$item_id."&title=".$item_title."\"><img src=\"image_files/artist_store_button.gif\" width=\"180\" height=\"43\" border=\"0\" /></a>" ?> Here is the full code for the item page. <?php session_start(); ?> <?php include('web_connect.php'); $result2 = mysql_query("SELECT date, image_upload_box FROM artist WHERE username = '".$_GET["username"]."'") or die(mysql_error()); if (mysql_num_rows($result2) < 1) { //invalid item $display_block .= "<p><em>Invalid item selection.</em></p>"; } else { //valid item, get info while ($items = mysql_fetch_array($result2)) { $artist_date = date('M d Y', strtotime($items['date'])); $artist_avatar = $items['image_upload_box']; } } $result = mysql_query("SELECT inactive, username FROM product WHERE inactive = 1 AND id = '".$_GET["id"]."'") or die(mysql_error()); if (mysql_num_rows($result) == 1) { header("location:error_page.php"); } else { //validate item $get_item_sql = mysql_query("SELECT c.cat_id, c.cat_title, p.id, p.title, ROUND(p.price,2) AS price, p.image_upload_box, p.username, p.description, ROUND(p.shipping_cost,2) AS shipping_cost, p.ship_to, p.international, p.in_location, ROUND(p.in_shipping,2) AS in_shipping, p.form_of_payment, p.country, p.city, p.state, p.inactive FROM product AS p LEFT JOIN category AS c on c.cat_id = p.cat_id WHERE p.inactive IS NULL AND id = '".$_GET["id"]."'") or die(mysql_error()); if (mysql_num_rows($get_item_sql) < 1) { //invalid item $display_block .= "<p><em>Invalid item selection.</em></p>"; } else { //valid item, get info while ($item_info = mysql_fetch_array($get_item_sql)) { $item_url = "artist_store.php?username={$items_info['username']}"; $item_url2 = "items3.php?id=".$_GET['id']."=username=".$item_username.""; $cat_id = $item_info['cat_id']; $cat_title = strtoupper(stripslashes($item_info['cat_title'])); $item_title = stripslashes($item_info['title']); $item_price = $item_info['price']; $item_image = $item_info['image_upload_box']; $item_username = $item_info['username']; $item_description = $item_info['description']; $item_shipping_cost = $item_info['shipping_cost']; $item_form_of_payment = $item_info['form_of_payment']; $item_country = $item_info['country']; $item_city = $item_info['city']; $item_state = $item_info['state']; $item_id = $item_info['id']; $item_inactive = $item_info['inactive']; $item_ship_to = $item_info['ship_to']; $item_international = $item_info['international']; $item_in_location = $item_info['in_location']; $item_in_shipping = $item_info['in_shipping']; $content .= ""; } list($width) = getimagesize("image_files/{$item_image}"); // set the maximum width of the image here $maxWidth = 500; if ($width > $maxWidth) //make breadcrumb trail $display_block .= "<p><strong><em>You are viewing:</em><br/> <a href=\"listtest6.php?cat_id=".$cat_id."\">".$cat_title."</a> > ".$item_title."</strong></p> <table cellpadding=\"3\" cellspacing=\"3\"> <tr>"; $display_block .= "<td valign=\"middle\" align=\"center\"><img alt=\"Image\" width=\"{$maxWidth}\" src=\"image_files/{$item_image}\" /></td> <td valign=\"middle\"><p><strong>Price:</strong> \$".$item_price."</p>"; if ($item_inactive == 1){ echo "Error, item is no longer active!"; } //free result mysql_free_result($get_item_sql); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>S Gallery Online - Contemporary Art</title> <link href="styles/sgallery2.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- a:link { color: #09C; text-decoration: none; } a:visited { text-decoration: none; color: #09C; } a:hover { text-decoration: underline; } a:active { text-decoration: none; } --> </style></head> <div align="center"> <body> <div class="mainbody"> <div class="header1"> <?php include('header.php'); ?> </div> <div class="storeitemsleft"> <br /> <?php echo $display_block = "<span class=breadcrumb><a href=\"index.php?cat_id=".$cat_id."\">HOME</a> > ".$item_title."</span>" ?><br /> <br /> <?php echo $display_block = "<span class=originalarttitle>".$item_title."</span>" ?><br /> <br /> <?php echo $display_block = "<img alt=\"{$item_title}\" width=\"{$maxWidth}\" src=\"image_files/{$item_image}\" />" ?><br /> <br /> <br /> <br /> <table width="500" height="510" border="0" bgcolor="#d0dfe2" cellpadding="10"> <tr> <td class="storeheaderfont">Item Description</td> </tr> <tr> <td valign="top" class="blackfont"><?php echo $item_description ?></td> </tr> <tr> <td class="storeheaderfont">Shipping Costs</td> </tr> <tr> <td valign="top" class="anotherfont">Ship To: <?php echo $display_block = "<span class=blackfont>".$item_ship_to."</span>" ?> <?php echo $display_block = "<span class=blackfont>\$".$item_shipping_cost."</span>" ?><br /><br /> Ship Internationally?: <?php echo $display_block = "<span class=blackfont>".$item_in_location."</span>" ?> <?php echo $display_block = "<span class=blackfont>\$".$item_in_shipping."</span>" ?></td> </tr> <tr> <td class="storeheaderfont">Payment:</td> </tr> <tr> <td valign="top" class="blackfont"><?php echo $item_form_of_payment ?></td> </tr> <tr> <td><img src="paypal_logo.gif" /></td> </tr> </table> </div> <div class="storeright"><br /> <br /> <br /><br /> <table width="250" border="0" cellpadding="10"> <tr> <td><br /> <?php echo $display_block = "\$".$item_price."" ?> USD<br /> <br /> <?php echo "<a href=\"commit_to_buy.php?username=$user_session&id=$item_id\"><img src=\"buy_now_button.gif\" width=\"144\" height=\"43\" border=\"0\" /></a>" ?> <br /> <br /> <?php echo "<img src=\"image_files/$artist_avatar\" width=\"50\" height=\"50\" />" ?><br /><br /> <span class="submissionfont"><?php echo $display_block = "$item_username" ?></span><br /> <br /> <span class="submissionfont"># of views: <?php include('counter1.php'); ?></span><br /><br /> <?php include('rate_calculate.php'); ?><br /><br /> <span class="submissionfont">Product Location:</span><br /> <span class="submissionfont"><?php echo $display_block = "$item_city, $item_state - $item_country" ?></span><br /><br /> <span class="submissionfont">Member since: <?php echo $display_block = "$artist_date" ?></span><br /><br /> <?php echo $display_block = "<a href=\"artist_store.php?username=".$item_username."&id=".$item_id."&title=".$item_title."\"><img src=\"image_files/artist_store_button.gif\" width=\"180\" height=\"43\" border=\"0\" /></a>" ?> <br /> <?php echo $display_block = "<a href=\"artist_profile.php?username=".$item_username."&id=".$item_id."&title=".$item_title."\"><img src=\"image_files/artist_policy_button.gif\" width=\"180\" height=\"43\" border=\"0\" /></a>" ?> <br /> <?php echo $display_block = "<a href=\"artist_policies.php?username=".$item_username."&id=".$item_id."&title=".$item_title."\"><img src=\"image_files/store_policy_button.gif\" width=\"180\" height=\"43\" border=\"0\" /></a>" ?><br /> <?php echo $display_block = "<a href=\"contact_artist.php?id=".$item_id."\"><img src=\"image_files/contact_artist_button.gif\" width=\"180\" height=\"43\" border=\"0\" /></a>" ?><br /> <?php echo $display_block = "<a href=\"favorites.php?username=".$item_username."&id=".$item_id."&title=".$item_title."\"><img src=\"image_files/favorites_button.gif\" width=\"180\" height=\"43\" border=\"0\" /></a>" ?> <br /> </td> </tr> </table> <br /> <br /> </div> <div class="footergallery"><?php include('footer.php'); ?>
  23. When signed in as a user, the username shows up on the top right page. Then, if I click a particular product of another user it changes the session variable to that of the other user. Why would this happen? It's really odd.
×
×
  • 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.