簡體   English   中英

magento onload表單提交

[英]magento onload form submit

我想從sugarcrm重定向到magento登錄。 我的想法是在bodyload表單上提交並將表單重定向到magento。

當我點擊聯系人登錄到magento管理面板並重定向到儀表板時,我在sugarcrm中有一個文件文件名是sugarfile文件中的sugarfile.php

if($_REQUEST['module']== 'Contacts')
{
header('Location:http://mysite/magento/redirect.php');
exit;
}

在magento文件夾中我有一個文件redirect.php,代碼在下面,但它需要很長時間,而且根本沒有重定向

<?php
// Include Magento application
require_once ( "/var/www/html/santosh/magento/app/Mage.php" );
umask(0);
Mage::app("default");
Mage::getSingleton("core/session", array("name" => "adminhtml"));
$session = Mage::getSingleton("admin/session");
if(!isset($_REQUEST['action'])) {
$_REQUEST['action'] = '';
}
 $_REQUEST['action'] = "login";
switch($_REQUEST['action']){
case "login":
try{
$login = $session->login('admin','admin');
}catch(Exception $e){
$message = $e->getMessage();
}

header("location: http://mysite/magento/index.php/admin/dashboard/");

break;
case "logout":
// Execute the logout request
$session->logout();
header("location: index.php");

break;
default:
// If the customer is not logged in, show login form
// else, show logout link
if(!$session->isLoggedIn()){
?>
<html>
<head>
<title>External Page for Magento</title>
<script language="javascript"> 

function onBodyLoad() 
{ 
   document.form.submit() 
} 
</script> 
</head>
<body onload="onBodyLoad();">
<h3>Login here</h3>
<form method="POST" name="form" action="index.php/admin/">
Username <input type="text" name="login[username]" size="10" value="admin"/>
Password <input type="password" name="login[password]" size="10" value="admin" />
<input type="submit" name="submit" value="login" />
<input type="hidden" name="action" value="login" />
</form>
</body>
</html>
<?php
}
}
?>

我哪里錯了?

<body onLoad="document.form_name.submit()">

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM