コード例 #1
0
 function get_list_photo()
 {
     if (!isset($_POST['gallery_id'])) {
         echo json_encode(array());
         exit;
     }
     require_once 'include/cypher.class.php';
     $cypher = new Cypher();
     $cypher->key = Core::inst()->img_password;
     $this('db')->query('SELECT `album_photo_name` FROM `di.album_photo` WHERE `album_photo_gallery_id` = ?;', $_POST['gallery_id']);
     $_echo = array();
     foreach ($this('db')->load_all() as $photo) {
         $_echo[] = str_replace(preg_split('~~u', '+/=', null, PREG_SPLIT_NO_EMPTY), preg_split('~~u', '-_,', null, PREG_SPLIT_NO_EMPTY), base64_encode(Core::inst()->img_prefix . $cypher->encrypt($photo['album_photo_name'])));
     }
     echo json_encode($_echo);
     exit;
 }
コード例 #2
0
 function images()
 {
     ini_set('memory_limit', '128M');
     require 'include/cypher.class.php';
     require 'include/timthumb/timthumb.class.php';
     $ecode_str = base64_decode(str_replace(preg_split('~~u', '-_,', null, PREG_SPLIT_NO_EMPTY), preg_split('~~u', '+/=', null, PREG_SPLIT_NO_EMPTY), $this->args[0]));
     $cypher = new Cypher();
     $cypher->key = Core::inst()->img_password;
     $images_param['src'] = '../view/upload/images/' . $cypher->decrypt(mb_substr($ecode_str, mb_strlen(Core::inst()->img_prefix, 'UTF-8') - mb_strlen($ecode_str, 'UTF-8')));
     $this('db')->query('SELECT * FROM `di.album_gallery`, `di.album_photo` WHERE `di.album_gallery`.`album_gallery_id` = `di.album_photo`.`album_photo_gallery_id` AND `di.album_photo`.`album_photo_name` = ? AND `di.album_gallery`.`album_gallery_visible` = 1;', $cypher->decrypt(mb_substr($ecode_str, mb_strlen(Core::inst()->img_prefix, 'UTF-8') - mb_strlen($ecode_str, 'UTF-8'))));
     if ($this('db')->affected_rows() == 0) {
         exit(0);
     }
     if (isset($this->args[1]) && $this->args[1] != 0) {
         $images_param['w'] = $this->args[1];
     }
     if (isset($this->args[2]) && $this->args[2] != 0) {
         $images_param['h'] = $this->args[2];
     }
     $images_param['q'] = 100;
     timthumb::start($images_param);
 }
コード例 #3
0
ファイル: sesiones.class.php プロジェクト: Batit/CadaverAldea
 function autenticateSession($userName, $sessionName)
 {
     //	print_r($_SESSION);
     if (isset($_SESSION['start']) && $_SESSION['start'] != "") {
         $key = $_SESSION[$userName] . $_COOKIE[$sessionName];
         $cypher = new Cypher();
         $cypherObj = $cypher->cypherOpen("", "");
         $descifrado = $cypher->descypher($cypherObj, $key, $_SESSION['vector'], $_SESSION['start']);
         if ($descifrado == $this->getIdSession()) {
             return true;
         } else {
             return false;
         }
     }
 }
コード例 #4
0
 /**
  * Get cypher service
  *
  * @return bool|Cypher
  */
 public function getCypher()
 {
     if (!empty($this->config['key'])) {
         require_once 'cypher.class.php';
         /** @var Cypher $Cypher */
         $Cypher = new Cypher();
         $Cypher->setKey($this->config['key'], true);
     } else {
         $Cypher = false;
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[Office] Could not protect data: you must specify the same nonempty keys at server and client. For example "&key=`8Hy76Jkw`".');
     }
     return $Cypher;
 }
コード例 #5
0
ファイル: protegido.php プロジェクト: Batit/CadaverAldea
$xajax->printJavascript("handlers/xajax/");

if(isset($_SESSION['textCap']) && 
   isset($_SESSION['nameUser']) && 
   isset($_SESSION['start']) && 
         $_SESSION['textCap']!="" && 
         $_SESSION['nameUser']!="" && 
         $_SESSION['start']!="")
	{
	$txtCapt = $_SESSION['textCap'];
	$sessionesObje=new Sessiones($txtCapt);
	try
	  {		
		 if($sessionesObje->autenticateSession($_SESSION['nameUser'],$txtCapt))
            		{
			$x = new Cypher();
			echo "===========>".$x->generateText(10)."<============";
               		echo "SESIONES: ".print_r($_SESSION,true)."<br></br>";
			echo "COOKIES: ".print_r($_COOKIE,true)."<br></br>";
			echo "SERVER: ".print_r($_SERVER,true)."<br></br>";
			echo "GET: ".print_r($_GET,true)."<br></br>";
			echo "session correcta"."<br></br><a href=#  onclick=xajax_destroySession() >cerrar session</>";
            		}
		else	{
			 header("Location: http://".$_SERVER["HTTP_HOST"]."".rtrim(dirname($_SERVER["PHP_SELF"]), "/\\")."/Sessionhandler.handler.php");
			}
	  }
	catch(Exception $e)
	  {
		echo "error ".$e."<br>";			
	  }