Generating an Encrypted URL for a Report

image_pdfimage_print

To generate an encrypted URL with user data for a report, you must use the following PHP script:

<h3>Please enter data then click on submit button</h3>
<?php
 $url = '';
 $secret = '';
 $user = '';
 $pass = '';if(isset($_GET['pass'])){
 $url = $_GET['url'];
 $secret = $_GET['secret'];
 $user = $_GET['user'];
 $pass = $_GET['pass'];

 echo '<div style="padding: 10px; border: 1px solid #333; color: black; font-style: bold; margin-bottom: 15px;">Click <a href="' . concat_url($url, $user, $pass, $secret) . '" target="_new">here</a> to jump to report.</div>';
}
?>

<form action="passgen.php" name="gen" type="post">
<input type="text" name="url" value="<?php echo $url;?>"> <b>URL</b>: copy/paste URL from a report (Properties/Link -without user credentials)<br>
<input type="text" name="secret" value="<?php echo $secret;?>"> <b>Secret</b>: copy/paste secret from "Jedox Suite\httpd\app\etc\config.php"<br>
<input type="text" name="user" value="<?php echo $user;?>"> <b>Username</b>: enter valid username<br>
<input type="text" name="pass" value="<?php echo $pass;?>"> <b>Password</b>: enter valid password<br>
<input type="submit">
<input type="reset"><br><b>
</form>

<?php
 function encrypt_password($username, $password, $secret)
 {
  $td = mcrypt_module_open('rijndael-128', '', 'cfb', '');
  $block_size = mcrypt_enc_get_block_size($td);
  $password_len = strlen($password);
  $password = str_pad($password, $password_len + $block_size - $password_len % $block_size);
  mcrypt_generic_init($td, $secret, md5($username, true));
  $password = mcrypt_generic($td, $password);
  mcrypt_generic_deinit($td);
  mcrypt_module_close($td);
  $password = urlencode(base64_encode($password));
  return $password;
 }
 function concat_url($url, $username, $password, $secret)
 {
  return $url . '&user=' . $username . '&pass=' . encrypt_password($username, $password, $secret);
 }
?>

The following dialog will result:

To copy the link, open the Reports component of Jedox Web, right-click on a report, and navigate to Properties→Link, then copy the link without login info.

image_pdfimage_print
Was this post helpful?
NoYes (No Ratings Yet)
Loading...