Create link in List view using encrypted ID

Permalink Browser Info Environment
Hopefully this is a simple question!!

I am trying to create a link within the Proforms List block that will pass the encrypted ProformsItemID through to a page that displays the form fields in a nice format for printing. Right now I can only seem to pass the unencrypted ID through.

<a href="http://www.mysite.com/?entryID=<?php echo $noO->getProformsItemID() ?>">Link to page</a>


The code above creates this link:http://www.mysite.com/99 rather thanhttp://www.mysite.com/Ghj7NNrmDwnnGKY5ZapOQ99yeJd3oehL0DI=...

How do I change the code above to call the $encryptedID that I can see in the display block's controller?

The reason I need to do this is when I pass an unencrypted ID through, the form fields won't show. They only show when I pass an encrypted ID through.

Type: Discussion
Status: In Progress
kspitzley
View Replies:
RadiantWeb replied on at Permalink Reply
RadiantWeb
Good question.

you need to set up the id encrypt first:

$salt = preg_replace('/[^A-Za-z0-9\-]/', '1', Config::get('SECURITY_TOKEN_ENCRYPTION') );
$encryptedID = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($salt), $noO->getProformsItemID(), MCRYPT_MODE_CBC, md5(md5($salt))));


ChadStrat
kspitzley replied on at Permalink Reply
kspitzley
Excuse my ignorance (as usual, ha), but do i put those lines right at the top of my view.php file where all the helpers are loaded, etc?

I totally saw that code in the controller.php and stared at it for about 10 minutes but couldn't figure out how to leverage it!
kspitzley replied on at Permalink Reply
kspitzley
I want to redeem myself slightly: I know that can't go up at the top, it has to go after you define $no0...but I'm still just not clear on where to put those lines. I'm playing around and failing.
RadiantWeb replied on at Permalink Reply
RadiantWeb
should just go within the foreach loop.

ChadStrat
kspitzley replied on at Permalink Reply
kspitzley
OK I've got that...I think I'm almost there! but do I need to do something to the link itself?

<?php
foreach($entries as $noO) { 
$action = View::url('/dashboard/proforms/search/edit/' . $noO->getProformsItemID());
$salt = preg_replace('/[^A-Za-z0-9\-]/', '1', Config::get('SECURITY_TOKEN_ENCRYPTION') );
$encryptedID = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($salt), $noO->getProformsItemID(), MCRYPT_MODE_CBC, md5(md5($salt))));
?>
<tr class="ccm-list-record <?php    echo $striped?>">
<?php    if($allow_edit || $allow_delete){ ?>
<td class="ccm-<?php   echo $searchType?>-list-cb" style="vertical-align: middle !important">
<a href="http://www.mysite.com/?entryID=<?php echo $noO->getProformsItemID() ?>">Print</a>
</td>


I feel like I need to do something to
<?php echo $noO->getProformsItemID() ?>
but everything I try isn't working.
RadiantWeb replied on at Permalink Reply
RadiantWeb
<?php
foreach($entries as $noO) { 
$action = View::url('/dashboard/proforms/search/edit/' . $noO->getProformsItemID());
$salt = preg_replace('/[^A-Za-z0-9\-]/', '1', Config::get('SECURITY_TOKEN_ENCRYPTION') );
$encryptedID = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($salt), $noO->getProformsItemID(), MCRYPT_MODE_CBC, md5(md5($salt))));
?>
<tr class="ccm-list-record <?php    echo $striped?>">
<?php    if($allow_edit || $allow_delete){ ?>
<td class="ccm-<?php   echo $searchType?>-list-cb" style="vertical-align: middle !important">
<a href="http://www.mysite.com/[[somepage_withform_here]]/?entryID=<?php echo $encryptedID; ?>">Print</a>
</td>
<?php } ?>
kspitzley replied on at Permalink Reply
kspitzley
This will either make you laugh or roll your eyes, but I did try that immediately, but neglected to include that little semicolon after $encryptedID...why is it always the tiniest, stupidest things that trip me up???

In any case IT WORKS!!! I am feeling triumphant thanks to your kind assistance.
RadiantWeb replied on at Permalink Reply
RadiantWeb
Hi there,

This is an auto responder to let you know that your support ticket has been forwarded to our entire support team at RadiantWeb!

Support tickets are reviewed Mondays thru Fridays 9am to 9pm & Saturdays 9am to 12pm EST.

A support team member will be following up with you as soon as possible.

Thank for supporting RadiantWeb Products!

RadiantWeb Support
http://goradiantweb.com

concrete5 Environment Information

# concrete5 Version
5.6.3.2

# concrete5 Packages
AddThis (1.0), Awkward Slider (1.0.4), Designer Content (3.1.1), Expand / Collapse (1.2.6), Guest Views (2.0), Image/File Search (2.06), Item Calendar (2.1.1), Lightboxed Image (0.9.2), List files from set (1.0.4), Locations (1.0.1), Login (1.1.1), Page List+ (5.6.0.0.0.5.6.1), Page List Title (2.3), Print my page (1.0.3), Pro Forms (7.5.6), tnSpacer (1.3), Webli-Toolbar (1.2.2), Whale Nivo Image Slider (1.2).

# concrete5 Overrides
blocks/autonav, blocks/icon_page_link, blocks/quick_links_grey, blocks/page_list, blocks/date_nav, blocks/proforms_display, blocks/locations_list, blocks/login, blocks/sub_right_sidebar, blocks/test, blocks/icon_list, blocks/file_download, blocks/proforms_list, blocks/home_banner_list, blocks/gray_line, blocks/search, blocks/print_my_page, controllers/event_nav, helpers/slateimage.php, themes/rpbcwd, themes/rpbcwdtheme

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - Off
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.2.17

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, ctype, curl, date, dba, dbase, dom, exif, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, json, ldap, libxml, mbstring, mcrypt, mhash, mime_magic, mysql, mysqli, ncurses, odbc, openssl, pcntl, pcre, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, posix, pspell, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, SQLite, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend Optimizer, zip, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 50M
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 50M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 200000
pcre.recursion_limit - 200000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.