
mrzebra81
Members-
Posts
29 -
Joined
-
Last visited
Never
Everything posted by mrzebra81
-
I do have the headers like in the example 2 also
-
I contacted godaddy and they said that they tested the form mailer and it isn't sending emails. They said i need to use the relay server in my code...how do i code that in? they gave me the server name and port number...
-
plain text emails get sent instantly, but these html emails aren't. I've only had one go through out of close to 20 test emails. godaddy.com is my hosting company.
-
now it doesn't seem to be working...it's very strange.
-
Yes they are on the same server...one email finally came through, in the proper html format. So it looks like it may be working with the code I posted above. I will test it out again. The only thing it says, is the email is from noreply@onlinerserver.cc How do i change that?
-
Hello, The mail function works on my one website but it won't on my other site. On the site that it won't work on, I'm trying to email the contents of the cart. I tested it out and it diplays the contents of the cart properly if I echo $email. I don't get any errors on the site, it seems to process but I don't receive any emails. here is my code for process.php: <?php session_start(); error_reporting(E_ALL); ini_set('display_errors','1'); require_once("connect.php"); ?> <?php $check=$_POST['check']; /* code that outputs the cart contents and totals up the cart */ $cartOutput=""; $total="0"; // start the foreach loop to go through each item in the cart array $i=0; foreach($_SESSION["cart_array"] as $each_item) { $item_id=$each_item['id']; $prod_id=$each_item['product_id']; // distiguish between a regular item and a gift box switch ($prod_id) { // if it is a gift box case "12": // Get product name and price $sql=mysql_query("SELECT products.productPrice, products.productName FROM products WHERE productId='$prod_id' LIMIT 1"); while ($row=mysql_fetch_array($sql)) { $product_name=$row["productName"]; $price=$row["productPrice"]; } $subtotal=$price*$each_item['quantity']; $total=$subtotal + $total; if(isset ($_SESSION["cart_array"] )) { // dynamic checkout button assembly // dynamic cart item display $cartOutput.="<tr align=center> <td width=5%><font face=arial color='#999999'>".substr($each_item['id'],0,7)."</font></td> <td width=25%><font face=arial color='#999999'>".$product_name."</font></td> <td width=40% valign=center><font face=arial color='#999999'>Wrap my products in a Gift Box</font></td> <td valign=center width=5%><font face=arial color='#999999'>".$each_item['quantity']." </td> <td width=5%><font color='#999999'>$".$price.".00</font></td> <td width=10%><font color='#999999'>$".$subtotal.".00</font></td> </tr> <tr> <td colspan=6><hr size=1 width=50% color='#CBB659'/></td></tr>"; } // end if statement to see if cart is empty break; // if it is a Reed Diffuser Bottle case "17": // Get product name and price $sql=mysql_query("SELECT products.productPrice, products.productName, products.productDesc FROM products WHERE productId='$prod_id' LIMIT 1"); while ($row=mysql_fetch_array($sql)) { $product_name=$row["productName"]; $price=$row["productPrice"]; $desc=$row['productDesc']; } $subtotal=$price*$each_item['quantity']; $total=$subtotal + $total; if(isset ($_SESSION["cart_array"] )) { // dynamic checkout button assembly // dynamic cart item display $cartOutput.="<tr align=center> <td width=5%><font face=arial color='#999999'>".substr($each_item['id'],0,7)."</font></td> <td width=25%><font face=arial color='#999999'>".$product_name."</font></td> <td width=40% valign=center><font face=arial color='#999999'>".$desc."</font></td> <td valign=center width=5%><font face=arial color='#999999'>".$each_item['quantity']."</td> <td width=5%><font face=arial color='#999999'>$".$price.".00</font></td> <td width=10%><font face=arial color='#999999'>$".$subtotal.".00</font></td> </tr> <tr> <td colspan=6><hr size=1 width=50% color='#CBB659'/></td></tr>"; } // end if statement to see if cart is empty break; // if it is a salve case "3": $salveId=substr($each_item['id'],2,4); $prodId=substr($each_item['id'],0,1); // Get product name and price $sql=mysql_query("SELECT * FROM salves WHERE productId='$salveId' LIMIT 1"); while ($row=mysql_fetch_array($sql)) { $scent=$row['productName']; } $sql=mysql_query("SELECT * FROM products WHERE productId='$prodId' LIMIT 1"); while ($row=mysql_fetch_array($sql)) { $price=$row['productPrice']; $product_name=$row['productName']; } if(isset ($_SESSION["cart_array"] )) { $subtotal=$price*$each_item['quantity']; $total=$subtotal + $total; // dynamic cart item display $cartOutput.="<tr align=center> <td width=5%><font face=arial color='#999999'>".$each_item['id']."</font></td> <td width=25%><font face=arial color='#999999'>".$product_name."</font></td> <td width=40%><font face=arial color='#999999'>".$scent."</font></td> <td valign=center width=5%><font face=arial color='#999999'>".$each_item['quantity']." </td> <td width=5%><font face=arial color='#999999'>$".$price.".00</font></td> <td width=10%><font face=arial color='#999999'>$".$subtotal.".00</font></td> </tr></form> <tr> <td colspan=6><hr size=1 width=50% color='#CBB659'/></td></tr>"; } // end if statement to see if cart is empty break; // if it is not a gift box or sale/clearance item default : $scent=substr($each_item['scent'],0,4); // Get product name and price $sql=mysql_query("SELECT products.productPrice, products.productName FROM products WHERE productId='$prod_id' LIMIT 1"); while ($row=mysql_fetch_array($sql)) { $product_name=$row["productName"]; $price=$row["productPrice"]; } // get scent for regular product $sql2=mysql_query("SELECT productscents.scentName FROM productscents WHERE scentId='$scent' LIMIT 1"); while ($row2=mysql_fetch_array($sql2)) { $scent=$row2['scentName']; } $subtotal=$price*$each_item['quantity']; $total=$subtotal + $total; if(isset ($_SESSION["cart_array"] )) { // dynamic cart item display $cartOutput.="<tr align=center> <td width=5%><font face=arial color='#999999'>".substr($each_item['id'],0,7)."</font></td> <td width=25%><font face=arial color='#999999'>".$product_name."</font></td> <td width=40%><font face=arial color='#999999'>".$scent."</font></td> <td valign=center width=5%><font face=arial color='#999999'>".$each_item['quantity']."</td> <td width=5%><font face=arial color='#999999'>$".$price.".00</font></td> <td width=10%><font face=arial color='#999999'>$".$subtotal.".00</font></td> </tr></form> <tr> <td colspan=6><hr size=1 width=50% color='#CBB659'/></td></tr>"; } // end if statement to see if cart is empty break; } // end switch } // end foreach that goes through each item in the cart /* Code that generates the email */ $ans=$_SESSION['check']; $check=$_POST['check']; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // customer information $firstName = strip_tags($_POST['firstName']); $lastName = strip_tags($_POST['lastName']); $address = strip_tags($_POST['address']); $city = strip_tags($_POST['city']); $prov = strip_tags($_POST['prov']); $postalCode = strip_tags(strtoupper($_POST['postal'])); $emailAddress = strip_tags($_POST['email']); $payment = $_POST['payment']; $ship = $_POST['shipping']; // email subject $subject= "Online Order Request"; // email address the form will be submitted to $myemail="orders@coppercreekbathandbody.ca"; if ($firstName!="" && $lastName!="" && $address!="" && $city!="" && $prov!="" && $postalCode!="" && $emailAddress!="" && $ans==$check) { $email="<html><center> <table border=0 width=100% cellspacing=0 cellpadding=5 style='background:#1d1d1d' > <tr> <td colspan=6><center><h2><font color=#999999>$subject</font></h2></center></td> </tr> <tr valign=center > <td colspan=6 align=center valign=center><font face=arial color=#999999> $firstName $lastName<br> $address<br> $city, $prov $postalCode<br> $emailAddress </font><br><br> </td> </tr> <tr align=center style='background: #333'> <td width=8%><font face=arial color=#999999>Item #</font></td> <td width=25%><font face=arial color=#999999>Product</font></td> <td width=40%><font face=arial color=#999999>Description</font></td> <td width=4%><font face=arial color=#999999>Quantity</font></td> <td width=4%><font face=arial color=#999999>Price</font></td> <td width=10%><font face=arial color=#999999>Total Cost</font></td> </tr> <tr><font face=arial> $cartOutput </font></tr> <tr style='background: #333'> <td colspan=5 align=right><font face=arial color=#999999>Total Price:</font></td> <td align=center><font face=arial color=#999999>$".$total.".00 </font></td> </tr> <tr> <td colspan=4 align=right valign=center> <font face=arial color=#999999>Payment Method: </font> </td> <td colspan=2 align=right valign=center> <font face=arial color=#999999>$payment</font> </td> </tr> <tr> <td colspan=4 align=right valign=center> <font face=arial color=#999999>Shipping: </font> </td> <td colspan=2 align=right valign=center> <font face=arial color=#999999>$ship</font> </td> </tr> </table></center></body></html>"; mail($myemail, $subject, $email, $headers); unset($_SESSION['check']); header("location: success.php"); } else { unset($_SESSION['check']); } customerInformation.php <?php session_start(); error_reporting(E_ALL); ini_set('display_errors','1'); require_once("connect.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script type="text/javascript" src="./js/functions.js"></script> <link rel="stylesheet" type="text/css" href="./css/navigationStyles.css"/> <script language=javascript type=text/javascript> function stopRKey(evt) { var evt = (evt) ? evt : ((event) ? event : null); var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if ((evt.keyCode == 13) && (node.type=="text")) { return false; } } document.onkeypress = stopRKey; </script> </head> <body> <div id='wrapper'> <div id='main'> <table border=0 width=70% cellspacing=10 cellpadding=5 id=table> <tr> <td colspan=6> <center><img src="./images/customerInfoLogo.gif"><br> <table border=0 width=90%> <tr> <td width=33% align=right> <a href='index.php'>HOME</a> </td> <td width=34%></td> <td width=33% align=left> <a href='cart.php'>VIEW CART</a> </td> </tr> </table> <br><br> </center> </td> </tr> <tr> <td colspan=6 align=center valign=center> <form action="process.php" name='order' method="post" onsubmit="document.getElementById('button').disabled=true; document.getElementById('button').value='Submitting, please wait...';"> <!-- REQUEST ORDER TABLE --> <table width=90% border=0 cellspacing=5 cellpadding=5> <!-- CLIENT NAME --> <tr valign=center> <td width=50% align=right> First Name: </td> <td width=50% align=left> <input type=text maxlength=40 width=40px class=contactBox id=firstName name="firstName" onBlur="validate(this.id);"> </td> </tr> <tr valign=center> <td width=50% align=right> Last Name: </td> <td width=50% align=left> <input type=text maxlength=40 width=40px onBlur='validate(this.id);' class=contactBox id=lastName name="lastName"> </td> </tr> <!-- ADDRESS --> <tr valign=center> <td width=50% align=right> Address: </td> <td width=50% align=left> <input type=text width=40px id=address class=contactBox name="address" onBlur='validate(this.id);'> </td> </tr> <!-- CITY --> <tr valign=center> <td width=50% align=right> City: </td> <td width=50% align=left> <input type=text width=40px id=city class=contactBox name="city" onBlur='validate(this.id);'> </td> </tr> <!-- Province --> <tr valign=center> <td width=50% align=right> Province: </td> <td width=50% align=left> <select name="prov"> <option value="AB">Alberta</option> <option value="BC">British Columbia</option> <option value="MB">Manitoba</option> <option value="NB">New Brunswick</option> <option value="NL">Newfoundland & Labrador</option> <option value="NT">Northwest Territories</option> <option value="NS">Nova Scotia</option> <option value="NU">Nunavut</option> <option value="ON">Ontario</option> <option value="PE">Prince Edward Island</option> <option value="QC">Quebec</option> <option value="SK" selected>Saskatchewan</option> <option value="YT">Yukon</option> </select> </td> </tr> <!-- POSTAL CODE --> <tr valign=center> <td width=50% align=right> Postal Code: </td> <td width=50% align=left> <input type=text width=40px id=postal class=contactBox name="postal" maxlength=7'> </td> </tr> <!-- EMAIL ADDRESS --> <tr valign=center> <td width=50% align=right> Email: </td> <td width=50% align=left> <input type=text width=60px id=email class=contactBox name="email" onBlur='validateEmail(this.id);'> </td> </tr> <!-- PAYMENT TYPE --> <tr valign=center> <td width=50% align=right> Payment Type: </td> <td width=50% align=left> <select name="payment"> <option value="Email Money Transfer" selected>Email Money Transfer</option> <option value="Cash">Cash</option> <option value="Money Order">Money Order</option> </select> </td> </tr> <!-- SHIPPING --> <tr valign=center> <td width=50% align=right> Need your order shipped: </td> <td width=50% align=left> <select name="shipping"> <option value="Don't Ship" selected>Don't Ship</option> <option value="Ship Order">Ship Order</option> </select> </td> </tr> <tr> <td colspan=2> <img src='captcha.php'> <input type='text' class=cap size=4 width=3 maxlength=4 onKeyPress='return check_qty(event);' name='check'> </td> </tr> <tr> <td colspan=2 valign=top> <input type=submit value='SEND ORDER' class='updateButton' id=button> <input type=reset value='CANCEL ORDER' class='updateButton' id=button onClick="location.href='home.php'"> </td> </tr> </table> </form> </td> </tr> </table> </div> <div id="sidebar" > <?php require ("menu.html"); ?> </div> </div> </body> </html> I have no idea what is happening. It should be displaying an html formatted email. Any help is greatly appreciated.
-
Hello, So I need a bit of help with tables. I currently have my website set up with the following tables: products (productId, productName, link, productPrice, productDesc) productscents (scentId, scentName, scentDesc) salves (productId, productName, productDesc) So now most products in the products table can be made in any of the scents in the productScents table (except for the salves and reed diffuser jar). I have a separate table of the salve types that can be ordered. How do I join each product with each productScent. For example: If I have the following products with their Id number: 1 Body Mist 2 Massage Oil 3 Reed Diffuser Jar and the following scents with their id (id has leading zeros): 0001 Mango 0002 Passionfruit 0003 Grapefruit How would I create a master products table that will display the following: 3 Reed Diffuser Jar 10001 Mango Body Mist 10002 Passionfruit Body Mist 10003 Grapefruit Body Mist 20001 Mango Massage Oil 20002 Passionfruit Massage Oil 20003 Grapefruit Massage Oil I hope this makes sense. lol. Any help would be greatly appreciated.
-
Is there any way to prevent bots from getting past a math captcha? I have 2 numbers generated randomly (from 1 to 20) and they are displayed in an image with the following lines: one going from the upper left corner to the lower right corner one going from the upper right to the lower left a vertical line in the middle of the image and a horizontal line in the middle.... Now I keep getting bots posting on my comments page every few weeks...is there a more effective method I should try in order to stop this? I have the answer stored in a session variable. I was going to try random numbers from (1 to 100). I also have a php counter on my webpage that has a file that the number of hits is written to and it seems everytime the bots post get past my captcha, the number of hits in the file is overridden. (It will go from 538 views down to 10 views).... Any ideas???
-
yes, i had a new line before the php started. I never knew a blank line could cause that many problems. Hahaha. Thanks you both for all the help. Greatly appreciated.
-
Yes, the blank space fixed it and it now displays an image. thanks.
-
Yeah, I copied it exactly. Uploading is done...just displays: ‰PNG IHDRdU9,¤ÄIDAThíÖK à FáZ²*7ãFÞM¸Û„P⣞t`.ü߬=ÜBB)å%kÞ»àI?–™Mö¬?5³ùb_Žö«®w)•s¾ýSÔ™¬É ÏIL»w”Þ¾€ónÕ™¬‰Úb}dêÊîzCÇbQó!]Yö(¡}u8¯qã—½õ£—?ubɈ޳ŠP,@±ÅBŒq÷Ü8RJ»Ïà†þ†€bŠ( X€bŠ( X€bŠ( XÀt^?q±û±´IEND®B`‚
-
so i uploaded the captcha.php file to my website...in explorer it displays a broken image and in firefox it displays "the image http://www.coppercreekbathandbody.ca/captcha.php cannot be displayed because it contains errors. I also uploaded the addComment.php page to see how it displays...in IE, it's a broken image and in firefox there is no image displayed. I'm also using WAMP to test before I upload to my site...could it be something in WAMP that is giving me grief?
-
So I have this on my addComment.php page: <?php // form to add comment echo "<table border=0 width=93%> <tr> <td align=center><br><br><h2>Post A Comment</h2><br><br> </td> </tr> <tr> <td align=center> <form action='guestProcess.php' method='post'><font color=#999999> <p>What is your name? <br><input type=text width=100 class=guestBox name='name'></p> <p>Where are you from? <br> <input type=text class=guestBox name='city'></p> <p>Please enter your comments:<br> <textarea class=guestBox name='comment' style='padding: 4px; overflow:hidden; border-style: single; border-color: #999999; height:100px;'></textarea></p> <p><img src='captcha.php'> <input type='text' class=cap size=1 width=3 maxlength=3 onKeyPress='return check_qty(event);' name='check'> <br> <p><input type='submit' class='updateButton' name='submit' value='POST COMMENT'></p> </font></form> </td> </tr> </table>"; ?> When i change the <img src='captcha.php'> to what you suggested nothing happens...it is just displayed as a broken image box. Maybe I'm doing something wrong, I'm not sure. hahaha
-
I still get a broken image on the page but if i just view the captcha.php page it displays this: ‰PNG IHDRdU9,¤kIDAThíÓÁ €0A«J3©+ÝÚ‚û ™ Ž…»×Zÿ<»œD¬@¬@¬@¬@¬@¬@¬@¬@¬@¬@¬@¬@¬àcìÞpŒwι{Ã1Ü0++++++++++++øáðÓÏ÷IEND®B`‚
-
Hi, I'm trying to get a math captcha image to display on localhost using WAMP, but all i get is a broken image box. Gd is enabled. Under apache, modules, I have php5_module selected. Here is my code: <?php $num1 = rand(1, 20); $num2 = rand(1, 20); $value = $num1. " + " .$num2. " = "; $ans=$num1+$num2; $_SESSION['check'] = $ans; // image properties $height=30; $width=100; $image = imagecreatetruecolor($width, $height); $background = imagecolorallocate($image, 29, 29, 29); $text = imagecolorallocate($image, 153, 153, 153); $line = imagecolorallocate($image, 58, 58, 58); imagefill($image, 0, 0, $text); imageline($image, 0, $height/2, $width, $height/2, $line); imagestring($image, 1, 5, 1, $value, $text); header("Content-type: image/png"); imagepng($image); imagedestroy($image); ?> Then i have <img src=captcha.php> where i want the image in my form to be displayed. I have no idea why it doesn't want to work....any suggestions???
-
Ok, looks like that will be a very good idea. Didn't realize that the price can be changed like that in the paypal cart. Lol. I will have to fix that up and look at using IPN. I should be able to use their php example as a template correct?
-
I'm using this from paypal: return Optional The URL to which the payer’s browser is redirected after completing the payment; for example, a URL on your site that displays a “Thank you for your payment” page. Default – The browser is redirected to a PayPal web page. So the user is redirected to my success.php after the payment is completed. It is on this page that i'm trying to update the clearance "in stock" quantity using what was in the user's shopping cart. So my paypal button uses this: <input type=hidden name="return" value="http://www.coppercreekbathandbody.ca/success.php"> Here is my entire success.php page code: <?php session_start(); error_reporting(E_ALL); ini_set('display_errors','1'); require_once("connect.php"); ?> <?php // update clearance item "in stock" quantity foreach ($_SESSION['cart_array'] as $each_item) { $quantity=0; $id=0; // if the item in the cart is a clearance item if ($each_item['product_id'] == 13) { // get the clearance item ID and quantity of item in the cart $id=substr($each_item['id'],2,4); $quantity=$each_item['quantity']; // update the clearance item stock $sql = " UPDATE clearance SET stock = stock - '$quantity' WHERE productId = '$id' LIMIT 1"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="./css/navigationStyles.css"/> <script type="text/javascript" src="./js/jquery.js"></script> <script type="text/javascript" src="./js/sliding_effect.js"></script> <script language="JavaScript"> var time = null function move() { window.location = 'home.php' } </script> <title>Your payment has been successfully recieved...</title> </head> <body bgcolor="#1d1d1d"> <!-- onload="timer=setTimeout('move()',5000)"> --> <div id="wrapper"> <div id="main"> <center><img src="./images/copperCreekLogo.gif"><br> <br> <br> <font size=+1 face=arial color="#999999">Thank you! Your order and payment have been sent.<br> If you are not redirected shortly, please click <a href=home.php>here</a></font> </center> </div> <div id="sidebar" > <?php require ("menu.html"); ?> </div> </div> <!-- End wrapper class --> </body> </html>
-
I still can't get it to work when i unset the session cart...nothing gets updated. I added the unset line after the foreach loop.
-
stock is an int value in the database. $quantity is set to 0 at the start and then if the id of the item in the cart is "13" the quantity is set to the quantity value in the cart for that item.
-
So echo <pre>...prints out the following: Array ( [0] => Array ( [id] => 40032 [product_id] => 4 [scent] => 0032 [quantity] => 1 ) [1] => Array ( [id] => 130002 [product_id] => 13 [scent] => 0004 [quantity] => 1 ) [2] => Array ( [id] => 130003 [product_id] => 13 [scent] => 0006 [quantity] => 1 ) ) When the user completes the paypal payment, they are taken to the success.php page and the code to update the "clearance" table is executed.
-
Hi, I'm trying to update the stock in my clearance table after payment has been received. I have this code on my success.php page and the problem is that it is taking twice as many out of stock as it should be....if 1 clearance item is ordered it is taking 2 out of stock, etc. Here is my code: <?php echo "<font color=red>CART COUNT: "; echo count($_SESSION['cart_array']); echo "</font><br>"; // update clearance item "in stock" quantity foreach ($_SESSION['cart_array'] as $each_item) { $quantity=0; $id=0; // if the item in the cart is a clearance item if ($each_item['product_id'] == 13) { // get the clearance item ID and quantity of item in the cart $id=substr($each_item['id'],2,4); $quantity=$each_item['quantity']; // update the clearance item stock $sql = " UPDATE clearance SET stock = stock - $quantity WHERE productId = '$id' LIMIT 1"; if (mysql_query($sql) == false) { user_error("QUERY FAILED: " . mysql_error()); } else { // comment this out in production version: user_error("DEBUG: Quantity updated: $sql"); } } } ?> Here is the output I get when I have 3 items in the shopping cart (2 are clearance items): CART COUNT: 3 Notice: DEBUG: Quantity updated: UPDATE clearance SET stock = stock - 1 WHERE productId = '0002' LIMIT 1 in C:\wamp\www\CopperCreek\success.php on line 39 Notice: DEBUG: Quantity updated: UPDATE clearance SET stock = stock - 1 WHERE productId = '0003' LIMIT 1 in C:\wamp\www\CopperCreek\success.php on line 39 I have no idea what the problem is....any help would be appreciated. I've been looking at this for a couple weeks now.
-
Ok. That makes sense. I will try restructure it so the code will be simpler. Now when I create the third table do I manually enter the data or is there a way I can join the two tables to create the third.
-
Ok. So how do I create the third table. Do I do something like a left join or full join to connect the first two? Sorry, I am new to this.
-
I do have leading 0s on the scent ids...not sure if that would help. So product 13 and scent 6 would have a unique id# of 1306. Would increasing the number of leading 0s to 3 or 4 make it better. We will never reach 100 products or 1000 scents. Would this be a good alternative?
-
The other thing that makes this complicating is that I have 2 mysql tables...one with the product and the other has the scents. I have 10 different products that are available in each scent. For example...elite hand creams have an I'd of 1 and the scent pomegranate has an id of 36, so I combine the two to give the product the id of 136. This will be the unique id. I have the product pages dynamically made using the tables. I will try clean up the code. Hopefully this makes sense.