
dwest
Members-
Posts
83 -
Joined
-
Last visited
Never
Everything posted by dwest
-
Thanks so much for both replies! Both work but need tweaking due to my own oversight. The data returned by eBay represents time left on an auction. Thus it changes constantly. As such, when there are no more days it reads as: PT8H10M26S When there are no more hours it reads like: PTH10M26S etc., etc. until it would read: PTHMS How can this be accommodated? Thanks so much! Both are great solutions
-
Hi, I have a string representing time left on an auction which is returned to me from the eBay API. It reads like so: P2T9H37M8S I need to reformat this to read: 2 Days 9 Hours 37 Minutes When a designation hits zero I need it to disappear. As in: 1 Day 2 Hours 10 Minutes 23 Hours 3 Minutes 1 Hours 2 Minutes 58 Minutes And finally nothing at all appears. I'm totally ignorant on how to approach this as I'm not a scripting guru. Any help would be greatly appreciated
-
Will do. Thanks for the pointer.
-
I'm running WordPress for a blog. It's PHP/MySQL. On the home page is an embedded flash widget from eBay which is supposedly "real-time". However, it's not really. One has to ctrl+F5 to get truly current status on an auction such as number of views. It's usually off a little if not refreshed. So, I need to refresh, as in ctrl+F5, the home page of the blog each time it loads but not the other pages. How can I do that? For reference, here is the blog: http://www.smallartgems.com Thanks!
-
Excellent! Thanks I'll give that a try.
-
Hi, I need some help with this code snippet. It is used with WordPress to allow me to mark blog posts with an expiration date. Trouble is I also need to be able to specify the time along with the date. Can someone guide me in adding that capability to this snippet? $expirationdate holds the value of a custom field I add to the blog entry and it currently expects a date formatted as yyyy/mm/dd. Can I have $expirationdate also hold the time along with the date? Such as yyyy/mm/dd,00:00:00 ? Then I could enter the tag as one entry instead of two separate ones. The code then compares current date to date I've entered and blocks the post from displaying if beyond that date. The addition of time it seems should be fairly easy for a guru (which I'm not). Any help would be appreciated and I'm sure there will be questions I need to answer before any real help can happen. So ask as needed. ***PUT THIS INSIDE THE WORDPRESS LOOP, FIRST THING*** <?php //to check against expiration date; $currentdate = date("Ymd"); $expirationdate = get_post_custom_values('expiration'); if (is_null($expirationdate)) { $expirestring = '30005050'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP; } else { if (is_array($expirationdate)) { $expirestringarray = implode($expirationdate); } $expirestring = str_replace("/","",$expirestringarray); } //else if ( $expirestring > $currentdate ) { ?> ***THEN PUT THE FOLLOWING LINE AT THE VERY END OF THE WORDPRESS LOOP*** <?php } //end if for expiration; ?>
-
[SOLVED] mail() question regarding multiple recipients
dwest replied to dwest's topic in PHP Coding Help
Ah! OK great. Thanks! It's been months since I've touched any PHP and I was a beginner then Thanks much for your help! -
[SOLVED] mail() question regarding multiple recipients
dwest replied to dwest's topic in PHP Coding Help
That seems to work! Thanks! However, now my email address validator throws an error because there are oddities in the text box for the recipient. Here is the validator code: function is_valid_email_address($email) { $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'. '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'; $quoted_pair = '\\x5c[\\x00-\\x7f]'; $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d"; $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22"; $domain_ref = $atom; $sub_domain = "($domain_ref|$domain_literal)"; $word = "($atom|$quoted_string)"; $domain = "$sub_domain(\\x2e$sub_domain)*"; $local_part = "$word(\\x2e$word)*"; $addr_spec = "$local_part\\x40$domain"; return preg_match("!^$addr_spec$!", $email) ? 1 : 0; } Can something be adjusted to allow for the multiple addresses in the text box? Thanks so much for your help on this! -
[SOLVED] mail() question regarding multiple recipients
dwest replied to dwest's topic in PHP Coding Help
Thanks for the reply! Unfortunately is still isn't working and won't even work with a single sent to address now. Most likely, I've got something incorrect in the copy paste process. Here is what I have: $pdfu_send_to = explode(",", $_POST['pdfu_send_to']); $pdfu_subject = $_POST['pdfu_subject']; $pdfu_support_email = $_POST['pdfu_support_email']; $pdfu_msg = $_POST['pdfu_msg']; $pdfu_msg = stripslashes($pdfu_msg); $pdfu_headers = 'MIME-Version: 1.0'."\r\n". 'Content-type: text/html; charset=iso-8859-1'."\r\n".'From: '. $pdfu_support_email."\r\n".'Reply-To: '.$pdfu_support_email. "\r\n".'BCC: '.$pdfu_support_email."\r\n".'X-Mailer: PHP/' . phpversion(); foreach($pdfu_send_to as $var => $val){ $pdfu_send_to = ltrim(rtrim($val)); mail($pdfu_send_to, $pdfu_subject, $pdfu_msg, $pdfu_headers); } echo 'The notification was sent successfully.'; If you don't see anything obvious, tell me what to do to get the error to echo and I'll post the error. Thanks! -
I have this code: $pdfu_subject = $_POST['pdfu_subject']; $pdfu_send_to = $_POST['pdfu_send_to']; $pdfu_support_email = $_POST['pdfu_support_email']; $pdfu_msg = $_POST['pdfu_msg']; $pdfu_msg = stripslashes($pdfu_msg); $pdfu_headers = 'MIME-Version: 1.0'."\r\n". 'Content-type: text/html; charset=iso-8859-1'."\r\n".'From: '. $pdfu_support_email."\r\n".'Reply-To: '.$pdfu_support_email. "\r\n".'BCC: '.$pdfu_support_email."\r\n".'X-Mailer: PHP/' . phpversion(); mail($pdfu_send_to, $pdfu_subject, $pdfu_msg, $pdfu_headers); echo 'The notification was sent successfully.'; In the form that feeds this I have a textbox where the recipient is entered. If I enter a recipient, a comma, and another recipient, when I submit the form the mail is not processed. If I enter a single recipient, all is well. I need to be able to enter multiple recipients in the text box. I've tried comma, comma +space, etc. to no avail. Can someone tell me what I'm doing wrong? Thanks!
-
[SOLVED] Magic quotes problem with html links saved in database
dwest replied to dwest's topic in PHP Coding Help
Never mind. I realize now after tinkering I just need to strip slashes each time I process the data. Thanks for the help! -
[SOLVED] Magic quotes problem with html links saved in database
dwest replied to dwest's topic in PHP Coding Help
Thanks ProjectFear. Now what about when it's emailed from the user form. Is there something I need to so in the email processing code to keep it formatted correctly? -
[SOLVED] Magic quotes problem with html links saved in database
dwest replied to dwest's topic in PHP Coding Help
Thanks fert. I'm aware of stripslashes but I'm not sure where to do the stripping. Should I strip before saving to the database and be done with it there? Or should I strip it as it is called from the database and leave the data storage alone? -
Hi, I think this is a magic quotes problem but I'm not certain. On the backend of a site, I have a form used to save some default content to a database. The form has a textarea among other fields. When a link is embedded in the textarea content like so, <a href="http://thelink.com/link/" >The Link</a> the link is saved in the database as, <a href=\"http://thelink.com/link/\" >The Link</a> I think this is due to magic quotes being on. (and no the host won't turn it off.) On the frontend of the site, The same default content is pulled into a user form which is used for emailing that content to others. It can be edited by the user prior to mailing if desired. For instance the user could add more links in the textarea as html. I would like any links in the default content to be formatted correctly in the frontend user form when it is called. I would also like those links, and any the user adds, to remain properly formatted when the email form is submitted. What can I do to achieve this? Thanks!
-
Hi, Are there any disadvantages to running PHP on a Windows server as a CGI executable as opposed to running it on a Linux server? Thanks!
-
I need to add that in the invoice form, all visible fields are seen as text boxes. Thus they can be edited at any time. So, the state of a piece of data gets posted "as is" not "as was". This allows user to tweak the name or description or price of an item in the invoice and still add more items, etc.
-
I see that and thanks :) What I'm doing is creating a means for a user to build an invoice form and when satisfied, submit it to the database. To do that, I have a submit button to add items and a submit button to save the invoice. The user goes back and forth to the available items list by clicking the add items submit button. She selects items from that list to add them to the invoice. The values are posted back to the invoice as hidden fields. Each click of the add items button, passes the items already selected, in hidden fields, to the items list form. Clicking done on that form passes the new selections plus the existing selections, back to the invoice form. All in hidden fields. This goes on until the user is done and then all the items in the invoice form are posted to the invoice database. So, is there any advantage gained from using sessions in this case? Seems to clutter things up more unless I'm missing something. (which is highly probable I might add ;) )
-
Now, I'm a little confused still. In previous posts here (or perhaps another forum), I was told that passing hidden fields back and forth between forms was insecure and that I should use sessions instead. But in order to get the values into a session I have to pass the hidden fields anyway. So how do sessions alleviate the security vulnerabilities?
-
Got it! I replied while you replied. :)
-
Say I have the following in a form: [code] <input type="text" name="text_name'.$r['item_id'].'[]" value="'.$r['name'].'" /> [/code] When I post the form, what Am I posting to? A form handler that then captures the posts and assigns them to the session?
-
So, I can't post directly to the session? I must first capture the post on a php page and then assign the $_POST's to the session?
-
Hi, What is the technique to get all the values in a form post captured in as session variable? Thanks!
-
Would $var{$id} create a variable with the name of $var plus whatever the value of $id is?
-
Well, best not to worry with why as it is a long answer and not relevant to the question. ;) Let me attempt to make the question a bit more simple. I have a variable called $var. I want a new variable called $var1. The "1" in the variable name $var1, should be the value held in $id. So in effect I want to create a dynamic variable NAME to be used in the code. Not a dynamic variable. Make sense? Any way to do that? Thanks!
-
[code] foreach($_POST['hid_price'.$id] as $price) { $total = ($price*$qty); }[/code] Note the $id tacked on to "hid_price"...the result being hid_price1, 2, etc. How would I go about tacking the value of $id on to the $total variable name so I get a corresponding variable named $total1, $total2, etc.? Thanks!