PHP - Body Id Based On Url - Wordpress/php
I've been trying to implement the ID the Body Based on URL wordpress snippet.
First issue seems to be a syntax error function curr_virtdir($echo=true){ $url = explode('/',$_SERVER['REQUEST_URI']); $dir = $url[1] ? $url[1] : 'home'; // defaults to this if in the root $dir = htmlentities(trim(strip_tags($dir))); // prevent injection into the DOM through this function if ($echo) echo $dir; return echo $dir; // ie. curr_virtdir(false) } function get_curr_virtdir(){ curr_virtdir(false); } I Get a syntax error on this line below return echo $dir; // ie. curr_virtdir(false) If i remove this line completly the script seems to work for in the following situation <body <?php id="<?php curr_virtdir(); ?>"> although I am trying to use the same functions as a conditional for my hardcoded navigation but it doesnt seem to work - any ideas? <li><a href="http://www.url.com/" class="<?php if ( get_curr_virtdir() == "home" ){echo "navhomecurrent";} else {echo "navhome";}?>">Home<span></span></a></li> <li><a href="http://www.url.com/solutions/solutions/" class="<?php if ( get_curr_virtdir() == "solutions" ){echo 'navsolutionscurrent';} else {echo 'navsolutions';}?>">Solutions<span></span></a></li> <li><a href="http://www.url.com/about-us/about-us/" class="<?php if ( get_curr_virtdir() == "about-us" ){echo "navaboutuscurrent";} else {echo "navaboutus";}?>">About us<span></span></a></li> Similar TutorialsI have a php tutorial that I followed for creating, inserting, selecting and updating a MySQL database with php. Everything works fine so I wanted to put it into Wordpress. I took the code and placed it into the wordpress page and everything worked just fine except the update function. Here is the tutorial I used. http://www.phpsimple.net/mysql_insert_record.html It is also the part I am having trouble with. I am able to create a record and I am also able to select a record but when I choose "update" the form doesn't load the data. It will outside the website but not inside wordpress. I am hoping this is not vague but because of my inexperience I am not sure what else to say. I will be more than happy to provide any other information you need. Hi, I've written a conditional statement to give my body tag a unique ID, depending on three conditions. (body id="red" etc..) The statement does indeed work when tested, but dreamweaver is highlighting the conditional in yellow - So I'm wondering if there is an alternate (and perhaps cleaner) way of writing the following.. It's for a joomla site btw.. (I've spread the code out a little here, so it's easier for you guys to see what I'm doing) Code: [Select] <body <?php if($this->countModules('headerlow')) : ?> id="up" <?php endif; ?> <?php if (JRequest::getVar('Itemid')==104) { ?> id="red" <? } else {?> id="low" <? } ?> > I want to read an imap message with all the headers, and body, what would be the best way to do that? Hey guys I have the following code and am trying to get the body of the webpage, however it is not currently working and the array at the end is empty. Any help appreciated!!!!! Code: <?php $word = $_GET['word']; function get_web_page( $url,$curl_data ) { $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_POST => 1, // i am sending post data CURLOPT_POSTFIELDS => $curl_data, // this are my post vars CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl CURLOPT_SSL_VERIFYPEER => false, // CURLOPT_VERBOSE => 1 // ); $ch = curl_init($url); curl_setopt_array($ch,$options); $content = curl_exec($ch); $err = curl_errno($ch); $errmsg = curl_error($ch) ; $header = curl_getinfo($ch); curl_close($ch); // $header['errno'] = $err; // $header['errmsg'] = $errmsg; //$header['content'] = $content; return $content; } $curl_data = "?tranword=".$word; $url = "http://www.wordreference.com/es/translation.asp?tranword=".$word; $response = get_web_page($url,$curl_data); preg_match('~<body>(.*)</body>~', $response, $output); print_r($output); ?> Thanks lots, Jake Hello all, I have a script I have been working on that retrieves my email from my mail server using some of the imap_functions. Everything works fine except for the emails that were sent from my blackberry. I have done some research and it seem to be something to do with the encoding that the blackberry uses. I have found a little bit of code that I was hoping would solve the issue. My goal is to get the body content from email that was produced with my blackberry and put bits of this body into a database. Then I want to do a report from that database once a week. I have developed a script that will retrieve all other message except from my blackberry. Does anyone know how blackberry encodes their body content? jmr3460 i am having issues getting the variables to show up on localhost server within the body element. is it something in the codes or something in the php.ini settings? here is some sample code Code: [Select] <h1>Skyward Aviation</h1> <h2>Contact Information</h2> <form action="ContactUpdate.php" method="get"> <table frame="border" rules="cols"> <colgroup width="50%" /> <colgroup width="50%" /> <tr> <td align="right" valign="top"> <p>First Name <input type="text" name="first_name" value="<?= $First ?>" size="36" /></p> <p>Last Name <input type="text" name="last_name" value="<?= $Last ?>" size="36" /></p> <p>Phone <input type="text" name="phone" value="<?= $Phone ?>" size="36" /></p> </td> <td align="right" valign="top"> <p>Address <input type="text" name="address" value="<?= $Address ?>" size="40" /></p> <p>City <input type="text" name="city" value="<?= $City ?>" size="10" /> State <input type="text" name="state" value="<?= $State ?>" size="2" maxlength="2" /> Zip <input type="text" name="zip" value="<?= $Zip ?>" size="10" maxlength="10" /></p> </td> </tr> </table> <p><input type="hidden" name="PHPSESSID" value='<?php echo session_id() ?>' /> <p><input type="submit" value="Submit" /></p> </form> In the page is shows <?= $First ?> in the area First Name textbox. This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=351491.0 Hi there guys, can any1 help me out to sort this thing. I'm using a simple php email script to send emails from online form (registration). Since i'm using unicode (cyrilic) font, i'm recieving an unreadable email from my php script. Here's the script (mailer.php): Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset="UTF-8" /> <title>Mecavnik</title> </head> <body> <!-- Reminder: Add the link for the 'next page' (at the bottom) --> <!-- Reminder: Change 'YourEmail' to Your real email --> <?php $ip = $_POST['ip']; $hp1 = $_POST['hp1']; $hp2 = $_POST['hp2']; $hp3 = $_POST['hp3']; $hp4 = $_POST['hp4']; $hp5 = $_POST['hp5']; $IP = $_POST['IP']; $hp6 = $_POST['hp6']; $hp7 = $_POST['hp7']; $hp8 = $_POST['hp8']; $hp9 = $_POST['hp9']; $hp10 = $_POST['hp10']; $hp11 = $_POST['hp11']; if (eregi('http:', $notes)) { die ("Ne ne! ! "); } if(!$hp8 == "" && (!strstr($hp8,"@") || !strstr($hp8,"."))) { echo "<h2>Error</h2>\n"; $badinput = "<h2>Error</h2>\n"; echo $badinput; die ("Error."); } if(empty($hp1) || empty($hp2) || empty($hp3) || empty($hp4) || empty($hp5) || empty($hp6) || empty($hp7) || empty($hp8 )) { echo "<h2>123</h2>\n"; die ("Error."); } $datum = date("l, F j, Y, g:i a") ; $subject = "Custom subject"; $message = "Firma: $hp1 \n Ime: $hp2 \n Prezime: $hp3 \n Email: $hp8 \n Telefon: $hp4 \n Konfekcijski broj: $hp5 \n Spavanje: $hp6 \n Prevoz: $hp7 \n "; $from = "From: $hp8 \n"; mail("evlj@something.bla", $subject, $message, $from); ?> <?php header( 'Location: http://blabla/123/123.html' ) ; ?> </p> </body> </html> Email that i have previously recieved: Code: [Select] Firma: Тестирам Ime: Упишите Ваше име Prezime: Упишите Ваше презиме Thanks in advance I have this code. Why aren't the php scripts working when executing the body onload or onunload functions? Code: [Select] <head> <script language="javascript"> <?php function hello() { $fp = fopen("counter.txt", "r"); $count = fread($fp, 1024); fclose($fp); $count = $count + 1; echo "<p>Number of users online now:" . $count . "</p>"; $fp = fopen("counter.txt", "w"); fwrite($fp, $count); fclose($fp); alert("Welcome to My Page"); } ?> <?php function goodbye() { $fp = fopen("counter.txt", "r"); $count = fread($fp, 1024); fclose($fp); $count = $count - 1; $fp = fopen("counter.txt", "w"); fwrite($fp, $count); fclose($fp); alert("Goodbye!"); } ?> </script> </head> <body onload="hello()" onUnLoad="goodbye()"> </div> </body> </html> I have a page which contains php scripts for the values that will be send through email. my problem is when i send it, it doesn't read the php script. The body only read plain html text. how can I output my php script values through html Hi, I wanted to know is there any class or functions which will parse the mail body and find all the features like how many sentences, how many stop words, how many paragraphs, how many punctuation chars, etc. I haven't find anything good in my searching so far. I have parsed the whole body of email and separated the headers and body in variables. Now I want to perform these operations in only in the body. Thank you in advance. Magento PHP mail function : <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $extra = $order->getIncrementId(); $message = " <tr> <td>$incrementid</td> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = "<table border='1'> <tr> <th>Id</th> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMail($finalMessage); } } public function sendMail($message) { $body ="$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('abc'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $emailTemplate->setToEmail('aveevacool@gmail.com'); $emailTemplate->send(); } } ?> Now my output like :
Edited January 7, 2020 by aveeva Hi,
I currently have some html stored in a variable as below:
<!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>Untitled Document</title> </head> <body> Hello world </body> </html>This requires a "<div class='container'>" to be inserted directly after the opening body tag. My original thinking was to use str_replace on the <body> to be <body><div class="container"> however note that occasionally my body will require an ID or Class. I therefore need a way to make it appear after the body tag, even if it has an ID or Class on it :-\ . I assume this may be reg-ex, but am not sure if there is a simple way around this? Would anyone be able to clarify and point me in the right direction. Much appreciated. MoFish Hello,
I've made a function that contains the html header (<head>). When I call that function in a other file, with the header file included, it puts the header function in the body. So all the meta tags are in the body, instead of the head.
Would it be possible to load this all in the head?
The head function does contain the html and head tags. However, without them, it still doesn't want to go to the head.
My external css file works on everything except for body, however, it works when I include the css on the page itself:
body{ margin-top: 0px; padding-top: 0px; margin-bottom: 0px; padding-bottom: 0px; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OERFQkEzRUJDNUM5MTFFMUE3NzBCMTZBMEExNEQ5NUQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OERFQkEzRUNDNUM5MTFFMUE3NzBCMTZBMEExNEQ5NUQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4REVCQTNFOUM1QzkxMUUxQTc3MEIxNkEwQTE0RDk1RCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4REVCQTNFQUM1QzkxMUUxQTc3MEIxNkEwQTE0RDk1RCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PiSp0pIAAAAySURBVHjaYmBgYOAHYmYGCADR/CDiDxDzQAW5gPgLlM3ACsQKUBqhBYjZkY3CMBMgwACvHQKnyUp+6gAAAABJRU5ErkJggg=="); background-color:#b20a22; -webkit-transition: all 300ms ease-in-out; -moz-transition: all 300ms ease-in-out; -ms-transition: all 300ms ease-in-out; -o-transition: all 300ms ease-in-out; transition: all 300ms ease-in-out; }What could be wrong? I've been trying to use an example I got off of this forum. The PHP file works fine as a separate PHP file. When it's adding into a wp page the following results occur; Page will access db and display the list of people. Columns can be sorted by either the id or name. Existing names can be modified However; Can not add new players or delete players ANY suggestions are appreciated! <?php /**** Dealing with the database ****/ // connect to db $conn = mysql_connect('xxxxxxxxxx','yyyyyyyyyy','zzzzzzzzzzzzz') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('ddddddddddddd',$conn) or trigger_error("SQL", E_USER_ERROR); // INSERT: if we have a name to add... if($_GET['name']) { // little bit of cleaning... $name = mysql_real_escape_string($_GET['name']); // insert new name into table $sql = "INSERT INTO info (id, name) VALUES ('','$name')"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } // end if // UPDATE: if we have name(s) to change... if($_POST['cname']) { // for each name to change... foreach($_POST['cname'] as $cid => $cname) { // little bit of cleaning... $id = mysql_real_escape_string($cid); $name = mysql_real_escape_string($cname); // update name in the table $sql = "UPDATE info SET name = '$name' WHERE id = '$id'"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } // end foreach } // end if // DELETE: if we have a name to delete... if($_GET['name']) { // little bit of cleaning... $name = mysql_real_escape_string($_GET['name']); // delete name from table $sql = "DELETE FROM info WHERE name = '$name'"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } // end if // ORDERBY: if one of the links was clicked.. if ($_GET['orderby']) { // make an aray of allowed names $allowed = array('id','name'); // bit of cleaning... $order = mysql_real_escape_string($_GET['orderby']); // is it a valid column name? yes: use it. no: default to 'id' $order = (in_array($order, $allowed))? $order : "id"; // if no link clicked, default to 'id' } else { $order = "id"; } // end else // SELECT: get the list of names from database $sql = "SELECT id, name FROM info ORDER BY $order"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); /**** end deal with the database ****/ /**** list everything out ****/ // list columns echo <<<LISTCOLS <form action = '{$_SERVER['REQUEST_URI']}' method = 'post'> <table border = '1'> <tr> <td><a href = '{$_SERVER['REQUEST_URI']}?orderby=id'>id</td> <td><a href = '{$_SERVER['REQUEST_URI']}?orderby=name'>name</td> <td>delete</td> </tr> LISTCOLS; // loop through list of names while ($list = mysql_fetch_assoc($result)) { echo <<<LISTINFO <tr> <td>{$list['id']}</td> <td><input type = 'text' name = 'cname[{$list['id']}]' value = '{$list['name']}'> <td><a href = '{$_SERVER['REQUEST_URI']}?name={$list['name']}'>delete</a></td> </tr> LISTINFO; } // end while // list input box for adding new entry echo <<<NEWENTRY <tr> <td bgcolor = 'gray'></td> <td><input type = 'text' name = 'name'></td> <td bgcolor = 'gray'></td> </tr><tr> <td></td> <td align = 'center'><input type = 'submit' value = 'submit'></td> <td></td> </tr> </table> </form> NEWENTRY; /**** end list everything out ****/ ?> I am new here I dont know if I am breaching any policy by posting questions.
Are there any Tutorials that can give me input for wordpress basics such as listed here -
http://codex.wordpress.org/Plugin_API
http://codex.wordpre...Class_Reference
I would be indebted if you can help me with that.
Looking Forward. Cheers!
Hi I am sure this is very simple but it's got me beat! I have a page that sends emails to people with their account details. I can get it to work fine with straight plain text but would like it in HTML and I can't get the username and password details into the body of the email. I'm sure it's just a formatting issue but I've tried many things and it fails!! Any suggestions very welcome. The code is below. Many thanks in advance. <?php // MAIL TO AP require_once '../phpmailer/class.phpmailer.php'; $mail = new PHPMailer(); if(isset($_GET['idcode'])){ $idcodepassed = $_GET['idcode']; }else{ $idcodepassed = 111111; // set this to your default value if no URL value is present } mysql_select_db($database_process, $process); $result = mysql_query("SELECT applicantid, idcode, type, company, email, CONCAT('pdf_document_',idcode) AS linkname, length, username, password, DATE_FORMAT(applicationdate,'%D %M %Y') AS formattedDate, parties FROM applicant WHERE idcode = '$idcodepassed' LIMIT 1 "); while($row = mysql_fetch_array($result)) { $appid = $row['applicantid']; $idcode = $row['idcode']; $type = $row['type']; $company = $row['company']; $email = $row['email']; $term = $row['length']; $username = $row['username']; $password = $row['password']; $appdate = $row['formattedDate']; $parties = $row['parties']; } // $body = file_get_contents('EmailTextAP.php'); // $body = eregi_replace("[\]",'',$body); $body = '<html><p>This email TO AP is confirmation of your appointment of Clear Appointments as your agent for service of process under the agreement between $parties. Our appointment starts on $appdate and you have appointed us for $term years from this date. We have attached our letter of confirmation to this email for your records.</p> <p>You can log into your account on our website (<a href=\"http://www.clearappointments.co.uk\">www.clearappointments.co.uk</a>) at any time to review your documents and change your contact details. Your user name is:??? and your password is ???.</p> <p>We appreciate your custom and hope that you will use us again.</p> <p>Kind regards</p> <p>Clear Appointments Team<br /> '; $mail->SetFrom('confirmation@clearappointments.co.uk', 'Clear Appointments'); $mail->AddReplyTo('confirmation@clearappointments.co.uk', 'Clear Appointments'); // set the subject of the email $mail->Subject = "Process Agent Letter of Confirmation Attached"; @MYSQL_CONNECT("localhost","lawwork1_graham","733576"); @mysql_select_db("lawwork1_process"); $query = "SELECT company, email FROM applicant WHERE idcode='$idcodepassed'"; $result = @MYSQL_QUERY($query); // sets name and location of attachment $directory = '../docs/'; $docname = 'Confirmation_Letter_'. $idcodepassed . '.pdf'; $invname = 'Invoice_' . $idcodepassed . '.pdf'; $send=$directory.$docname; $sendinvoice=$directory.$invname; while ($row = mysql_fetch_array ($result)) { $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $mail->AddAddress($row["email"]); // $mail->AddAddress($row["instemail"]); // attachment // $mail->AddAttachment($send); // $mail->AddAttachment($sendinvoice); $mail->AddAttachment($send); // attachment // $mail->AddAttachment($sendinvoice); // attachment if(!$mail->Send()) { echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '<br>'; } else { echo ""; // echo "Message sent to :" . $row["full_name"] . ' (' . str_replace("@", "@", $row["email"]) . ')<br>'; } // Clear all addresses and attachments for next loop $mail->ClearAddresses(); $mail->ClearAttachments(); } ?> Hey guys, I know nothing of PHP so please bare with me as I try to explain my problem. My company collects sales leads that are emailed through to a CRM system (GoldMine). We are currently in the process of moving our website from a shared windows server to a dedicated linux server and it seems to be causing a problem with the form, or at least PHP behind it. The guy who handed the initial set up has mysteriously disapeared so we're in a bit of a fix. I'm not specifically looking for a solution, more of an idea of where to go from here. I'm not sure wether the problem lies in the PHP itself or something else.. like the server for example. I was hoping someone here might be able to point me in the right direction somewhat. Anyway, the problem is that while testing the form on the new server the email is sent and our CRM picks it up but cannot read because a newly appeared line has been inserted at the top of the body. This does not appear when filling in the form currently live on our site (windows server). the line is: Code: [Select] Content-Type: text/x-gm-impdata As far as I'm aware this content-type is necessary for our CMR to recognize and read the email, but it shouldn't be showing up in the body of the mail. The full on send PHP is: Code: [Select] <?php $redirectURL = "http://www.website.co.uk/confirmation_page.htm"; function Decode($strValueIn) { //Do not modify this function! $intX = 0; $intY = 0; $Temp = ""; $Mod = ""; $intMod =0; $intTemp = 0; $ValueOut = ""; $intY = 1; $strValueOut=""; for ($intX=1; $intX<=((strlen($strValueIn)/2)/2); $intX=$intX+1) { $strTemp=""; $strMod=""; if (($intX % 2)==0) { $strMod=substr(substr($strValueIn,$intY-1,4),0,2); $strTemp=substr(substr($strValueIn,$intY-1,4),strlen(substr($strValueIn,$intY-1,4))-(2)); } else { $strMod=substr(substr($strValueIn,$intY-1,4),strlen(substr($strValueIn,$intY-1,4))-(2)); $strTemp=substr(substr($strValueIn,$intY-1,4),0,2); } $intMod=hexdec($strMod); $intTemp=hexdec($strTemp); $intTemp=$intTemp-$intMod; $strValueOut=$strValueOut.chr($intTemp); $intY=$intY+4; } return $strValueOut; } if ($_POST["GMsubmit"]!="") { $Body = ""; $Notes = ""; $SendToEmail = Decode($_POST["SendToEmail"]); //$SMTP = Decode($_POST["SMTP"]); //Your SMTP data may have to be set set on the Apache Server, and this variable is not used. $OnNewSendGMEmail = $_POST["OnNewSendGMEmail"]; if ($OnNewSendGMEmail!="") {$OnNewSendGMEmail = Decode($OnNewSendGMEmail);} else {$OnNewSendGMEmail = "";} if ($_POST["OnDUPSendGMEmail"]!="") {$OnDUPSendGMEmail = Decode($_POST["OnDUPSendGMEmail"]);} else {$OnDUPSendGMEmail = "";} if ($_POST["OnNewAttachTrack"]!="") {$OnNewAttachTrack = Decode($_POST["OnNewAttachTrack"]);} else {$OnNewAttachTrack = "";} if ($_POST["OnDupAttachTrack"]!="") {$OnDupAttachTrack = Decode($_POST["OnDupAttachTrack"]);} else {$OnDupAttachTrack = "";} if ($_POST["Word"]!="") {$Password = Decode($_POST["Word"]);} else {$Password = "";} if ($_POST["DupLogic"]!="") {$DupLogic = Decode($_POST["DupLogic"]);} else {$DupLogic = "";} $OutputAs = $_POST["OutPutAs"]; $DuplicateCount=0; $XML = "<gmdata>"; if ($_POST["DuplicateCount"]!="") { $DuplicateCount =intval($_POST["DuplicateCount"]); } if ($DuplicateCount >0 || $OnNewSendGMEmail!="" || $OnDUPSendGMEmail!="" || $OnNewAttachTrack!="" || $OnDupAttachTrack!="") { $Body = $Body."[Instructions]\r\n"; $XML = $XML."<Instructions>"; if ($DuplicateCount > 0) { for($counter=0; $counter < $DuplicateCount; $counter++) { $RealCount=$counter+1; $str = "DuplicateChecking$RealCount"; eval("\$str = \"$str\";"); $Body = $Body."DupCheck".$RealCount."=".$_POST[$str]."\r\n"; //print($str.":".$_POST[$str].";"); $tempVal = $_POST[$str]; if ($tempVal==="EMAIL") { $XML = $XML."<DupCheck>EA1</DupCheck>"; } else { if ($tempVal==="WEBSITE") { $XML = $XML."<DupCheck>WS1</DupCheck>"; } else { $XML = $XML."<DupCheck>".htmlspecialchars($_POST[$str])."</DupCheck>"; } } } if ($DupLogic !="") {$Body = $Body."DupLogic=OR\r\n";} } if ($OnNewSendGMEmail!="") { $Body = $Body."OnNewSendGMEmail=".$OnNewSendGMEmail."\r\n"; $XML = $XML."<OnNewSendGMEmail>".htmlspecialchars($OnNewSendGMEmail)."</OnNewSendGMEmail>"; } if ($OnDUPSendGMEmail!="") { $Body = $Body."OnDUPSendGMEmail=".$OnDUPSendGMEmail."\r\n"; $XML = $XML."<OnDupSendGMEmail>".htmlspecialchars($OnDUPSendGMEmail)."</OnDupSendGMEmail>"; } if ($OnNewAttachTrack!="") { $comma =strpos($OnNewAttachTrack, ","); $Body = $Body."OnNewAttachTrack=".$OnNewAttachTrack."\r\n"; if ($comma =="") { $XML = $XML."<OnNewAttachTrack>".htmlspecialchars($OnNewAttachTrack)."</OnNewAttachTrack>"; } else { list($track, $user) = split(',', $OnNewAttachTrack,2); $XML = $XML."<OnNewAttachTrack User=".chr(34).htmlspecialchars($user).chr(34).">".htmlspecialchars($track)."</OnNewAttachTrack>"; } } if ($OnDupAttachTrack!="") { $comma =strpos($OnDupAttachTrack, ","); $Body = $Body."OnDupAttachTrack=".$OnDupAttachTrack."\r\n"; if ($comma =="") { $XML = $XML."<OnDupAttachTrack>".htmlspecialchars($OnDupAttachTrack)."</OnDupAttachTrack>"; } else { list($track, $user) = split(',', $OnDupAttachTrack,2); $XML = $XML."<OnDupAttachTrack User=".chr(34).htmlspecialchars($user).chr(34).">".htmlspecialchars($track)."</OnDupAttachTrack>"; } } if ($Password!="") { $Body = $Body."Password=".$Password."\r\n"; $XML = $XML."<Password>".htmlspecialchars($Password)."</Password>"; } if ($DupLogic!="") { $XML = $XML."<DupLogic>OR</DupLogic>"; } else { $XML = $XML."<DupLogic>AND</DupLogic>"; } $XML = $XML."</Instructions>"; } $Body = $Body."[Data]\r\n"; $XML = $XML."<accounts><account>"; $Phone = ""; $EA = ""; $WS = ""; $PR = ""; while(list($key,$value)= each($_POST)) { eval("$\$key = \"$value\";"); { if ($key!="GMsubmit" && $key!="SMTP" && $key!="OnNewSendGMEmail" && $key!="OnDUPSendGMEmail" && $key!="OnNewAttachTrack" && $key!="OnDupAttachTrack" && $key!="SendToEmail" && $key!="DuplicateCount" && $key!="Word" && strpos($key, "DuplicateChecking") === false && $key!="OutPutAs" && $key!="DupLogic" && strpos($key, "pretty_") === false) { if($value!="") { if ($key=="UHCUSTDESC" || $key=="UHDESCGOOD" || $key=="UHPI") { $value = str_replace("\r\n","<br/>",$value); $NoteHeader = ""; if ($key=="UHCUSTDESC") { $NoteHeader = "<strong>Customer Description</strong><br/><br/>"; } if ($key=="UHDESCGOOD") { $NoteHeader = "<strong>Descriptions of Goods</strong><br/><br/>"; } if ($key=="UHPI") { $NoteHeader = "<strong>Packing Information</strong><br/><br/>"; } $Notes = $Notes.$NoteHeader.$value."<br/><br/>"; } $Body = $Body.$key."=".$value."\r\n"; if (substr($key,0,5)!="PHONE" && substr($key,0,3)!="FAX" && substr($key, 0, 5)!="EMAIL" && substr($key,0, 7)!="WEBSITE") { $PR = $PR."<property name=".chr(34).$key.chr(34)." db_name=".chr(34).$key.chr(34).">"; $PR = $PR."<property_string>".htmlspecialchars($value)."</property_string>"; $PR = $PR."</property>"; } else { if(substr($key,0,5)=="PHONE") { $Phone = $Phone."<phone international=".chr(34)."0".chr(34)." type=".chr(34).$key.chr(34)." source_fld=".chr(34).$key.chr(34).">"; $Phone = $Phone."<properties><property name=".chr(34)."phone_number".chr(34)."><property_string>".$value."</property_string></property></properties>"; $Phone = $Phone."</phone>"; } elseif(substr($key,0,3)=="FAX") { $Phone = $Phone."<phone international=".chr(34)."0".chr(34)." type=".chr(34).$key.chr(34)." source_fld=".chr(34).$key.chr(34).">"; $Phone = $Phone."<properties><property name=".chr(34)."phone_number".chr(34)."><property_string>".$value."</property_string></property></properties>"; $Phone = $Phone."</phone>"; } elseif(substr($key,0,7)=="WEBSITE") { $WS = $WS."<website primary=".chr(34)."1".chr(34)." id=".chr(34)."WS1".chr(34).">"; $WS = $WS."<properties><property name=".chr(34)."web_site".chr(34)."><property_string>".$value."</property_string></property></properties>"; $WS = $WS."</website>"; } elseif(substr($key,0,5)=="EMAIL") { $EA = $EA."<email primary=".chr(34)."1".chr(34)." id=".chr(34)."EA1".chr(34).">"; $EA = $EA."<properties><property name=".chr(34)."email_address".chr(34)."><property_string>".$value."</property_string></property></properties>"; $EA = $EA."</email>"; } } } } } } if ($PR !="") {$XML = $XML."<properties>".$PR."</properties>";} if($Phone!="") { $XML = $XML."<phone_numbers>".$Phone."</phone_numbers>"; } if($EA!="") { $XML = $XML."<emails>".$EA."</emails>"; } if($WS!="") { $XML = $XML."<websites>".$WS."</websites>"; } $XML = $XML."</account></accounts></gmdata>"; $ToSubject="Web Import"; //The PHP built in function mail() will not raise or cause errors if it fails - so be sure that your PHP server is setup correctly! if( $OutputAs!="INI") { $Body = $XML; } //ini_set("SMTP", Decode($SMTP)); $Body = $Body."UHSUBDATE=".date("d/m/Y")."\r\n"; $Body = $Body."NOTES=".$Notes; if(mail(Decode($SendToEmail), $ToSubject, $Body, "From: GoldMine WebImport <no-reply@frontrange.com>\r\n\r\nContent-Type: text/x-gm-impdata\r\n\r\n" )) { //print "Your data has been recorded successfully!\r\n\r\n<!--\r\n".Decode($SendToEmail)."\r\n".$ToSubject."\r\n".$Body."\r\n\r\n".$OutputAs."\r\n\r\n-->"; header("location: ".$redirectURL); } else { print("There was a mailer failure.\r\n\r\n<!--\r\n".$Body."\r\n\r\n-->");} } else { echo "There was no form data passed."; } ?> Line 294 contains the text that's appearing in the email. Any ideas would be very, very much appreciated. Hi, I want to read multipart messages. If i send a mail from Gmail or yahoo, the body of the message is not read properly. I also want to read all the messages properly. Can someone give me the code for it? I am developing an email application for the first time. Thanks Raja |