<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=ProcessWire_-_Formulare_mit_CSRF_Schutz</id>
	<title>ProcessWire - Formulare mit CSRF Schutz - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=ProcessWire_-_Formulare_mit_CSRF_Schutz"/>
	<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=ProcessWire_-_Formulare_mit_CSRF_Schutz&amp;action=history"/>
	<updated>2026-05-06T19:39:53Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Wikizone</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.stephanschlegel.de/index.php?title=ProcessWire_-_Formulare_mit_CSRF_Schutz&amp;diff=23618&amp;oldid=prev</id>
		<title>93.208.103.149: Die Seite wurde neu angelegt: „Use CSRF in your own forms Problem  If you do not wish to create forms via the ProcessWire API, but still aiming to use PW&#039;s form features, you can use its CRS…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=ProcessWire_-_Formulare_mit_CSRF_Schutz&amp;diff=23618&amp;oldid=prev"/>
		<updated>2019-02-09T16:34:17Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „Use CSRF in your own forms Problem  If you do not wish to create forms via the ProcessWire API, but still aiming to use PW&amp;#039;s form features, you can use its CRS…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Use CSRF in your own forms&lt;br /&gt;
Problem&lt;br /&gt;
&lt;br /&gt;
If you do not wish to create forms via the ProcessWire API, but still aiming to use PW&amp;#039;s form features, you can use its CRSF (Cross-Site Request Forgery) preventing features like so:&lt;br /&gt;
&lt;br /&gt;
Solution&lt;br /&gt;
 https://processwire-recipes.com/recipes/use-csrf-in-your-own-forms/&lt;br /&gt;
&lt;br /&gt;
First you need to create a token and a token name, you do that as following:&lt;br /&gt;
&lt;br /&gt;
 $tokenName = $this-&amp;gt;session-&amp;gt;CSRF-&amp;gt;getTokenName();&lt;br /&gt;
 $tokenValue = $this-&amp;gt;session-&amp;gt;CSRF-&amp;gt;getTokenValue();&lt;br /&gt;
&lt;br /&gt;
Now what you want to do is create a hidden input field like this:&lt;br /&gt;
&lt;br /&gt;
 $html .= &amp;#039;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;_post_token&amp;quot; name=&amp;quot;&amp;#039; . $tokenName . &amp;#039;&amp;quot; value=&amp;quot;&amp;#039; . $tokenValue . &amp;#039;&amp;quot;/&amp;gt;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
Now this will generate something that will look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;_post_token&amp;quot; name=&amp;quot;TOKEN1470842875&amp;quot; value=&amp;quot;fe8ce9c1b9e6b9e361830df3525c49317a35332fbf626aa8793777a3b705824a&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You are done on the form side.&lt;br /&gt;
&lt;br /&gt;
You can now go to the part where you are receiving the post. Then use:&lt;br /&gt;
&lt;br /&gt;
 $session-&amp;gt;CSRF-&amp;gt;validate();&lt;br /&gt;
&lt;br /&gt;
This will return true (1) on a valid request and an exception on a bad request. You can test this out to open up your Firebug/Chrome debug console and change the value of the textbox to something else.&lt;br /&gt;
&lt;br /&gt;
Basicly what this does is set a session variable with a name (getTokenName) and gives it a hashed value. If a request has a token in it it has to have the same value or it is not send from the correct form.&lt;/div&gt;</summary>
		<author><name>93.208.103.149</name></author>
	</entry>
</feed>