Exemplo n.º 1
0
function login($account_id, $password)
{
    // Verify user data
    $auth_result = User_Authenticate_Password($account_id, $password, $GLOBALS['bd']);
    // Return erros if it found any problem
    if ($auth_result == 1) {
        $user_ok = 1;
    } elseif ($auth_result == 0) {
        return "Wrong Password";
    } else {
        return "User Not Found";
    }
    // Create the session code
    $ip_address = $_SERVER['REMOTE_ADDR'];
    $sess_id = Create_Session($account_id, 'default', $ip_address, 1, 0, $GLOBALS['bd']);
    $crypt_sess_id = md5($sess_id);
    $complete_sess_id = $crypt_sess_id . $sess_id;
    // Return the session code to the user
    return $complete_sess_id;
}
Exemplo n.º 2
0
 $category_id = $bd->FetchResult($result1, 0, 'category');
 $cat = List_Categories($category_id, '', $bd);
 $cur_password = $_POST['cur_password'];
 $category = $cat[0][1];
 $commentaries = $_POST['commentaries'];
 $type_array = $role . "_type";
 $image_enable = "";
 for ($i = 0; $cfg[$type_array][$i]; $i++) {
     $field_type = $cfg[$type_array][$i];
     if ($_POST[$field_type] == 'on') {
         $image_enable .= "1";
     } else {
         $image_enable .= "0";
     }
 }
 if (!User_Authenticate_Password($account_id, $cur_password, $bd)) {
     $error[$num_errors++] = "The Current Password is Wrong";
 }
 switch (User_Validate_Simple_Field($name, 50)) {
     case 0:
         $error[$num_errors++] = "The name is blank";
         break;
     case -1:
         $error[$num_errors++] = "The name length is more than 50 characters";
         break;
 }
 switch (User_Validate_Email($email, 70)) {
     case 0:
         $error[$num_errors++] = "The e-mail is invalid";
         break;
     case -1:
Exemplo n.º 3
0
<?php

require "./inc/script_inicialization.php";
require "./inc/nrp_api.php";
$num_errors = 0;
$num_alerts = 0;
if (isset($_REQUEST['submit']) && $_REQUEST['submit'] == "Login") {
    ob_start();
    $val_id = User_Validate_Simple_Field($_REQUEST['id'], 32);
    $val_password = User_Validate_Password($_REQUEST['password'], 6);
    $user_ok = 0;
    if ($val_id && $val_password) {
        $auth_result = User_Authenticate_Password($_REQUEST['id'], $_REQUEST['password'], $bd);
        if ($auth_result == 1) {
            $user_ok = 1;
        } elseif ($auth_result == 0) {
            $error[$num_errors++] = "Wrong Password";
        } else {
            $error[$num_errors++] = "User Not Found";
        }
    } else {
        if ($val_id == 0) {
            $error[$num_errors++] = "The User ID is blank";
        } else {
            if ($val_id == -2) {
                $error[$num_errors++] = "There are invalid characters in the User ID";
            }
        }
        if ($val_password == 0) {
            $error[$num_errors++] = "The password is blank";
        } elseif ($val_password == -1) {