用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4645|回复: 6
收起左侧

[已解决] GODADDY 空间对CI的支持问题

[复制链接]
发表于 2011-2-9 11:54:57 | 显示全部楼层 |阅读模式
今天把我开发的一个小东西发到godaddy的空间里去了,发现很多问题。一个是.htaccess的问题,不过在网上找到解决办法了。可是后来发现另外一个问题,居然不能找到model,这个是怎么个回事儿。这个代码在我自己的机器跑得还很顺流啊
这是我的view:
HTML复制代码
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php header("Content-Type: text/html; charset=gb2312");?>
<title>登录页面</title>
<link rel="stylesheet" type="text/css"
        href="/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/js/themes/icon.css">
<script type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/js/jquery.easyui.min.js"></script>
<script type="text/javascript">
$(function(){
       
        $('#win').window({
                collapsible:false,
                minimizable:false,
                maximizable:false,
                closable:false
        });
       
        $(document).bind('contextmenu',function(e){
                $('#mm').menu('show', {
                        left: e.pageX,
                        top: e.pageY
                });
                return false;
        });
 
        $.extend($.fn.validatebox.defaults.rules, {
            minLength: {
                validator: function(value, param){
                    return value.length >= param[0];
                },
                message: '请输入最少{0}个字符'
            },
            maxLength: {
                validator: function(value, param){
                    return value.length >= param[0];
                },
                message: '请输入最多{0}个字符'
            }
        });
 
        $('#username').focus();
});
 
function submitFF(){
        $('#ff').form('submit', {
                url: '/index.php?user_login',
            onSubmit: function(){
                        return $(this).form('validate');
            },
            success:function(data){
                    if(data=='TRUE'){
                            //$.messager.alert('info','<?php echo $this->session->userdata('name');?>','info');
                            window.location.href='';
                    }else if(data=='FALSE'){
                            $.messager.alert('错误!','用户名或者密码错误','error');
                    }else if(data=='ERROR'){
                            $.messager.alert('错误!','验证码输入错误','error');
                    }else{
                        $.messager.alert('错误!','未知错误!['+data+']','error');
                    }
            }
        });
}
        </script>
</head>
<body class="easyui-layout">
 
<div region="center" style="overflow: hidden;">
<div id="win" class="easyui-window" title="登录" style="width: 270px; height: 200px;">
<form id="ff" action='/index.php?user_login' method="post">
<table width='80%' border='0' height='100%' style='margin-top: 20px; margin-left: 10px'>
        <tr>
                <td><label for="username">用户名</label></td>
                <td><input class="easyui-validatebox" type="text" name="username"
                        id='username' required="true" validType='minLength[3]' value='zouyj'></input></td>
        </tr>
        <tr>
                <td><label for="password">密码:</label></td>
                <td><input class="easyui-validatebox" type="password" name="password"
                        id='password' validType='minLength[6]' required="true" value='password'></input></td>
        </tr>
        <tr>
                <td><label for="password">验证码</label></td>
                <td><input type="text" name="extraCode"
                        id='extraCode' size='4' maxLength='4'></input>
                        <img src='/index.php?util_extraCode/<?php echo rand(0, hexdec('FFFFFF'));?>' /></td>
        </tr>
        <tr>
                <td colspan='2' style='text-align: right; height: 50px'><a href="#" onclick="submitFF();"
                        class="easyui-linkbutton" icon="icon-ok">登录</a></td>
        </tr>
</table>
</form>
 
</div>
 
</div>
<div id="mm" class="easyui-menu" style="width: 120px;">
<div onclick="javascript:window.location.href=''" iconCls='icon-reload'>刷新</div>
<div onclick="$.messager.alert('信息','天正教育帮助','info');" iconCls='icon-help'>帮助</div>
<div onclick='window.close()'>退出</div>
</div>
</body>
</html>
 
 
复制代码


点登录之后,进入的Controllers
PHP复制代码
 
<?php
 
class User extends Controller {
 
        function __construct()
        {
                parent::Controller();
        }
 
        function index()
        {
        }
       
        function login(){
                if(strtolower($this->session->userdata('verify_code'))==strtolower($this->input->post("extraCode"))){
                        $this->load->model('Users','user');
                        $user = $this->user->hasUser($this->input->post("username"),$this->input->post("password"));
                        if($user <> false){
                                $this->session->set_userdata($user);
                                echo 'TRUE';
                        }else{
                                echo 'FALSE';
                        }
                }else{
                        echo 'ERROR';
                }
               
        }
 
}
 
复制代码


load的Model
PHP复制代码
 
<?php
class Users extends Model {
 
    function __construct()
    {
        parent::__construct();
    }
   
    function hasUser($username,$password){
        if(isset($username,$password)){
                $this->load->database();
               
                $query = $this->db->query("SELECT code,
                        name, role_id roleId FROM users where code='"
.$username.
                        "' and password='".md5($password)."'");
               
                if ($query->num_rows() > 0){
                        return $query->row_array();
                }else{
                        return null;
                }
        }
        return null;
    }
}
 
 
复制代码
发表于 2011-2-9 12:11:10 | 显示全部楼层
先报告下 CI 版本?
 楼主| 发表于 2011-2-9 13:19:01 | 显示全部楼层
提问的时候是1.73,现在换成2.0了
现在所有的页面都是404错误,包括Index.php
我用了网上写的改.htaccess的那个,也改了config.php:
.htaccess

  1. #Enable mod rewrite
  2. RewriteEngine On
  3. #the location of the root of your site
  4. #if writing for subdirectories, you would enter /subdirectory
  5. RewriteBase /

  6. #Removes access to CodeIgniter system folder by users.
  7. #Additionally this will allow you to create a System.php controller,
  8. #previously this would not have been possible.
  9. #'system' can be replaced if you have renamed your system folder.
  10. RewriteCond %{REQUEST_URI} ^system.*
  11. RewriteRule ^(.*)$ /index.php?/$1 [L]

  12. #Checks to see if the user is attempting to access a valid file,
  13. #such as an image or css document, if this isn't true it sends the
  14. #request to index.php
  15. RewriteCond %{REQUEST_FILENAME} !-f
  16. RewriteCond %{REQUEST_FILENAME} !-d
  17. #This last condition enables access to the images and css
  18. #folders, and the robots.txt file
  19. #Submitted by Michael Radlmaier (mradlmaier)
  20. # I added this line based on some info from other posts
  21. RewriteCond $1 !^(index.php|images|robots.txt|css)

  22. RewriteRule ^(.*)$ index.php?/$1 [L]
复制代码
config.php
PHP复制代码
$config['uri_protocol'] = 'QUERY_STRING';
复制代码
 楼主| 发表于 2011-2-9 15:52:34 | 显示全部楼层
几乎废了我一天时间,终于搞明白了。
错误是由于我对文件名大小写和routes里面文件名大小写没搞对造成的。
在windows里面,大小写文件名没什么影响,在linux里面可就不行了,折腾死我了,不过好在终于成功了,嘿嘿
发表于 2011-2-9 22:36:28 | 显示全部楼层
回复 4# abayomi.zou


    你要是严格按照手册的规定命名,就不会出错了,手册对于大小写都有明确规定。
发表于 2011-2-10 10:30:32 | 显示全部楼层
内个引用名称是不是最好别一样了啊……都用user你不怕搞混了啊……
发表于 2011-2-12 16:24:02 | 显示全部楼层
汗,还能犯这种错误。

本版积分规则