Example #1
0
 protected function setData($messageFetch)
 {
     $this->_id = $messageFetch["idMessage"];
     $this->_message = $messageFetch["message"];
     $this->_dateSended = $messageFetch["date"];
     $this->_ip = $messageFetch["ip"];
     $this->_user = User::getUserByID($messageFetch["idUser"]);
 }
Example #2
0
 private static function setData($canalFetch)
 {
     $canal = new Canal($canalFetch["name"], User::getUserByID($canalFetch["creator"]));
     $canal->setID($canalFetch["id_canal"]);
     $canal->setName($canalFetch["name"]);
     $canal->setDateCreated($canalFetch["dateCreated"]);
     return $canal;
 }
Example #3
0
 public static function setData($messageFetch)
 {
     $message = new Message($messageFetch["content"], User::getUserByID($messageFetch["transmitter"]));
     $message->setID($messageFetch["id_message"]);
     $message->setIpTransmitter($messageFetch["ipTransmitter"]);
     $message->setDate($messageFetch["date"]);
     $message->wasSent($messageFetch["wasSent"]);
     return $message;
 }
Example #4
0
/**
* Retrieves the information of the currently logged in user.
*/
function getUserInfo()
{
    $user = new User();
    if (!empty($_SESSION['user_id'])) {
        $user->getUserByID($_SESSION['user_id']);
        echo '{"user_id":"' . $user->user_id . '","fName":"' . $user->fName . '","lName":"' . $user->lName . '","credit_provider":"' . $user->credit_provider . '","credit_number":"' . $user->credit_number . '"}';
    } else {
        echo 'null';
    }
}
Example #5
0
if (empty($data) || $data === null) {
    $res["reason"] = "Data Illegal";
    die(json_encode($res));
}
$db = new MySQL($log);
if ($mysqli = $db->openDB()) {
    $user = new User($mysqli, $log);
    $module = new Module($mysqli, $log);
    $pmd = new ProjectModuleData($mysqli, $log);
    $attackData = new AttackData($mysqli, $log);
    $attackLog = new AttackLog($mysqli, $log);
    //load attack module
    if ($data['op'] === 'load') {
        if ($module->getModuleByID($data['m_id'])) {
            $md = $module->getFields();
            $md["author"] = $user->getUserByID($md['author_id']) ? $user->username : '******';
            $res["result"] = true;
            $res["reason"] = $md;
        }
    }
    //send attack script
    if ($data['op'] === 'attack') {
        // do attack
        if (!empty($data['pmd_id']) && !empty($data['m_id'])) {
            $attackData->pmd_id = $data['pmd_id'];
            $attackData->module_id = $data['m_id'];
            //echo json_encode($data['config']);
            if ($data['config'] == null || count($data['config']) == 0) {
                $attackData->module_config = "";
            } else {
                $attackData->module_config = json_encode($data['config']);
Example #6
0
$method = $_REQUEST['method'];
$code = $_GET['code'];
$id = $_GET['id'];
$email = $_POST['email'];
$captcha = $_POST['captcha'];
$code = $code ? $code : "";
$id = $id ? $id : 0;
$method = $method ? $method : '';
$email = $email ? $email : '';
$captcha = $captcha ? $captcha : '';
if ($method == 'active') {
    $db = new MySQL($log);
    if ($mysqli = $db->openDB()) {
        $user = new User($mysqli, $log);
        $invitation = new Invitation($mysqli, $log);
        if ($user->getUserByID($id)) {
            if ($user->status == 2) {
                $s_email = $user->email;
                $v_res = $invitation->validateEmailCode($code, $id);
                if ($v_res['result']) {
                    $user->status = 1;
                    if ($user->updateUser($id)) {
                        $res['result'] = true;
                        $res['message'] = '恭喜您,用户已激活成功';
                        $res['action'] = 'login';
                    }
                } else {
                    $res['message'] = $v_res['reason'];
                    $res['action'] = 'resend';
                }
            } else {
Example #7
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once $_SERVER["DOCUMENT_ROOT"] . "/modele/User.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/modele/Message.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/modele/Canal.php";
session_start();
require_once $_SERVER["DOCUMENT_ROOT"] . "/controller/functions.php";
authentificationRequire();
if (isset($_GET["user"])) {
    $to = User::getUserByID($_GET["user"]);
    $me = $_SESSION["user"];
    $canal = new Canal($me->getPseudo() . ", " . $to->getPseudo(), $me);
    $canal->addUser($to);
    if (($id_canal = $canal->exists()) != false) {
        $canal = Canal::getCanalByID($id_canal);
    } else {
        $canal->save();
    }
    header("Location: /Salon/Canal/" . $canal->getID());
}
?>

Example #8
0
<?php

require_once 'classMessages.php';
require_once 'classUser.php';
session_start();
if ($_POST['msg'] != '' && isset($_SESSION['userID'])) {
    $usr = User::getUserByID($_SESSION['userID']);
    Messages::storeMessage($usr->chatID(), $usr->userID(), $_POST['msg']);
}
Example #9
0
$m_id = $m_id ? $m_id : 0;
$res = false;
$editAble = false;
$db = new MySQL($log);
$mysqli = $db->openDB();
$stor = new SaeStorage();
if ($m_id > 0) {
    if ($mysqli != null) {
        $module = new Module($mysqli, $log);
        $mCategory = new ModuleCategory($mysqli, $log);
        $array_category = $mCategory->getCategorys();
        $res = $module->getModuleByID($m_id);
        if ($res) {
            $user = new User($mysqli, $log);
            //get the module author name
            $author = $user->getUserByID($module->author_id) ? $user->username : '******';
            //Only the op is 'edit' and the current user is  the module author
            //the user can edit the form
            if ($user_info['id'] === $module->author_id) {
                $editAble = true;
            }
            $op = 'edit';
        }
    }
} else {
    //if the op is 'new', user the can edit the empty form to create a new module
    if ($mysqli != null) {
        $mCategory = new ModuleCategory($mysqli, $log);
        $array_category = $mCategory->getCategorys();
    }
    $editAble = true;
Example #10
0
        exit;
    }
    if ($_GET['t'] == 'update') {
        if ($_POST['pass'] == "") {
            $result = User::updateUser($_POST['idus'], $_POST['name'], $_POST['tipo'], $_POST['mail']);
        } else {
            $result = User::updateUser($_POST['idus'], $_POST['name'], $_POST['tipo'], $_POST['mail'], $_POST['pass']);
        }
        if (isError($result)) {
            echo dError($result);
        }
        exit;
    }
}
if ($_GET['id']) {
    $us = User::getUserByID($_GET['id']);
}
?>
            
<form action = "<?php 
if ($_GET['t'] != 'update') {
    echo 'javascript:fn_agregar();';
} else {
    echo 'javascript:fn_update();';
}
?>
" method = "post" id = "form_adminUser">
<input type="hidden" value="<?php 
echo $us->id;
?>
" name="idus" />
Example #11
0
        echo $md->m_id;
        ?>
" ></td>
						<td class="hidden" for="author_id" ><?php 
        echo $md->author_id;
        ?>
</td>
						<td for="m_name" ><a href="moduleItem.php?m_id=<?php 
        echo $md->m_id;
        ?>
"><?php 
        echo $md->m_name;
        ?>
</a></td>
						<td for="author" ><?php 
        echo $user->getUserByID($md->author_id) ? $user->username : '******';
        ?>
</td>
						<td for="category" ><?php 
        foreach ($array_category as $ca) {
            if ($ca['id'] === (int) $md->category_id) {
                echo $ca['text'];
            }
        }
        ?>
</td>
						<td for="m_info" ><?php 
        echo $md->m_info;
        ?>
</td>
						<td for="risk" 	 ><?php 
Example #12
0
 public function save()
 {
     include $_SERVER["DOCUMENT_ROOT"] . "/scripts/bdd/connect.php";
     if (!User::getUserByID($this->_id)) {
         $sql = "INSERT INTO user VALUES\t(:idUser,:pseudo,:mail,:password,:sexe,:phoneNumber,:birth,:avatar,:statut,:reputation,:password,:country,:state,:city,:inscriptionDate,:lastConnexion,:lastDownloadMessage,:lastUploadMessage)";
     } else {
         $sql = "UPDATE user SET \r\n\t\t\t\t\tidUser=:idUser, \r\n\t\t\t\t\tpseudo=:pseudo, \r\n\t\t\t\t\tage=:age, \r\n\t\t\t\t\tbirth=:birth, \r\n\t\t\t\t\tsexe=:sexe, \r\n\t\t\t\t\tavatar=:avatar, \r\n\t\t\t\t\tstatut=:statut, \r\n\t\t\t\t\treputation=:reputation, \r\n\t\t\t\t\temail=:email, \r\n\t\t\t\t\tpassword=:password, \r\n\t\t\t\t\tcountry=:country, \r\n\t\t\t\t\tstate=:state, \r\n\t\t\t\t\tcity=:city, \r\n\t\t\t\t\tinscriptionDate=:inscriptionDate, \r\n\t\t\t\t\tlastConnexion=:lastConnexion, \r\n\t\t\t\t\tlastUploadMessage=:lastUploadMessage";
     }
     $req = $bdd->prepare($sql);
     $req->execute(array(":idUser" => $this->_id, ":pseudo" => $this->_pseudo, ":age" => $this->_age, ":birth" => $this->_birth, ":sexe" => $this->_sexe, ":avatar" => $this->_avatar, ":statut" => $this->_administrator, ":reputation" => $this->_reputation, ":email" => $this->_mail, ":password" => $this->_password, ":country" => $this->_country, ":state" => $this->_state, ":city" => $this->_city, ":inscriptionDate" => $this->_inscriptionDate, ":lastConnexion" => $this->_lastConnexion, ":lastDownloadMessage" => $this->_lastDownloadMessage, ":lastUploadMessage" => $this->_lastUploadMessage));
     return $bdd->errorInfo();
 }
Example #13
0
                        <th>#</th>
                        <th>Irány</th>
                        <th>Ügyfél</th>
                        <th>Összeg</th>
                        <th>Leírás</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
    $accid = $user->getAccByUserID($user->data()->ID);
    $tranid = $user->getTranByAccID($accid->ID);
    $transactions = $user->getTransactions($tranid->ID);
    if (count($transactions) > 0) {
        for ($i = 0; $i < count($transactions); $i++) {
            $lugyfel = $user->getUserByAccID($transactions[$i][2]);
            $ugyfel = $user->getUserByID($lugyfel->User_ID);
            echo '<tr>
                    <th scope="row">' . ($i + 1) . '</th>
                    <td>' . ($transactions[$i][5] == 0 ? '<i class="fa fa-arrow-right"></i>' : '<i class="fa fa-arrow-left"></i>') . ' </td>
                    <td>' . $ugyfel->LastName . ' ' . $ugyfel->FirstName . '</td>
                    <td>' . $transactions[$i][4] . ' RON</td>
                    <td>' . $transactions[$i][6] . '</td>
                  </tr>';
        }
    }
    ?>
                </tbody>
            </table>
    </div>
    <?php 
}
Example #14
0
        return;
    }
    if ($usr->isAvailable()) {
        if (!$usr->isFB()) {
            $usr->deleteUser();
        }
    } else {
        $chat = Chat::getChatByID($usr->chatID());
        if ($chat) {
            $chat->deleteChat();
            $chat->deleteHistory();
            if (!$usr->isFB()) {
                $usr->deleteUser();
            } else {
                $usr->setAvailability(true);
                $usr->updateUser();
            }
            //echo "--" . $chat->user1() . "-" . $chat->user2() . "--";
            if ($chat->user1() == $usr) {
                $friend = User::getUserByID($chat->user2());
            } else {
                $friend = User::getUserByID($chat->user1());
            }
            if ($friend) {
                $friend->setAvailability(true);
                $friend->updateUser();
            }
        }
    }
    unset($_SESSION['userID']);
}
Example #15
0
<?php

include 'closeChat.php';
require_once 'classFb.php';
$fbid = fb::userID();
$usr = new User();
$usrk = false;
//new or existing user, false: new
if ($fbid != 0) {
    if ($usrk = User::getUserByID($fbid)) {
        $usr = $usrk;
    } else {
        $usr->setUserID($fbid);
    }
    $usr->setisFB(true);
    $usr->setUsername('abc');
    $usr->setAvailability(true);
    $usr->setChatID(0);
    $_SESSION['userID'] = $usr->userID();
    $_SESSION['prevTime'] = date('Y-m-d H:i:s');
    echo $fbid;
    if (!$usrk) {
        $usr->storeUser();
    } else {
        $usr->updateUser();
    }
}
Example #16
0
 static function deleteUser($id)
 {
     global $db;
     if ($r = User::getUserByID(intval($id))) {
         if ($r->user != 'admin') {
             return $db->qs("DELETE FROM user WHERE id=%d;", array(intval($id)));
         } else {
             return E_USER_ADMIN_NOT_DELETE;
         }
     }
     return E_USER_NOT_EXIST;
 }
Example #17
0
                <strong><?php 
        echo $_GET["messagge"];
        ?>
</strong>
            </div>
        </div>  
<?php 
    }
}
?>

<?php 
//Get user data
$user_id = $_GET["user_id"];
$user_object = new User();
$user_data = $user_object->getUserByID($user_id);
if ($user_data != false) {
    ?>

<div class="container">
    <div class="col-md-12">
        <div class="col-md-offset-4 col-md-4">
            <h1 class="text-info text-center">Actualizar usuario</h1>
            <div class="text-center">Los campos con asterisco (*) son obligatorios. No modifique el password si es que no desea cambiarlo</div>           
            
            <form id="frmUpdate" method="post" action="update_pro.php" >
            <fieldset>
                <legend class="text-center"></legend>
                <div class="row form-group">
                    <label class="control-label">Nombres y Apellidos*</label>
                    <input value="<?php 
Example #18
0
        $_SESSION["erreur"][] = "Vous devez compléter le champ mot de passe";
    }
    if (isset($_SESSION["erreur"])) {
        header("Location: /Erreur");
    }
    if (filter_var($_POST["login"], FILTER_VALIDATE_EMAIL)) {
        $sql = "SELECT idUser FROM user WHERE UCASE(email)=UCASE(:login) AND UCASE(password)=UCASE(:password)";
    } else {
        $sql = "SELECT idUser FROM user WHERE UCASE(pseudo)=UCASE(:login) AND UCASE(password)=UCASE(:password)";
    }
    $req = $bdd->prepare($sql);
    $req->execute(array(":login" => $_POST["login"], ":password" => sha1($_POST["password"])));
    if ($req->rowCount() == 1) {
        $idUser = $req->fetch();
        $user = new User(0, "", "", "", "", "");
        $_SESSION["user"] = $user->getUserByID($idUser["idUser"]);
        header("Location: /Salon/Canal");
    } else {
        if ($req->rowCount() == 0) {
            $_SESSION["erreur"][] = "Les identifiant données sont invalide.";
            echo "Les identifiant données sont invalide.";
        } else {
            $_SESSION["erreur"][] = "Une erreur est survenu au seins de la base de données.";
            echo "Une erreur est survenu au seins de la base de données.";
        }
    }
    if (isset($_SESSION["erreur"])) {
        header("Location: /Erreur");
    }
}
?>
Example #19
0
 $id_usuario = (int) $custom[1];
 $id_plan = (int) $custom[0];
 $id_service = isset($custom[2]) ? (int) $custom[2] : false;
 $invoice = false;
 $service = false;
 $ref_id = $mp_op_id;
 if (strlen($ref_id) > 0) {
     $invoice = $db->ls("SELECT * FROM api_invoices WHERE payment_name = 'mercadopago-ve' AND payment_reference = '%s'", array(secInjection($ref_id)), true);
     if ($invoice) {
         $id_service = (int) $invoice['id_service'];
     }
 }
 if ($id_service > 0) {
     $service = $db->ls("SELECT * FROM api_services WHERE id_service = %d", array($id_service), true);
 }
 $user = User::getUserByID($id_usuario);
 $plan_db = $user ? $db->ls("SELECT planes.*, precios.* FROM api_planes planes INNER JOIN api_precio_planes precios ON planes.id_plan = precios.id_plan WHERE precios.currency = '%s' AND precios.id_plan = '%d'" . ($user->rol == 1 ? '' : ' AND planes.activo = 1'), array(secInjection($result['currency']), (int) $id_plan), true) : false;
 if (!$plan_db || !$user || abs((double) $plan_db['amount'] - (double) $result['price']) > 0.1) {
     email($user->mail, 'Ocurrio un error en su Pago', 'Su pedido no pudo ser procesado por un error en el monto pagado y el costo real del plan, porfavor contactenos si esto es un error');
 } else {
     if ($result['status'] == 'Completed') {
         email($user->mail, 'Pago Aceptado', 'Su pago fue aceptado y ya fue creado su APP para poder disfrutar de nuestro servicios, ingrese a "Mi Cuenta" en http://cedula.com.ve/ para mayor información.');
         if ($id_service) {
             $db->qs("UPDATE api_services SET activo = 1, id_plan = %d, proximo_corte = '%s' WHERE id_service = %d", array($id_plan, date('Y-m-d H:i:s', strtotime('+' . $plan_db['periocidad'] . ' month', $service ? strtotime($service['proximo_corte']) : time())), $id_service));
         } else {
             $db->qs("INSERT INTO api_services (id_usuario,id_plan,token,fecha_inicio,proximo_corte, activo) VALUES\n                                ('%d','%d','%s',NOW(),'%s', 1)", array((int) $user->id, (int) $id_plan, md5(time() . $user->id . User::$keySecurity), date('Y-m-d H:i:s', strtotime('+' . $plan_db['periocidad'] . ' month', $service ? strtotime($service['proximo_corte']) : time()))));
             $id_service = (int) $db->id();
         }
         if (!$invoice) {
             $db->qs("INSERT INTO api_invoices (id_service,currency,amount,payment_name,payment_status,payment_reference,date_created,date_expire,log_payment) VALUES\n                                ('%d','%s','%s','mercadopago-ve','completed','%s',NOW(),'%s','%s')", array($id_service, secInjection($result['currency']), secInjection($result['price']), secInjection($ref_id), date('Y-m-d H:i:s', strtotime('+' . $plan_db['periocidad'] . ' month')), secInjection($result['message'])));
         } else {
Example #20
0
        sendNotify($n);
    }
}
$notify = $db->ls("SELECT * FROM api_services\n        WHERE activo = 1\n        AND proximo_corte < DATE_ADD(NOW(),INTERVAL 2 DAY)\n        AND last_remember < DATE_SUB(NOW(),INTERVAL 2 DAY)\n        LIMIT 30\n        ", array(), false);
if ($notify) {
    foreach ($notify as $n) {
        sendNotify($n);
    }
}
$mp_pending = $db->ls("SELECT * FROM api_invoices\n        WHERE\n            payment_status = 'pending'\n        AND\n            payment_name = 'mercadopago-ve'\n        LIMIT 30\n        ", array(), false);
if ($mp_pending) {
    foreach ($mp_pending as $invoice) {
        $result = validateMercadoPago($invoice['payment_reference']);
        if (isset($result['order_id']) && isset($result['status']) && $result['status'] != 'Pending') {
            $custom = preg_split('/-/', $result['order_id']);
            $id_plan = (int) $custom[0];
            $id_service = (int) $invoice['id_service'];
            $service = $db->ls("SELECT * FROM api_services WHERE id_service = %d", array($id_service), true);
            $user = User::getUserByID($service['id_usuario']);
            $plan_db = $user ? $db->ls("SELECT planes.*, precios.* FROM api_planes planes INNER JOIN api_precio_planes precios ON planes.id_plan = precios.id_plan WHERE precios.currency = '%s' AND precios.id_plan = '%d'" . ($user->rol == 1 ? '' : ' AND planes.activo = 1'), array(secInjection($result['currency']), (int) $id_plan), true) : false;
            if ($result['status'] == 'Completed') {
                email($user->mail, 'Pago Aceptado', 'Su pago fue aceptado y ya fue creado su APP para poder disfrutar de nuestro servicios, ingrese a "Registro / Login" en http://cedula.com.ve/ para mayor información.');
                $db->qs("UPDATE api_services SET activo = 1, proximo_corte = '%s' WHERE id_service = %d", array($id_plan, date('Y-m-d H:i:s', strtotime('+' . $plan_db['periocidad'] . ' month', strtotime($service['proximo_corte']))), $id_service));
                $db->qs("UPDATE api_invoices SET payment_status = 'completed', log_payment = '%s' WHERE id_invoice = %d", array(secInjection($result['message']), $invoice['id_invoice']));
            } else {
                email($user->mail, 'Error en el Pago', 'Su pago fue rechazado por Mercadopago, ingrese a "Registro / Login" en http://cedula.com.ve/ y vuelva a realizar su pedido para reintentar la compra.');
                $db->qs("UPDATE api_invoices SET payment_status = 'rejected', log_payment = '%s' WHERE id_invoice = %d", array(secInjection($result['message']), $invoice['id_invoice']));
            }
        }
    }
}
Example #21
0
                    $res["reason"] = "删除用户ID:" . $uid . "失败!";
                    break;
                }
            }
        }
    } else {
        $res["reason"] = "你没有权限!";
    }
}
//锁定帐户
if ($action == "lock") {
    if ($id == $_SESSION['user_info']['id']) {
        $res["reason"] = "禁止锁定自己!";
    } else {
        if ($_SESSION['user_info']['type'] == 1) {
            if ($user->getUserByID($id)) {
                $user->status = 0;
                if ($user->updateUser($id)) {
                    $res["result"] = true;
                    $res["reason"] = "用户锁定成功!";
                } else {
                    $res["reason"] = "用户状态更新失败!";
                }
            } else {
                $res["reason"] = "用户不存在!";
            }
        } else {
            $res["reason"] = "你没有权限!";
        }
    }
}