在joomla中包含用户详细信息的iframe

时间:2010-07-09 23:14:23

标签: html joomla

我有一个可以发布并具有SSO的网站。 SSO使用iframe,用户的详细信息在查询字符串中给出,其中一个细节必须进行哈希处理(MD5)。例如: http://www.come2play.com/channel_auth.asp?channel_id=9000&uid=123456&nick_name=The+Man&auth_sig=dc952e4371e04551684afbcbf12cf14c

我的一位发布商使用joomla并希望使用SSO。他不是程序员,而是让我以管理员身份访问他的joomla系统。我所要做的就是添加iframe和用户的详细信息,但我不知道从哪里开始。

我在这里看到了如何获取用户的详细信息: http:// docs.joomla.org/Accessing_the_current_user_object

我应该创建一个php页面吗? joomla artice?延期?模块?零件?我不确定是什么,我的目标很简单。在我创建之后,我该把它放在哪里? (我可以访问网络服务器)。

请帮忙!

2 个答案:

答案 0 :(得分:0)

如果您需要将详细信息传递给iframe中的某些内容,请在templates / YOURTEMPLATE / html /中创建一个新文件夹,以便我们可以覆盖默认行为。

包装 --tmpl ----如default.php

然后,您需要从components / com_wrapper / views / wrapper

复制文件

如果您查看该文件,您将看到以下代码:

<iframe <?php echo $this->wrapper->load; ?>
id="blockrandom"
name="iframe"
src="<?php echo $this->wrapper->url."?username=".$user->username."&email=".$user->email; ?>"
width="<?php echo $this->params->get( 'width' ); ?>"
height="<?php echo $this->params->get( 'height' ); ?>"
scrolling="<?php echo $this->params->get( 'scrolling' ); ?>"
align="top"
frameborder="0"
class="wrapper<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo JText::_( 'NO_IFRAMES' ); ?>
</iframe>

如果查看src属性,可以看到我正在传递用户名和电子邮件。您应该可以对其他参数执行相同的操作

答案 1 :(得分:0)

我知道这已经过时了,但是对于任何可能偶然发现并且需要时间相似的人来说。我有一个位于iframe中的页面,我添加了一些额外的位,以便能够将它与用户数据库连接:

<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$user =& JFactory::getUser();
?>

以上是连接数据库,然后您可以从字段中的位置获取用户的信息:

  <input type="hidden" name="Nickname" value="<?php print($user->username); ?>">
  <?php
  if($user->username){
     print($user->username);
  }else{
     print("You need to <a href=\"http://yoursite.com/index.php/component/users/?view=registration\" title=\"Create an account\" target=\"_top\">register</a> to use chat.");
  }
  ?>

和/或:

Real name: 
      <input type="hidden" name="Realname" value="<?php print($user->name); ?>">
      <?php print($user->name); ?>

希望它可以帮助任何需要它的人。

相关问题