PHP Classes

File: class/users_sign_in.php

Recommend this page to a friend!
  Classes of Javier AP   Pergamus Publication Manager   class/users_sign_in.php   Download  
File: class/users_sign_in.php
Role: Auxiliary script
Content type: text/plain
Description: Sign-in functions
Class: Pergamus Publication Manager
Web based manager for scientific publications
Author: By
Last change: Directory path added to filename
Date: 19 years ago
Size: 1,705 bytes
 

Contents

Class file image Download
<?php
function form_validation($last_name, $first_name, $email, $password, $password_conf, $usuario) {
   if(
$first_name == '' || $last_name == '' || $email == '' || $usuario == '' ||
      
$password == '' || $password_conf == '') {
          return
'You must fill all the fields.';
   } else if(
$password != $password_conf) {
       return
'The password and it\'s confirmation are different.';
   } else if(!
check_email($email)) {
       return
'The email address is incorrect.';
   } else{
       return
'valid';
   }
}

function
register_user($last_name, $first_name, $email, $password, $username) {
  
$reg =& new Collection('userslist');
  
$lista_campos = array("last_name" => $last_name, "first_name" => $first_name, "email" => $email, "username" => $username, "password" => $password);
  
$reg->add_item('user', $lista_campos);
  
$reg->save();
}

function
check_email($email) {
   
$regex =
   
'^'.
  
'[_a-z0-9-]+'. /* One or more underscore, alphanumeric,
                           or hyphen charactures. */
   
'(\.[_a-z0-9-]+)*'. /* Followed by zero or more sets consisting
                           of a period and one or more underscore,
                           alphanumeric, or hyphen charactures. */
   
'@'. /* Followed by an "at" characture. */
   
'[a-z0-9-]+'. /* Followed by one or more alphanumeric
                           or hyphen charactures. */
   
'(\.[a-z0-9-]{2,})+'. /* Followed by one or more sets consisting
                           of a period and two or more alphanumeric
                           or hyphen charactures. */
   
'$';
    return
eregi($regex, $email);
}
?>