PHP - Php Mailer And Today's Date
Is there a way of getting today's date (in European format - day-month-year) into the body of an email sent via phpmailer?
Many thanks. Similar Tutorials(continuing from topic title) So if I set a date of July 7 2011 into my script, hard coded in, I would like the current date to be checked against the hard coded date, and return true if the current date is within a week leading up to the hard coded date. How could I go about doing this easily? I've been researching dates in php but I can't seem to work out the best way to achieve what I'm after. Cheers Denno Hi, I have a job listing website which displays the closing date of applications using: $expired_date (This displays a date such as 31st December 2019) I am trying to show a countdown/number of days left until the closing date. I have put this together, but I can't get it to show the number of days. <?php $expired_date = get_post_meta( $post->ID, '_job_expires', true ); $hide_expiration = get_post_meta( $post->ID, '_hide_expiration', true ); if(empty($hide_expiration )) { if(!empty($expired_date)) { ?> <span><?php echo date_i18n( get_option( 'date_format' ), strtotime( get_post_meta( $post->ID, '_job_expires', true ) ) ) ?></span> <?php $datetime1 = new DateTime($expired_date); $datetime2 = date('d'); $interval = $datetime1->diff($datetime2); echo $interval->d; ?> <?php } } ?> Can anyone help me with what I have wrong? Many thanks Hi guys, I'm putting together a small event system where I want the user to add his own date and time into a textfield (I'll probably make this a series of drop-downs/a date picker later). This is then stored as a timestamp - "0000-00-00 00:00:00" which displays fine until I try to echo it out as a UK date in this format - jS F Y, which just gives today's date but not the inputted date. Here's the code I have right now: Code: [Select] $result = mysql_query("SELECT * FROM stuff.events ORDER BY eventdate ASC"); echo "<br />"; echo mysql_result($result, $i, 'eventvenue'); echo ", "; $dt = new DateTime($eventdate); echo $dt->format("jS F Y"); In my mysql table eventdate is set up as follows: field - eventdate type - timestamp length/values - blank default - current_timestamp collation - blank attributes - on update CURRENT_TIMESTAMP null - blank auto_increment - blank Any help as to why this could be happening would be much appreciated, thanks. I'm looking for a simple little code to display today's date, month, day, year and countdown to 365 days. Can anyone please help. is it possible to do something like Code: [Select] $today = date("Y-m-d"); $result = mysql_query("SELECT * FROM staff where date = '.$today.' "); also, is it normal for the first entry in the database not to be displayed? i have 6 entries in a table and only 2-6 are shown. when i changed the id for 1 to 7, it only displayed 3-7. still shows all records in the database... any idea how i go about this? Code: [Select] $date= date('y-m-d'); $query=mysql_query("SELECT * FROM listing WHERE date >= $date") or die (mysql_error()); Hi I am trying to add a field to a database that is 4 days from the date the record is added, but it is not adding a value Code: [Select] $end_date=strtotime("+ 4 days"); $add_vehicle_sql=mysql_query("INSERT INTO `tbl_auction_lot`(`cust_id`,`reserve`,`make`,`model`,`spec`,`fuel`,`doors`,`mot_date`,`fns`,`fos`,`rns`,`ros`,`condition`,`reg_no`,`service_history`,`sale_type`,`status`,`keepers`,`gearbox`,`emissions`,`colour`,`date_first_reg`,`date_manufacture`,`bhp`,`engine_size`,`end_date`) VALUES ('$seller_id','$reserve','$make','$model','$body_style','$fuel_type','$no_of_doors','$mot','$fns','$fos','$rns','$ros','$vehicle_condition','$vrm','$service_history','auction','$status','$prev_keepers','$gearbox','$emissions','$colour','$date_reg','$date_man','$bhp','$engine_size','$end_date')") or die(mysql_error()); What am I doing wrong and what is there a better way to achieve the desired result. This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=333553.0 Hello, In my Mysql database, it has a datetime field. and I have created a $today = date('Y-m-d H:i:s'); <- today's date and time How do I write a query to run in PHP in order to get all today's items by comparing datetime field and $today? Thanks! Hi everyone! Newbie in PHP Im trying unsuccessfully to get php mailer to send mail to a specific email address I dont know if its even possible. I have a form in flash but it uses php. Now all the emails that get sent from the site go to a ddatabase and then are posted in the site admin area under contact Im assuming its php mail that send sends these emails. What i would like is it to send those emails to a specific address. I downloaded the latest phpmailer for php 4 since thats what the server is running. Any help would be appreciated. Here ive attached the current mailer file. THANKS. PEACE I got this PHP mailer as part of a template I downloaded. It seems to work for everyone except for me. I would love some help. I followed their documentation as for what to change and you will see it documented as to the area I was supposed to change and the part I should not touch. I only updated the top portion but for some reason its not working. When I tested the contact page after uploading the site, I used one of my own email addresses to send an email to the destination address of my company. I get a response email in the account that I fill in the email field with, but the actual destination email account for my business never gets the message that the customer/I write. This is the code I have so far, so could you please tell me whats wrong. Thanks! Sorry I cant upload files at work. Code: [Select] <?php error_reporting(E_WARNING); $variables = array( "subject" => $_POST["sender_subject"], "message" => $_POST["sender_message"], "name" => $_POST["sender_name"], "email" => $_POST["sender_email"], ); $conf = array( "notification_email" => array( "enable" => true, "to" => "shane@photographybysp.com", "to_name" => "Photography by Shane Padgett", "from" => "{EMAIL}", "from_name" => "{NAME}", "subject" => "New Message: {SUBJECT}", "type" => "html", "message" => <<<EOD <p>Someone new is interested!</p> <p> Email: {EMAIL}<br> Subject: {SUBJECT}<br> {MESSAGE} </p> EOD ), "autoresponder_email" => array( "enable" => true, "from" => "shane@photographybysp.com", "from_name" => "Photography by Shane Padgett", "to" => "{EMAIL}", "to_name" => "{NAME}", "subject" => "Thank you for your message", "type" => "html", "message" => <<<EOD <p>Your message has been recieved!</p> <p> Email: {EMAIL}<br> Subject: {SUBJECT}<br> {MESSAGE} </p> EOD ), ); ## starting the actual code, you have nothing else to configure from this point forward. function SendMail() { $params = AStripSlasshes(func_get_args()); //check to see the numbers of the arguments switch (func_num_args()) { case 1: $email = $params[0]; $vars = array(); break; case 2: $email = $params[0]; $vars = $params[1]; break; case 3: $to = $params[0]; $email = $params[1]; $vars = $params[2]; break; case 4: $to = $params[0]; $to_name = $params[1]; $email = $params[2]; $vars = $params[3]; break; } if ($email["email_status"] == 1) { return true; } $msg = new CTemplate(stripslashes($email["email_body"]) , "string"); $msg = $msg->Replace($vars); $sub = new CTemplate(stripslashes($email["email_subject"]) , "string"); $sub = $sub->Replace($vars); $email["email_from"] = new CTemplate(stripslashes($email["email_from"]) , "string"); $email["email_from"] = $email["email_from"]->Replace($vars); $email["email_from_name"] = new CTemplate(stripslashes($email["email_from_name"]) , "string"); $email["email_from_name"] = $email["email_from_name"]->Replace($vars); if (!$email["email_reply"]) $email["email_reply"] = $email["email_from"]; if (!$email["email_reply_name"]) $email["email_reply_name"] = $email["email_from_name"]; //prepare the headers $headers = "MIME-Version: 1.0\r\n"; if ($email["email_type"] == "html") $headers .= "Content-type: text/html\r\n"; else $headers .= "Content-type: text/plain\r\n"; //prepare the from fields if (!$email["email_hide_from"]) { $headers .= "From: {$email[email_from_name]}<{$email[email_from]}>\r\n"; $headers .= "Reply-To: {$email[email_reply_name]}<{$email[email_reply]}>\r\n"; } $headers .= $email["headers"]; if (!$email["email_hide_to"]) { return @mail($email["email_to"] , $sub, $msg,$headers); } else { } $headers .= "X-Mailer: PHP/" . phpversion(); return mail($to, $sub, $msg,$headers); } function AStripSlasshes($array) { if (is_array($array)) foreach ($array as $key => $item) if (is_array($item)) $array[$key] = AStripSlasshes($item); else $array[$key] = stripslashes($item); else return stripslashes($array); return $array; } $_TSM = array(); class CTemplate { /** * template source data * * @var string * * @access private */ var $input; /** * template result data * * @var string * * @access public */ var $output; /** * template blocks if any * * @var array * * @access public */ var $blocks; /** * constructor which autoloads the template data * * @param string $source source identifier; can be a filename or a string var name etc * @param string $source_type source type identifier; currently file and string supported * * @return void * * @acces public */ function CTemplate($source,$source_type = "file") { $this->Load($source,$source_type); } /** * load a template from file. places the file content into input and output * also setup the blocks array if any found * * @param string $source source identifier; can be a filename or a string var name etc * @param string $source_type source type identifier; currently file and string supported * * @return void * * @acces public */ function Load($source,$source_type = "file") { switch ($source_type) { case "file": $this->template_file = $source; // get the data from the file $data = GetFileContents($source); //$data = str_Replace('$','\$',$data); break; case "rsl": case "string": $data = $source; break; } // blocks are in the form of <!--S:BlockName-->data<!--E:BlockName--> preg_match_all("'<!--S\:.*?-->.*?<!--E\:.*?-->'si",$data,$matches); // any blocks found? if (count($matches[0]) != 0) // iterate thru `em foreach ($matches[0] as $block) { // extract block name $name = substr($block,strpos($block,"S:") + 2,strpos($block,"-->") - 6); // cleanup block delimiters $block = substr($block,9 + strlen($name),strlen($block) - 18 - strlen($name) * 2); // insert into blocks array $this->blocks["$name"] = new CTemplate($block,"string"); } // cleanup block delimiters and set the input/output $this->input = $this->output = preg_replace(array("'<!--S\:.*?-->(\r\n|\n|\n\r)'si","'<!--E\:.*?-- >(\r\n|\n|\n\r)'si"),"",$data); } /** * replace template variables w/ actual values * * @param array $vars array of vars to be replaced in the form of "VAR" => "val" * @param bool $clear reset vars after replacement? defaults to TRUE * * @return string the template output * * @acces public */ function Replace($vars,$clear = TRUE) { if (is_array($vars)) { foreach ($vars as $key => $var) { if (is_array($var)) { unset($vars[$key]); } } } // init some temp vars $patterns = array(); $replacements = array(); // build patterns and replacements if (is_array($vars)) // just a small check foreach ($vars as $key => $val) { $patterns[] = "/\{" . strtoupper($key) . "\}/"; //the $ bug $replacements[] = str_replace('$','\$',$val); } // do regex $result = $this->output = @preg_replace($patterns,$replacements,$this->input); // do we clear? if ($clear == TRUE) $this->Clear(); // return output return $result; } function SepReplace($ssep , $esep , $vars,$clear = TRUE) { if (is_array($vars)) { foreach ($vars as $key => $var) { if (is_array($var)) { unset($vars[$key]); } } } // init some temp vars $patterns = array(); $replacements = array(); // build patterns and replacements if (is_array($vars)) // just a small check foreach ($vars as $key => $val) { $patterns[] = $ssep . strtoupper($key) . $esep; //the $ bug $replacements[] = str_replace('$','\$',$val); } // do regex $result = $this->output = @preg_replace($patterns,$replacements,$this->input); // do we clear? if ($clear == TRUE) $this->Clear(); // return output return $result; } /** * replace a single template variable * * @param string $var variable to be replaced * @param string $value replacement * @param bool $perm makes the change permanent [i.e. replaces input also]; defaults to FALSE * * @return string result of replacement * * @acces public */ function ReplaceSingle($var,$value,$perm = FALSE) { if ($perm) $this->input = $this->Replace(array("$var" => $value)); else return $this->Replace(array("$var" => $value)); } /** * resets all the replaced vars to their previous status * * @return void * * @acces public */ function Clear() { $this->output = $this->input; } /** * voids every template variable * * @return void * * @acces public */ function EmptyVars() { global $_TSM; //$this->output = $this->ReplacE($_TSM["_PERM"]); //return$this->output = preg_replace("'{[A-Z]}'si","",$this->output); return $this->output = preg_replace("'{[A-Z_\-0-9]*?}'si","",$this->output); //return $this->output = preg_replace("'{[\/\!]*?[^{}]*?}'si","",$this->output); } /** * checks if the specified template block exists * * @param string $block_name block name to look for * * @return bool TRUE if exists or FALSE if it doesnt * * @access public */ function BlockExists($block_name) { return isset($this->blocks[$block_name]) && is_object($this->blocks[$block_name])? TRUE : FALSE; } /* function Block($block,$vars = array(),$return_error = false) { if ($this->BlockExists($block)) return $this->blocks[$block]->Replace($vars); else { return ""; } } */ /*Extra functions to keep the compatibility with the new CTemplateDynamic library*/ /** * description * * @param * * @return * * @access */ function BlockReplace($block , $vars = array(), $clear = true){ if (!is_object($this->blocks[$block])) echo "CTemplate::{$this->template_file}::$block Doesnt exists.<br>"; return $this->blocks[$block]->Replace($vars , $clear); } /** * description * * @param * * @return * * @access */ function BlockEmptyVars($block , $vars = array(), $clear = true) { if (!is_object($this->blocks[$block])) echo "CTemplate::{$this->template_file}::$block Doesnt exists.<br>"; if (is_array($vars) && count($vars)) $this->blocks[$block]->Replace($vars , false); return $this->blocks[$block]->EmptyVars(); } /** * description * * @param * * @return * * @access */ function Block($block) { if (!is_object($this->blocks[$block])) echo "CTemplate::{$this->template_file}::$block Doesnt exists.<br>"; return $this->blocks[$block]->output; } } /** * description * * @library * @author * @since */ class CTemplateStatic{ /** * description * * @param * * @return * * @access */ /** * description * * @param * * @return * * @access */ function Replace($tmp , $data = array()) { $template = new CTemplate($tmp , "string"); return $template->replace($data); } function EmptyVars($tmp , $data = array()) { $template = new CTemplate($tmp , "string"); if (count($data)) { $template->replace($data , false); } return $template->emptyvars(); } /** * description * * @param * * @return * * @access */ function ReplaceSingle($tmp , $var , $value) { return CTemplateStatic::Replace( $tmp , array( $var => $value ) ); } } header("Content-Type: text/xml"); if (!$variables["email"]) { echo "<response><message>error</message></response>"; die(); } if(!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$variables["email"])){ echo "<response><message>error</message></response>"; die(""); } //check if the notification should be sent if ($conf["notification_email"]["enable"] == true) { $vars = $variables; foreach ($conf["notification_email"] as $key => $val) { $conf["notification_email"][$key] = CTemplateStatic::Replace($val , $vars); } //process the notify email $email = array( "email_to" => utf8_decode($conf["notification_email"]["to"]), "email_to_name" => utf8_decode($conf["notification_email"]["to_name"]), "email_from" => utf8_decode($conf["notification_email"]["from"]), "email_from_name" => utf8_decode($conf["notification_email"]["from_name"]), "email_subject" => utf8_decode($conf["notification_email"]["subject"]), "email_body" => utf8_decode($conf["notification_email"]["message"]), "email_type" => utf8_decode($conf["notification_email"]["type"]) ); foreach ($email as $key => $val) { $email[$key] = CTemplateStatic::Replace($val , $vars); } SendMail($email); } //check if the notification should be sent if ($conf["autoresponder_email"]["enable"] == true) { $vars = $variables; foreach ($conf["autoresponder_email"] as $key => $val) { $conf["autoresponder_email"][$key] = CTemplateStatic::Replace($val , $vars); } //process the notify email $email = array( "email_to" => utf8_decode($conf["autoresponder_email"]["to"]), "email_to_name" => utf8_decode($conf["autoresponder_email"]["to_name"]), "email_from" => utf8_decode($conf["autoresponder_email"]["from"]), "email_from_name" => utf8_decode($conf["autoresponder_email"]["from_name"]), "email_subject" => utf8_decode($conf["autoresponder_email"]["subject"]), "email_body" => utf8_decode($conf["autoresponder_email"]["message"]), "email_type" => utf8_decode($conf["autoresponder_email"]["type"]) ); foreach ($email as $key => $val) { $email[$key] = CTemplateStatic::Replace($val , $vars); } SendMail($email); } echo "<response><message>sent</message></response>"; die(); ?> MOD EDIT: [code] . . . [/code] tags added. Hello, i'm trying to get the number of users that registered today and the number of users that registered yersterday (seperate), i've got this field in mysql: 'registertime' which stores data in this format 2011-11-14 14:53:49 also i have the field 'time' in the same format that updates everytime the user logs in. Now previously i wanted to find out users online in last 24 hours, the code i used for that is this: Code: [Select] $query = "SELECT COUNT(*) as Anzahl FROM customers WHERE country = 'de' AND time BETWEEN DATE_SUB( NOW(), INTERVAL 24 HOUR ) and NOW() "; $queryerg = mysql_query($query) OR die(mysql_error()); while($row = mysql_fetch_array($queryerg)){ $customers_on_de_24 = $row[0]; } How could i edit that to select the count just by date and ignore the time (hours minutes seconds) ? Hi guyz. I need to create a Booking System using form. same like this: https://www.theorytest.net/book-your-theory-test.php Information will be sent to Email. I know the form creation and sending to Email as well! But i this form is divided into pages how can i collect information that will be available to send through email at the end. (when user will complete this booking) Waiting for your reply Thanks OK so to start. We have our domain in the format X.com. Our new-mail form (php) is under mails.X.com. We use phpmail for sending mails. Receiving is disabled. There is apcall for mail() function in button's onclick event. Works as intended (gets call transmitted to phpmail function as well as MTP's) but mails never leaves our servers (and reaches receipient(s)). What may the problem be? Hi guys I need some help here about mailer. I have created a file register new user (register.php) and when a new user register an email will be sent to their address. I have this code on my register file but when I run them it's okay but I did not get the email... can anyone assist me what I did wrong? Thanks. <?php $to = "someone@example.com"; //change to a valid email $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; //change to a valid email $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> Here's my situation: I had someone create a PHP form for me. I have inserted it into a website I am designing. The form works on my personal host (except still trying to figure out how to have the uploaded file be attached to the sent email), but I am getting an error where the form will actually be hosted. See below. Please let me know if any more info is needed. Form: http://www.jjbuttons.com/order Error on submission: Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/j/u/m/jumpinjack/html/form/attach_mailer_class.php on line 186 Error while sending you mail. Host: GoDaddy PHP version: 4.4.9 http://www.jjbuttons.com/info.php Same form / code: http://www.chrisdoughmandesign.com/order.html Mail submits (except still trying to figure out how to have uploaded file be attached to email) Host: JustHost PHP version: 5.2.16 http://www.chrisdoughmandesign.com/info.php Code: [Select] <?php if(isset($_POST['cmd']) && ($_POST['cmd'] == 'complete')) { if(isset($_POST['completeorder'])) { //UPDATE THESE VARIABLES $to = 'user@example.com'; // TODO: Change to your desired email. $cc = ""; //OPTIONAL $bcc = ""; //OPTIONAL $subject = 'Order Form Submission'; //TODO: Update to a subject for the email that you like $uploadpath = $_SERVER['DOCUMENT_ROOT']."/files/mail/"; //TODO: Change path to match your environment $max_size = 1024*2; //TODO: Update the max. size for uploading in kbs require($_SERVER['DOCUMENT_ROOT']."/form/attach_mailer_class.php"); //TODO: Change path to match your environment include ($_SERVER['DOCUMENT_ROOT']."/form/upload_class.php"); //TODO: Change path to match your environment //EDITTING BELOW THIS SHOULD NOT BE NECESSARY $name = $_POST['fname'] . ' ' . $_POST['lname']; $from = $_POST['email']; $msg = ""; $body =' <!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> <style> .rounded_corners { border-radius: 15px; -moz-border-radius: 15px; } fieldset { margin:10px auto; } #commentForm label.error, #commentForm input.submit { margin-left: 10px; } </style> </head> <body> <div style="margin:0 auto; width:900px; padding:10px;"> <fieldset class="rounded_corners"> <LEGEND ACCESSKEY=I style="font-weight:bold; padding:1px 5px;"> Billing / Shipping Information</LEGEND> <div style="float:left; width:430px; "> <div class="rounded_corners" style="background-color:#EEE; padding:5px; font-weight:bold; ">Bill To:</div> <div> <table style="margin-left:5px; width:100%:" cellpadding="3" cellspacing="0"> <tr> <td style="width:110px; text-align:right;">* First Name:</td> <td style="width:290px;">'.$_POST['fname'].'</td> </tr> <tr> <td style="text-align:right;">* Last Name:</td> <td>'.$_POST['lname'].'</td> </tr> <tr> <td style="text-align:right;">Company:</td> <td>'.$_POST['company'].'</td> </tr> <tr> <td style="text-align:right;">Address 1</td> <td>'.$_POST['add1'].'</td> </tr> <tr> <td style="text-align:right;">Address 2</td> <td>'.$_POST['add2'].'</td> </tr> <tr> <td style="text-align:right;">City:</td> <td>'.$_POST['city'].'</td> </tr> <tr> <td style="text-align:right;">State:</td> <td>'.$_POST['state'].'</td> </tr> <tr> <td style="text-align:right;">* Zip:</td> <td>'.$_POST['zip'].'</td> </tr> <tr> <td style="text-align:right;">* Phone:</td> <td>'.$_POST['phone'].'</td> </tr> <tr> <td style="text-align:right;">* Email:</td> <td>'.$_POST['email'].'</td> </tr> </table> </div> </div> <div style="float:right; width:430px;"> <div class="rounded_corners" style="background-color:#EEE; padding:5px; font-weight:bold; "> <span style="float:left;">Ship To:</span> <span style="float:right;"><input type="checkbox" name="sameasbilling" id="sameasbilling" /></span> <div style="clear:both; height:1px;"></div> </div> <div> <table style="margin-left:5px; width:100%:" cellpadding="3" cellspacing="0"> <tr> <td style="width:110px; text-align:right;">* First Name:</td> <td style="width:290px;">'.$_POST['fname2'].'</td> </tr> <tr> <td style="text-align:right;">* Last Name:</td> <td>'.$_POST['lname2'].'</td> </tr> <tr> <td style="text-align:right;">Company:</td> <td>'.$_POST['company2'].'</td> </tr> <tr> <td style="text-align:right;">Address 1</td> <td>'.$_POST['add12'].'</td> </tr> <tr> <td style="text-align:right;">Address 2</td> <td>'.$_POST['add22'].'</td> </tr> <tr> <td style="text-align:right;">City:</td> <td>'.$_POST['city2'].'</td> </tr> <tr> <td style="text-align:right;">State:</td> <td>'.$_POST['state2'].'</td> </tr> <tr> <td style="text-align:right;">* Zip:</td> <td>'.$_POST['zip2'].'</td> </tr> <tr> <td style="text-align:right;">* Phone:</td> <td>'.$_POST['phone2'].'</td> </tr> </table> </div> </div> <div style="clear:both; height:1px;"></div> <div style="width:100%; text-align:center;"> * indicates required information</div> </fieldset> <fieldset class="rounded_corners"> <legend accesskey="2" style="font-weight:bold; padding:1px 5px;"> Order</LEGEND> <div class="rounded_corners" style="background-color:#EEE; padding:5px; font-weight:bold; "> <table style="width:100%;"> <tr> <td style="width: 150px;"></td> <td style="font-weight:bold; text-align:center;">Button Size</td> <td style="font-weight:bold; text-align:center;">Quantity</td> <td style="font-weight:bold; text-align:center;">Button Back</td> <td style="font-weight:bold; text-align:center;"></td> </tr> </table> </div> <div style="width:100%; padding:5px;"> <table style="width:100%;" cellpadding="2"> <tr> <td style="width: 150px; text-align:center; font-weight:bold;">* Product 1</td> <td style="">'.$_POST['size1'].'</td> <td style="">'.$_POST['qty1'].'</td> <td style="">'.$_POST['back1'].'</td> <td style=""></td> </tr>'; if(isset($_POST['size2']) && isset($_POST['qty2']) && isset($_POST['back2'])) { $body .= '<tr> <td style="width: 150px; text-align:center; font-weight:bold;">Product 2</td> <td style="">'.$_POST['size2'].'</td> <td style="">'.$_POST['qty2'].'</td> <td style="">'.$_POST['back2'].'</td> <td style=""></td> </tr>'; } if(isset($_POST['size3']) && isset($_POST['qty3']) && isset($_POST['back3'])) { $body .= '<tr> <td style="width: 150px; text-align:center; font-weight:bold;">Product 3</td> <td style="width: 150px; text-align:center; font-weight:bold;">Product 2</td> <td style="">'.$_POST['size3'].'</td> <td style="">'.$_POST['qty3'].'</td> <td style="">'.$_POST['back3'].'</td> <td style=""></td> </tr>'; } if(isset($_POST['size4']) && isset($_POST['qty4']) && isset($_POST['back4'])) { $body .= '<tr> <td style="width: 150px; text-align:center; font-weight:bold;">Product 4</td> <td style="width: 150px; text-align:center; font-weight:bold;">Product 2</td> <td style="">'.$_POST['size4'].'</td> <td style="">'.$_POST['qty4'].'</td> <td style="">'.$_POST['back4'].'</td> <td style=""></td> </tr>'; } $body .= '</table> </div> </fieldset> <fieldset class="rounded_corners"> <LEGEND accesskey="3" style="font-weight:bold; padding:1px 5px;">Miscellaneous Info</LEGEND> <table cellpadding="5"> <tr> <td style="width:280px; text-align:center;">*When do you need your order?</td> <td style="width:280px; text-align:center;">'.$_POST['month'].'</td> <td style="width:280px; text-align:center;">'.$_POST['days'].'</td> </tr> <tr> <td style="width:280px; text-align:center;">Is this a Quote or an Order?</td> <td style="width:280px; text-align:center;">'.$_POST['saletype'].'</td> <td style="width:280px; text-align:center;"></td> </tr> <tr> <td style="width:280px; text-align:center;">Have you ordered from us before?</td> <td style="width:280px; text-align:center;">'.$_POST['prevorder'].'</td> <td style="width:280px; text-align:center;"></td> </tr> <tr> <td colspan="3" style="width:100%; text-align:center; font-weight:bold;"> Comments, questions, special instructions: </td> </tr> <tr> <td colspan="3" style="width:100%; text-align:center;"> '.$_POST['comments'].' </td> </tr> </table> </fieldset> </div> </body> </html>'; $my_mail = new attach_mailer($name , $from , $to, $cc , $bcc, $subject, $body); if (isset($_FILES)) { foreach ($_FILES as $key => $file) { for($i = 0; $i < count($file['name']); $i++) { if(isset($file['tmp_name'][$i]) && $file['tmp_name'][$i] != '') { $my_upload = new file_upload; $my_upload->extensions = array(".ai", ".eps", ".pdf", ".psd", ".jpg", ".jpeg"); $my_upload->rename_file = false; $my_upload->upload_dir = $uploadpath; $my_upload->the_temp_file = $file['tmp_name'][$i]; $my_upload->the_file = $file['name'][$i]; $my_upload->http_error = $file['error'][$i]; if ($my_upload->upload()) { $full_path = $my_upload->upload_dir.$my_upload->file_copy; $my_mail->create_attachment_part($full_path); $my_upload->del_temp_file($full_path); } $msg .= $my_upload->show_error_string(); } } } } $my_mail->process_mail(); $msg .= $my_mail->get_msg_str(); echo $msg; } } elseif(isset($_POST['cmd']) && $_POST['cmd'] == 'set_opts') { switch ($_POST['selected']) { case '1\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back','Zipper Pull'); break; case '1.25\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back','Zipper Pull'); break; case '2.25\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back', 'Bottle Opener', 'Bottle Opener With Key Ring'); break; case '3\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '3.5\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '2x3\" Rectangle': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '3x2\" Vertical Rectangle': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '2x2 Square': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '2x2 Diamond': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case 'Select Button Size': $options = array('Select Back Button'); break; } echo json_encode(array('result' => $options)); } ?> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=306860.0 Hi All, Newbie here.
I run a website using xmb forums software as a base login script to connect to my database and created my own crude and simple pages for adding and displaying the data learning as I went. Over the years with recent upgrades of php versions its now virtually useless and unsecure code. I archive a lot of news articles but have had trouble pasting text that includes apostrophe's and special characters, but managed to fix that using addslashes() now. Can someone suggest a tutorial or a way to rebuild my site from scratch or something I can use as a template to connect to my pages ?. As far as I can see, this code: Code: [Select] $this->_licence_expires = date('Y/m/d', mktime(0, 0, 0, date("m"), date("d")-1, date("Y"))); results in accounts expiring 1 year from today, right? How can I change it so that it will result in expiry 9 months from today? TIA |