/** * 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); }
function getcookies() { $crypt = new Encryption(); $this->array = array(); if (isset($_COOKIE[$this->name])) { foreach ($_COOKIE[$this->name] as $key => $value) { $this->array[$key] = $crypt->decode($value); } } }
$city = strip_tags(trim($_POST['city'])); $venue = preg_replace('/\\s+/', ' ', $venue); $city = preg_replace('/\\s+/', ' ', $city); $_SESSION['venue'] = $venue; $_SESSION['city'] = $city; //if(isset($_POST['login'])) { $uid1 = $data_rendezvous->getUserId($_SESSION['username']); $displayName = "{$venue}, {$city}"; $data_rendezvous->insertBasicSearch($uid1, $venue, $city, $displayName); //} } } } if (isset($_GET['venue']) && isset($_GET['city'])) { $encryption = new Encryption(); $venue = $encryption->decode($_GET['venue']); $city = $encryption->decode($_GET['city']); unset($_GET['venue']); unset($_GET['city']); sendNameCity($data_foursq, $venue, $city); } if (isset($_SESSION['venue']) && isset($_SESSION['city'])) { $venue = trim($_SESSION['venue']); $venue = strip_tags($venue); $city = trim($_SESSION['city']); $city = strip_tags($city); $venue = preg_replace("/\\s+/", " ", $venue); $city = preg_replace("/\\s+/", " ", $city); unset($_SESSION['venue']); unset($_SESSION['city']); sendNameCity($data_foursq, $venue, $city);
<?php /* Here Geenerated document Download process will be held with the unique URL sent in Email*/ require 'wp-load.php'; // loads the wordpress methods $enc_file = ConvertDirectoryPath(plugin_dir_path(__FILE__) . DIRECTORY_SEPARATOR . "wp-content" . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "templatemerge" . DIRECTORY_SEPARATOR . "urlencode.php"); // checks for the URL encode decode library if (file_exists($enc_file) && isset($_GET['q']) && !empty($_GET['q'])) { require_once $enc_file; $enc = new Encryption(); //echo $enc_url = $enc->encode('www.google.com'); $enc_url = $_GET['q']; ?> <script> window.location.href="<?php echo $enc->decode($enc_url); ?> "; </script> <?php } else { ?> <script> window.location.href="<?php echo site_url(); ?> "; </script> <?php }
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'); } } } } }
function forget_password($param) { $db_functions_obj = new DbFunctions(); $user_obj = new User(); $converter = new Encryption(); $decoded = $converter->decode($param); $email = explode(CHANGE_PW_SEPARATOR, $decoded); $link_date = $email[1]; $exp_date = strtotime(FORGET_PW_EXP_DATE, $email[1]); $type = 'email'; if ($email[0] != "" && $link_date < $exp_date) { $this->content = $user_obj->build_change_forget_password_form($email[0], 'email'); } else { $this->page_not_found(); } }
/** * Generates the auth ticket and auto login cookies for a validated user * * @param bool $remember_login Should the user's login info be remembered for auto-login? */ public function load_session($ticket = null, $origin_ip = null) { // get the ticket cookie if ($ticket == null) { $ticket = get_cookie($this->name); } if ($ticket == false) { return; } $encrypter = new Encryption(); $cookie = $encrypter->decode($ticket); list($content, $time, $ip, $md5) = explode("|@@!@@|", $cookie); if ($origin_ip) { $ipaddy = $origin_ip; } else { if (defined('ORIGIN_IP_ADDRESS')) { $ipaddy = ORIGIN_IP_ADDRESS; } else { $ipaddy = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; } } $newmd5 = md5(implode('|@@!@@|', array($content, $time, $ipaddy)) . $this->salt); if ($content && $time > time() && $ip == $ipaddy && $newmd5 == $md5) { $this->data = unserialize($content); } }
function decrypt_doc_url($str) { $enc_file = ConvertDirectoryPath(plugin_dir_path(__FILE__) . "urlencode.php"); if (file_exists($enc_file)) { require_once $enc_file; $enc = new Encryption(); $str = $enc->decode($str); } return $str; }
" class="input" /><span class="warning">*</span></td> </tr> <tr class="evenrow"> <td width="35%" height="35" align="right" class="bldTxt">Email: </td> <td width="65%" height="24" align="left" class="txt"><input type="text" name="email" id="email" value="<?php if (isset($line->email)) { echo $line->email; } ?> " class="input" placeholder="Enter email" /><span class="warning">*</span></td> </tr> <tr class="oddrow"> <td width="35%" height="35" align="right" class="bldTxt">Password: </td> <td width="65%" height="24" align="left" class="txt"><input type="password" name="password" id="password" value="<?php if (isset($line->password)) { echo $encryptObj->decode($line->password); } ?> " class="input" placeholder="Enter password" /><span class="warning">*</span></td> </tr> <tr class="evenrow"> <td width="35%" height="35" align="right" class="bldTxt">Address: </td> <td width="65%" height="24" align="left" class="txt"><textarea id="address" placeholder="Enter address." name="address" cols="27"><?php if (isset($line->address)) { echo $line->address; } ?> </textarea><span class="warning">*</span></td> </tr> <tr class="oddrow"> <td width="35%" height="35" align="right" class="bldTxt">Mobile: </td>
<?php /******************************************************* * Copyright (C) 2014 http://isvipi.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ******************************************************/ require_once ISVIPI_PAGES_BASE . 'm_base.php'; require_once ISVIPI_CLASSES_BASE . 'global/getFeeds_cls.php'; require_once ISVIPI_CLASSES_BASE . 'utilities/encrypt_decrypt.php'; $converter = new Encryption(); $feed_id = $converter->decode($PAGE[1]); $loadFeed = new single_feed(); $f = $loadFeed->feed_id($feed_id); include_once ISVIPI_ACT_THEME . 'post.php';
/** * Gets an encrypted message and resolves the FastBill credentials * to set them to their corresponding properties of the class. * Format of the resolved credentials 'username:API_Key'. * * @param string $message the encoded string with the credentials separated by ':' * @return array with the decoded username and key */ function decodeAndSetCredentials($message) { $c = Encryption::decode($message, $this->getAppId()); $cr = explode(':', $c); if (sizeof($cr) != 2) { return $this->throwSDKException(51); } $creds = array('userName' => $cr[0], 'apiKey' => $cr[1]); if ($this->setCredentials($creds['userName'], $creds['apiKey'])) { return $creds; } else { return $this->throwSDKException(50); } }
echo 1; } else { echo 0; } break; case 'getContract': $encrypt = new Encryption(); $id = $encrypt->decode($_GET['id']); $db = new MysqliDb(); $db->where('id', $id); $contracts = $db->getOne('contracts'); echo json_encode($contracts); break; case 'getContractByClient': $encrypt = new Encryption(); $id = $encrypt->decode($_GET['id']); $db = new MysqliDb(); $db->where('id', $id); $cols = array("id", "ignitor_name", "ignitor_title", "client", "ignitor_email", "client_name", "client_title", "client_company", "client_name is not null as registed"); $contracts = $db->get('contracts', null, $cols); echo json_encode($contracts); break; case 'saveToHistory': $db = new MysqliDb(); //$db->where('id',$_GET['id']); $data = array('doc_id' => $_POST['index'], 'contract_id' => $_POST['id'], 'content' => $_POST['content'], 'date' => date('Y-m-d H:i:s')); $id = $db->insert('history', $data); break; case 'getContractContent': $db = new MysqliDb(); $db->where('id', $_GET['id']);
Webfinance is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Webfinance; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ include "../inc/main.php"; include "../inc/Encryption.php"; $societe = GetCompanyInfo(); //PAYPAL Vars $paypal_params = array('paypal_url_form' => 'https://www.paypal.com/cgi-bin/webscr', 'paypal_url_return' => $societe->wf_url . '/payment/return.php', 'paypal_url_cancel' => $societe->wf_url . '/payment/cancel.php', 'paypal_url_notify' => $societe->wf_url . '/payment/paypal/ipn.php', 'paypal_email_account' => '*****@*****.**', 'id_payment_type' => '2'); $converter = new Encryption(); $decoded = $converter->decode($_GET['id']); $chain = explode('|', $decoded); $id_invoice = $chain[0]; $id_client = $chain[1]; if (!isset($id_client) or !isset($id_invoice)) { echo "Missing arguments"; exit; } if (!is_numeric($id_client) or !is_numeric($id_invoice)) { echo "Wrong arguments"; exit; } $Client = new Client(); # check client and invoice if (!$Client->exists($id_client)) { echo _("This client doesn't exist");
$_SESSION['rating'] = $rating; $_SESSION['radius'] = $radius; $_SESSION['lat'] = $midlat; $_SESSION['lng'] = $midlong; $_SESSION['lat1'] = $lat1; $_SESSION['lng1'] = $lng1; $_SESSION['lat2'] = $lat2; $_SESSION['lng2'] = $lng2; $uid = $data_rendezvous->getUserId($_SESSION['username']); $displayName = "{$address1},{$address2}"; $data_rendezvous->insertMeetSearch($uid, $midlat, $midlong, $rating, $radius, $displayName, $lat1, $lng1, $lat2, $lng2); } } if (isset($_GET['lat']) && isset($_GET['lng']) && isset($_GET['lat1']) && isset($_GET['lng1']) && isset($_GET['lat2']) && isset($_GET['lng2']) && isset($_GET['radius']) && isset($_GET['rating'])) { $encryption = new Encryption(); $lat = $encryption->decode($_GET['lat']); $lng = $encryption->decode($_GET['lng']); $radius = $encryption->decode($_GET['radius']); $rating = $encryption->decode($_GET['rating']); $lat1 = $encryption->decode($_GET['lat1']); $lng1 = $encryption->decode($_GET['lng1']); $lat2 = $encryption->decode($_GET['lat2']); $lng2 = $encryption->decode($_GET['lng2']); unset($_GET['lat']); unset($_GET['lng']); unset($_GET['lat1']); unset($_GET['lng1']); unset($_GET['lat2']); unset($_GET['lng2']); unset($_GET['rating']); unset($_GET['radius']);