Jump to content

gwood_25

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gwood_25's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I have a function that duplicates records in a database then takes the user to an edit form. This function works fine until a record with an apostrophe is encountered and then it breaks. I have tried to implement the mysql_real_escape_string() function but it still gives the same error. Here is my code: // Get the ID of the product to duplicate $ID = $_GET['ID']; $sql = "select products.* from products where ID=$ID"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result,MYSQL_ASSOC); // Load the values of the record to duplicate $SubCategoryID = $row['SubCategoryID']; $BrandID = $row['BrandID']; $Name = $row['Name']; $Price = $row['Price']; $Keywords = $row['Keywords']; $Description = $row['Description']; $Image = "noimage.png"; // Create a new record in the database and populate it with the values from the record to be duplicated $sql = sprintf("Insert Into products (SubCategoryID, BrandID, Name, Price, Keywords, Description, Image) Values ('$SubCategoryID', '$BrandID', '$Name', '$Price', '$Keywords', '$Description', '$Image')", mysql_real_escape_string($SubCategoryID), mysql_real_escape_string($BrandID), mysql_real_escape_string($Name), mysql_real_escape_string($Price), mysql_real_escape_string($Keywords), mysql_real_escape_string($Description), mysql_real_escape_string($Image)); mysql_query($sql) or die(mysql_error()); // Get the ID for the newly inserted record $ID = mysql_insert_id(); $link = "edit_product.php?ID=".$ID; // Take the user to the edit screen to edit the details of this product header("Location:".$link); mysql_close($dbh); I'm sure i've done something wrong but unfortunately i'm very new to php and don't know why it's not working
  2. the code i have and that you modified for me should work under normal circumstances, however, yahoo doesn't allow you to send email via script that has a return address who's domain is outside of your hosted domain. If the return address domain is outside of the hosted domain, a default return address is used instead. This is a yahoo specific setting and is inteded for anti-spam measures. Thank you again for your help.
  3. Thank you so much for your help. I'm not sure if maybe this is a yahoo issue and they don't allow you to change this setting?
  4. ok, but the original question still remains.... why won't the "from" address in my mail client appear as the email addy submitted via the web form. It always displays as info@domain.com ... I can't change it. The reason I want to change it is so that I can easily reply to a customer message without copying and pasting.
  5. I tried running your code and it didn't work. When I put the dots back in... it worked.
  6. removing the dots breaks the script. The dots are required for concatenation aren't they? Please bear with me I am very new to php and I am not sure what the issue is. I am able to send mail successfully with my original script, it just won't change the from address or teh reply to address. This site is hosted with yahoo and runs on a linux server does this make a difference?
  7. Hello, I have a strange problem that I'm not sure how to solve. I have a web form that collects name, email and message from users of my website. This info is posted to a php script which then emails the info to our email address. The problem is, the from address never gets changed from webmaster@ourdomain.com. I haven't specified this address in the script at all and am adding extra headers to try and change the from address to the email addy specified by the user....here is my script. Any help is greatly appreciated. <?php header("Cache-Control: no-cache, must-revalidate"); $mail_to= "info@mysite.com"; //address I want the website emails going to $Name =$_GET['Name']; $mail_from=$_GET['Email']; $mail_sub="Message from Wheatcity Cowtown Website"; $mail_mesg=$Name."<".$mail_from."> wrote: \n\n".$_GET['Message']; $headers = $mail_from."\r\n"."Reply-To:".$mail_from."\r\n"; if(mail($mail_to,$mail_sub,$mail_mesg,$headers)) { echo "<br><br><p align=center>E-mail has been sent successfully</p>"; } else { echo "<br><br><p align=center>Failed to send the E-mail, please try again or contat us info@wheatcitycowtown.com</p><br>"; } ?>
  8. Thank you so much. That worked perfectly.
  9. ok, I am very new to php so how do I do that and do I have to do it each time I upload a file? Where in the code should the chmod command go?
  10. hello, I am uploading an image to my web host and am storing a reference to the file in a mysql database. The file upload works and the reference to the image is stored in the db. However viewing the image generates an "unauthorized" error. I was told by the host that this was a problem with my php script and not setting permissions on the uploaded file via script. I have reasearched this and to the best of my knowledge I need to use the chmod command. Following is my code, at what point to I call chmod? Any help is greatly appreciated. $pic=($_FILES['photo']['name']); if($pic != "") { //Writes the information to the database mysql_query("INSERT INTO `brands` (Name, Weblink, Image) VALUES ('$name', '$weblink', '$pic')") or die(mysql_error()); //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { chmod($_FILES['photo']['tmp_name'],0755); //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the database"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } } else { //Writes the information to the database mysql_query("INSERT INTO `brands` (Name, Weblink, Image) VALUES ('$name', '$weblink', 'noimage.png')") or die(mysql_error()); } mysql_close($dbh); ?>
  11. yes I can see the file in yahoo's file manager. However, attempting to view the file give the "unauthorized" error message.
  12. That's the problem. I cannot see them. This site is being hosted on yahoo and using their file manager the only thing i can see is that the folder is a public folder. Also, I have uploaded images with the same script on multiple client machines running different OS's (vista, xp, mac os 10.x) and get the same result. I am suspecting that this is a yahoo problem that I would not have access to change even if I wanted to. Also, they are blaming the script for not setting the appropriate permissions? I don't get that. How unsecure would that be if a script was allowed to change permissions for a file or directory? Can I safely assume that if my script is putting the files where they are supposed to and successfully writing to the db that my script is not the problem? Again, thank you for your help.
  13. Hello, I have a php upload script that stores a reference to an image in a mysql database and uploads the image to a specified directory. I am hosting a site on yahoo and the script uploads the image successfully and stores the appropriate data in the database without a problem. However, when I go to view the image, i get an "unauthorized" error returned from the webserver. If I upload an image with yahoo's online file manager, I have no problems. Forcing users to use the yahoo file manager is not acceptable. Yahoo is blaming my script stating that my script is the problem. If that is true, what could the problem with the script be? I personally think this is a permissions issue on their side. Any advice would be greatly appreciated.
  14. ok I tried the code you provided...same result. blank page and bottom link is not rendered. How can I output an error message if any to see where the problem is?
×
×
  • 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.