[eluser]pisio[/eluser]
http://picbg.net/img.php?file=4af4a0bfcfcce8a5.png
look this picture.How can I fix a problem ?
The Controler file : useractive.php
Code:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of useractive
*
* @author pepi
*/
class useractive extends Controller {
//put your code here
function insert_user()
{
parent::Controller();
header('Content-type: text/html; charset=utf-8');
$dsn = 'mysql://root@localhost/wikis';
$this->load->database($dsn);
$this->load->library('parser');
if($this->uri->segment(3)== 'register'){
if($_POST['user_name'] != NULL AND $_POST['passwd'] == $_POST['passwd'] AND $_POST['email'] != NULL)
{
$this->db->where('username', $_POST['user_name']);
$query = $this->db->get('users');
$useri = $this->db->count_all_results();
if($useri == 0)
{
$data = array( 'id' => '' ,'username' => $_POST['user_name'] ,'password' => md5($_POST['passwd']),'email' => $_POST['email'] , 'activ' => '0' , 'avatar' => 'NULL');
if($this->db->insert('users', $data))
{
$data['user_error'] = 0;
}
}
else
{
$data['user_error'] = 1;
}
}
else
{
$data['user_error'] = 2;
}
}
echo $useri;
$this->parser->parse('user_reg', $data);
// $this->load->view('user_reg');
}
}
?>
View file: user_reg.php
Code:
{data}
{user_error}
{/data}
<form action="http://localhost/wiki/index.php/useractive/insert_user/register" method="POST">
<table border="1">
<tbody>
<tr>
<td>Потребител:</td>
<td><input type="text" name="user_name" value="" /></td>
</tr>
<tr>
<td>Парола<small>(2 пъти)</small>:</td>
<td><input type="password" name="passwd" value="" /><br/><input type="password" name="passwd2" value="" /></td>
</tr>
<tr>
<td>Е-поща:</td>
<td><input type="text" name="email" value="" /></td>
</tr>
<tr>
<td><input type="submit" /></td>
</tr>
</tbody>
</table>
</form>