2

urlencodeaction

  1. require_once 'urlencrypt.php';
  2.  
  3. define('CONFIRMNEWUSER', 1);
  4. define('CONFIRMNEWSLETTERSUBSCRIBE', 2);
  5. define('CONFIRMNEWSLETTERUNSUBSCRIBE', 3);
  6. define('CONFIRMCOMMENT', 4);
urlencodeaction
SYNOPSIS

urlencodeaction($id, $param=false)

CODE
  1. function urlencodeaction($id, $param=false) {
  2.     global $sitekey;
  3.  
  4.     $data=pack('N', time()) . pack('C', $id);
  5.  
  6.     if ($param) {
  7.         $data .= serialize($param);
  8.     }
  9.  
  10.     $digest=md5($data, true);
  11.     $sdata=$digest.$data;
  12.  
  13.     $s64=urlencrypt($sdata, $sitekey);
  14.  
  15.     return $s64;
  16. }
urldecodeaction
SYNOPSIS

urldecodeaction($s64)

CODE
  1. function urldecodeaction($s64) {
  2.     global $sitekey;
  3.  
  4.     $sdata=urldecrypt($s64, $sitekey);
  5.  
  6.     if (!$sdata) {
  7.         return false;
  8.     }
  9.  
  10.     $digest=substr($sdata, 0, 16);
  11.  
  12.     $data=substr($sdata, 16);
  13.  
  14.     if ($digest != md5($data, true)) {
  15.         return false;
  16.     }
  17.  
  18.     $r=unpack('N', substr($data, 0, 4));
  19.     if (!$r) {
  20.         return false;
  21.     }
  22.     $timestamp = $r[1];
  23.  
  24.     $r=unpack('C', substr($data, 4, 1));
  25.     if (!$r) {
  26.         return false;
  27.     }
  28.     $actionid = $r[1];
  29.  
  30.     $param=false;
  31.     if (strlen($data) > 5) {
  32.         $param=@unserialize(substr($data, 5));
  33.         if (!$param) {
  34.             return false;
  35.         }
  36.     }
  37.  
  38.     return array($actionid, $timestamp, $param);
  39. }
SEE ALSO

urlencodeaction, emailconfirmuser, emailconfirmcomment

Comments

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].