So I tried to test out the following code:
Submitting the data in plaintext via a simple testform:
Which then gets pushed to another page which encrypts the plaintext data:
And till that point it works quite well, <cms:dump> spits out the db_vorname variable as the encrypted string.
I can even decrypt it, using some simple php and <cms:show>.
The problem is, I can't get it to save to the database as the initial variable set by the editable 'vv_vorname'
I googled back and forth and found the db_persist tag and came up with the following code:
Which does nothing, or at least not what I want it to do, since the variable vv_vorname is empty, every time I test it.
So some part of the code apparently works, since it overwrites the variable with empty space.
But the content of db_vorname does not get passed to vv_vorname of the initial template.
What might I be doing wrong? I've tried to solve that problem with a lot of forum reading and google for some time now, but I can't get it working. Thanks in advance for the help.
Submitting the data in plaintext via a simple testform:
- Code: Select all
<cms:template order ="99" hidden="1" access_level='4' clonable="1" hidden="1" >
<cms:editable type="text" label="Vorname" name="vv_vorname" />
</cms:template>
<main>
<div class="container">
<h2>
<cms:show vv_vorname/>
</h2>
<form action="actiontest.php" method="post">
Vorname <input type="text" value="<cms:show vv_vorname/>" name="vorname"><br>
<input type="submit">
</form>
</div>
</main>
Which then gets pushed to another page which encrypts the plaintext data:
- Code: Select all
<cms:template order ="99" hidden="1" access_level='4' clonable="1" hidden="1" />
<?php
$cipher = new Crypt_Twofish();
$cipher->setKey('2W76Q6fMX2Wp031tnZjR6f63IVrXHpjO');
$enc_vorname = $cipher->encrypt($_POST["vorname"]);
global $CTX;
$CTX->set('db_vorname', $enc_vorname, 'global');
?>
And till that point it works quite well, <cms:dump> spits out the db_vorname variable as the encrypted string.
I can even decrypt it, using some simple php and <cms:show>.
The problem is, I can't get it to save to the database as the initial variable set by the editable 'vv_vorname'
I googled back and forth and found the db_persist tag and came up with the following code:
- Code: Select all
<cms:pages masterpage="test.php">
<cms:db_persist
_masterpage=k_template_name
_mode='edit'
_page_id=k_page_id
_separator='|'
_invalidate_cache='0'
_auto_title='0'
vv_vorname = db_vorname
/>
<main>
<h2>
<cms:php>
$cipher = new Crypt_Twofish();
$cipher->setKey('2W76Q6fMX2Wp031tnZjR6f63IVrXHpjO');
echo $cipher->decrypt('<cms:show vv_vorname />');
</cms:php>
</h2>
</main>
</cms:pages>
Which does nothing, or at least not what I want it to do, since the variable vv_vorname is empty, every time I test it.
So some part of the code apparently works, since it overwrites the variable with empty space.
But the content of db_vorname does not get passed to vv_vorname of the initial template.
What might I be doing wrong? I've tried to solve that problem with a lot of forum reading and google for some time now, but I can't get it working. Thanks in advance for the help.