function transform_string($array, $array2) { $res = encrypt($array, $array2); $res2 = implode($res); $array4 = str_split($res2, 2); return encrypt_string($array4); }
/** * Create customer data * * @access public * @param $username * @param $password * @param $email * @return boolean */ public function create($username, $password, $email) { //insert into admin table $result = $this->db->insert('administrators', array('user_name' => $username, 'user_password' => encrypt_string($password), 'email_address' => $email)); if ($result) { //get administartor id $administrators_id = $this->db->insert_id(); //add access return $this->db->insert('administrators_access', array('administrators_id' => $administrators_id, 'module' => '*')); } return FALSE; }
function batchAddFeeds() { $cat_id = $this->dbh->escape_string($_REQUEST['cat']); $feeds = explode("\n", $_REQUEST['feeds']); $login = $this->dbh->escape_string($_REQUEST['login']); $pass = trim($_REQUEST['pass']); foreach ($feeds as $feed) { $feed = $this->dbh->escape_string(trim($feed)); if (validate_feed_url($feed)) { $this->dbh->query("BEGIN"); if ($cat_id == "0" || !$cat_id) { $cat_qpart = "NULL"; } else { $cat_qpart = "'{$cat_id}'"; } $result = $this->dbh->query("SELECT id FROM ttrss_feeds\n\t\t\t\t\tWHERE feed_url = '{$feed}' AND owner_uid = " . $_SESSION["uid"]); if (strlen(FEED_CRYPT_KEY) > 0) { require_once "crypt.php"; $pass = substr(encrypt_string($pass), 0, 250); $auth_pass_encrypted = 'true'; } else { $auth_pass_encrypted = 'false'; } $pass = $this->dbh->escape_string($pass); if ($this->dbh->num_rows($result) == 0) { $result = $this->dbh->query("INSERT INTO ttrss_feeds\n\t\t\t\t\t\t\t(owner_uid,feed_url,title,cat_id,auth_login,auth_pass,update_method,auth_pass_encrypted)\n\t\t\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$feed}',\n\t\t\t\t\t\t\t'[Unknown]', {$cat_qpart}, '{$login}', '{$pass}', 0, {$auth_pass_encrypted})"); } $this->dbh->query("COMMIT"); } } }
/** * @return array (code => Status code, message => error message if available) * * 0 - OK, Feed already exists * 1 - OK, Feed added * 2 - Invalid URL * 3 - URL content is HTML, no feeds available * 4 - URL content is HTML which contains multiple feeds. * Here you should call extractfeedurls in rpc-backend * to get all possible feeds. * 5 - Couldn't download the URL content. * 6 - Content is an invalid XML. */ function subscribe_to_feed($url, $cat_id = 0, $auth_login = '', $auth_pass = '') { global $fetch_last_error; require_once "include/rssfuncs.php"; $url = fix_url($url); if (!$url || !validate_feed_url($url)) { return array("code" => 2); } $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); if (!$contents) { return array("code" => 5, "message" => $fetch_last_error); } foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SUBSCRIBE_FEED) as $plugin) { $contents = $plugin->hook_subscribe_feed($contents, $url, $auth_login, $auth_pass); } if (is_html($contents)) { $feedUrls = get_feeds_from_html($url, $contents); if (count($feedUrls) == 0) { return array("code" => 3); } else { if (count($feedUrls) > 1) { return array("code" => 4, "feeds" => $feedUrls); } } //use feed url as new URL $url = key($feedUrls); } if ($cat_id == "0" || !$cat_id) { $cat_qpart = "NULL"; } else { $cat_qpart = "'{$cat_id}'"; } $result = db_query("SELECT id FROM ttrss_feeds\n\t\t\tWHERE feed_url = '{$url}' AND owner_uid = " . $_SESSION["uid"]); if (strlen(FEED_CRYPT_KEY) > 0) { require_once "crypt.php"; $auth_pass = substr(encrypt_string($auth_pass), 0, 250); $auth_pass_encrypted = 'true'; } else { $auth_pass_encrypted = 'false'; } $auth_pass = db_escape_string($auth_pass); if (db_num_rows($result) == 0) { $result = db_query("INSERT INTO ttrss_feeds\n\t\t\t\t\t(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted)\n\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$url}',\n\t\t\t\t'[Unknown]', {$cat_qpart}, '{$auth_login}', '{$auth_pass}', 0, {$auth_pass_encrypted})"); $result = db_query("SELECT id FROM ttrss_feeds WHERE feed_url = '{$url}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]); $feed_id = db_fetch_result($result, 0, "id"); if ($feed_id) { set_basic_feed_info($feed_id); } return array("code" => 1); } else { return array("code" => 0); } }
function wp2moodle_generate_hyperlink($cohort, $group) { // needs authentication; ensure userinfo globals are populated global $current_user; get_currentuserinfo(); $update = get_option('wp2m_update_details') ?: "true"; $enc = array("offset" => rand(1234, 5678), "stamp" => time(), "firstname" => $current_user->user_firstname, "lastname" => $current_user->user_lastname, "email" => $current_user->user_email, "username" => $current_user->user_login, "passwordhash" => $current_user->user_pass, "idnumber" => $current_user->ID, "cohort" => $cohort, "group" => $group, "updatable" => $update); // encode array as querystring $details = http_build_query($enc); // encryption = 3des using shared_secret return get_option('wp2m_moodle_url') . WP2M_MOODLE_PLUGIN_URL . encrypt_string($details, get_option('wp2m_shared_secret')); //return get_option('wp2m_moodle_url').WP2M_MOODLE_PLUGIN_URL.'=>'.$details; }
/** Set password to session * @param string * @param string * @param string * @param string * @return null */ function set_password($vendor, $server, $username, $password) { $_SESSION["pwds"][$vendor][$server][$username] = $_COOKIE["adminer_key"] && is_string($password) ? array(encrypt_string($password, $_COOKIE["adminer_key"])) : $password; }
/** * @return array (code => Status code, message => error message if available) * * 0 - OK, Feed already exists * 1 - OK, Feed added * 2 - Invalid URL * 3 - URL content is HTML, no feeds available * 4 - URL content is HTML which contains multiple feeds. * Here you should call extractfeedurls in rpc-backend * to get all possible feeds. * 5 - Couldn't download the URL content. * 6 - Content is an invalid XML. */ function subscribe_to_feed($url, $cat_id = 0, $auth_login = '', $auth_pass = '') { global $fetch_last_error; require_once "include/rssfuncs.php"; $url = fix_url($url); if (!$url || !validate_feed_url($url)) { return array("code" => 2); } $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); if (!$contents) { return array("code" => 5, "message" => $fetch_last_error); } if (is_html($contents)) { $feedUrls = get_feeds_from_html($url, $contents); if (count($feedUrls) == 0) { return array("code" => 3); } else { if (count($feedUrls) > 1) { return array("code" => 4, "feeds" => $feedUrls); } } //use feed url as new URL $url = key($feedUrls); } /* libxml_use_internal_errors(true); $doc = new DOMDocument(); $doc->loadXML($contents); $error = libxml_get_last_error(); libxml_clear_errors(); if ($error) { $error_message = format_libxml_error($error); return array("code" => 6, "message" => $error_message); } */ if ($cat_id == "0" || !$cat_id) { $cat_qpart = "NULL"; } else { $cat_qpart = "'{$cat_id}'"; } $result = db_query("SELECT id FROM ttrss_feeds\n\t\t\tWHERE feed_url = '{$url}' AND owner_uid = " . $_SESSION["uid"]); if (strlen(FEED_CRYPT_KEY) > 0) { require_once "crypt.php"; $auth_pass = substr(encrypt_string($auth_pass), 0, 250); $auth_pass_encrypted = 'true'; } else { $auth_pass_encrypted = 'false'; } $auth_pass = db_escape_string($auth_pass); if (db_num_rows($result) == 0) { $result = db_query("INSERT INTO ttrss_feeds\n\t\t\t\t\t(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted)\n\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$url}',\n\t\t\t\t'[Unknown]', {$cat_qpart}, '{$auth_login}', '{$auth_pass}', 0, {$auth_pass_encrypted})"); $result = db_query("SELECT id FROM ttrss_feeds WHERE feed_url = '{$url}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]); $feed_id = db_fetch_result($result, 0, "id"); if ($feed_id) { update_rss_feed($feed_id, true); } return array("code" => 1); } else { return array("code" => 0); } }
} $theme = find_theme($fp, $personal, $default_theme); // Following variables are stored in an array in the session in this order // user - user who is logging in // pass - users encrypted (if supported) password // server - server connected too // port - port connected on // dir - current directory // warn - warning messagez // IP - remote IP address // level - warning severity level // Server Name - Display name for the ftp server (selected from the login dropdown) $sess_Data = array("user" => $ftp_User, "pass" => $enc_ftp_Pass, "server" => $ftp_Server, "port" => $ftp_Port, "dir" => ftp_pwd($fp), "warn" => "", "level" => 0, "Server Name" => $login_server, "IP" => $REMOTE_ADDR); if (isset($ftp_Remember) && $ftp_remember_me) { $cookie_string = $ftp_User . "::" . $ftp_Pass; $cookie_string = encrypt_string($cookie_string, $key, session_id(), $pref_ciphers); setcookie("WeebleFM_cookie", $cookie_string, time() + 31536000, "/", $HTTP_SERVER_VARS["SERVER_NAME"], 0); setcookie("WeebleFM_SID", session_id(), time() + 31536000, "/", $HTTP_SERVER_VARS["SERVER_NAME"], 0); setcookie("WeebleFM_Server", $login_server, time() + 31536000, "/", $HTTP_SERVER_VARS["SERVER_NAME"], 0); } // Set passive mode if desired. if ($ftp_Passive_Mode) { $result = @ftp_pasv($fp, TRUE); if ($result == 0) { $sess_Data["warn"] = sprintf("{$code_err}: {$err_ftp}."); $sess_Data["level"] = "medium"; } } // log sign in if set too if ($log["level"] > 0) { log_message($log, $ftp_User . "/" . $REMOTE_ADDR . " - Logged in.\n");
} $permanent = array(); if ($_COOKIE["adminer_permanent"]) { foreach (explode(" ", $_COOKIE["adminer_permanent"]) as $val) { list($key) = explode(":", $val); $permanent[$key] = $val; } } if (isset($_POST["server"])) { session_regenerate_id(); // defense against session fixation $_SESSION["pwds"][$_POST["driver"]][$_POST["server"]][$_POST["username"]] = $_POST["password"]; if ($_POST["permanent"]) { $key = base64_encode($_POST["driver"]) . "-" . base64_encode($_POST["server"]) . "-" . base64_encode($_POST["username"]); $private = $adminer->permanentLogin(); $permanent[$key] = "{$key}:" . base64_encode($private ? encrypt_string($_POST["password"], $private) : ""); cookie("adminer_permanent", implode(" ", $permanent)); } if (count($_POST) == ($_POST["permanent"] ? 5 : 4) || DRIVER != $_POST["driver"] || SERVER != $_POST["server"] || $_GET["username"] !== $_POST["username"]) { redirect(auth_url($_POST["driver"], $_POST["server"], $_POST["username"])); } } elseif ($_POST["logout"]) { if ($token && $_POST["token"] != $token) { page_header(lang('Logout'), lang('Invalid CSRF token. Send the form again.')); page_footer("db"); exit; } else { foreach (array("pwds", "dbs", "queries") as $key) { set_session($key, null); } $key = base64_encode(DRIVER) . "-" . base64_encode(SERVER) . "-" . base64_encode($_GET["username"]);
$reason = 1; } if (empty($_POST["repassword"])) { $proceed = false; $reason = 1; } if ($_POST["password"] != $_POST["repassword"]) { $proceed = false; $reason = 3; } // Now we see if we have a problem if ($proceed == true) { // No problem? Show a welcome message. $msg = "<p>You are successfuly registered to QCS Asia Members Area.<br />We sent you an email with your password, you have to click on the link in this email to confirm account creation and access the Members Area, check your mailbox now.<br /></p>"; $country_ip = getCountryByIP($_SERVER['REMOTE_ADDR']); $sqlQuery = "INSERT INTO qcs_members (firstname, lastname , company_name, country, email, password, date_creation , address , website , type , country_ip)\n VALUES (\n '" . addslashes($_POST["firstname"]) . "'\n , '" . addslashes($_POST["lastname"]) . "'\n , '" . addslashes($_POST["company_name"]) . "'\n , '" . addslashes($_POST["country"]) . "'\n , '" . $_POST["email"] . "'\n , '" . encrypt_string($_POST["password"]) . "'\n , '" . date('Y-m-d H:i:s') . "'\n , '" . $_POST["company_address"] . "'\n , '" . $_POST["company_website"] . "'\n , '" . $_POST["company_type"] . "'\n , '" . $country_ip . "'\n )"; // echo "sqlQuery = " . $sqlQuery; // insert in database $wpdb->query($sqlQuery); ///////////////////////////////////////////////////////////////////////////////////////////////// // Build our subject line fo the email $subject = 'Your subscription to QCS Asia Members Area'; // And our actual message $message = 'You are successfuly registered to QCS Asia Members Area.<br /><br />'; $message .= 'Your id: ' . $_POST['email'] . '<br />'; $message .= 'Your password: '******'password'] . '<br /><br />'; $message .= 'To start to access QCS Asia Members Area confirm your email address by clicking on the link below.<br /><br />'; $message .= '<a href="' . get_bloginfo('url') . '/confirm.php?email=' . $_POST['email'] . '">' . get_bloginfo('url') . '/confirm.php?email=' . $_POST['email'] . '</a><br /><br />'; $message .= 'If it does not works Copy and Paste this link directly into your browser.<br /></br>'; $message .= 'Thanks! Regards.<br /><br />---<br />'; $message .= 'Please do not delete this email.';
if ($proceed == true) { // No problem? Show a welcome message. $msg = '<p style="font-size: 20px;">Application form is completed.</p><p style="font-size: 17px;">You will receive shortly an e-mail with a link to click to confirm your e-mail address.</p>'; $country_ip = getCountryByIP($_SERVER['REMOTE_ADDR']); $sqlQuery = "INSERT INTO qcs_members (firstname, lastname , company_name, country, email, password, date_creation , address , website , type , country_ip) VALUES ( '" . addslashes($_POST["firstname"]) . "' , '" . addslashes($_POST["lastname"]) . "' , '" . addslashes($_POST["company_name"]) . "' , '" . addslashes($_POST["country"]) . "' , '" . $_POST["email"] . "' , '" . encrypt_string($_POST["password"]) . "' , '" . date('Y-m-d H:i:s') . "' , '" . $_POST["company_address"] . "' , '" . $_POST["company_website"] . "' , '" . $_POST["company_type"] . "' , '" . $country_ip . "' )"; // echo "sqlQuery = " . $sqlQuery; // insert in database $wpdb->query($sqlQuery); ///////////////////////////////////////////////////////////////////////////////////////////////// // Build our subject line fo the email
if ($issecure == "Y") { $host = "ssl://" . $host; } $fsok = fsockopen(trim($host), intval(trim($port))); if (FALSE == $fsok) { echo "Target Host not Found/Down"; return; } fwrite($fsok, $bodyData); $port = ""; $host = ""; $hostport = ""; $bodyData = ""; while ($line = fread($fsok, 25000)) { if ($encryptEnable == "Y") { echo encrypt_string($line); } else { echo $line; } } fclose($fsok); } function encrypt_string($input) { global $encKey; $line = ""; for ($i = 0; $i < strlen($input); $i++) { $line .= chr(ord($input[$i]) + $encKey); } return $line; }
function smtp_options_validate($input) { $smtp_options = get_option('smtp_options'); $input['host'] = stripslashes(wp_filter_kses(addslashes(strip_tags($input['host'])))); if ($input['host'] == '') { $input['host'] = $smtp_options['host']; } $input['port'] = absint($input['port']); if ($input['port'] == 0 || $input['port'] == 1) { $input['port'] = $smtp_options['port']; } if ($input['smtp_secure'] != '' && $input['smtp_secure'] != 'ssl' && $input['smtp_secure'] != 'tls') { $input['smtp_secure'] = $smtp_options['smtp_secure']; } $input['username'] = stripslashes(wp_filter_kses(addslashes(strip_tags($input['username'])))); if ($input['username'] == '') { $input['username'] = $smtp_options['username']; } $input['password'] = stripslashes(wp_filter_kses(addslashes(strip_tags($input['password'])))); if ($input['password'] == '') { $input['password'] = $smtp_options['password']; } else { $input['password'] = encrypt_string($input['password'], CRYPT_KEY); } return $input; }
function encrypt_string_and_encode($salt, $string) { return base64_encode(encrypt_string($salt, $string)); }