我正在运行 Magento 版本。1.6.2.0 在 Ubuntu EC2 实例上,但我的表单返回为 base64 编码的 php 文件,这些文件没有被解码。关于为 Magento 或 PHP 开启 base64 解码的任何想法?
我们有一个联系我们表格,您可以填写并点击提交。此表单附带我们安装的 Magento 主题(Themeforest 的 CrispAndClean)。但是,当您单击提交时,您将返回一个空白页面,而不是提交表单。如果单击查看源代码,您可以看到 base64 编码的 PHP。
您可以使用此站点对其进行解码: http ://www.tareeinternet.com/scripts/decrypt.php
结果如下:
?>http://www.facebook.com/rebimol * * * @author Vladimir Popov * @copyright 版权所有 (c) 2011 Vladimir Popov * @license http://opensource.org/licenses/osl-3.0.php 开放软件许可证 (OSL 3.0) */class VladimirPopov_WebForms_Block_Webforms 扩展 Mage_Core_Block_Template{ protected function _toHtml() { if((float)substr(Mage::getVersion(),0,3) <= 1.3){ if($this->getTemplate() == 'webforms/default.phtml' && $this->getData('nolegacy')!='0'){ $this->setTemplate('webforms/legacy.phtml'); } } $note = "由 WebForms 提供支持
结果')) == 1) $this->getResults(); if($webform->getSurvey()){ $collection = Mage::getModel('webforms/results')->getCollection(); if(Mage::helper('customer')->isLoggedIn()) $collection->addFilter('webform_id',$data['webform_id'])->addFilter('customer_id',Mage::getSingleton('customer /session')->getCustomerId()); else{ $session_validator = Mage::getSingleton('customer/session')->getData('_session_validator_data'); $collection->addFilter('customer_ip',ip2long($session_validator['remote_addr'])); } $count = $collection->count(); 如果($count>0){ $show_success = true; } } if(Mage::getSingleton('core/session')->getWebformsSuccess() == $data['webform_id'] || $show_success){ Mage::register('show_success',true); Mage::getSingleton('core/session')->setWebformsSuccess(); } if($webform->getRegisteredOnly() && !Mage::helper('customer')->isLoggedIn()){ Mage::getSingleton('customer/session')->setBeforeAuthUrl($this->getRequest() ->getRequestUri()); Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::helper('customer')->getLoginUrl(),301); 法师::register('fields_to_fieldsets',$webform->getFieldsToFieldsets()); //使用验证码 if(!Mage::helper('customer')-> isLoggedIn()){ $pubKey = Mage::getStoreConfig('webforms/captcha/public_key'); $privKey = Mage::getStoreConfig('webforms/captcha/private_key'); if($this->captchaAvailable()) Mage::register('use_captcha',true); } //处理结果 if($this->getRequest()->getParam('submitWebform_'.$data['webform_id'])){ //验证验证码 if(Mage::registry('use_captcha')){ if($this->getRequest()->getParam('recaptcha_response_field')) { $verify = $this->getCaptcha()->verify($this->getRequest()->getParam('recaptcha_challenge_field'),$ this->getRequest()->getParam('recaptcha_response_field')); 如果($验证-> isValid()){ $success = $this->saveResult(); } else { Mage::getSingleton('core/session')->addError($this->__('验证码不正确,请重试。')); 法师::register('captcha_invalid',true); } } else { Mage::getSingleton('core/session')->addError($this->__('验证码不正确,请重试。')); 法师::register('captcha_invalid',true); } } 其他 { $success = $this->saveResult(); } if($success){ Mage::getSingleton('core/session')->setWebformsSuccess($data['webform_id']); } //提交成功后重定向 $url = Mage::helper('core/url')->getCurrentUrl(); if($webform->getRedirectUrl()){ if(strstr($webform->getRedirectUrl(),'://')) $url = $webform->getRedirectUrl(); 否则 $url = $this->getUrl($webform->getRedirectUrl()); if($success) Mage::app()->getFrontController()->getResponse()->setRedirect($url); 父::_prepareLayout(); $this->getLayout()->getBlock('head')->setTitle(Mage::registry('webform')->getName()); } 公共函数 captchaAvailable(){ if(class_exists('Zend_Service_ReCaptcha') && Mage::getStoreConfig(' webforms/captcha/public_key') && Mage::getStoreConfig('webforms/captcha/private_key') ) 返回 true;返回假;} 公共函数 getCaptcha(){ $pubKey = Mage::getStoreConfig('webforms/captcha/public_key'); $privKey = Mage::getStoreConfig('webforms/captcha/private_key'); if($pubKey && $privKey) $recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey); 返回 $recaptcha; } 公共函数 saveResult(){ if(!Mage::registry('webform')) return false; 尝试{ $postData = $this->getRequest()->getPost(); $result = Mage::getModel('webforms/results'); $session_validator = Mage::getSingleton('customer/session')->getData('_session_validator_data'); $iplong = ip2long($session_validator['remote_addr']); if((float)substr(Mage::getVersion(),0,3)<=1){ $iplong = ip2long($this->getRealIp()); $result->setData($postData) ->setWebformId(Mage::registry('webform')->getId()) ->setStoreId(Mage::app()->getStore()->getId()) ->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId()) ->setCustomerIp($iplong) ->save(); Mage::dispatchEvent('webforms_result_submit',array('result'=>$result,'webform'=>Mage::registry('webform'))); $emailSettings = Mage::registry('webform')->getEmailSettings(); if($emailSettings['email_enable']){ $result = Mage::getModel('webforms/results')->load($result->getId()); $result->sendEmail(); if(Mage::registry('webform')->getDuplicateEmail()){ $result->sendEmail('customer'); } } 返回真;} catch (Exception $e){ Mage::getSingleton('core/session')->addError($e->getMessage()); 返回假;} } 公共函数 getRealIp() { $ip = false; if(!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ips = explode(", ", $_SERVER[' HTTP_X_FORWARDED_FOR']); if($ip) { array_unshift($ips, $ip); $ip = 假;} for($i = 0; $i < count($ips); $i++) { if(!preg_match("/^(10|172\.16|192\.168)\./i", $ips [$i])) { if(version_compare(phpversion(), "5.0.0", ">=")) { if(ip2long($ips[$i]) != false) { $ip = $ips[ $i]; 休息; } } else { if(ip2long($ips[$i]) != - 1) { $ip = $ips[$i]; 休息; } } } } } return ($ip ? $ip : $_SERVER['REMOTE_ADDR']); } 公共函数 getResults(){ $data = $this->getData(); $webform = Mage::registry('webform'); //得到结果 $page_size = $data["page_size"]; $current_page = (int)$this->getRequest()->getParam('p'); if(!$current_page) $current_page = 1; $来自 = $current_page*$page_size; $results = Mage::getModel('webforms/results')->getCollection() ->addFilter('webform_id',$webform->getId()) ->addFilter('approved',1) ->setPageSize($ page_size) ->setCurPage($current_page) ; $results->getSelect()->order('created_time desc'); $last_page = $results->getLastPageNumber(); $page_url = $this->getUrl(Mage::getSingleton('cms/page')->getData('identifier')); 回声 get_class($page_url); if($current_page1){ $next_url= $page_url."?p=".($current_page-1); 法师::register('prev_url',$prev_url); 法师::register('next_url',$next_url); 法师::register('current_page',$current_page); 法师::register('results',$results); } 受保护的函数 _afterToHtml($html){ Mage::unregister('webform'); 法师::unregister('fields_to_fieldsets'); 法师::unregister('prev_url'); 法师::unregister('next_url'); 法师:: 注销('current_page');法师::注销('结果'); 法师::unregister('redirect_url'); 法师::unregister('use_captcha'); 法师::unregister('captcha_invalid'); 返回父级::_afterToHtml($html); }}?>