Jump to content

NeMoD

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

NeMoD's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It's only sending the product numbers from $mailorder ??? if ($cart) { $to = "email@mail.com"; $subject = "my subject"; if (is_array($_SESSION['mailorder'])) { foreach($_SESSION['mailorder'] as $key => $val) { $body .= $val . PHP_EOL; } } $body .= $_POST['firstname'].$_POST['lastname'].$_POST['street'].$_POST['zipcode'].$_POST['country'].$_POST['email'].$_POST['phonenumber']; if (mail($to, $subject, $body)) { echo('<p>Order Submitted!'); } else { echo('<p>Order failed, please try again!'); } } put the quotes in, still only sends the product numbers from mailorder
  2. How do I assign multiple strings to $body? if ($cart) { $to = "email@mail.com"; $subject = "my subject"; $body .= $_POST['firstname']; $body .= $_POST['lastname']; $body .= $_POST['street']; $body .= $_POST['zipcode']; $body .= $_POST['country']; $body .= $_POST['email']; $body .= $_POST['phonenumber']; if (is_array($_SESSION[mailorder])) { foreach($_SESSION[mailorder] as $key => $val) { $body .= $val . PHP_EOL; } } if (mail($to, $subject, $body)) { echo('<p>Order Submitted!'); } else { echo('<p>Order failed, please try again!'); } } $mailorder is an array containing all the product numbers, that part is working fine.
  3. Sorry for the double post, but it seems I can't edit my post twice. You're script is working now, I didn't put the $_SESSION in when I declared the array. So onto my next problem: How do I fill this array, $_SESSION[$sessionarray]? foreach ($contents as $product_id=>$qty) { $sql = "SELECT * FROM product_listing WHERE product_id = '$product_id'"; $result = $db->query($sql); $row = $result->fetch(); $_SESSION[$sessionarray] = $product_id; // here we go extract($row); $output[] = '<tr>'; $output[] = '<td><img src="/images/uploads/'.$image.'" width="165" height="124" />'; $output[] = '<td><a href="cart.php?action=delete&product_id='.$product_id.'" class="r">Remove</a></td>'; $output[] = '<td><input type="text" name="qty'.$product_id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '</tr>'; $output[] = $_SESSION[$sessionarray].'</br>'; //test }
  4. I tested it and it only sends a blank message ??? <? session_start(); $sessionarray = array(number1,number2,number3); $to = "email@mail.com"; $subject = "hey"; $body = ""; if (is_array($_SESSION[$sessionarray])) { foreach($_SESSION[$sessionarray] as $key => $val) { $body .= $val . PHP_EOL; } } if (mail($to, $subject, $body)) { echo("<p>success!</p>"); } else { echo("<p>Failed...</p>"); } ?>
  5. It's only sending the first value of $sessionarray, How do I make it send everything? $to = "somewhere@mail.com"; $subject = "hey"; $body = $_SESSION[$sessionarray]; if (mail($to, $subject, $body)) { echo("<p>success!</p>"); } else { echo("<p>Failed...</p>"); }
  6. Ok, it works now, thanks a ton! [quote author=HPWebSolutions link=topic=258367.msg1215780#msg1215780 date=1246124696 Somewhat related, you may want to read up on secure file uploading at http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/ if this is going to be an internet facing web form. Thanks for the link, will give it a read
  7. I'm attempting to make a form where you upload an item with an image, it returns "Query Finished" but the file never gets uploaded and the database never gets updated ??? <? //initilize PHP if($_POST['submit']) //If submit is hit { //then connect as user $conn = mysql_connect("********", "********", "********") or die(mysql_error()); //select db mysql_select_db('********', $conn) or die(mysql_error()); //convert all the posts to variables: $category = $_POST['category']; $name = $_POST['name']; $product_id = $_POST['product_id']; $image = $_FILES['image']; $uploadfile = $_SERVER['DOCUMENT_ROOT']."/images/uploads/" . $_FILES['image']['name']; if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile)) { //Insert the values into the correct database with the right fields $result=MYSQL_QUERY("INSERT INTO product_listing (id,category,name,product_id,price,description,cur_timestamp,image,)". "VALUES ('NULL', '$category', '$name', '$product_id', 'NULL', 'NULL', 'NULL', '$uploadfile')"); //confirm echo 'Query Finished. Return <a href="./index.php">Home</a>'; } else { echo "Possible file upload attack!\n"; echo 'Here is some more debugging info:'; print_r($_FILES); echo '</br>'; print_r($uploaddir); echo '</br>'; print_r($uploadfile); echo '</br>'; } } else { ?> <form method="post" action="add.php" enctype="multipart/form-data"> <TABLE> <TR> <TD>Category:</TD> <TD><INPUT TYPE='TEXT' NAME='category' VALUE='' size=60></TD>> </TR> <TR> <TD>Name:</TD> <TD><INPUT TYPE='TEXT' NAME='name' VALUE='' size=60></TD> </TR><br> <TR> <TD>Product ID:</TD> <TD><INPUT TYPE='TEXT' NAME='product_id' VALUE='' size=60></TD> </TR> <TR> <TD>Image:</TD> <TD><input name="image" type="file"></TD> </TR> <TR> <TD></TD><br> <TD><INPUT TYPE="submit" name="submit" value="submit"></TD> </TR> </TABLE> </form> <? } //close the else statement ?>
  8. I had a coppermine photo gallery, installed a year ago, before I got rid of my site I backed up all the files and the db. Now I have a new site and would like to import it, I copied over the files, pointed the config to the newly created db, and tried importing the old db into the new one, but I keep getting this error [code]MySQL said: Documentation #1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO `cpg133_albums` VALUES (1, 'IG Community', 'Click h [/code] heres up to the line, where it errors out [code] SQL query: -- -- Table structure for table `cpg133_albums` -- CREATE TABLE `cpg133_albums` ( `aid` int( 11 ) NOT NULL AUTO_INCREMENT , `title` varchar( 255 ) NOT NULL default '', `description` text NOT NULL , `visibility` int( 11 ) NOT NULL default '0', `uploads` enum( 'YES', 'NO' ) NOT NULL default 'NO', `comments` enum( 'YES', 'NO' ) NOT NULL default 'YES', `votes` enum( 'YES', 'NO' ) NOT NULL default 'YES', `pos` int( 11 ) NOT NULL default '0', `category` int( 11 ) NOT NULL default '0', `pic_count` int( 11 ) NOT NULL default '0', `thumb` int( 11 ) NOT NULL default '0', `last_addition` datetime NOT NULL default '0000-00-00 00:00:00', `stat_uptodate` enum( 'YES', 'NO' ) NOT NULL default 'NO', `keyword` varchar( 50 ) default NULL , PRIMARY KEY ( `aid` ) , KEY `alb_category` ( `category` ) )-- -- Dumping data for table `cpg133_albums` -- INSERT INTO `cpg133_albums` VALUES ( 1, 'IG Community', 'Click here for pictures of some active (and inactive) unreal instagib players.', 0, 'YES', 'YES', 'YES', 100, 0, 0, 0, '0000-00-00 00:00:00', 'NO', NULL ) [/code] any help is appreciated I'm positive I'm using mysql5 for my new host, my old host had 4.1.18
×
×
  • 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.