		<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>Appnitro Software Forums Topic: Update Link</title>
<link>http://www.appnitro.com/forums/</link>
<description>Appnitro Software Forums Topic: Update Link</description>
<language>en</language>
<pubDate>Tue, 07 Feb 2012 09:27:44 +0000</pubDate>

<item>
<title>yuniar on "Update Link"</title>
<link>http://www.appnitro.com/forums/topic/update-link#post-1370</link>
<pubDate>Thu, 17 Apr 2008 06:59:17 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">1370@http://www.appnitro.com/forums/</guid>
<description>&#60;p&#62;&#38;lt;&#38;lt;I just have not figured out a easy exit out of the edit form for non-admin users.&#38;gt;&#38;gt;&#60;/p&#62;
&#60;p&#62;Hmm.. what if you go like this:&#60;/p&#62;
&#60;p&#62;1) If non-admin user is accessing edit_entry.php, set a special variable to mark this user and store it in a session.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$_SESSION[&#38;#39;is_non_admin&#38;#39;] = true;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;2) When the form is submitted and successful, check for that session variable, if exists then this is a non admin user, log them out (clear the session) and redirect it to any page you need it.
&#60;/p&#62;</description>
</item>
<item>
<title>startupguy on "Update Link"</title>
<link>http://www.appnitro.com/forums/topic/update-link#post-1358</link>
<pubDate>Wed, 16 Apr 2008 10:32:27 +0000</pubDate>
<dc:creator>startupguy</dc:creator>
<guid isPermaLink="false">1358@http://www.appnitro.com/forums/</guid>
<description>&#60;p&#62;AMurray is right on the money. Imagine if a form is created to collect information from a customer base. I would like to create a hashed link to each entry (or be able to generate a hashed link on demand) and send it out to individual customers. They would be then be able to click on that link and edit their form entry without admin access...&#60;/p&#62;
&#60;p&#62;Currently editing individual entries are only editable by admin user. &#60;/p&#62;
&#60;p&#62;I have most of that routine worked out...I just have not figured out a easy exit out of the edit form for non-admin users. &#60;/p&#62;
&#60;p&#62;I put together these hash functions in a file (includes/hash-functions.php)&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
function create_hash_links ($input) {&#60;/p&#62;
&#60;p&#62;   $str_length = strlen($input);&#60;br /&#62;
   $key1 = &#34;1 - Several species of small furry animals gathered together in a cave and grooving with a pict.&#34;;&#60;br /&#62;
   $key2 = time();&#60;br /&#62;
   $alg = &#34;rijndael-128&#34;;&#60;br /&#62;
   $cmode = 'ecb';&#60;/p&#62;
&#60;p&#62;   /* open the cipher */&#60;/p&#62;
&#60;p&#62;   $iv_size = mcrypt_get_iv_size($alg, $cmode);&#60;br /&#62;
   $iv = mcrypt_create_iv($iv_size, MCRYPT_DEV_RANDOM);&#60;br /&#62;
   $ks = mcrypt_get_key_size($alg, $cmode);&#60;/p&#62;
&#60;p&#62;   /* create key */&#60;br /&#62;
   $key1 = md5($key1);&#60;br /&#62;
   $key2 = md5($key2);&#60;/p&#62;
&#60;p&#62;   $key = substr($key1, 0, $ks/2) . substr(strtoupper($key2), (round(strlen($key2) / 2)), $ks/2);&#60;br /&#62;
   $key = substr($key.$key1.$key2.strtoupper($key1),0,$ks);&#60;/p&#62;
&#60;p&#62;   /* Encrypt and encode data */&#60;br /&#62;
   $enc = mcrypt_encrypt($alg,$key, $input, $cmode, $iv);&#60;br /&#62;
   $enc_val = rawurlencode(base64_encode($enc));&#60;/p&#62;
&#60;p&#62;   /* encode key */&#60;br /&#62;
   $encoded_key = rawurlencode(base64_encode($key));&#60;/p&#62;
&#60;p&#62;   $ret_val =  &#34;h=&#34;. $enc_val . &#34;&#38;#38;k=&#34; . $encoded_key;&#60;br /&#62;
   return $ret_val;&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;function retrieve_hashed_links($hashed_input) {&#60;/p&#62;
&#60;p&#62;   $hash = base64_decode(rawurldecode($hashed_input['h']));&#60;br /&#62;
   $key = base64_decode(rawurldecode($hashed_input['k']));&#60;/p&#62;
&#60;p&#62;   $alg = &#34;rijndael-128&#34;;&#60;br /&#62;
   $cmode = 'ecb';&#60;/p&#62;
&#60;p&#62;   /* open the cipher */&#60;br /&#62;
   $iv_size = mcrypt_get_iv_size($alg, $cmode);&#60;br /&#62;
   $iv = mcrypt_create_iv($iv_size, MCRYPT_DEV_RANDOM);&#60;/p&#62;
&#60;p&#62;   /* Decrypt encrypted string */&#60;br /&#62;
   $decrypted = trim(mcrypt_decrypt($alg, $key, $hash, $cmode, $iv));&#60;/p&#62;
&#60;p&#62;   return $decrypted;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;A version of edit_entry.php would then call these functions ...&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
$url = retrieve_hashed_links($_GET);&#60;br /&#62;
                parse_str($url, $output);&#60;br /&#62;
                $form_id = $output['id'];&#60;br /&#62;
                $entry_id = $output['edit'];&#60;/p&#62;
&#60;p&#62;                if(empty($form_id) &#124;&#124; empty($entry_id)){&#60;br /&#62;
                        die('Invalid Link.');&#60;br /&#62;
                }&#60;/p&#62;
&#60;p&#62;                //set session value to override password protected form and captcha&#60;br /&#62;
                $_SESSION['user_authenticated'] = $form_id;&#60;/p&#62;
&#60;p&#62;                if(!empty($_GET['done'])){&#60;br /&#62;
                        $markup = display_success($form_id);&#60;br /&#62;
                }else{&#60;/p&#62;
&#60;p&#62;                        //get initial form values&#60;br /&#62;
                        $form_values = get_entry_values($form_id,$entry_id);&#60;/p&#62;
&#60;p&#62;                        $markup = display_form($form_id,$form_values,'','',$entry_id);&#60;br /&#62;
                }&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>AMurray on "Update Link"</title>
