예제 #1
0
 /**
  * @Api
  */
 public function show_aes_key()
 {
     $aes_key = $this->aes_key_model->get_key($this->request->param('id'));
     echo aesEncrypt("a=1&b=2", $aes_key);
     $data = array("aes_key" => $aes_key);
     $this->output->set_output(json_encode($data));
 }
예제 #2
0
 public static function encryptUid($uid)
 {
     if (empty($uid)) {
         return null;
     }
     $enUid = bin2hex(aesEncrypt($uid, self::UID_AES_KEY));
     return $enUid;
 }
예제 #3
0
             $extension = getExtension($filename);
             if ($extension == 'htaccess') {
                 $alert = '<div class="alert alert-danger" role="alert"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>Dateityp nicht erlaubt!</div>';
             } elseif (filesize($file['tmp_name'][$i]) > 50000000) {
                 $alert = '<div class="alert alert-danger" role="alert"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>Datei ist zu gro&szlig;!</div>';
             } else {
                 $save_as_name = $filename;
                 move_uploaded_file($file['tmp_name'][$i], 'data/' . $save_as_name);
                 $uploadhandle = fopen("data/" . $filename, "r");
                 $uploadinhalts = '';
                 while ($uploadinhalt = fgets($uploadhandle, 4096)) {
                     $uploadall = $uploadinhalt;
                     $uploadinhalts .= $uploadall;
                 }
                 $uploaddatei = fopen("data/" . $filename, "w");
                 fwrite($uploaddatei, aesEncrypt($uploadinhalts, $_SESSION['key']));
                 fclose($uploaddatei);
                 fclose($uploadhandle);
             }
             ++$i;
         }
     }
 } elseif (isset($_GET['bild']) && file_exists('data/' . $_GET['bild'])) {
     $notshow = true;
     $info = getimagesize('data/' . $_GET['bild']);
     switch ($info[2]) {
         case 1:
             header("Content-type: image/gif");
             break;
         case 2:
             header("Content-type: image/jpeg");
예제 #4
0
파일: AesApi.php 프로젝트: hung5s/yap
 public function actionEncrypt($data)
 {
     $data = trim($data);
     return $this->result = aesEncrypt($data);
 }
예제 #5
0
function backupTables($host, $user, $pass, $name, $tables = '*')
{
    $link = mysql_connect($host, $user, $pass);
    mysql_select_db($name, $link);
    if ($tables == '*') {
        $tables = array();
        $result = mysql_query('SHOW TABLES');
        while ($row = mysql_fetch_row($result)) {
            $tables[] = $row[0];
        }
    } else {
        $tables = is_array($tables) ? $tables : explode(',', $tables);
    }
    $aViews = array();
    $aTables = array();
    foreach ($tables as $sTable) {
        if (strpos($sTable, 'oxv_') !== false) {
            array_push($aViews, $sTable);
        } else {
            array_push($aTables, $sTable);
        }
    }
    $aNewTables = array_merge($aTables, $aViews);
    foreach ($aNewTables as $table) {
        $result = mysql_query('SELECT * FROM ' . $table);
        $num_fields = mysql_num_fields($result);
        $return .= 'DROP TABLE ' . $table . ';';
        $row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE ' . $table));
        $return .= "\n\n" . $row2[1] . ";\n\n";
        for ($i = 0; $i < $num_fields; $i++) {
            while ($row = mysql_fetch_row($result)) {
                $return .= 'INSERT INTO ' . $table . ' VALUES(';
                for ($j = 0; $j < $num_fields; $j++) {
                    $row[$j] = mysql_real_escape_string($row[$j]);
                    if (isset($row[$j])) {
                        $return .= '"' . $row[$j] . '"';
                    } else {
                        $return .= '""';
                    }
                    if ($j < $num_fields - 1) {
                        $return .= ',';
                    }
                }
                $return .= ");\n";
            }
        }
        $return .= "\n\n\n";
    }
    $timestamp = time();
    file_put_contents(dirname(__FILE__) . "/tmp/backup-" . date('dmY', $timestamp) . ".sql", aesEncrypt($return, $sKey));
}