简体   繁体   English

magento onload表单提交

[英]magento onload form submit

i want to have a redirect to magento login from sugarcrm. 我想从sugarcrm重定向到magento登录。 My idea is to have on bodyload form submit and redirect the form to magento. 我的想法是在bodyload表单上提交并将表单重定向到magento。

I have a file in sugarcrm when i click the contacts it has to login to the magento admin panel and redirect to dashboard The filename is sugarfile.php in sugarfolder 当我点击联系人登录到magento管理面板并重定向到仪表板时,我在sugarcrm中有一个文件文件名是sugarfile文件中的sugarfile.php

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

In magento folder i have a file redirect.php the code is below but its taking a long time and it is not redirecting at all 在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
}
}
?>

where am I going wrong? 我哪里错了?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM