Use Python to get link from a form with authenticity token - php

I am wondering if it's possible to make a script in Python that parses the authencity token from a fom and get its correspondent link.
What would be the best approach to do so?
I am attaching a piece of the HTML source code as reference.
<form id="take_file_form" class="edit_document ng-pristine no-valid" data-dynamic-pricing-activated="true" data-dynamic-pricing-url="https://
api.textmaster.com/privateldocuments/Sd9208496831676601735397/
dynamic _pricing- data-dynamic-pricing.refresh-interval-in-sec="128"
action="/authors/tasksJ5d920849683I6700e1735397/start" accept-charset="UTF-8" method="post">
<input name="utf8" type="hidden" value="✓">
<input type="hidden" name="_method" value="patch">
<input type="hidden" name="authenticity_token" value="Sall2FcgxufyNBTFw4sUlliallY09+EljvfKEFdgzijsullgv+2Q811aggs7BovNytlFShGxjincdOrga78=="> <input id="document_dynamic_author_word_count" type="hidden" name="document[dynamic_author_word_count]" value="8"> <input type="submit" name="commit" value="Pegue essa tarefa" class=
"anim btn blue-hg action-btn"> == $0
Thanks!

Related

append php form URL

I currently built a simple form to GET request someones zipcode.
<form action="http://example.com" method="get" target="_blank">
<p>ZIPCODE</p>
<input type="text" name="zip">
<input type="submit" value="Submit">
</form>
When submitted it will be http://example.com/?zip=ZIPCODE
What I am looking to do it add an additional piece so it will be http://example.com/?zip=234&country=usa
I tried adding a hidden field <input type="hidden" name="country=usa"></input> but this replaces = with %3D and adds = after it like so: http://example.com/?zip=ZIPCODE&country%3Dusa=
How can I easily append the URL with country=usa?
Try:
<form action="http://example.com" method="get" target="_blank">
<p>ZIPCODE</p>
<input type="text" name="zip">
<input type="hidden" name="country" value="usa">
<input type="submit" value="Submit">
</form>

MS excel sheet is not showing properly through ZOHO excel viewer

<form method="POST" action="https://sheet.zoho.com/remotedoc.im" target="_self" accept-charset="UTF-8">
File :
I tried the above and I get a response like below:
RESULT=TRUE
URL=https://sheet.zoho.com/editor.do?doc=c2826da1f9894a549f13cf1172e390a30cabeb061f45f393&lang=en
I want to see it inside a web browser using ZOHO sheet.
<form method="POST" action="https://sheet.zoho.com/remotedoc.im" target="_self" accept-charset="UTF-8">
File : <input type="file" name="content" size="38" value=""> <br>
<input type="hidden" name="apikey" value="a1a00a67760e39e2ecb8b1187d05271b">
<input type="hidden" name="output" value="url">
<input type="hidden" name="mode" value="normaledit">
<input type="hidden" name="filename" value="mydocument.doc">
<input type="hidden" name="lang" value="en">
<input type="hidden" name="id" value="22345678">
<input type="hidden" name="format" value="xlsx">
<input type="hidden" name="saveurl" value="">
<input type="submit" name="submit" value="Open/Edit">
</form>
This is the original form.After submit it, I can't view the excel sheet.

ogone error unknown order/0/s/

I'm trying to configure my script to use ogone payment gateway
i've assigned a pass phrase let's say e.g: abcd1234
so the code that will be hased is
$sh = "AMOUNT=5000abcd1234CURRENCY=USDabcd1234LANGUAGE=en_USabcd1234ORDERID=1122abcd1234PSPID=MyIDabcd1234";
and i'm using this form
<FORM METHOD="post" ACTION="https://secure.ogone.com/ncol/test/orderstandard.asp" id="form1" name="form1">
<INPUT type="hidden" NAME="PSPID" value="MyID">
<INPUT type="hidden" NAME="ORDERID" value="1122">
<INPUT type="hidden" NAME="AMOUNT" value="5000">
<INPUT type="hidden" NAME="CURRENCY" value="USD">
<INPUT type="hidden" NAME="LANGUAGE" value="en_US">
<INPUT type="hidden" NAME="SHASIGN" value="<?php echo $sh; ?>">
<input type="submit" value="Your button lib" id="submit2" name="submit2">
</form>
after adjusting the referrer URL of this webpage i get this error unknown order/0/s/
Any idea please?
The error unknown order/0/s means that you are not sending the proper SHA-1 signature.
This is related to a parameter configured in Ogone's backoffice there :
Configuration > Technical information > Data and origin verification
I am very late, but the answer to this question is to hash the SHASIGN value with an algorithm that is chosen within the Merchant portal.
Passing the hashed value solves the issue.

