表单验证为空

时间:2011-12-14 23:12:10

标签: php codeigniter

我确定这是一个愚蠢的问题,但由于某种原因它没有显示错误。它只显示一个白色的屏幕。

http://kansasoutlawwrestling.com/kowmanager/

应该在空表单提交时执行此操作: http://kansasoutlawwrestling.com/peach/Template/login.html

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Usermanagement extends CI_Controller { 

public function index()
{
    //Config Defaults Start
    $msgBoxMsgs = array();//msgType = dl, info, warn, note, msg
    $cssPageAddons = '';//If you have extra CSS for this view append it here
    $jsPageAddons = '';//If you have extra JS for this view append it here
    $metaAddons = '';//Sometimes there is a need for additional Meta Data such in the case of Facebook addon's
    $siteTitle = '';//alter only if you need something other than the default for this view.
    //Config Defaults Start


    //examples of how to use the message box system (css not included).
    //$msgBoxMsgs[] = array('msgType' => 'dl', 'theMsg' => 'This is a Blank Message Box...');

    /**********************************************************Your Coding Logic Here, Start*/

    // ensure user is signed in
    if ( $this->session->userdata('is_logged_in') == FALSE ) {
        $bodyContent = "login";//which view file    // no session established, kick back to login page
    }

    $bodyType = "full";//type of template

    /***********************************************************Your Coding Logic Here, End*/

    //Double checks if any default variables have been changed, Start.
    //If msgBoxMsgs array has anything in it, if so displays it in view, else does nothing.      
    if(count($msgBoxMsgs) !== 0)
    {
        $msgBoxes = $this->msgboxes->buildMsgBoxesOutput(array('display' => 'show', 'msgs' =>$msgBoxMsgs));
    }
    else
    {
        $msgBoxes = array('display' => 'none');
    }

    if($siteTitle == '')
    {
        $siteTitle = $this->metatags->SiteTitle(); //reads 
    }

    //Double checks if any default variables have been changed, End.

    $this->data['msgBoxes'] = $msgBoxes;
    $this->data['cssPageAddons'] = $cssPageAddons;//if there is any additional CSS to add from above Variable this will send it to the view.
    $this->data['jsPageAddons'] = $jsPageAddons;//if there is any addictional JS to add from the above variable this will send it to the view.
    $this->data['metaAddons'] = $metaAddons;//if there is any addictional meta data to add from the above variable this will send it to the view.
    $this->data['pageMetaTags'] = $this->metatags->MetaTags();//defaults can be changed via models/metatags.php
    $this->data['siteTitle'] = $siteTitle;//defaults can be changed via models/metatags.php
    $this->data['bodyType'] = $bodyType;
    $this->data['bodyContent'] = $bodyContent;
    $this->load->view('usermanagement/index', $this->data);
}

function login()
{
    $this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
    $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean');

    if ($this->form_validation->run())
    {

    }
}

function logout()
{
   $this->session->sess_destroy();
   $this->index();
}       

}

/* End of file usermanagement.php */ 
/* Location: ./application/controllers/usermanagement.php */ 

使用我的模板系统,任何人都可以看到我需要做些什么来纠正他的问题?

3 个答案:

答案 0 :(得分:2)

你打电话给会议的自动加载吗?它看起来像你的代码没有__construct()它看起来像你使用另一个库或帮助器,只是确保你必须加载它们

答案 1 :(得分:1)

尝试启用错误报告。在脚本的顶部添加这行代码

<?php error_reporting(E_ALL ^E_NOTICE); ?>

如果仍然无效,请尝试在脚本的不同部分回显一些内容,以查看失败的位置。您在脚本中的某处有解析错误或致命错误。

你在任何地方使用输出缓冲吗?

答案 2 :(得分:1)

我早些时候在AIM上与你谈过.. 您在页面上收到的错误。

“消息:无法修改标题信息 - 已经发送的标题(输出从/home/xtremer/public_html/kowmanager/application/controllers/usermanagement.php:3开始)”

显示具有CI的会话当前未运行。或者您在召开会议之前向浏览器输出内容。了解您的CI安装。我会说你的问题部分是缺少缺失的_construct。导致CI安装自动加载会话功能。当你想使用像

这样的东西时,这是必需的
$this->session->userdata('is_logged_in')

将构造函数重新放入,就像使用其他控制器一样,然后再次尝试加载页面,看看是否没有修复它。