PHP Classes

File: contents/themes/simplecolor/model/contactus.php

Recommend this page to a friend!
  Classes of Minh Tien   Noblesse CMS   contents/themes/simplecolor/model/contactus.php   Download  
File: contents/themes/simplecolor/model/contactus.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: 9 years ago
Size: 911 bytes
 

Contents

Class file image Download
<?php

function contactProcess()
{
    if(
Session::has('contactus'))
    {
       
$total=(int)Session::get('contactus');

        if(
$total >= 5)
        {
           
Redirect::to('404page');
           
// Alert::make('Page not found');
       
}
    }

   
$valid=Validator::make(array(
       
'send.fullname'=>'min:2|slashes',
       
'send.email'=>'min:5|slashes',
       
'send.content'=>'min:3|slashes'
       
));

    if(!
$valid)
    {
       
$alert='<div class="alert alert-warning">Contact information not valid.</div>';

        return
$alert;
    }

    if(!
$id=Contactus::insert(Request::get('send')))
    {
       
$alert='<div class="alert alert-warning">Error. '.Database::$error.'</div>';

        return
$alert;
    }

    if(
Session::has('contactus'))
    {
       
$total=(int)Session::get('contactus');

       
$total++;

       
Session::make('contactus',$total);
    }
    else
    {
       
Session::make('contactus','1');
    }

   

       
$alert='<div class="alert alert-success">Success. We will response soon!</div>';

        return
$alert;
}


?>