PHP $_POST is empty when posting hidden fields

I have the following form that is dynamically generated:
<form action="index.php?route=module/print_wizard/showPrintSheet&token=4ef5f4af6ba25d6096357fdb4809e819" method="post" enctype="multipart/form-data" id="form">
<input name="[print][6][1]" type="hidden" value="on">
<input name="[print][6][3]" type="hidden" value="on">
<input name="[info]" type="hidden" value="INV-GIS-00002-3">
<input name="[layout_override][6][1]" type="hidden" value="">
<input name="[layout_override][6][3]" type="hidden" value="">
<input name="[bundle_override][6][1]" type="hidden" value="">
<input name="[bundle_override][6][3]" type="hidden" value="">
<input name="[run_id]" type="hidden" value="14040455">
<button type="submit">Export</button>
</form>
My PHP code is:
var_dump($_POST);
echo "<HR>".$this->request->server['REQUEST_METHOD'];
I have done this a million times before and can not for the life of me figure out why my $_post array is empty. I have changed my post to a get and all the fields and values are passing, but I need to use a post. Do I need to have one visible form element? Please help!
You are not using valid names for your form fields:
<input name="[print][6][1]" type="hidden" value="on">
is not valid as it just has an array index but no name.
If you change it to for example:
<input name="print[6][1]" type="hidden" value="on">
it will work without any problems.

Form validation - Minimum number value

Could someone offer me some advice as to form validation that restricts entry of a number below 5. I have got a donation form, simply an amount input field and a submit button to paypal.
What form validation shall I use to restrict submission of the form if the amount value is below 5 (for £5.00).
The form is below:
<form target="paypal" id="donate" action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<div class="span6 text-center">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="SECRET-ID">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="General">
<input type="hidden" name="item_number" value="GEN">
<div class="input-prepend input-append">
<span class="add-on">£</span>
<input class="span12" name="amount" value="5" placeholder="Enter Donation Amount" id="appendedPrependedInput" size="20" type="text">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
</div>
</div>
<div class="span6 text-center">
<div class="controls">
<a id="buynow" class="btn btn-danger" href="#" rel="nofollow" onclick="document.getElementById('donate').submit(); return false;">
<span style="">Donate via PayPal!</span></a>
<noscript>
<style>#buynow { display: none; } #page_theme #donate input { display: inline; }</style>
<input type="submit" class="btn btn-danger" value="Donate via PayPal!">
</noscript>
</div>
</div>
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
In your case I would use parsley.js
So to use parsley on your form (after you install it), add this data attribute to your form:
data-validate="parsley"
It should look like this:
<form target="paypal" id="donate" action="https://www.paypal.com/cgi-bin/webscr" data-validate="parsley" method="post" >
And for your input add the following data attribute (read the documentation for more validation rules):
data-min="6"
So it should look like:
<input class="span12" name="amount" value="5" placeholder="Enter Donation Amount" data-min="6" id="appendedPrependedInput" size="20" type="text">
And that's it.
There's a lot of them, but since most people are already using JQuery and they want to use client-side validations, I would use Jquery Validation. Remember for back-end, you have to use your own PHP, C# or whatever validation that you need. If you aren't using JQuery, I would use this
If you want a very simple frontend solution, you can use a Javascript function attached to the onblur event for the input element to test the value of the input:
<input type="text" name="amount" onblur="checkValue(this)" />
In the attached function, you pass the element and check the value of that element:
function checkValue(element){
if(element.value < 5){
alert('The minimum donation is 5.00!');
// clear value, display message, etc.
}
}
This function will be triggered whenever the cursor leaves the input field. A simple alert may be all you need. You may also want to add additional check to make sure the element input is actually a number and not a string. It's best to assume the end-user will not know how to use the form.
Please note that this is only a frontend solution and all submitted forms should be validated on the server-side language of choice (e.g. PHP). You should not accept this Javascript validation as a reliable validator when saving data.

Categories