I have this log on a Wordpress database (wp_postmeta, if it's relevant), which is the inputs sent via a webform and that I receive as e-mail. This is serialized as follows.
s:859:"a:11:{s:10:"Producent*";a:1:{i:0;s:4:"Test";}s:8:"Adresse*";a:1:{i:0;s:4:"Test";}s:7:"Postnr*";a:1:{i:0;s:4:"1111";}s:3:"By*";a:1:{i:0;s:4:"Test";}s:8:"Telefon*";a:1:{i:0;s:8:"12345678";}s:7:"E-mail*";a:1:{i:0;s:12:"test#test.dk";}s:14:"Kontaktperson*";a:1:{i:0;s:3:"LOC";}s:13:"Bemærkninger";a:1:{i:0;s:2:"Yo";}s:9:"_log_time";a:1:{i:0;i:1453898700;}s:12:"_log_form_id";s:4:"1939";s:10:"_log_mails";a:1:{s:7:"Webform";s:247:"<p>Ny besked fra *URL* </p>
<p>Producent<br />
Test</p>
<p>Adresse<br />
Test</p>
<p>Postnr<br />
1111</p>
<p>By<br />Test</p>
<p>Telefon<br />
12345678</p>
<p>E-mail<br />test#test.dk</p>
<p>Kontaktperson<br />
LOC</p>
<p>Bemærkninger<br />
Yo</p>
<p> </p>
";}}";
My question is if I can extract a log time from s:9:"_log_time";a:1:{i:0;i:1453898700;} in the form of dd/mm/yyyy hh:mm or something to that effect? If not:
(1) How can I do that from this data (there's no other data saved)?
(2) What is this _log_time supposed to be?
Many thanks in advance for helping us newbies learn more!
PS: if this question has already been posted somewhere, please point me to the right direction, as my Google search and search here has given me nothing useful.
Running a:1:{i:0;i:1453898700;} through unserialize() results in:
array (
0 => 1453898700,
)
(Well, we could've guessed that from just looking at the serialized data.)
Using PHP's date function, we find out this particular Unix timestamp (i.e. 1453898700) is equivalent to Wednesday, 27-Jan-16 12:45:00 UTC.
What that date/time is supposed to mean, exactly, I can't help you with. The time the form data was submitted?
Related
I have this handle bars statement in SendGrid. When using the variable taskCount the value is only used in the greaterThan block. The other 2 times it is used it appears to be null.
Here is the json data
{
"Username":"ChampCbg",
"JoinedAt":"12/1/2020",
"DaysSinceJoined":"20",
"taskCount":5
}
here is statement with handlebars
{{#greaterThan taskCount 0}}
Congrats on starting {{insert taskCount "default=1"}} task{{#greaterThan taskCount 1}} (s){{/greaterThan}} and taking the first small step.
{{else}}
You have not started a task yet. What are you waiting for? It has been {{DaysSinceJoined}} days since you joined on {{JoinedAt}}.
You have missed {{DaysSinceJoined}} days where you could been making Small Steps towards the dreams of you better tomorrow.
{{/greaterThan}}
Here is the end result
Hello ChampCbg!
Congrats on starting 1 task and taking the first small step.
Don't let another day pass you by. Start designing you vision board
today.
As the results show the greaterThan block selects the correct statement, but then next times taskCount is used the default value and null value are chosen.
What is the cause of this?
Twilio SendGrid developer evangelist here.
Honestly, I thought your template would work as you wrote it. But I tried it out and it did not (not that I didn't believe you, I just had to do that to work out what to do!).
So, the way to deal with this is to refer to the variables in your data using the #root object within the greaterThan conditional (or other conditionals).
Try this as your template:
{{#greaterThan taskCount 0}}
Congrats on starting {{insert #root.taskCount "default=1"}} task{{#greaterThan #root.taskCount 1}} (s){{/greaterThan}} and taking the first small step.
{{else}}
You have not started a task yet. What are you waiting for? It has been {{#root.DaysSinceJoined}} days since you joined on {{#root.JoinedAt}}.
You have missed {{#root.DaysSinceJoined}} days where you could been making Small Steps towards the dreams of you better tomorrow.
{{/greaterThan}}
Setting up an RSS campaign with Mailchimp, and hit a roadblock. The import seems to work, the design looks great, but we only are able to ever get one post -- the most recent one-- into the email.
The RSS feed is: https://our.news/feed/trending
We have verified that pubDate is included and properly formatted on all items, ie:
<item>
<title>The FBI is warning you to reboot your router to prevent a new attack here’s everything you need to do</title>
<link>https://our.news/2018/05/30/the-fbi-is-warning-you-to-reboot-your-router-to-prevent-a-new-attack-heres-everything-you-need-to-d/</link>
<comments>https://our.news/2018/05/30/the-fbi-is-warning-you-to-reboot-your-router-to-prevent-a-new-attack-heres-everything-you-need-to-d/#comments</comments>
<pubDate>Wed, 30 May 2018 07:33:04 +0000</pubDate>
<dc:creator><![CDATA[OurBot]]></dc:creator>
<category><![CDATA[Headlines]]></category>
<guid isPermaLink="false">https://our.news/?p=103857</guid>
<description><![CDATA[BUSINESSINSIDER.COM – On Friday, the FBI said anyone who uses a router to connect to the internet should reboot their routers. That will “temporarily disrupt...]]></description>
<wfw:commentRss>https://our.news/2018/05/30/the-fbi-is-warning-you-to-reboot-your-router-to-prevent-a-new-attack-heres-everything-you-need-to-d/feed/</wfw:commentRss>
<slash:comments>1</slash:comments>
<media:content xmlns:media="http://search.yahoo.com/mrss/" medium="image" type="image/jpeg" url="https://dsezcyjr16rlz.cloudfront.net/wp-content/uploads/2018/05/30023303/httpsamp.businessinsider.comimages5b0d64001ae66220008b47d5640320.1.jpg.jpg" width="150" height="75" />
</item>
The specific email design template we're using is simple, relevant section is:
*|RSSITEMS:[$count=5]|*
<span style="float:left">*|RSSITEM:IMAGE|* </span>
*|RSSITEM:TITLE|*
*|END:RSSITEMS|*
This happens in Preview Mode, in the Test Email, AND in the actual weekly campaign sends. The campaign is set to send weekly, and when it does, it only includes the first item from the list. Ideally, we'd like this to always just include the most recent 5 items. Anyone have any ideas?
Try using a FeedBlock
*|FEEDBLOCK:https://www.url.com/test.xml|*
*|FEEDITEMS:[$count=5]|*
<span style="float:left">*|FEEDITEM:IMAGE|* </span>
*|FEEDITEM:TITLE|*
*|END:FEEDITEMS|*
There are many interesting articles on the Post Redirect Get pattern for example here: http://www.theserverside.com/news/1365146/Redirect-After-Post
But here's a simple question...
If the user does POST and is redirected to a GET. Fine if they hit refresh the browser just sends GET, easy to understand. But if the hit the BACK button after the GET and then hit refresh they can surely hit the POST again? yeah?
I am trying to understand how we can be 100% sure the POST can never be resubmitted?
One method for ensuring that a POST is not resubmitted is have a unique identifier associated with that post session, for example, if it's a shopping cart, when they begin checking out, generate a unique ID for that process. Once the checkout has completed (e.g. POST has been sent), remove that ID from the ID's that can be used.
You could also do this by generating a unique key with the form, and if the form is submitted, remove that key from where it is stored.
<input type="hidden" name="key" value="<?php echo generateUniqueKey(); ?>" />
where the generateUniqueKey() function will query a table and insert a unique ID, then return the ID. On the page where you are processing the form, do something like this:
<?php
$key = $_POST['key'];
if (isKeyStillValid ($key)) {
markKeyAsInvalid ($key);
// Process form ...
}
else {
die ("You have already submitted this form".);
}
?>
Where the isKeyStillValid() function will check the database to ensure the key used with the form is still a useable key, and the markKeyAsInvalid() function will remove the key from the database.
Update:
Here's an example that I just made which involves exactly what I described earlier. This is a very simple example, and simply uses an auto-incrementing ID in a SQL table as the key, but it should be sufficient as an example. Realistically, you would want something more thought out than this.
http://alexloney.com/post/
But if the hit the BACK button after the GET and then hit refresh they can surely hit the POST again? yeah?
Yeah.
When the user uses the back button, this can happen - the pattern doesn't protect against that, just against having the result coming up in the same page as the original form, where a refresh (F5) would cause a repost.
how we can be 100% sure the POST can never be resubmitted?
One way is to check the posted values against all values submitted in the last X minutes, discarding duplicates (at the risk of losing intentional duplicates).
I cannot get time remaining from groupon HTML. I did find a method before by hitting the link and it returned in JSON format, but that link no longer works.
So is there any way to get the time remaining from the deals? Only for goods, getaways, and all deals.I can get from the now deals(that is just text) unlike others which is a countdown counter.
To be on same page lets start with this link:
http://www.groupon.com/deals/3rd-coast-cruising-1?c=all&p=23
And before I used to hit:
http://www.groupon.com/deals/3rd-coast-cruising-1/deal_status.json
And got information including the remaining time, but it's not doing so any longer.
It's still there, in the form of a timestamp. Using the source of the first link:
<li class='groupon_countdown' data-deadline='1337576399' ...
And in the second link:
"deadline":"1337576399"
I don't know what language you're using, but with python you can convert this to a readable format like this:
>>>import time
>>>time.asctime(time.localtime(1337576399))
'Mon May 21 06:59:59 2012'
Which corresponds with now + the time left on their timer, in my timezone anyway.
I started building a app that will automatically download my delicious bookmarks, and save to a database, so they I can view them on my own website in my favoured format.
I am forced to use oAuth, as I have a yahoo id to login to delicious. The problem is I am stuck at the point where oAuth requires a user to manually go and authenticate.
Is there a code/ guidelines available anywhere I can follow? All I want is a way to automatically save my bookmarks to my database.
Any help is appreciated. I can work on java, .net and php. Thanks.
Delicious Provides an API for this already:
https://api.del.icio.us/v1/posts/all?
Returns all posts. Please use sparingly. Call the update function to see if you need to fetch this at all.
Arguments
&tag={TAG}
(optional) Filter by this tag.
&start={#}
(optional) Start returning posts this many results into the set.
&results={#}
(optional) Return this many results.
&fromdt={CCYY-MM-DDThh:mm:ssZ}
(optional) Filter for posts on this date or later
&todt={CCYY-MM-DDThh:mm:ssZ}
(optional) Filter for posts on this date or earlier
&meta=yes
(optional) Include change detection signatures on each item in a 'meta' attribute. Clients wishing to maintain a synchronized local store of bookmarks should retain the value of this attribute - its value will change when any significant field of the bookmark changes.
Example
$ curl https://user:passwd#api.del.icio.us/v1/posts/all
<posts tag="" user="user">
<post href="http://www.weather.com/" description="weather.com"
hash="6cfedbe75f413c56b6ce79e6fa102aba" tag="weather reference"
time="2005-11-29T20:30:47Z" />
...
<post href="http://www.nytimes.com/"
description="The New York Times - Breaking News, World News & Multimedia"
extended="requires login" hash="ca1e6357399774951eed4628d69eb84b"
tag="news media" time="2005-11-29T20:30:05Z" />
</posts>
There are also public and private RSS feeds for bookmarks, so if you can read and parse XML you don't necessarily need to use the API.
Note however that if you registered with Delicious after December, and therefore use your Yahoo account, the above will not work and you'll need to use OAuth.
There are a number of full examples on the Delicious support site, see for example: http://support.delicious.com/forum/comments.php?DiscussionID=3698