本文整理汇总了PHP中Encryption::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP Encryption::encode方法的具体用法?PHP Encryption::encode怎么用?PHP Encryption::encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encryption
的用法示例。
在下文中一共展示了Encryption::encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setcookies
function setcookies()
{
$crypt = new Encryption();
foreach ($this->array as $key => $value) {
setcookie($this->name . "[{$key}]", $crypt->encode($value), time() + TIMEOUT);
}
}
示例2: testEncrypt
/**
* Tests encryption
*/
public function testEncrypt()
{
$string = "this is a test string";
$enc = new Encryption();
$encrypted = $enc->encode($string);
$this->assertTrue($encrypted != $string);
$unencrypted = $enc->decode($encrypted);
$this->assertTrue($unencrypted == $string);
}
示例3: check_login
public function check_login($username, $password)
{
$encryption = new Encryption();
$password = $encryption->encode($password);
$this->db->where('username', $username);
$this->db->where('password', $password);
$this->db->where('status', '1');
$this->db->where('backend_login', '1');
$results = $this->db->getOne("users");
if ($results) {
$_SESSION['login'] = true;
$_SESSION['user_logged_in_name'] = $results['name'] . " " . $results['lastname'];
$_SESSION['user_id'] = $results['id'];
create_log_action($_SESSION['user_id'], 'User Logged in!');
return true;
} else {
return false;
}
}
示例4: Auth
function Auth()
{
global $nombre, $password, $status_msg, $UserID, $UserTpo, $UserApe, $UserNom;
include "conexion.php";
/*/echo "autorizo<br>";*/
require dirname(__FILE__) . '/class/Encryption.php';
if ($nombre == "" or $password == "") {
$status_msg .= " Datos incorrectos<br />";
$nombre = "";
$password = "";
return false;
}
$nombre = htmlspecialchars($_POST['nombre']);
/* $password = md5 (htmlspecialchars($_POST['password']));*/
$posicion = strpos($nombre, '@');
/*echo $posicion."<br>";*/
/*/ Seguidamente se utiliza ===. La forma simple de comparacion (==)*/
/*/ no funciona como deberia, ya que la posicion de 'a' es el caracter*/
/*/ numero 0 (cero)*/
if ($posicion === false and $nombre != 'Admin') {
$status_msg .= " Datos incorrectos<br />";
$nombre = "";
$password = "";
return false;
} else {
$str = $_POST['password'];
$converter = new Encryption();
/*Para recuperar contraseña*/
// echo $encoded = $converter->encode($str );
$encoded = $converter->encode($str);
$c_usuario = "SELECT * FROM `clientes` WHERE `email`='{$nombre}' AND `contrasenia`='{$encoded}'";
$r_usuario = @mysql_query($c_usuario, $conectar) or die(mysql_error());
if (mysql_num_rows($r_usuario) >= 1) {
$r_ok = @mysql_fetch_array($r_usuario);
if ($r_ok['email'] != $nombre && $r_ok['contrasenia'] != $encoded) {
$status_msg .= $r_ok['email'] . " Datos incorrectos<br />";
$nombre = "";
$password = "";
//return false;
} else {
$UserID = $r_ok['codcliente'];
$UserTpo = $r_ok['tipo'];
$UserNom = $tratamiento . " " . $r_ok['nombre'];
$UserApe = $r_ok['apellido'];
return true;
}
} else {
if ($_POST['password'] == 'admin' and $nombre == 'Admin') {
$UserID = '2';
$UserTpo = '2';
$UserNom = $nombre;
$UserApe = $nombre;
return true;
}
}
}
}
示例5: build_session
/**
* Generates the auth ticket
*/
public function build_session()
{
// for development
if (defined('ORIGIN_IP_ADDRESS')) {
$ipaddy = ORIGIN_IP_ADDRESS;
} else {
$ipaddy = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
}
$ticket = implode('|@@!@@|', array(serialize($this->data), time() + $this->duration, $ipaddy));
$ticket .= "|@@!@@|" . md5($ticket . $this->salt);
$encrypter = new Encryption();
$ticket = $encrypter->encode($ticket);
return $ticket;
}
示例6: mkdir
}
if (!is_dir('output')) {
mkdir('output');
}
if (!is_dir('output/' . $uid)) {
mkdir('output/' . $uid);
}
$exts = explode('.', $_FILES['uploadfiles']["name"][$i]);
$exten = '.' . $exts[count($exts) - 1];
$altername = $alias . $exten;
move_uploaded_file($_FILES['uploadfiles']["tmp_name"][$i], "input/" . $uid . "/" . $_FILES['uploadfiles']["name"][$i]);
rename("input/" . $uid . "/" . $_FILES['uploadfiles']["name"][$i], "input/" . $uid . "/" . $altername);
$mainfile = "input/" . $uid . "/" . $altername;
$str = file_get_contents($mainfile);
$converter = new Encryption();
$encoded = $converter->encode($str, $skey);
$fp = fopen($mainfile, 'wb');
fwrite($fp, $encoded);
fclose($fp);
$post['udate'] = date('Y-m-d H:i:s');
$post['keyid'] = $skey;
$post['user_id'] = $uid;
$post['filename'] = $altername;
$post['title'] = $_POST['filename'][$i];
$fieldnames = '';
$fieldvalues = '';
$cnt = 1;
foreach ($post as $key => $value) {
if ($cnt == 1) {
$fieldnames .= "`{$key}`";
$fieldvalues .= "'{$value}'";
示例7: hashedPassword
private static function hashedPassword($password)
{
//equation left side md5 password and add static salt for it then multiple in hashing class the right side of algorithm
$hashing = new Encryption();
return $hashing->encode(md5($password . self::SALT));
}
示例8: encrypt_doc_url
function encrypt_doc_url($str)
{
$enc_file = ConvertDirectoryPath(plugin_dir_path(__FILE__) . "urlencode.php");
$str = str_replace("\\", "/", $str);
if (file_exists($enc_file)) {
require_once $enc_file;
$enc = new Encryption();
$str = $enc->encode($str);
}
return $str;
}
示例9: foreach
</head>
<body>
<?php
include 'inc/header.php';
?>
<div class="container">
<div>
<table>
<thead>
<tr><th>Status</th><th>Creation Date</th><th>Client</th><th>Link</th><th>Download</th><th>Email</th><th>Remove</th><th>Edit</th></tr>
</thead>
<?php
if ($db->count > 0) {
foreach ($contracts as $contract) {
$link = $encrypt->encode($contract['id']);
echo "<tr id={$contract['id']}>";
if ($contract['sec_signed']) {
echo "<td><span class='label label-success'>Complete</span></td>";
} else {
if ($contract['first_signed']) {
echo "<td><span class='label label-warning' >Stage 1</span></td>";
} else {
if ($contract['client_name'] != null) {
echo "<td><span class='label label-default' data-container=\"body\" data-toggle=\"popover\" trigger='focus' data-placement=\"right\" data-html='true' data-title='New User registed in this contract:' data-content=\"<b>" . $contract['client_name'] . "</b><br><a href='mailto:" . $contract['client_email'] . "'>" . $contract['client_email'] . "</a><br><i>" . $contract['client_title'] . "</i><br>" . $contract['client_company'] . "\">Stage 0</span></td>";
} else {
echo "<td></td>";
}
}
}
echo "<td>{$contract['date']}</td>\n <td>{$contract['client']}</td>\n <td><a href='contract.php?id={$link}'>contract.php?id={$link}</a></td>\n <td><a href='assets/contracts/download.php?client=" . $contract['folder'] . "' class='btn btn-info btn-xs'>Download</a></td>\n <td><a href='' data-link='{$link}' data-client='" . $contract['client_email'] . "' data-ignitor='" . $contract['ignitor_name'] . "' data-email='" . $contract['ignitor_email'] . "' class='btn btn-default btn-xs email'>Email</a></td>\n <td><img style='display:none' src='assets/img/loading.gif'/><button class='btn btn-danger btn-xs remove'>Remove</button></td>\n <td><a href='edit.php?id={$link}' class='btn btn-warning btn-xs edit'>Edit</a></td>";
示例10: Encryption
function generate_forget_password_url($email)
{
global $base_path;
$converter = new Encryption();
$encode = $converter->encode($email . CHANGE_PW_SEPARATOR . time());
$url = "http://" . $_SERVER['HTTP_HOST'] . $base_path . "forget_password/" . $encode;
return $url;
}
示例11: __beforeAction
public function __beforeAction()
{
// User authentication
$user_model = new User_Model();
User_Model::$auth_status = User_Model::AUTH_STATUS_NOT_LOGGED;
// Authentication by post
if (isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
try {
if (!preg_match('#^[a-z0-9-]+$#', $username)) {
throw new Exception('Invalid username');
}
if ($user_model->authenticate($username, $password)) {
User_Model::$auth_status = User_Model::AUTH_STATUS_LOGGED;
// Write session and cookie to remember sign-in
Cookie::write('login', Encryption::encode($username . ':' . $password), 60 * 24 * 3600);
Session::write('username', $username);
} else {
throw new Exception('Bad username or password');
}
} catch (Exception $e) {
User_Model::$auth_status = User_Model::AUTH_STATUS_BAD_USERNAME_OR_PASSWORD;
Cookie::delete('login');
Session::delete('username');
}
} else {
// Authentication by session
if (($username = Session::read('username')) !== null) {
try {
$user_model->loadUser($username);
User_Model::$auth_status = User_Model::AUTH_STATUS_LOGGED;
} catch (Exception $e) {
Session::delete('username');
Cookie::delete('login');
}
// Authentication by cookies
} else {
if (($login = Cookie::read('login')) !== null) {
try {
if (isset($login) && ($login = Encryption::decode($login))) {
$login = explode(':', $login);
$username = $login[0];
if (!preg_match('#^[a-z0-9-]+$#', $username)) {
throw new Exception('Invalid username');
}
array_splice($login, 0, 1);
$password = implode(':', $login);
if ($user_model->authenticate($username, $password)) {
User_Model::$auth_status = User_Model::AUTH_STATUS_LOGGED;
// Write session to remember sign-in
Session::write('username', $username);
} else {
throw new Exception('Bad username or password');
}
} else {
throw new Exception('Invalid user cookie');
}
} catch (Exception $e) {
Cookie::delete('login');
}
}
}
}
}
示例12: Encryption
$localidad = $_POST["alocalidad"];
$codprovincia = $_POST["cboProvincias"];
$codformapago = $_POST["cboFPago"];
$codentidad = $_POST["cboBanco"];
$cuentabanco = $_POST["acuentabanco"];
$codpostal = $_POST["acodpostal"];
$telefono = $_POST["atelefono"];
$movil = $_POST["amovil"];
$email = $_POST["aemail"];
$web = $_POST["aweb"];
$tipo = $_POST["Ttipo"];
$horas = $_POST["nhoras"];
$contrasenia = $_POST["contrasenia"];
$cadena_busqueda = $_POST["cadena_busqueda"];
$converter = new Encryption();
$contrasenia = $converter->encode($contrasenia);
$secQ = $_POST["secQ"];
$secA = $_POST["secA"];
$service = $_POST["service"];
if ($accion == "alta") {
$query_operacion = "INSERT INTO clientes (codcliente, nombre, apellido, empresa, nif, direccion, codprovincia, localidad, \n\tcodformapago, codentidad, cuentabancaria, codpostal, telefono, movil,\n\t email, web, tipo, contrasenia, sessionid, secQ, secA, service, horas, borrado) VALUES \n\t ('', '{$nombre}', '{$apellido}', '{$empresa}', '{$nif}', '{$direccion}', '{$codprovincia}', '{$localidad}',\n\t '{$codformapago}', '{$codentidad}', '{$cuentabanco}', '{$codpostal}', '{$telefono}', '{$movil}',\n\t '{$email}', '{$web}', '{$tipo}', '{$contrasenia}', '{$sessionid}', '{$secQ}', '{$secA}', '{$service}', '{$horas}', '0')";
$rs_operacion = mysql_query($query_operacion);
if ($rs_operacion) {
$mensaje = "El cliente ha sido dado de alta correctamente";
}
$cabecera1 = "Inicio >> Clientes >> Nuevo Cliente ";
$cabecera2 = "INSERTAR CLIENTE ";
$sel_maximo = "SELECT max(codcliente) as maximo FROM clientes";
$rs_maximo = mysql_query($sel_maximo);
$codcliente = mysql_result($rs_maximo, 0, "maximo");
}
示例13: encodeMessage
function encodeMessage($message)
{
return Encryption::encode($message, $this->getAppId());
}
示例14: systemStatusUpdateEmail
function systemStatusUpdateEmail($id, $message)
{
$db = new MysqliDb();
$db->where('id', $_GET['id']);
$contract = $db->getOne('contracts');
$to = $contract['client_email'];
$subject = "";
$encrypt = new Encryption();
$link = $encrypt->encode($id);
$message = "Updates have been made to one or more of your documents. Please click the link below to review and approve the changes.\n http://" . $_SERVER['HTTP_HOST'] . "/contract_gen/contract.php?id=" . $link;
$headers = 'From: support@ignitorlabs.com' . "\r\n" . 'Reply-To: ' . $contract['ignitor_email'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
示例15: SendPaymentRequest
function SendPaymentRequest($id_invoice, $mode = 'paypal')
{
$Invoice = new Facture();
$invoice = $Invoice->getInfos($id_invoice);
$client = new Client($invoice->id_client);
$societe = GetCompanyInfo();
$q = "SELECT value FROM webfinance_pref WHERE type_pref='mail_paypal_" . $invoice->language . "'";
$result = mysql_query($q) or die(mysql_error());
list($data) = mysql_fetch_array($result);
$pref = unserialize(base64_decode($data));
$varlink = $id_invoice . '|' . $invoice->id_client;
$converter = new Encryption();
$encoded_varlink = $converter->encode($varlink);
$link = $societe->wf_url . "/payment/?id={$encoded_varlink}";
$mails = array();
$from = '';
$fromname = '';
$subject = '';
$patterns = array('/%%NUM_INVOICE%%/', '/%%CLIENT_NAME%%/', '/%%URL_PAYPAL%%/', '/%%AMOUNT%%/', '/%%COMPANY%%/');
$replacements = array($invoice->num_facture, $invoice->nom_client, $link, $invoice->nice_total_ttc, $societe->raison_sociale);
$body = stripslashes(preg_replace($patterns, $replacements, stripslashes(utf8_decode($pref->body))));
if (!$Invoice->sendByEmail($id_invoice, $mails, $from, $fromname, $subject, $body)) {
die(_('Invoice was not sent'));
}
return $link;
}