Links getting corrupted in HTML emails - html

I am sending an email with a HTML link embedded as follows:
<a href="https://mydomain.com/?d=zJBTDhP%2bZxolUHQ6qJ2yFA%3d%3d" target='_blank'>Link</a>
When called the query string parameter 'd' is URL decoded and then decrypted (Rijndael) using our own function. Very occasionally (1% of cases), with certain users this fails and the error log shows that the query string value has morphed into this:
mWOGQuC%2oMkbyHUD6dW2lSN%3q%3q
so from:
zJBTDhP%2bZxolUHQ6qJ2yFA%3d%3d
to:
mWOGQuC%2oMkbyHUD6dW2lSN%3q%3q
Due to the intermittent nature of this problem...is this likely to be an overzealous spam filter or is this an encoding problem on our side?

Related

Node-RED Twitter out throws Error 32 when passing msg.params

I'm doing a Visual Rec app on nodered and want to tweet out the resultas as a reply to the original tweet (that reuqested de vis rec).
If I only put the username at the beginning sometimes twitter doesn't show it to the user because of the "in_reply_to_status_id" field being empty, so I need to pass thos parameters though msg.params.
When I do that, the tweet out node throws:
"Error: HTTP Error 401: Unauthorized, API message: {"errors":[{"code":32,"message":"Could not authenticate you."}]}"
If I "//" the msg.params line, it tweets just fine.
My params line goes like this:
msg.params=[{"tweet.in_reply_to_status_id":context.global.tweet.id},{"tweet.in_reply_to_screen_name":context.global.tweet.user.screen_name}];
I also tried without the "in_reply_to_screen_name" field (not sure if that's absolutely necessary for the reply), and without the "tweet." part as well.
Any help?!
OK, this worked:
msg.params={"tweet.in_reply_to_status_id":context.global.tweet.id,"tweet.in_reply_to_screen_name":context.global.tweet.user.screen_name};
Thanks Timothy from work!

How to store hidden fields inside message in web application?

I have web app (laravel 5.3, mysql) where users can comment any entity in project (almost every page contains something like chat)
I want to add possibility to mention other users inside message via '#' symbol ("Hello, #John, see here", for example).
When this message is posted to chat user named John must get notification about new message (via email, if he is offline).
Every message is connected to some page (/object/45, for example), so when email is sent user will know the page where he was mentioned.
The question is how to store this inside database?
message field has type text
In this example row would contain this data "Hello, #John, see here" (without quotes).
Problem is that there can be many users with name "John" so I can not not do simple:
select email from users where username = 'John' -- email is used as login
Also username can be something like #John Malkovich, so I have to parse string to find out, if "John" or "John Malkovich" was mentioned.
What is unique - user id.
So how to store this inside database?
Possible solution:
Hello, [user=34], see here - field in database
Parse string before displaying to web browser and replace this string with
Hello, #John, see here
but, obviously, no one can paste literal text '[user=123]' inside message, because it would be interpreted as userid.
P.S. Inside one message many users can be mentioned.
Maybe you could create something like <span value="user34">John Malkovich</span> and parse the value?
Or <span data-user-id="user34">John Malkovich</span> is probably better semantically.
Have absolutely no experience in this kind of stuff though, so don't take me too seriously ;)

In Jmeter, What would be syntax of parameters in Body Data section of HTTP Request Sampler, if I am using Rest APIs and taking input from CSV files?

I am trying to create 10 users at the same time in Jmeter, using REST APIs.
Test Data i.e. input is taken from CSV files (The details of users like user name, last name , mobile)
For this I have added one thread group,User Defined Variable,HTTP Header Manager, HTTP Request Sampler (which perform successful login into web application), JSON PATH EXTRACTOR ( to extract auth token, which will be used while adding user)
To Add User, I have used one "Loop Controller" - "HTTP Request Sampler" - HTTP Header Manager, CSV Data Set Config.
And to track result, View Results Tree and Aggregate Report.
Please tell me what would be the syntax of parameters which I am passing in "Body Data" section of HTTP Request sampler, so that it can read values from csv files.
Below is the syntax I am using now to add single user.
{
"phoneNo": "9998885551",
"lastName": "john25",
"email": "azp25#gmail.com",
"firstName": "ricky25",
"mobileNo": "9820420420"
}
If your CSV file looks like:
9998885551,john25,azp25#gmail.com,ricky25,9820420420
9998885552,john26,azp26#gmail.com,ricky26,9820420421
....
Configuration should be the following:
Filename: full path to your source .csv file
Variable Names: phone,lastname,email,firstname,mobile
Delimiter: ,
Populate other values according to your test scenario i.e. whether you want test to stop on .csv file end or re-spin or whatever.
And your HTTP Request should look like:
The main point is that variables defined in the CSV Data Set Config need to match the ones in the HTTP Request.
See Using CSV DATA SET CONFIG guide for detailed instructions.
I would also recommend adding the following entry to your HTTP Header Manager:
Name: Content-Type
Value: application/json
elsewise your request will be treated like plain text and may fail.
Also don't forget to disable View Results Tree listener for actual load test run as it consumes a lot of resources and may lead to out-of-memory errors on JMeter side.
Also,if your formparam\ Body data contains multiple parameters like this:
UserName=abc
password=abc123,
Instead of created two columns for userName and password, it can be given in single column like this:
UserName=abc&password=abc123
This way you can loop through multiple\different URL's which takes different numbers of bodydata
E.g.: If URL1 takes only username as body data and URL2 takes Username & password as body data the above will be an easy solution.

Query strings with HTTP URL

I am trying to do a HTTP GET of an URL with multiple query strings using a browser. Following is my observation
http://192.168.0.1:80/mycontent/?key1=value1 //Works.
http://192.168.0.1:80/mycontent/?key1=value1&key2=value2 //Doesen't work.
The question here :
I am finding a hard time to figure out what's the right format to
append the query string
Should we use &amp when we put in the browser?
Is there a way that I can find the validity (availability in the server) of the query string I enter in the URL.
You should use & when writing the link into HTML, for example:
Example
But not when entering the URL into the address bar, or using it directly in JavaScript (for example).
Your format is correct, so you should be able to pick up both key1 and key2 in the request collection. Depending on the language you are using on the server, the technique for this differs.

GET and POST values in the same link

I want something like this:
link
GET and 2x POST in hyperlink. How can I do that? Nothing wants to work
I have a GET array in PHP and I want to generate a link which leads to the correct url to give me those GET variables.
You can't have 2 GET variables with the same name. You can arrange them into an array as follows:
link
Just for clarification, this is still a GET request, links cannot normally produce a POST request, nor you should try to achieve that not-normally.
EDIT: To answer OP's calrification.
If you have a $_GET array, and you want to generate a link to get you there, you can use http_build_query()
I don't think you understand what GET and POST means in the HTTP world. Any items you put on a query string of a URL are GET parameters, you can't have 2 with the same name. POST parameters are sent as a part of the request, not as a query string on the URL.
GET and POST are http operations.
Sending values by using the ? as a separator in the url is different but related. eg:
foo.com/page.php?val1=1&val2=2
The values are called Query String values.
For GET operations, values are sent as a query string values. For POST operations, the values are sent in the body of the POST request. This is why POST must be used when a lot of data is being sent to the server. (Query strings have a maximum length, HTTP requests do not.)
You can do a POST operation to a url that includes query string values. This is more common with Ajax requests but can be done in a form as well. Just set the action url to something like index.php?val1=1&val2=2 the form's (additional) values will be sent as the http body. Remember to set method="post" in the form.
Note that you will need to create the query string yourself in this example, including escaping it properly.
Repeating value names in the query string values
Usually this causes both values to be sent, but the server overwrites the variable and ends up only presenting the last one to the client software.
So if you use a url such as
<a href="http://localhost/index.php?get=abc&post=cde&post=efg">
// It will be decoded by php and most server-side frameworks as
set get to abc
set post to cde
set post to efg
Result: 2 variables, get and post
There is nothing in the HTTP standard that says you can't send two query string params with the same name. However, you won't be able to use $_GET to retrieve these values; $_GET will pick up the last one. Instead, you'll have to manually parse $_SERVER['QUERY_STRING']. It's not that hard and I've done it a number of times when PHP has to handle a URL pattern generated by a third-party tool. If you're feeling really fancy you can have your query-string parse routine generate a $_GET member as an array if more than one instance of that member is encountered.