PHP Classes

File: application/models/admincp/register.php

Recommend this page to a friend!
  Classes of Minh Tien   Noblesse CMS   application/models/admincp/register.php   Download  
File: application/models/admincp/register.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Noblesse CMS
Content management system with custom plugins
Author: By
Last change:
Date: 8 years ago
Size: 1,263 bytes
 

Contents

Class file image Download
<?php

function registerProcess()
{
   
$valid=Validator::make(array(
       
'send.firstname'=>'min:1|slashes',
       
'send.lastname'=>'min:1|slashes',
       
'send.email'=>'min:4|slashes',
       
'send.username'=>'min:5|slashes',
       
'send.password'=>'min:5|slashes',
       
'send.repassword'=>'min:5|slashes'
       
));

    if(!
$valid)
    {
        throw new
Exception("Error Processing Request. Check your information again!");
       
    }

    if(!
Captcha::verify())
    {
        throw new
Exception("Wrong captcha characters.");
       
    }

   
$send=Request::get('send');

   
$username=$send['username'];

   
$email=$send['email'];

   
$password=$send['password'];

   
$repassword=$send['repassword'];

   
$firstname=$send['firstname'];

   
$lastname=$send['lastname'];

   
$loadUser=Users::get(array(
       
'cache'=>'no',
       
'where'=>"where (username='$username' OR email='$username') OR (username='$email' OR email='$email') "
       
));

    if(isset(
$loadUser[0]['email']))
    {
        throw new
Exception('This user exists in our system.');
    }

   
$insertData=array(
       
'email'=>$email,
       
'username'=>$username,
       
'password'=>$password,
       
'firstname'=>$firstname,
       
'lastname'=>$lastname
       
);
   
    try {
       
Users::makeRegister($insertData);
    } catch (
Exception $e) {
        throw new
Exception($e->getMessage());
    }


   
// Redirect::to(System::getAdminUrl());
}

?>