Jump to content

fazzfarrell

Members
  • Posts

    154
  • Joined

  • Last visited

    Never

Everything posted by fazzfarrell

  1. I tried it like this <?php $english_format_number = number_format($number); $number1 = $row_rsProd['P_Retail_Price']; $number2 = $row_rsUser['Percent']; if (isset($_SESSION['MM_Username'])) { $save = ($number2 * 100); }else{ $save = 1; } $retail = ($number1 / $save ); echo FormatPrice($retail)." save'd $save% (".FormatPrice($number2).")"; { echo FormatPrice($retail); } //function closes function FormatPrice($price) { $price = preg_replace("/[^0-9\.]/", "", str_replace(',','.',$price)); if (substr($price,-3,1)=='.') { $sents = '.'.substr($price,-2); $price = substr($price,0,strlen($price)-3); } elseif (substr($price,-2,1)=='.') { $sents = '.'.substr($price,-1); $price = substr($price,0,strlen($price)-2); } else { $sents = '.00'; } $price = preg_replace("/[^0-9]/", "", $price); return number_format($price.$sents,2,'.',''); } ?> But still getting an error?
  2. Seem to get an error You pay:£ Fatal error: Call to undefined function: formatprice() in /home/sites/octopus8.co.uk/public_html/products.php on line 413?
  3. That works great, how can I change it so that the price without logging in becomes You Pay £41.50 etc opposed to £41,50? An when I login for my discount the price becomes £38 (example) instead of £38.00? Is it to do with the english format?
  4. Yeah the user is from a session MM_Username
  5. HI Yes I need a condional, how do I apply this to the code I have? thanks
  6. I have this code <?php $english_format_number = number_format($number); $number1 = $row_rsProd['P_Retail_Price']; $number2 = $row_rsUser['Percent']; echo number_format ($number1 / $number2 * 100); ?> the '$row_rsUser['Percent']' is pulling a percentage (117.5 etc) from a database when the user logs in, which gives the user a discount. if they don't log in want it to be a '0' percent so that the full price displays. anyone help?
  7. Must be sunday morning, my brain would not work properly thanks!
  8. I have this code: <?php //Rob Farrell and Leyon Nevett: add up design cost x hrs $number1 = $row_rsProd['P_Retail_Price']; $number2 = $row_rsUser['Percent']; echo number_format ($number1 / $number2); ?> I know how to create a session - but I am having a blank how to turn this into a session? can any one help?
  9. I have third party script that should display a message afer submitting. but it always comes out blank? Any one see why? <?php if ($_SERVER['REQUEST_METHOD']=="POST"){ // we'll begin by assigning the To address and message subject $to=$HTTP_POST_VARS['Position']; $subject="E-mail with attachment"; // get the sender's name and email address // we'll just plug them a variable to be used later $from = stripslashes($_POST['fromname'])."<".stripslashes($_POST['fromemail']).">"; // generate a random string to be used as the boundary marker $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; // store the file information to variables for easier access $tmp_name = $_FILES['filename']['tmp_name']; $type = $_FILES['filename']['type']; $name = $_FILES['filename']['name']; $size = $_FILES['filename']['size']; $myname = $HTTP_POST_VARS['fromname']; $Add = $HTTP_POST_VARS['fromaddress']; $Tel = $HTTP_POST_VARS['fromTel']; $Pos = $HTTP_POST_VARS['Position']; $Found = $HTTP_POST_VARS['Found']; // here we'll hard code a text message // again, in reality, you'll normally get this from the form submission $message = "Here is my CV: $name, My Name is: $myname, My Address is: $Add, My Telephone number is: $Tel, Found us via: $Found"; // if the upload succeded, the file will exist if (file_exists($tmp_name)){ // check to make sure that it is an uploaded file and not a system file if(is_uploaded_file($tmp_name)){ // open the file for a binary read $file = fopen($tmp_name,'rb'); // read the file content into a variable $data = fread($file,filesize($tmp_name)); // close the file fclose($file); // now we encode it and split it into acceptable length lines $data = chunk_split(base64_encode($data)); } // now we'll build the message headers $headers = "From: $from\are\n" . "MIME-Version: 1.0\are\n" . "Content-Type: multipart/mixed;\are\n" . " boundary=\"{$mime_boundary}\""; // next, we'll build the message body // note that we insert two dashes in front of the // MIME boundary when we use it $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // now we'll insert a boundary to indicate we're starting the attachment // we have to specify the content type, file name, and disposition as // an attachment, then add the file content and set another boundary to // indicate that the end of the file has been reached $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"{$name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; // now we just send the message if (@mail($to, $subject, $message, $headers)) echo "Thank you for your application."; else echo "Failed to send"; } } else { ?> As a young, dynamic and expanding company, we are always looking for the right staff.<br> <br> Please fill in your details and upload your cv below and press submit. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form1"> <table width="100%" border="0"> <tr> <td width="15%">Name:</td> <td width="85%"><input type="text" name="fromname"></td> </tr> <tr> <td>e-mail:</td> <td><input type="text" name="fromemail"></td> </tr> <tr> <td align="left" valign="top">Address</td> <td><textarea name="fromaddress" rows="4"></textarea></td> </tr> <tr> <td>Tel:</td> <td><input type="text" name="fromTel"></td> </tr> <tr> <td>Upload your cv :</td> <td><input type="file" name="filename"></td> </tr> <tr> <td>Position:</td> <td><select name="Position" id="Position"> <option value="adace@damarhomes.co.uk">Commercial</option> <option value="swells@damarhomes.co.uk">Sales and Marketing</option> <option value="adace@damarhomes.co.uk">Accounts</option> <option value="adace@damarhomes.co.uk">Land</option> <option value="swells@damarhomes.co.uk">Construction management</option> <option value="swells@damarhomes.co.uk">Secretarial</option> </select></td> </tr> <tr> <td>Founds us via: </td> <td><select name="Found" id="Found"> <option value="Advert">Advert</option> <option value="Local Press">Local press</option> <option value="Search Engine">Search Engine</option> </select></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> <br> </form>
  10. HI I have just tested this: <code> <?php if($_SERVER['PHP_SELF'] == "careers.php") { echo "<a href=\"careers.php\">Back[/url]"; } ?> <code> If the url comes from the careers.php I ant the back button to appear if it comes from elsewhere it should not, at the moment it does not appear at all? I think it may be due that it come from http://82.110.105.85/spgrouptemp.co.uk/careers-red.php?Area=Birmingham or another area such as =Redditch?
  11. HI I have just tested this: <code> <?php if($_SERVER['PHP_SELF'] == "careers.php") { echo "<a href=\"careers.php\">Back</a>"; } ?> <code> If the url comes from the careers.php I ant the back button to appear if it comes from elsewhere it should not, at the moment it does not appear at all?
  12. Thanks tried this </code> <?php if($_SERVER['PHP_SELF'] == "index.htm") { <a href="careers.php">Back } else { // No link } ?> <code> but i get this error: Parse error: syntax error, unexpected '<' in /home/sites/clays.co.uk/public_html/careers-red.php on line 182 Am i missig something?
  13. I have a page that can be accessed by two differnet urls - what I would like to do is hide a link when coming from the second url can anyone point me in the roght diection? thanks
  14. I specified tha save path outside my root folder and now it works thanks for your help!
  15. I keep getting this error and I can't get rid of it any one help? Warning: session_start() [function.session-start]: open(/tmp/sess_72b9bf3e0228df49654f24222e3b7f06, O_RDWR) failed: Permission denied (13) in /home/sites/st-ives.com/public_html/careers-red.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/sites/st-ives.com/public_html/careers-red.php:3) in /home/sites/st-ives.com/public_html/careers-red.php on line 3
  16. I have some forgion langages in my database eg é for some reason this throws up some weired symbols on my web pages any ideas?
  17. Ah now I see what you mean, I keep moving the code to the wrong place! It now works a treat thank you
  18. I blocked it out not sure were im supposed to move it to!
  19. sorry quite new to this stuff! I have moved it with errors. I am at a loss sorry
  20. thanks but nor quite sure what you mean? not sure if I explained myself properly either! I want to be able to send the mail with or without the attachement!
  21. can any one help, If I fill in the form and make no attachement the form does not send and display the message, if I do attach it works fine? any one help this is my code <?php if ($_SERVER['REQUEST_METHOD']=="POST"){ // we'll begin by assigning the To address and message subject $to=$HTTP_POST_VARS['ToEmail']; $subject="E-mail with attachment"; // get the sender's name and email address // we'll just plug them a variable to be used later $from = stripslashes($_POST['FirstName'])."<".stripslashes($_POST['EMail']).">"; // generate a random string to be used as the boundary marker $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; // store the file information to variables for easier access $tmp_name = $_FILES['filename']['tmp_name']; $type = $_FILES['filename']['type']; $name = $_FILES['filename']['name']; $size = $_FILES['filename']['size']; $myTitle = $HTTP_POST_VARS['Title']; $myFirstName = $HTTP_POST_VARS['FirstName']; $myLastName = $HTTP_POST_VARS['LastName']; $myTelephone = $HTTP_POST_VARS['Telephone']; $myEmail = $HTTP_POST_VARS['EMail']; $myMessage = $HTTP_POST_VARS['Message']; $ContactBy = $HTTP_POST_VARS['ContactBy']; $FoundUs = $HTTP_POST_VARS['FoundUs']; // here we'll hard code a text message // again, in reality, you'll normally get this from the form submission $message = " My Title is: $myTitle, My First Name is: $myFirstName, My Second Name is: $myLastName, My Telephone number is: $myTelephone, My Email is: $myEmail, Message: $myMessage, Contact Me via: $ContactBy, Found us via: $FoundUs"; // if the upload succeded, the file will exist if (file_exists($tmp_name)){ // check to make sure that it is an uploaded file and not a system file if(is_uploaded_file($tmp_name)){ // open the file for a binary read $file = fopen($tmp_name,'rb'); // read the file content into a variable $data = fread($file,filesize($tmp_name)); // close the file fclose($file); // now we encode it and split it into acceptable length lines $data = chunk_split(base64_encode($data)); } // now we'll build the message headers $headers = "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; // next, we'll build the message body // note that we insert two dashes in front of the // MIME boundary when we use it $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // now we'll insert a boundary to indicate we're starting the attachment // we have to specify the content type, file name, and disposition as // an attachment, then add the file content and set another boundary to // indicate that the end of the file has been reached $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"{$name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; // now we just send the message if (@mail($to, $subject, $message, $headers)) echo "Thank you for applying to AgilityWorks."; else echo "Failed to send"; } } else { ?>
  22. thanks tried that before andthe page hung, silly me forgot ';' at the end of the line! thanks a lot!
  23. I have this code to send my cart via email <?php if (isset($HTTP_POST_VARS["IMXeMailVForm1"])) { $IMXMAIL = new MailCart(); $IMXMAIL->cart = &$HTTP_SESSION_VARS["icJag"]; $IMXMAIL->to = $HTTP_SESSION_VARS['MM_Username']; $IMXMAIL->from = "Spgroup"; $IMXMAIL->subject = "##UNCONFIRMED ORDER##"; $IMXMAIL->cc = "mark.houston@******.co.uk"; $IMXMAIL->bcc = "kellyg@******.co.uk"; $IMXMAIL->message = "##UNCONFIRMED ORDER##"; $IMXMAIL->redir = ""; $IMXMAIL->send($HTTP_POST_VARS); } ?> in the bcc coloum I want to add more than one email address so I tried "kellyg@******.co.uk"; "rob@******.co.uk"; and it did not work is the a simple answer?
  24. <?php $paramID_rsColour = "1"; if (isset($row_rsProducts['ColRef'])) { $paramID_rsColour = (get_magic_quotes_gpc()) ? $row_rsProducts['ColRef'] : addslashes($row_rsProducts['ColRef']); } mysql_select_db($database_poles, $poles); $query_rsColour = sprintf("SELECT Colour.Colour_ID, Colour.Name, Colour.ColRef, Colour.Code FROM Colour WHERE Colour.ColRef = %s", GetSQLValueString($paramID_rsColour, "int")); $rsColour = mysql_query($query_rsColour, $poles) or die(mysql_error()); $row_rsColour = mysql_fetch_assoc($rsColour); $totalRows_rsColour = mysql_num_rows($rsColour); // IntelliCART MX - Add Multiple Items if ($HTTP_POST_VARS["imxmavf1"]) { $IMXADD = new addition; $IMXADD->quantityField = "Qty"; // Loop through the instances $IMX_Q = $HTTP_POST_VARS["Qty"]; //Reference to posted size $size_field = $HTTP_POST_VARS['size_selection']; for ($k=0; $k < count($IMX_Q)+1; $k++) { if ($IMX_Q[$k] > 0) { $IMXADD->column[] = $row_rsProducts['Product_ID']; $IMXADD->column[] = $row_rsProducts['CatID']; $IMXADD->column[] = ''; $IMXADD->column[] = $row_rsProducts['CatID2']; $IMXADD->column[] = $row_rsProducts['Style']; $IMXADD->column[] = $row_rsProducts['Name']; $IMXADD->column[] = ''; $IMXADD->column[] = $IMX_Q[$k]; $IMXADD->column[] = ''; $IMXADD->column[] = $row_rsProducts['Misc']; $IMXADD->column[] = ''; $IMXADD->addMultiRow($HTTP_SESSION_VARS["icPoles"]); } $row_rsProducts = mysql_fetch_assoc($rsProducts); } $IMXADD->redirect = "cart.php"; $IMXADD->urlparams = preserve($HTTP_GET_VARS); $IMXADD->addMultiDone(); } $HTTP_GET_VARS = preserve($HTTP_GET_VARS); ?> <form id="frmProducts" name="frmProducts" method="POST" action="<?php echo $PHP_SELF; ?>?<?php echo arrToString($HTTP_GET_VARS); ?>">
×
×
  • 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.