Esempio n. 1
0
 function testDecodeDetectsTampering()
 {
     $value = array('foo' => 'bar', 'baz' => 1);
     $encoded = Pluf_Sign::dumps($value);
     $transforms = array(strtoupper($encoded), $encoded . 'a', 'a' . substr($encoded, 1), str_replace('M', '', $encoded));
     $this->assertEqual($value, Pluf_Sign::loads($encoded));
     foreach ($transforms as $t) {
         try {
             Pluf_Sign::loads($t);
             $this->fail();
         } catch (Exception $e) {
             $this->pass();
         }
     }
 }
Esempio n. 2
0
File: AB.php Progetto: burbuja/pluf
 /**
  * Process the request.
  *
  * If the request has the A/B test cookie, set $request->pabuid.
  *
  * @param Pluf_HTTP_Request The request
  * @return bool False
  */
 function process_request($request)
 {
     if (isset($request->COOKIE['pabuid']) and self::check_uid($request->COOKIE['pabuid'])) {
         $request->pabuid = $request->COOKIE['pabuid'];
     }
     $request->pabprops = array();
     if (isset($request->COOKIE['pabprops'])) {
         try {
             $request->pabprops = Pluf_Sign::loads($request->COOKIE['pabprops']);
         } catch (Exception $e) {
         }
     }
     return false;
 }