<link>http://www.appnitro.com/forums/topic/update-link#post-1352</link>
<pubDate>Tue, 15 Apr 2008 19:25:26 +0000</pubDate>
<dc:creator>AMurray</dc:creator>
<guid isPermaLink="false">1352@http://www.appnitro.com/forums/</guid>
<description>&#60;p&#62;I assume Startupguy means to edit the record; in the Admin screen the admin person has the ability to edit the SQL records; so Startupguy wants the ability for users to go back to an existing record to edit it - much like you can do with this forum, if you have posted an answer and want to add to it, you click &#34;Edit&#34; and it allows you to add to that existing posting.
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Update Link"</title>
<link>http://www.appnitro.com/forums/topic/update-link#post-1350</link>
<pubDate>Tue, 15 Apr 2008 11:39:35 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">1350@http://www.appnitro.com/forums/</guid>
<description>&#60;p&#62;Sorry, what do you mean by edit/update link for the form?&#60;/p&#62;
&#60;p&#62;Update the entry? Or update the form?
&#60;/p&#62;</description>
</item>
<item>
<title>startupguy on "Update Link"</title>
<link>http://www.appnitro.com/forums/topic/update-link#post-1349</link>
<pubDate>Mon, 14 Apr 2008 21:04:54 +0000</pubDate>
<dc:creator>startupguy</dc:creator>
<guid isPermaLink="false">1349@http://www.appnitro.com/forums/</guid>
<description>&#60;p&#62;Is there a way to create an edit/update link for the form ? If we have someone fill out a form and they don't have all the information handy, it would be nice to send them a hashed link and have them update it...&#60;/p&#62;
&#60;p&#62;-startupguy
&#60;/p&#62;</description>
</item>

</channel>
</rss>

