Пример #1
0
 public function tryRegister(UserCredentials $uc, &$user)
 {
     $this->userName = $uc->getUserName();
     $this->password = $uc->getPassword();
     $user = new User($this->userName, $this->password);
     if (!User::checkIfUserExists($this->userName)) {
         User::AddUser($user);
         $this->validRegister = true;
         return true;
     } else {
         return false;
     }
 }
Пример #2
0
});
$app->get('/getSeeting/:userId', function ($userId) {
    //renvoi les seetings de l'utilisateur
    $seeting = User::getSeeting($userId);
});
$app->get('/getUser/:userId', function ($userId) {
    //renvoi les infos de l'utilisateur
    $user = User::getUser($userId);
});
$app->get('/getAllUser', function () {
    //renvoi toutes les infos de tous les utilisateurs
    $user = User::getAllUser();
});
$app->post('/AddUser', function () {
    //ajoute un utilisateur
    $user = User::AddUser($_POST["pseudo"], $_POST["email"], $_POST["password"], $_POST["birthdate"], $_POST["city"], $_POST["budget"]);
});
$app->get('/connexion/:pseudo/:password', function ($pseudo, $password) {
    User::connexion($pseudo, $password);
    //retourne userID si ok sinon retourne 0
});
$app->put('/modifUser', function () {
    //modifier utilisateur
    $user = User::UpdateUser($_POST["pseudo"], $_POST["email"], $_POST["password"], $_POST["birthdate"], $_POST["city"], $_POST["budget"], $_POST["id"]);
});
$app->delete('/delUser', function () {
    //modifier utilisateur
    $user = User::DeleteUser($_POST["id"]);
});
/*--------------------------------------------------
						FRIGO
Пример #3
0
<?php

header("Content-type: text/html; charset=utf-8");
header('Access-Control-Allow-Origin:*');
require_once 'function.php';
$user = new User();
$track = new Track();
// 所有p开头意为param
$pHash = @I('uhash');
$uid = $user->GetUserId($pHash);
if ($uid == null) {
    $user->AddUser($pHash);
}
$res_json = array('status' => false);
// 分发
switch (@I('type')) {
    // 增加追踪
    case 'addtrack':
        $pQuestionid = @I('qid');
        $pAnswerid = @I('aid');
        if ($pAnswerid == null || $pQuestionid == null) {
            $res_json['info'] = 'Aid or Qid 未命中';
            break;
        }
        if ($track->AddTrack($uid, $pQuestionid, $pAnswerid) > 0) {
            $res_json['status'] = true;
        }
        break;
    case 'removetrack':
        $pQuestionid = @I('qid');
        $pAnswerid = @I('aid');
Пример #4
0
        //Construct a user object
        $user = new User($username, $displayname, $password, $email);
        //Checking this flag tells us whether there were any errors such as possible data duplication occured
        if (!$user->status) {
            if ($user->username_taken) {
                $errors[] = lang("ACCOUNT_USERNAME_IN_USE", array($username));
            }
            if ($user->displayname_taken) {
                $errors[] = lang("ACCOUNT_DISPLAYNAME_IN_USE", array($displayname));
            }
            if ($user->email_taken) {
                $errors[] = lang("ACCOUNT_EMAIL_IN_USE", array($email));
            }
        } else {
            //Attempt to add the user to the database, carry out finishing  tasks like emailing the user (if required)
            if (!$user->AddUser()) {
                if ($user->mail_failure) {
                    $errors[] = lang("MAIL_ERROR");
                }
                if ($user->sql_failure) {
                    $errors[] = lang("SQL_ERROR");
                }
            }
        }
    }
    if (count($errors) == 0) {
        $successes[] = $user->success;
    }
}
require_once "models/header.php";
echo "\n\n\n<div id='left-nav'>";
Пример #5
0
        $apend = $id_for_img . $img_type;
        $uploadfile = "{$uploaddir}{$apend}";
        move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile);
    } else {
        if ($img_type == 'image/png') {
            $img_type = '.png';
            $uploaddir = 'upload/consumer_avatar/';
            $apend = $id_for_img . $img_type;
            $uploadfile = "{$uploaddir}{$apend}";
            move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile);
        } else {
            echo 'Not supported type.';
        }
    }
    $avatar_extension = $uploadfile;
    $masid = $addNewUser->AddUser($id_group, $login, $password, $orgName, $email, $avatar_extension);
}
if ($status == 'up') {
    $id = $_GET['id'];
    $UpdateUser = new User();
    $img_name = $_FILES['myfile']['name'];
    $img_type = $_FILES['myfile']['type'];
    $id_for_img = $id;
    if ($img_name) {
        if ($img_type == 'image/jpeg' or $img_type == 'image/jpg') {
            $img_type = '.jpg';
            $uploaddir = 'upload/consumer_avatar/';
            $apend = $id_for_img . $img_type;
            $uploadfile = "{$uploaddir}{$apend}";
            move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile);
            $avatar_extension = $uploadfile;
Пример #6
0
     $success = Avatar::Upload($_FILES['upload_field']);
     $message = $success ? array(Config::Get('success.saved')) : Error::GetAll();
     $data = array('avatar' => Config::Get('base_url') . Config::Get("avatar.upload_path") . Session::Get('current_user_temp_avatar') . '?' . time());
     break;
 case 'settings_crop':
     $success = Avatar::Crop();
     $message = $success ? array(Config::Get('success.saved')) : Error::GetAll();
     $data = array('avatar' => Session::Get('current_user')->GetAvatar());
     break;
 case 'settings_password':
     $success = Session::Get('current_user')->ChangePassword($_POST);
     $message = $success ? array(Config::Get('success.saved')) : Error::GetAll();
     break;
 case 'admin_add':
     $_POST['social_type'] = 'normal';
     $success = User::AddUser($_POST);
     if (isset($_POST['emailpassword']) && $success) {
         Email::SendEmail($_POST['email'], 'New account', 'Admin created an account with your email; Your password is : ' . $_POST['password']);
     }
     $message = $success ? array(Config::Get('success.created')) : Error::GetAll();
     break;
 case 'admin_edit':
     $user = new User();
     $user->Load(array('id' => $_POST['user_id']));
     $user->ChangeSettings($_POST);
     $success = Error::HasErrors() ? false : true;
     if (!empty($_POST['password']) || !empty($_POST['cpassword'])) {
         $success = $success && $user->ChangePassword($_POST);
     }
     $message = $success ? array(Config::Get('success.saved')) : Error::GetAll();
     $data = array('email' => $user->Get('email'), 'username' => $user->Get('username'));
Пример #7
0
require_once "../lib/config.inc.php";
require_once "../lib/classes/Admin.php";
require_once "../lib/classes/User.php";
require_once "../lib/encryption.inc.php";
$UserObj = new User();
$adminObj = new Admin();
$encryptObj = new Encryption();
$adminObj->validateAdmin();
$commonObj->cleanInput();
if (isset($_POST['submitForm']) && $_POST['submitForm'] == 'Yes') {
    if (!empty($_POST['uid']) && $_POST['uid'] != null) {
        $PASS = $encryptObj->encode($_POST['password']);
        $UserObj->updateUser($_POST, $PASS);
    } else {
        $PASS = $encryptObj->encode($_POST['password']);
        $UserObj->AddUser($_POST, $PASS);
    }
}
if (isset($_GET['uid'])) {
    $line = $UserObj->getUser(intval($_GET['uid']));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"><link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"><link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php 
echo ucfirst(SITE_ADMIN_TITLE);
?>
Пример #8
0
 static function ConnectTwitter($user_data)
 {
     $user = new User();
     $result = $user->Load(array('social_id' => $user_data['id']));
     if ($result) {
         Session::Set("current_user", $user);
         return true;
     } else {
         if (Session::Get('twitter_user')) {
             $img = str_replace("_normal", "", $user_data['picture']);
             $data = array('avatar' => $img, 'email' => $user_data['email'], 'username' => $user_data['username'], 'fullname' => $user_data['fullname'], 'location' => $user_data['location'], 'about' => $user_data['about'], 'social_id' => $user_data['id'], 'social_type' => 'twitter', 'activation_state' => '1', 'user_type' => 'user');
             $user = User::AddUser($data);
             if ($user) {
                 $user->Load(array('social_id' => $user_data['id']));
                 unset($_SESSION['twitter_user']);
                 Session::Set('current_user', $user);
                 header('Location: ' . Config::Get('base_url') . 'index.php');
                 return true;
             }
         } else {
             Session::Set('twitter_user', $user_data);
             header('Location: ' . Config::Get('base_url') . 'auth/twitteremail.php');
         }
     }
     return false;
 }
Пример #9
0
<?php

session_start();
require_once "lib/config.inc.php";
require_once "lib/classes/User.php";
require_once "lib/encryption.inc.php";
$encryptObj = new Encryption();
$UserObj = new User();
if (isset($_POST['submitForm']) && $_POST['submitForm'] == 'Yes') {
    $PASS = $encryptObj->encode($_POST['password']);
    $UserObj->AddUser($_POST, $PASS, 'front');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome To <?php 
echo SITE_TITLE;
?>
</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
<style>
input[type="text"],input[type="Password"],select,textarea {
	padding: 9px;
	width: 90%;
	font-size: 1.1em;	
	border: 2px solid#EAEEF1;
	color: #666666;
	background:#EAEEF1;