나는이 youtube video과 같이 간단한 로그인 양식을 작성하려고합니다. 동영상에서 제조업체가 리디렉션하는 URL에서 볼 수 있듯이 내 로그인 양식에서 정보를 POST하고 가져 오지 않아야 함이 표시됩니다. 내 CodeIgniter는 항상 내 로그인 정보를 제출하고 다음 예제 링크로 리디렉션 된 후, 정보를 가져옵니다 그러나Codeigniter가 Post as Get
은 :
http://localhost/CodeIgniter/?email=member%40backupbull.com&password=password13&login_submit=Login
양식 헬퍼는 CodeIgniter의에 자동으로 적재된다.
컨트롤러 다음 login.php보기에로드
<?php $this->load->view('site_template/header.php'); ?>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<!-- This code is taken from http://twitter.github.com/bootstrap/examples/hero.html -->
<?php $this->load->view('site_template/navigation.php'); ?>
<div class="container">
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p><a class="btn btn-primary btn-large">Learn more »</a></p>
</div>
<!-- Example row of columns -->
<div class="row">
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details »</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details »</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn" href="#">View details »</a></p>
</div>
</div>
<hr>
<?php $this->load->view('site_template/footer.php'); ?>
보기 (navigation.php) :
public function login()
{
$this->load->view('login');
}
public function login_validation()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('email','Email','required');
$this->form_validation->set_rules('password','Password','required|md5');
if($this->form_validation->run()){
redirect('pages/members');
} else {
$this->load->view('login');
}
}
public function members(){
$this->load->view('members');
}
보기 (login.php)
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#"><?php echo SITE_NAME; ?></a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="<?php echo base_url(); ?>pages/features">Features</a></li>
<li><a href="<?php echo base_url(); ?>pages/pricing">Pricing</a></li>
<li><a href="<?php echo base_url(); ?>pages/about_us">About Us</a></li>
<li><a href="<?php echo base_url(); ?>pages/contact">Contact</a></li>
<!--
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="nav-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
-->
</ul>
<form class="navbar-form pull-right">
<?php
echo form_open('pages/login_validation');
echo validation_errors();
echo'<p>';
echo form_input('email', '[email protected]');
echo'</p>';
echo'<p>';
echo form_password('password', 'password');
echo'</p>';
echo'<p>';
echo form_submit('login_submit', 'Login');
echo'</p>';
echo form_close();
?>
<!--<input class="span2" type="text" placeholder="Email">
<input class="span2" type="password" placeholder="Password">
<button type="submit" class="btn">Sign in</button>-->
</form>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
루트에 691,363,210
htaccess로 :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /BackupBull/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 /index.php
</IfModule>
내가 어떻게이 문제를 해결하는 방법 아무 생각이 없습니다.
미리 도움을 청하십시오!
와우, 그 생각하지 않았어! 대단히 고마워, 해결 했어! – Dragon54