function login_process() { $this->config->load('api', TRUE); $num_users = $this->config->item('num_users', 'api'); $this->form_validation->set_rules('login', 'Логин', 'required'); $this->form_validation->set_rules('password', 'Пароль', 'required|min_length[3]'); if ($this->form_validation->run() == FALSE) { $this->output->set_output('<ul>' . validation_errors('<li>', '</li>') . '</ul>'); } elseif ($this->Authmodel->verify_user($this->input->post('login'), $this->input->post('password')) == FALSE) { $this->output->set_output('Не правильный логин или пароль!'); } elseif ($this->Authmodel->status_user($this->input->post('login'), $this->input->post('password')) == FALSE) { $this->output->set_output('Ваша учетная запись заблокирована!'); } elseif (num_users() >= $num_users) { $this->output->set_output('Превышено число активных сессий!'); } else { $userdata = $this->Authmodel->verify_user($this->input->post('login'), $this->input->post('password')); if ($userdata->manager == 0) { $session_data = array("login" => $this->input->post('login'), "guid" => $userdata->guid, "type_price" => $userdata->type_guid, "hash" => md5($userdata->upassword . $this->config->item('password_hash'))); $this->session->set_userdata($session_data); echo '<script>location.href="' . base_url('user') . '";</script>'; } elseif ($userdata->manager == 1) { $data['users'] = $this->Authmodel->manager($userdata->guid); $this->load->view('nonauth/manager', $data); } } }
* (at your option) any later version. * * JonesCMS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with JonesCMS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ if (eregi("header.php", $_SERVER['PHP_SELF'])) { Header("Location: index.php"); die; } $num_users = num_users(); if ($num_users == 0) { Header("Location: init.php"); die; } list($title, $sitename, $topname, $logo, $theme, $homepage) = getSiteData(); $cookie = getCookie(); updateHits(); enterSession(); header("Content-type: text/html; charset=iso-8859-1"); echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel="stylesheet" href="themes/<?php
function finish($uname, $fname, $lname, $pwd1, $pwd2, $email, $title, $sitename, $topname, $logo, $theme) { global $dbi; # is she already registered? if (num_users() > 0) { Header("Location: index.php"); die; echo "ASDASD"; } # do the passwords differ? if (strcmp($pwd1, $pwd2) != 0) { $error = "The two passwords provided differ!"; Header("Location: init.php?error={$error}&uname={$uname}&fname={$fname}&lname={$lname}&email={$email}"); die; } # is the pwd longer than 6 chars? if (strlen($pwd1) < 6) { $error = "Password cannot be shorter than 6 chars! Passowrd is = " . $pwd1; Header("Location: init.php?error={$error}&uname={$uname}&fname={$fname}&lname={$lname}&email={$email}"); die; } # is it a valid email? if (!$email || $email == "" || !eregi("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}\$", $email) || strrpos($email, ' ') > 0) { $error = "Invalid email address!"; Header("Location: init.php?error={$error}&uname={$uname}&fname={$fname}&lname={$lname}&email={$email}"); die; } # is it a valid username? if (!$uname || $uname == "" || ereg("[^a-zA-Z0-9_-]", $uname) || is_numeric($uname[0])) { $error = "Invalid username!"; Header("Location: init.php?error={$error}&uname={$uname}&fname={$fname}&lname={$lname}&email={$email}"); die; } # cypher pwd $pwd = md5($pwd1); # set privs at 0 (root) $privs = 0; # insert into db sql_query("insert into jones_user values (NULL, '{$uname}', '{$pwd}', '{$fname}', '{$lname}', '{$email}', '{$privs}')", $dbi); sql_query("update jones_site set title='{$title}', sitename='{$sitename}', topname='{$topname}', logo='{$logo}', theme='{$theme}'", $dbi); Header("Location: index.php"); }